From: | Melvin Davidson <melvin6925(at)gmail(dot)com> |
---|---|
To: | Alban Hertroys <haramrae(at)gmail(dot)com> |
Cc: | matt(dot)figg(at)internode(dot)on(dot)net, "pgsql-general(at)postgresql(dot)org >> PG-General Mailing List" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Programmatically duplicating a schema |
Date: | 2018-03-13 13:09:02 |
Message-ID: | CANu8Fiy3BCDi77ZDDKmscCnYaAvgtPKNSqx+Ks2xVpC3TUCa+A@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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. Itnow 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!
Attachment | Content-Type | Size |
---|---|---|
clone_schema.sql | text/plain | 13.7 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Melvin Davidson | 2018-03-13 13:47:14 | Re: UPSERT on a view |
Previous Message | Laurenz Albe | 2018-03-13 11:51:41 | Re: Point-in-time recovery after failover |