pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Markus Schaber <schabi@logix-tt.com>
To: Casey T. Deccio <ctdecci@sandia.gov>
Cc: pgsql-sql@postgresql.org
Subject: Re: Building a database from a flat file
Date: Thu, 03 Mar 2005 19:44:48 +0100
Message-ID: <42275B20.6030108@logix-tt.com> (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>

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/



view thread (11+ messages)  latest in thread

Message-ID: <42275B20.6030108@logix-tt.com>
Permalink:  ../42275B20.6030108@logix-tt.com/
Also on:    postgresql.org/message-id/42275B20.6030108@logix-tt.com

 · 

reply

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: schabi@logix-tt.com, ctdecci@sandia.gov
  Subject: Re: Building a database from a flat file
  In-Reply-To: <42275B20.6030108@logix-tt.com>

* 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