From: Sean Davis <sdavis2@mail.nih.gov>
To: Casey T. Deccio <ctdecci@sandia.gov>
Cc: Markus Schaber <schabi@logix-tt.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Building a database from a flat file
Date: Thu, 3 Mar 2005 14:30:27 -0500
Message-ID: <659c8c4acbee32e7334c8ff68c97dcba@mail.nih.gov> (raw)
In-Reply-To: <1109875028.12428.98.camel@boomerang.ran.sandia.gov>
References: <1109808921.12430.75.camel@boomerang.ran.sandia.gov>
<42272D27.4030900@logix-tt.com>
<1109875028.12428.98.camel@boomerang.ran.sandia.gov>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: sdavis2@mail.nih.gov, ctdecci@sandia.gov, schabi@logix-tt.com
Subject: Re: Building a database from a flat file
In-Reply-To: <659c8c4acbee32e7334c8ff68c97dcba@mail.nih.gov>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox