Re: feature request: pg_restore renaming target schema - Mailing list pgsql-admin

From CN
Subject Re: feature request: pg_restore renaming target schema
Date
Msg-id 1450365586.2726209.470114761.326B7E39@webmail.messagingengine.com
Whole thread Raw
In response to Re: feature request: pg_restore renaming target schema  (Shreeyansh Dba <shreeyansh2014@gmail.com>)
Responses Re: feature request: pg_restore renaming target schema
List pgsql-admin
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

pgsql-admin by date:

Previous
From: Shreeyansh Dba
Date:
Subject: Re: feature request: pg_restore renaming target schema
Next
From: John Scalia
Date:
Subject: Re: feature request: pg_restore renaming target schema