Thread: Duplicate Key violation on dump&reload using pg_restore
pg_restore: connecting to database for restore
pg_restore: disabling triggers for ct_com_user
pg_restore: restoring data for table "ct_com_user"
pg_restore: [archiver (db)] Error while PROCESSING TOC:
pg_restore: [archiver (db)] Error from TOC entry 4256; 0 106035908 TABLE DATA ct_com_user postgres
pg_restore: [archiver (db)] COPY failed: ERROR: duplicate key value violates unique constraint "pk_ct_com_user"
CONTEXT: COPY ct_com_user, line 357214: "2463013 Xxxxx xxxxxxxx 5 \N \N 0 \N 0 \N 0 \N 0 \N 1 \N 1 \N 1 \N 0 \N 0 \N 0 \N 0 xxxxxx@foo.foo 0 ..."
pg_restore: *** aborted because of error
(
user_id integer NOT NULL,
"login" text,
"password" text,
[...]
CONSTRAINT pk_ct_com_user PRIMARY KEY (user_id)
)
WITH (OIDS=TRUE);
pg_restore: [archiver (db)] Error while PROCESSING TOC:
pg_restore: [archiver (db)] Error from TOC entry 9116; 0 106035908 TABLE DATA ct_com_user postgres
pg_restore: [archiver (db)] COPY failed: ERROR: duplicate key value violates unique constraint "pk_ct_com_user"
CONTEXT: COPY ct_com_user, line 356811: "2463013 Xxxxx xxxxxxxx 5 \N \N 0 \N 0 \N 0 \N 0 \N 1 \N 1 \N 1 \N 0 \N 0 \N 0 \N 0 xxxxxx@foo.foo 0 ..."
pg_restore: enabling triggers for ct_com_user
Computec Media AG
Sitz der Gesellschaft und Registergericht: Fürth (HRB 8818)
Vorstandsmitglieder: Johannes S. Gözalan (Vorsitzender) und Rainer Rosenbusch
Vorsitzender des Aufsichtsrates: Jürg Marquard
Umsatzsteuer-Identifikationsnummer: DE 812 575 276
"Markus Wollny" <Markus.Wollny@computec.de> writes: > I'm currently trying to migrate one of our databases from PostgreSQL 8.2.4 to PostgreSQL 8.3.1. I have worked around theTsearch2 migration (we used the contrib module) without too much hassle, but find myself stuck at an unexpected point- I get a duplicate key violation for the primary key on one of my tables: Maybe there actually is a duplicate key in the source DB --- have you checked? There were some bugs in early 8.2.x releases that could possibly allow that to happen. regards, tom lane
Computec Media AG
Sitz der Gesellschaft und Registergericht: Fürth (HRB 8818)
Vorstandsmitglieder: Johannes S. Gözalan (Vorsitzender) und Rainer Rosenbusch
Vorsitzender des Aufsichtsrates: Jürg Marquard
Umsatzsteuer-Identifikationsnummer: DE 812 575 276
> checked? There were some bugs in early 8.2.x releases that could
> possibly allow that to happen.
Thanks, I was hoping there would be an easy explanation like that. I guess I'll have to do a little reading up on the change logs of post-8.2.4-releases :)
Computec Media AG
Sitz der Gesellschaft und Registergericht: Fürth (HRB 8818)
Vorstandsmitglieder: Johannes S. Gözalan (Vorsitzender) und Rainer Rosenbusch
Vorsitzender des Aufsichtsrates: Jürg Marquard
Umsatzsteuer-Identifikationsnummer: DE 812 575 276