From: | Sean Davis <sdavis2(at)mail(dot)nih(dot)gov> |
---|---|
To: | "Casey T(dot) Deccio" <ctdecci(at)sandia(dot)gov> |
Cc: | "Markus Schaber" <schabi(at)logix-tt(dot)com>, pgsql-sql(at)postgresql(dot)org |
Subject: | Re: Building a database from a flat file |
Date: | 2005-03-03 19:30:27 |
Message-ID: | 659c8c4acbee32e7334c8ff68c97dcba@mail.nih.gov |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
On Mar 3, 2005, at 1:37 PM, Casey T. Deccio wrote:
> On Thu, 2005-03-03 at 08:28 -0700, Markus Schaber wrote:
>> - Create the new date in another schema, and then simply rename those
>> two schemas for "switch over"
>>
>
> This worked very well. I created another schema ("build") and
> populated
> the tables within build. Then:
>
> BEGIN;
> ALTER SCHEMA public RENAME TO public_old;
> ALTER SCHEMA build RENAME TO public;
> COMMIT;
> /* remove data from tables in build schema... */
>
> It was very quick and seamless.
>
> Question: is there an "easy" way to duplicate an existing schema
> (tables, functions, sequences, etc.)--not the data; only the schema?
> This way, I would only need to modify one schema (public) to make
> changes, and the build schema could be created each time as a duplicate
> of the public schema. Maintenance would be much simpler.
Why not just create a dump of your schema (without data), drop the
schema, rebuild it from the dump and then populate as normal. Then do
the name switch.
Sean
From | Date | Subject | |
---|---|---|---|
Next Message | Markus Schaber | 2005-03-03 20:21:49 | Re: Building a database from a flat file |
Previous Message | Bricklen Anderson | 2005-03-03 18:47:40 | Re: Building a database from a flat file |