pg_restore duplicate key violations - Mailing list pgsql-general

From Karl O. Pinc
Subject pg_restore duplicate key violations
Date
Msg-id 1147115499l.18374l.3l@mofo
Whole thread Raw
Responses Re: pg_restore duplicate key violations  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
Hello,

PostgreSQL 8.1.3, Centos 4.2

I'm having trouble with a dump and restore:

$ pg_dump --format=t --schema=babase --data-only --user babase_admin
babase_test | pg_restore --data-only --disable-triggers --user
babase_admin --dbname=babase
pg_restore: ERROR:  duplicate key violates unique constraint
"activities_pkey"
CONTEXT:  COPY activities, line 1: "B   t       t       Be groomed"
pg_restore: [archiver (db)] error returned by PQendcopy: ERROR:
duplicate key violates unique constraint "activities_pkey"
CONTEXT:  COPY activities, line 1: "B   t       t       Be groomed"

The two databases/schemas are identical.

I bumped around the list archives and found a post that seemed
to indicate locale could be a problem.  When I did an initdb
to initialize the cluster I made sure that the locale was C,
and all the LC_ options in postgresql.conf are shown
as C and "show all" shows them all as C in both databases.

The locale in my shell is all en_US.UTF-8 so I tried setting
LC_CHAR and LC_COLLATE to C in the shell before running
the dump/restore and this did not work.  Likewise with LC_ALL.
I also tried exporting LC_CHAR and LC_COLLATE as C in
/etc/sysconfig/pgsql/postgresql so that the server would run
in the correct locale, just in case, but this did not work either.

If it matters when installing postgres I recompiled the
source rpm so as to make it an i686.

Where do I go from here?

Thanks.

Karl <kop@meme.com>
Free Software:  "You don't pay back, you pay forward."
                  -- Robert A. Heinlein


pgsql-general by date:

Previous
From: Volkan YAZICI
Date:
Subject: Re: intarray internals
Next
From: "George Pavlov"
Date:
Subject: exporting quoted CSV data from a query