Re: feature request: pg_restore renaming target schema

From: CN <cnliou9(at)fastmail(dot)fm>
To: pgsql-admin(at)postgresql(dot)org
Subject: Re: feature request: pg_restore renaming target schema
Date: 2015-12-17 15:19:46
Message-ID: 1450365586.2726209.470114761.326B7E39@webmail.messagingengine.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message John Scalia 2015-12-17 15:34:12 Re: feature request: pg_restore renaming target schema
Previous Message Shreeyansh Dba 2015-12-17 13:20:58 Re: feature request: pg_restore renaming target schema