Open kaladay opened 1 year ago
Describe the bug
I've been seeing some weird problems with the primary key synchronization. Errors like:
org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "internal_metadata_pkey" Detail: Key (id)=(42) already exists.
Relevant parts of the database look like:
sage=# select max(id) + 1 from internal_metadata; ?column? ---------- 45 (1 row) sage=# select * from internal_metadata_id_seq ; last_value | log_cnt | is_called ------------+---------+----------- 42 | 0 | f (1 row) sage=# select * from internal_metadata where id = 42; id | field | gloss | required ----+--------+-------------------------+---------- 42 | medium | Medium (dcterms.medium) | f (1 row)
This is wrong, the id sequence should be 45. Any attempt to create new metadata would result in a duplicate key violation because 42 already exists.
This is temporarily fixed by doing something like:
alter table internal_metadata alter COLUMN id restart with 45;
To Reproduce Steps to reproduce the behavior:
Expected behavior Should always be able to create new metadata without the primary keys being behind.
This appears to be a problem regarding the code here:
The immediate solution is to make sure this and other SQL db import files are not run when hibernate.ddl-auto is set to something other than create-drop.
hibernate.ddl-auto
create-drop
Describe the bug
I've been seeing some weird problems with the primary key synchronization. Errors like:
Relevant parts of the database look like:
This is wrong, the id sequence should be 45. Any attempt to create new metadata would result in a duplicate key violation because 42 already exists.
This is temporarily fixed by doing something like:
To Reproduce Steps to reproduce the behavior:
Expected behavior Should always be able to create new metadata without the primary keys being behind.