pg_restore ERROR - Mailing list pgsql-admin

From George Wilk
Subject pg_restore ERROR
Date
Msg-id 024301c7d9eb$b3b5b340$1f7ca8c0@ellacoya.com
Whole thread Raw
List pgsql-admin

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

pgsql-admin by date:

Previous
From: "Tena Sakai"
Date:
Subject: Re: postgres authentication
Next
From: Chris Browne
Date:
Subject: Re: use replication on a database only on selected schemes?