Project

General

Profile

Actions

Bug #4808

closed

session add new dbo ptr after restore backup

Added by Steven Descheemaeker over 8 years ago. Updated over 8 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?

Actions #1

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

Actions #2

Updated by Steven Descheemaeker over 8 years ago

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

Actions #3

Updated by Koen Deforche over 8 years ago

  • Status changed from Feedback to Resolved
Actions #4

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
Actions

Also available in: Atom PDF