Re: Programmatically duplicating a schema

Поиск
Список
Период
Сортировка
От Melvin Davidson
Тема Re: Programmatically duplicating a schema
Дата
Msg-id CANu8Fiy3BCDi77ZDDKmscCnYaAvgtPKNSqx+Ks2xVpC3TUCa+A@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Programmatically duplicating a schema  (Alban Hertroys <haramrae@gmail.com>)
Список pgsql-general
 > What is a reliable way to programmatically & generically populate an empty schema with all the objects in the public schema as a template?

The simplest way is just to load the attached clone_schema function. It was originally created by Emanuel '3manuek', which I enhanced. It
now copies all sequences, tables, indexes, rules, triggers, data(optional), views & functions from any existing schema to a new schema.

Then just call the function.

SAMPLE CALL:
SELECT clone_schema('public', 'new_schema', TRUE);

Use FALSE if you do not want to copy data.


--
Melvin Davidson
Maj. Database & Exploration Specialist

Universe Exploration Command – UXC

Employment by invitation only!
Вложения

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

Предыдущее
От: Laurenz Albe
Дата:
Сообщение: Re: Point-in-time recovery after failover
Следующее
От: Melvin Davidson
Дата:
Сообщение: Re: UPSERT on a view