Avoid duplicated rows when restoring data from pg_dumpall ?? - Mailing list pgsql-admin

From Pablo Alonso-Villaverde Roza
Subject Avoid duplicated rows when restoring data from pg_dumpall ??
Date
Msg-id fbd3fefa0908240354i53d95667i9239477d3927bf9e@mail.gmail.com
Whole thread Raw
Responses Re: Avoid duplicated rows when restoring data from pg_dumpall ??  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-admin
Hi all,

I'm getting duplicated rows in some of my tables when I try to restore data from a dump file generated with 'pg_dumpall'.
I use:
   pg_dumpall -c -U postgres > mybackup.sql
to dump all the data, roles, etc. into a file.

Then I try to restore the data using:
   psql -U postgres -f mybackup.sql

The only "way" I have found to solve this problem is deleting my database before restoring the data, so everything is 're-created' in the restore process without generating duplicated rows.

I thought, that the "-c" flag on pg_dumpall would force a DROP of any previous data structures on the server but...it looks like it doesn't work as I expected and ...when I restore data I get duplicated rows.

How can I get a "clean" restore automatically? I mean, getting exactly the same data there was on the server at the moment I made the 'pg_dumpall'

Excuse me for my poor English, by the way.

Thanks in advance,


pgsql-admin by date:

Previous
From: Andy Shellam
Date:
Subject: Re: Background color in query tool
Next
From: Geoffrey
Date:
Subject: Re: 32bit and 64bit cluster with shared data silo