I am trying to backup one database and restore it into a new schema in
another database. Database1 has the tables in the public schema
database2 has some tables in the public schema but their names will
clash so the database needs to be stored in a different schema.
I back up like this.
/usr/bin/pg_dump --host localhost --port 5432 --username tim --format
custom --blobs --verbose --file
"/usr/local/home/tim/tmp/database.backup" database1
/usr/bin/pg_restore --host localhost --port 5432 --username tim
--dbname database2 --schema database1_schema --verbose
"/usr/local/home/tim/tmp/database.backup"
pg_restore: connecting to database for restore
pg_restore: implied data-only restore
Nothing gets restored.
What is the proper way to restore databases into a particular schema?