Re: PG_DUMP/PG_RESTORE duplicate Rows? - Mailing list pgsql-general

From Larry Rosenman
Subject Re: PG_DUMP/PG_RESTORE duplicate Rows?
Date
Msg-id 014901ca72b5$3d58b070$b80a1150$@org
Whole thread Raw
In response to PG_DUMP/PG_RESTORE duplicate Rows?  ("Larry Rosenman" <ler@lerctr.org>)
List pgsql-general
Never mind.  I had my appserver up, and it probably screwed up.



--
Larry Rosenman                     http://www.lerctr.org/~ler
Phone: +1 512-248-2683                E-Mail: ler@lerctr.org
US Mail: 430 Valona Loop, Round Rock, TX 78681-3893


-----Original Message-----
From: pgsql-general-owner@postgresql.org
[mailto:pgsql-general-owner@postgresql.org] On Behalf Of Larry Rosenman
Sent: Tuesday, December 01, 2009 12:31 PM
To: pgsql-general@postgresql.org
Subject: [GENERAL] PG_DUMP/PG_RESTORE duplicate Rows?

Greetings,
    I have a PostgreSQL 8.3.7 database that gets backed up each night with
pg_dump -Fc.  When I restored it today I got the following:

pg_restore: [archiver (db)] Error while PROCESSING TOC:
pg_restore: [archiver (db)] Error from TOC entry 2021; 2606 20719 CONSTRAINT
last_run_id_key drucker
pg_restore: [archiver (db)] could not execute query: ERROR:  could not
create unique index "last_run_id_key"
DETAIL:  Table contains duplicated values.
    Command was: ALTER TABLE ONLY last_run
    ADD CONSTRAINT last_run_id_key UNIQUE (id);

Looking at the table:
druckerdb=> select ctid,* from last_run;
  ctid  | id |        last_run
--------+----+-------------------------
 (0,10) |  2 | 2009-12-01 09:44:26.269
 (0,11) |  2 | 2009-12-01 09:44:26.269
 (0,60) |  1 | 2009-12-01 11:49:26.269
 (0,61) |  1 | 2009-12-01 11:49:26.269
(4 rows)

My question is, how did this happen?

Yes, we're moving to 8.4.1 on our next release (12-12-2009).

I cleaned it up by:
druckerdb=> delete from last_run where ctid='(0,10)' or ctid='(0,60)';
DELETE 2

and putting the constraint back in place.





--
Larry Rosenman                     http://www.lerctr.org/~ler
Phone: +1 512-248-2683                E-Mail: ler@lerctr.org
US Mail: 430 Valona Loop, Round Rock, TX 78681-3893



--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


pgsql-general by date:

Previous
From: "Larry Rosenman"
Date:
Subject: PG_DUMP/PG_RESTORE duplicate Rows?
Next
From: Rüdiger Sörensen
Date:
Subject: optimizing advice