Bug #4808
closedsession add new dbo ptr after restore backup
0%
Description
We are facing a problem when we have imported a backup (file with insert lines) into our postgres database. After the import we try to add a record to a table where records were inserted.
Wt does not recognize the imported records :
Wt: error during event handling: ERROR: duplicate key value violates unique constraint ""map_pkey""
DETAIL: Key (id)=(1) already exists.
When we keep trying the key goes always up by 1
Wt: error during event handling: ERROR: duplicate key value violates unique constraint ""map_pkey""
DETAIL: Key (id)=(2) already exists.
Is there a way to deal with this/fix this?
Updated by Koen Deforche over 8 years ago
- Status changed from New to Feedback
You also need to reset the id-generator based on the data in your export: it is the database itself that is responsible for generating auto-incrementing id's not Wt::Dbo.
In your case, it looks like you're using Postgres, and the command you need is something like this (I'm not sure about the syntax below):
ALTER SEQUENCE product_id_seq RESTART WITH 12345;
where '12345' is (select max(id) + 1 from product);
You can find out the name of the generator by listing the database schema in postgres, e.g. using '\d' in psql.
Koen
Updated by Steven Descheemaeker over 8 years ago
thanks, didnt knew about the sequence part! another lesson learned.
Updated by Koen Deforche over 8 years ago
- Status changed from Feedback to Resolved
Updated by Koen Deforche over 8 years ago
- Status changed from Resolved to Closed
- Target version changed from 3.3.3 to 3.3.6