| From: | Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at> |
|---|---|
| To: | Nagaraj Raj <nagaraj(dot)sf(at)yahoo(dot)com>, Pgsql-performance <pgsql-performance(at)postgresql(dot)org> |
| Subject: | Re: pg_restore schema dump to schema with different name |
| Date: | 2021-08-23 13:19:26 |
| Message-ID: | 4a3a3b2569bf521a8da585f3f87c8e56c6d19145.camel@cybertec.at |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-performance |
On Mon, 2021-08-23 at 09:44 +0000, Nagaraj Raj wrote:
> I know I can alter schema name after restoring but the problem is the name already exist and I don't want to touch that existing schema.
> The dump type is "custom".
>
> So effectively I want something like.
> pg_dump -U postgres --schema "source_schema" --format "c" --create --file "source_schema.bak" my_db
> pg_restore -U postgres --exit-on-error --dbname "my_db" --destination-schema "destination_schema"
The only way to do that is to create a new database, import the data there,
rename the schema and dump again.
Then import that dump into the target database.
Yours,
Laurenz Albe
--
Cybertec | https://www.cybertec-postgresql.com
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Jean-Christophe Boggio | 2021-08-23 13:38:44 | Re: pg_restore schema dump to schema with different name |
| Previous Message | Nagaraj Raj | 2021-08-23 09:44:07 | pg_restore schema dump to schema with different name |