Re: ERROR: duplicate key value violates unique constraint "geocode_settings_pkey" - Mailing list pgsql-admin

From Ankur Kaushik
Subject Re: ERROR: duplicate key value violates unique constraint "geocode_settings_pkey"
Date
Msg-id CALXoLqxp_cgOFGvkVDpUk2a1mh4CoMNjw3o3NZyH1iUN0EivqQ@mail.gmail.com
Whole thread Raw
In response to Re: ERROR: duplicate key value violates unique constraint "geocode_settings_pkey"  (Albe Laurenz <laurenz.albe@wien.gv.at>)
Responses Re: ERROR: duplicate key value violates unique constraint "geocode_settings_pkey"  (Ankur Kaushik <ankurkaushik@gmail.com>)
Re: ERROR: duplicate key value violates unique constraint "geocode_settings_pkey"  (Albe Laurenz <laurenz.albe@wien.gv.at>)
List pgsql-admin

I opened the Backup File seen , The duplicate error came in schema : tiger , table : geocode_setting , already data for primary key column exist "debug_geocode_address" primary key value

What is use of tiger schema , is related postGIS . Can we take dump for only schema public ?

On Mon, Jun 15, 2015 at 3:27 PM, Albe Laurenz <laurenz.albe@wien.gv.at> wrote:
Ankur Kaushik wrote:
> I took Backup using below command
>  pg_dump "database name" | gzip > /root/dump.sql.gz
>
>
>
> While restoring in fresh PostgreSQL  server getting below error .
>
> ERROR:  duplicate key value violates unique constraint "geocode_settings_pkey"
> DETAIL:  Key (name)=(debug_geocode_address) already exists.

That looks like data corruption on the original database.

Look at https://wiki.postgresql.org/wiki/Corruption and
follow the "VITALLY IMPORTANT FIRST RESPONSE".

Check if that is the only row that violates the constraint.
You could manually delete all offending rows on the source,
then dump/restore (don't continue working with the database
even if it seems consistent again).

Yours,
Laurenz Albe

pgsql-admin by date:

Previous
From: Albe Laurenz
Date:
Subject: Re: ERROR: duplicate key value violates unique constraint "geocode_settings_pkey"
Next
From: Ankur Kaushik
Date:
Subject: Re: ERROR: duplicate key value violates unique constraint "geocode_settings_pkey"