Re: [GENERAL] Postgres BackUp and Restore: ERROR: duplicate key violates unique constraint "pg_largeobject_loid_pn_index"

2009-05-12 Thread Sam Mason
On Tue, May 12, 2009 at 05:25:26PM +0530, CM J wrote:
>  The above results in following exception and the data is not getting
> restored:
> 
> ERROR:  duplicate key violates unique constraint 
> "pg_largeobject_loid_pn_index"
> 
>   What else do i need to drop/delete to completely reinitialize my
> database ?

There are "large objects"[1] remaining in the system.  The way I've
removed them in the past was by doing a boring:

  DELETE FROM pg_largeobject;

A TRUNCATE could probably be used here as well.  I wouldn't go as far as
dropping and re-creating the table though.

-- 
  Sam  http://samason.me.uk/
 
 [1] http://www.postgresql.org/docs/current/static/catalog-pg-largeobject.html

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


[GENERAL] Postgres BackUp and Restore: ERROR: duplicate key violates unique constraint "pg_largeobject_loid_pn_index"

2009-05-12 Thread CM J
Hi,

  I backup my database using the following command:

pg_dump.exe -f  Backup.sql  -U  -p  MYDB

   Now,before restoring, i drop all my tables,indexes,foreign key
constraints.Then, i restore using the cmd below:


psql.exe -U  -p -d MYDB -f Backup.sql

 The above results in following exception and the data is not getting
restored:

ERROR:  duplicate key violates unique constraint
"pg_largeobject_loid_pn_index"

  What else do i need to drop/delete to completely reinitialize my
database ? Also, instead of dropping the tables,indexes,foreign key
constraints, if drop the database and recreate it, the above error is not
thrown.However, this approach is not an option for me due to some limitation
in my application.

   Kindly help.

Thanks