bug in pg_restore
I think there is a little bug in pg_restore. It says it can't restore
because the database doesn't exist, but then if I create the database it
says it can't proceed because the database DOES exist. The solution for
me was to omit the -C argument, but it looks like a bug to me:
pg@carlito:/bigraid/tmp$ pg_restore -C -F custom -d rupert -v rupert.dump
pg_restore: connecting to database for restore
pg_restore: [archiver (db)] connection to database "rupert" failed: FATAL 1: Database "rupert" does not exist in the system catalog.
pg_restore: *** aborted because of error
pg@carlito:/bigraid/tmp$ createdb rupert
CREATE DATABASE
pg@carlito:/bigraid/tmp$ pg_restore -C -F custom -d rupert -v rupert.dump
pg_restore: connecting to database for restore
pg_restore: creating DATABASE rupert
pg_restore: [archiver (db)] could not execute query: ERROR: CREATE DATABASE: database "rupert" already exists
pg_restore: *** aborted because of error
pg@carlito:/bigraid/tmp$ pg_restore -F custom -d rupert -v rupert.dump
pg_restore: connecting to database for restore
pg_restore: creating SEQUENCE request_id
...
The dump file was created with the -C argument.
Regards,
Jeffrey
On 18 Jan 2002, Jeffrey W. Baker wrote:
I think there is a little bug in pg_restore. It says it can't restore
because the database doesn't exist, but then if I create the database it
says it can't proceed because the database DOES exist. The solution for
me was to omit the -C argument, but it looks like a bug to me:
I think the intention is that with -C, the -d argument is the database
to connect to before generating the create for the database that's
specified in the dump, not the final name of the database.
Stephan Szabo <sszabo@megazone23.bigpanda.com> writes:
On 18 Jan 2002, Jeffrey W. Baker wrote:
I think there is a little bug in pg_restore. It says it can't restore
because the database doesn't exist, but then if I create the database it
says it can't proceed because the database DOES exist. The solution for
me was to omit the -C argument, but it looks like a bug to me:
I think the intention is that with -C, the -d argument is the database
to connect to before generating the create for the database that's
specified in the dump, not the final name of the database.
Yeah. The 7.1 documentation is very confusing on this point.
I tried awhile ago to clean it up for 7.2. You might care to look at
http://developer.postgresql.org/docs/postgres/app-pgdump.html
http://developer.postgresql.org/docs/postgres/app-pgrestore.html
(there might be some stuff in there that's new for 7.2, but these
switches didn't change).
regards, tom lane