I am trying to restore a binary
pg_dump backup under a different database name that was in the original dump. Despite giving
--dbname command line argument,
pg_restore tries to restore everything under the original database name - the behavior I especially want to avoid.
createdb mydb pg_restore --dbname=mydb --exit-on-error -Fc database.bak pg_restore: [archiver (db)] Error while PROCESSING TOC: pg_restore: [archiver (db)] Error from TOC entry 8; 2615 16396 SCHEMA topology u9o2f4j0 pg_restore: [archiver (db)] could not execute query: ERROR: schema "topology" already exists Command was: CREATE SCHEMA topology;
How can I make
pg_restore to restore the database under a different name?
pg_dump --version pg_dump (PostgreSQL) 9.5.5 pg_restore --version pg_restore (PostgreSQL) 9.6.1