From: CN <cnliou9@fastmail.fm>
To: pgsql-admin@postgresql.org
Subject: feature request: pg_restore renaming target schema
Date: Thu, 17 Dec 2015 15:44:05 +0800
Message-ID: <1450338245.2626908.469822713.6C14EE8F@webmail.messagingengine.com> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-admin>
Hi!
I need to restore one source schema to multiple target schema currently.
For example,
source database: db1
source schema: s1
target database: db2
The existing approach I know is following these steps:
(1) pg_dump -n s1 -Fc -f source.db db1
(2a) pg_restore -d db2 -n s1 source.db
(2b) psql -c "ALTER SCHEMA s1 RENAME TO t1" db2
(3a) pg_restore -d db2 -n s1 source.db
(3b) psql -c "ALTER SCHEMA s1 RENAME TO t2" db2
So far so good.
However, with existing tool I know, obviously step groups (2) and (3)
can only run sequentially.
If pg_restore allows "redirecting" source schema to target schema, then
I can concurrently issue some imaginary commands like these:
pg_restore -d db2 -n s1 --target-schema=t1 source.db
pg_restore -d db2 -n s1 --target-schema=t2 source.db
pg_restore -d db2 -n s1 --target-schema=t3 source.db
Best Regards,
CN
--
http://www.fastmail.com - Faster than the air-speed velocity of an
unladen european swallow
--
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-admin@postgresql.org
Cc: cnliou9@fastmail.fm
Subject: Re: feature request: pg_restore renaming target schema
In-Reply-To: <1450338245.2626908.469822713.6C14EE8F@webmail.messagingengine.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox