Leonard Ehrenfried
Leonard Ehrenfried

Reputation: 1613

Slick, UUID and Postgres

I'm trying to map a java.util.UUID to a Slick column, which should be possible according to this: https://github.com/slick/slick/issues/79

I'm defining the columns as follows:

def id = column[UUID]("id", O.PrimaryKey, O.DBType("UUID"))

According to the Github issue linked above the manual DBType override should not be necessary but I couldn't get it to work without.

The error I'm getting when I'm trying to insert a row into Postgres is this:

org.postgresql.util.PSQLException: 
ERROR: column "id" is of type uuid but expression is of type bytea 

Seems that the mapping from java.util.UUID to a Postgres uuid type doesn't seem to work.

I'm using the following artifact versions:

"com.typesafe.slick" %% "slick" % "2.0.1",
"org.slf4j" % "slf4j-nop" % "1.6.4",
"org.postgresql" % "postgresql" % "9.3-1101-jdbc41"

My postgres version is $ psql --version psql (PostgreSQL) 9.3.3

What am I doing wrong?

Upvotes: 7

Views: 5116

Answers (1)

cvogt
cvogt

Reputation: 11270

Looks like a bug. Please report one https://github.com/slick/slick/issues/new and refer to: https://github.com/slick/slick/issues/79 or simply re-open the latter.

UPDATE: Not a bug, but you imported the wrong driver. This happens often enough to people. Slick should catch that and provide a better error message. Here's the ticket: https://github.com/slick/slick/issues/670

Upvotes: 4

Related Questions