Avoid duplicated rows when restoring data from pg_dumpall ??

From: Pablo Alonso-Villaverde Roza <pavroza(at)gmail(dot)com>
To: pgsql-admin(at)postgresql(dot)org
Subject: Avoid duplicated rows when restoring data from pg_dumpall ??
Date: 2009-08-24 10:54:04
Message-ID: fbd3fefa0908240354i53d95667i9239477d3927bf9e@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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,

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Geoffrey 2009-08-24 14:35:09 Re: 32bit and 64bit cluster with shared data silo
Previous Message PESTY Benoit 2009-08-24 07:23:34 Re: [ADMIN] Background color in query tool