pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Tiffany Thang <tiffanythang@gmail.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: Copy entire schema A to a different schema B
Date: Mon, 11 Feb 2019 08:07:45 -0800
Message-ID: <07d00cdd-19a5-8fcf-072b-7e1346fc372b@aklaver.com> (raw)
In-Reply-To: <CAB_W-NMjRS4ah_txcF=pZmYA_KfZLm+mT5eL26-az+xTHEdXcA@mail.gmail.com>
References: <CAB_W-NMjRS4ah_txcF=pZmYA_KfZLm+mT5eL26-az+xTHEdXcA@mail.gmail.com>

On 2/11/19 8:00 AM, Tiffany Thang wrote:
> Hi,
> To copy the source schema A to target schema B in the same database in 
> PG10.3, I use psql to dump schema A and manually removes anything 
> specific to the schema in the text dump file before importing into 
> schema B. How do I achieve the same exporting from Schema A and 
> importing into schema B using pg_dump with the -Fc option? Since the 

Use the -f option to pg_restore:

https://www.postgresql.org/docs/10/app-pgrestore.html

So something like:

pg_restore -f text_file.sql the_binary_file.out

This will get you back to a text file you can manipulate.

> dump file generated is binary, I could not make modifications to the 
> file. Is the procedure the same in version 11?
> 
> Thank.
> 
> Tiff


-- 
Adrian Klaver
adrian.klaver@aklaver.com




view thread (17+ messages)  latest in thread

Message-ID: <07d00cdd-19a5-8fcf-072b-7e1346fc372b@aklaver.com>
Permalink:  ../07d00cdd-19a5-8fcf-072b-7e1346fc372b@aklaver.com/
Also on:    postgresql.org/message-id/07d00cdd-19a5-8fcf-072b-7e1346fc372b@aklaver.com

 · 

reply

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: adrian.klaver@aklaver.com, tiffanythang@gmail.com
  Subject: Re: Copy entire schema A to a different schema B
  In-Reply-To: <07d00cdd-19a5-8fcf-072b-7e1346fc372b@aklaver.com>
  References: <CAB_W-NMjRS4ah_txcF=pZmYA_KfZLm+mT5eL26-az+xTHEdXcA@mail.gmail.com> <07d00cdd-19a5-8fcf-072b-7e1346fc372b@aklaver.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