Thread: pg_restore ERROR
After running pg_dumpall on my database cluster like this:
$PGBIN/pg_dumpall –c -U ipscdb | gzip > /var/db/pgsql_bkp/pg_dump_file.gz
I subsequently delete the PGDATA directory for the backed up database and initialize a new database. Next I attempt to run the restore using initialized database like this:
cat /var/db/pgsql_bkp/pg_dump_file.gz | gunzip | $PGBIN/psql postgres > /dev/null
This results in a couple of error messages:
ERROR: current user cannot be dropped
ERROR: role "ipscdb" already exists
Since I ran initdb to initialize my database after the pg_dumpall as “ipscdb” user, and subsequently am running the restore as “ipscdb” user, it does make sense that I see these errors. The first one is caused by the –c switch on pg_dumpall which generates the script to drop all database objects before restore is done. The second is a consequence of the first one – script is attempting to create a role, which already exists.
My questions are:
1) What would be the right way to do this? (other than pg_restore with the create option)
2) Does the restore go forward despite the two errors shown above – meaning that I can pretty much ignore these errors?
Thanks in advance,
~george