Re: Copy entire schema A to a different schema B

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Tiffany Thang <tiffanythang(at)gmail(dot)com>, pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Copy entire schema A to a different schema B
Date: 2019-02-11 16:07:45
Message-ID: 07d00cdd-19a5-8fcf-072b-7e1346fc372b@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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(dot)klaver(at)aklaver(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ron 2019-02-11 16:10:48 Re: Copy entire schema A to a different schema B
Previous Message Tiffany Thang 2019-02-11 16:00:37 Copy entire schema A to a different schema B