> pg_restore -U admin -C -d staging /home/postgres/staging-dump
 pg_restore: [archiver (db)] could not execute query: ERROR:  database
 "staging" already exists

-C tells it to create (and then connect to) the target DB, rather than connect to an existing DB and restore into that. So generally you want to say "-d template1" (or some other existing DB) when you use -C.

Tom,

But if I first "dropdb -U admin staging", and then issue:
pg_restore -U admin -C -d staging /home/postgres/staging-dump

I get the error:
pg_restore: [archiver (db)] connection to database "staging" failed: FATAL: database "staging" does not exist


Yet the docs state that the above command should Create the database named by the "-d staging"
part of the command. I'm confused as to why that doesn't work. I also am not sure what the
template1 and template0 are there for.


Regards,
Devin

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Reply via email to