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
systemcatalog.
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