I am trying to run following command:
sshpass -p "pass" ssh x@1.2.3.4 "pg_dump -Fc -U foo some_db" | pg_restore --create --dbname=new_db
I get:
failed: FATAL: database "new_db" does not exist
postgresqlpostgresql-9.3psql
I am trying to run following command:
sshpass -p "pass" ssh x@1.2.3.4 "pg_dump -Fc -U foo some_db" | pg_restore --create --dbname=new_db
I get:
failed: FATAL: database "new_db" does not exist
Best Answer
This is because it is the way pg_restore works.
pg_restore manual reads as follow :
The -d will restore in the given database if and only if -C is not used. If -C is used, the database is used as a "launchpad", not as the destination.