From: | Markus Schaber <schabi(at)logix-tt(dot)com> |
---|---|
To: | "Casey T(dot) Deccio" <ctdecci(at)sandia(dot)gov> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: Building a database from a flat file |
Date: | 2005-03-03 18:44:48 |
Message-ID: | 42275B20.6030108@logix-tt.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Hi, Casey,
Casey T. Deccio schrieb:
> 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.
I do not know about schemas, but for tables you can "CREATE TABLE alpha
(LIKE beta)".
>>- Create the new data in differently named tables, and then simply
>>rename all the old and new tables for "switch over".
> This probably would work too, but there may be problems with foreign
> keys in renaming the tables one at a time (unless deferrable is used).
> To avoid any mess, the previous one works well.
AFAIK, the foreign key relations are adopted when a table is renamed,
they stick to the same table disregarding name changes.
Markus
--
Markus Schaber | Dipl. Informatiker | Software Development GIS
Fight against software patents in EU! http://ffii.org/
http://nosoftwarepatents.org/
From | Date | Subject | |
---|---|---|---|
Next Message | Bricklen Anderson | 2005-03-03 18:47:40 | Re: Building a database from a flat file |
Previous Message | Casey T. Deccio | 2005-03-03 18:37:08 | Re: Building a database from a flat file |