Search Postgresql Archives

PG_DUMP/PG_RESTORE duplicate Rows?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx
US Mail: 430 Valona Loop, Round Rock, TX 78681-3893



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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux