Re: How to copy a schema under another name in same database

Поиск
Список
Период
Сортировка
От Daniel Gour
Тема Re: How to copy a schema under another name in same database
Дата
Msg-id 6B0B2B2B3D1F634F99AD4D99BA30A20B02FEE93A@adacel-mail.adacelcanada.com
обсуждение исходный текст
Ответ на How to copy a schema under another name in same database  ("Daniel Gour" <Daniel.Gour@adacel.com>)
Ответы Re: How to copy a schema under another name in same database
Список pgsql-novice
Thanks for the suggestion, but I need the application to be multi-platform
(I'm using Qt).  Since sed is not natively available on XP...  Also, as you
mention, it is risky to blindly replace one string for another in the whole
sql script.

The solution is however simple and elegant, maybe someone else will find it
useful.  Thanks!

---------------------------------
Daniel Gour
Adacel Inc.

-----Original Message-----
From: Frank Bax [mailto:fbax@sympatico.ca]
Sent: Wednesday, July 30, 2008 12:51 PM
To: PostgreSQL List - Novice
Subject: Re: [NOVICE] How to copy a schema under another name in same
database

Daniel Gour wrote:
> Hello!  I have a PostgreSQL (8.3.3, WinXP + linux) database with
> multiple schemas.  I would like, on a regular basis, to be able to copy
> the structure and data of one schema under a new schema, using of course
> a different name.  What would be the easiest way?



Backup the schema with pg_dump; edit file; change schema name and
restore?  If schema names do not show up in data; then this might work:

pg_dump ... | sed s:schema1:schema2:g | psql


--
Sent via pgsql-novice mailing list (pgsql-novice@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-novice

В списке pgsql-novice по дате отправления:

Предыдущее
От: Frank Bax
Дата:
Сообщение: Re: How to copy a schema under another name in same database
Следующее
От: "Rodrigo E. De León Plicet"
Дата:
Сообщение: Re: How to copy a schema under another name in same database