I am using slick with Postgresql 9.6.1, Plya! 2.5 and play-slick 2.0.2.
(I also use slick-pg 0.14.3, but I donโt think it is changing anything here.)
I use insertOrUpdate
in a very direct way, but I still get a unique exception.
I have a very simple test using insertOrUpdate
: if I run it several times, I always get sql exception:
ERROR: duplicate key value violates unique constraint "ga_client_id_pkey"
Detail: Key (client_id)=(1885746393.1464005051) already exists
However, my table is defined as client_id
a primary key:
def clientId = column[String]("client_id", O.PrimaryKey)
and is defined in sql as follows:
client_id TEXT NOT NULL UNIQUE PRIMARY KEY
The proven function is simple:
db.run(gaClientIds.insertOrUpdate(gaClientId))
and the controller simply calls these methods and does nothing.
It is strange that starting the methods themselves several times does not lead to an error, but the controller does, although it only calls the method.
insertOrUpdate
Is the slick function still not sure, or am I missing something?