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,