Re: feature request: pg_restore renaming target schema

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Maybe a bit off-postgresql, but why couldn't you just add to your existing automations script, Use sed or your favorite stream editor and have that do the renaming in the dump output?

FWIW,
Jay

On Thu, Dec 17, 2015 at 9:19 AM, CN <cnliou9@xxxxxxxxxxx> wrote:
Thank you! Venkataramana,
 
On Thu, Dec 17, 2015, at 09:20 PM, Shreeyansh Dba wrote:
But if you are trying to do with second option like from source schema(s1) of db1 to target schema(t1) of db2, it is not possible with pg_restore because while restoring from backup dump, it follows the sequence of commands like 
"CREATE SCHEMA s1"
"SET SEARCH_PATH=s1"
"CREATE TABLE table_name(id int)"
"INSERT INTO table_name VALUES(1)"
 
Indeed. I have just peeked the content of the dumped file in plain format and have noticed that all objects are prefixed with original schema name. This makes me feel that the task of adding the mentioned feature to pg_restore or pg_dump must be nontrivial :-(
 
2: If you are taking the dump in plan text format you can edit the plain text file and replace schema old name to new name and then you can restore the file using psql -d <db> -U <user> -f <path of plain text file>.
 
 
Manual editing is not quite feasible because I need to automate the sequence of jobs by executing pg_dump and pg_restore in program.
 
Best Regards,
CN
-- 
http://www.fastmail.com - Accessible with your email software
                          or over the web


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux