X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 2ECF856397 for ; Thu, 3 Mar 2005 18:44:52 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 60559-03 for ; Thu, 3 Mar 2005 18:44:51 +0000 (GMT) Received: from mail.logix-tt.com (wallaby.dingens.org [212.75.36.180]) by svr1.postgresql.org (Postfix) with ESMTP id D5BA856393 for ; Thu, 3 Mar 2005 18:44:50 +0000 (GMT) Received: from kingfisher.intern.logi-track.com (pD95DCDF2.dip0.t-ipconnect.de [217.93.205.242]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.logix-tt.com (Postfix) with ESMTP id 44B92A859A; Thu, 3 Mar 2005 18:44:53 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by kingfisher.intern.logi-track.com (Postfix) with ESMTP id 099C5AB3D8; Thu, 3 Mar 2005 19:44:48 +0100 (CET) Message-ID: <42275B20.6030108@logix-tt.com> Date: Thu, 03 Mar 2005 19:44:48 +0100 From: Markus Schaber User-Agent: Mozilla Thunderbird 1.0 (X11/20050116) X-Accept-Language: de-DE, de, en-us, en MIME-Version: 1.0 To: "Casey T. Deccio" Cc: pgsql-sql@postgresql.org Subject: Re: Building a database from a flat file References: <1109808921.12430.75.camel@boomerang.ran.sandia.gov> <42272D27.4030900@logix-tt.com> <1109875028.12428.98.camel@boomerang.ran.sandia.gov> In-Reply-To: <1109875028.12428.98.camel@boomerang.ran.sandia.gov> X-Enigmail-Version: 0.90.1.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200503/50 X-Sequence-Number: 20529 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/