Re: duplicate key errors when restoring 8.4.0 database dump into 9.1.2

From: Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com>
To: Culley Harrelson <harrelson(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: duplicate key errors when restoring 8.4.0 database dump into 9.1.2
Date: 2011-12-30 16:06:27
Message-ID: 201112300806.27644.adrian.klaver@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Friday, December 30, 2011 7:49:31 am Culley Harrelson wrote:
> They are just your standard sql errors seen in the output of psql mydb <
> backup.sql
>
>
> ALTER TABLE
> ERROR: could not create unique index "ht_user_pkey"
> DETAIL: Key (user_id)=(653009) is duplicated.
>
> There is a unique index on user_id in the 8..4.0 system and, of course,
> only one record for 653009.
>

http://www.postgresql.org/docs/9.1/interactive/app-pgdump.html

When doing the pg_dump of the 8.4 database you might want to use the -c option

"
-c
--clean

Output commands to clean (drop) database objects prior to outputting the
commands for creating them. (Restore might generate some harmless errors.)

This option is only meaningful for the plain-text format. For the archive
formats, you can specify the option when you call pg_restore.
"

My suspicion is that there is already data in the tables of the 9.1 server from
previous restore attempts.

--
Adrian Klaver
adrian(dot)klaver(at)gmail(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Culley Harrelson 2011-12-30 16:12:27 Re: duplicate key errors when restoring 8.4.0 database dump into 9.1.2
Previous Message Culley Harrelson 2011-12-30 15:49:31 Re: duplicate key errors when restoring 8.4.0 database dump into 9.1.2