zio / zio-protoquill

Quill for Scala 3
Apache License 2.0
209 stars 48 forks source link

org.postgresql.util.PSQLException: ERROR: could not determine data type of parameter $1 #264

Open johannegger opened 1 year ago

johannegger commented 1 year ago

Version: (e.g. 4.6.0.1) Module: (e.g. quill-jdbc) Database: (e.g. postgresql)

Expected behavior

I have a table with a column of type nullable uuid (i map postgres uuid -> java.util.UUID) inserting of rows works as expected but filtering by this field when it's empty results in this error:

org.postgresql.util.PSQLException: ERROR: could not determine data type of parameter $1

calling translate and executing the resulting query from the command-line works just fine.

I created this snippet but as since the problem is related to the jdbc driver it's not happening there.

Workaround

using String instead of java.util.UUID works

@getquill/maintainers

timzaak commented 11 months ago

add code like this, it has a doc: https://zio.dev/zio-quill/extending-quill

import ctx._
import java.util.UUID

implicit val encodeUUID = MappedEncoding[UUID, String](_.toString)
implicit val decodeUUID = MappedEncoding[String, UUID](UUID.fromString(_))