Closed anamariamv closed 7 years ago
This kind of error is rooted at Postgresql handling of serial types. It arises when a row is created using a value for the serial
column larger than the latest used value.
This error can be reproduced in the localhost db as follows:
sbt
session with the localhost.conf
file, and execute flywayClean
and flywayMigrate
to reset the database.psql
session with the ninecards_user
user into the ninecards
DB.psql
, execute the following commands:
insert into users(id,email,sessiontoken,apikey) values (2,'a','a','a') ;
insert into users(email,sessiontoken,apikey) values ('b','b','b') ;
insert into users(email,sessiontoken,apikey) values ('b','b','b') ;
Once the error appears, the next insertion proceeds normally. This error should not normally occur, since the only insertions to this tables are through the signup operation. Nevertheless, some solutions are proposed here.
ERROR: duplicate key value violates unique constraint "users_pkey" Detail: Key (id)=(2) already exists.