Re: how could duplicate pkey exist in psql? - Mailing list pgsql-general

From Yan Chunlu
Subject Re: how could duplicate pkey exist in psql?
Date
Msg-id CAOA66tG=w9tRO296wGczjx16GighWp=7W_yP7P60882Z+_j5Og@mail.gmail.com
Whole thread Raw
In response to Re: how could duplicate pkey exist in psql?  (Adrian Klaver <adrian.klaver@gmail.com>)
Responses Re: how could duplicate pkey exist in psql?  (Adrian Klaver <adrian.klaver@gmail.com>)
List pgsql-general
and database will stop receiving the following data after detected an error?  
that means while using pg_restore, no error allowed to happen, otherwise the database will stop receiving data and the import will fail.

I found only one record in psql's log:

 duplicate key value violates unique constraint "account_pkey"

does that means one duplicate record will prevent all other records to import?

On Mon, Nov 21, 2011 at 10:55 PM, Adrian Klaver <adrian.klaver@gmail.com> wrote:
On Monday, November 21, 2011 6:39:55 am Yan Chunlu wrote:
> got it.  thank you very much for you help.   I found out this problem too
> late, and there is no backup.
>
> luckily there was not too much data for this, and my app keeps running
> without error.
>
> I am not sure if they are related but I could not use pg_restore to import
> data dumped by "pg_dump -Fc";
>
> pg_restore will print some error message about "duplicate primary key", and
> the table is empty. no data has been imported.
>
> pg_restore supposed to import the data and ignore the errors.    does any
> one have the similar problem?
>

pg_restore may ignore the error and keep on going but the database will not. In
other words when pg_restore receives the error it will continue on to the next
item (unless you have the -e switch on). As far as the server(database) is
concerned duplicate primary key is still an error and the data will not be
loaded.


--
Adrian Klaver
adrian.klaver@gmail.com

pgsql-general by date:

Previous
From: Mike Blackwell
Date:
Subject: Re: stored function data structures - difficulty
Next
From: David Johnston
Date:
Subject: Re: Select duplicated values