Project

General

Profile

Actions

Bug #4808

closed
SD

session add new dbo ptr after restore backup

Bug #4808: session add new dbo ptr after restore backup

Added by Steven Descheemaeker over 10 years ago. Updated about 10 years ago.

Status:
Closed
Priority:
Immediate
Assignee:
-
Target version:
Start date:
03/14/2016
Due date:
% Done:

0%

Estimated time:

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?

KD Updated by Koen Deforche over 10 years ago Actions #1

  • 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

SD Updated by Steven Descheemaeker over 10 years ago Actions #2

thanks, didnt knew about the sequence part! another lesson learned.

KD Updated by Koen Deforche over 10 years ago Actions #3

  • Status changed from Feedback to Resolved

KD Updated by Koen Deforche about 10 years ago Actions #4

  • Status changed from Resolved to Closed
  • Target version changed from 3.3.3 to 3.3.6
Actions

Also available in: PDF Atom