Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 87F8C4767ED for ; Tue, 3 Dec 2002 15:16:24 -0500 (EST) Received: from megazone.bigpanda.com (megazone.bigpanda.com [63.150.15.178]) by postgresql.org (Postfix) with ESMTP id 3BFDF4769AC for ; Tue, 3 Dec 2002 14:55:58 -0500 (EST) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id C0295D60C; Tue, 3 Dec 2002 11:55:58 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id B5DC75C02; Tue, 3 Dec 2002 11:55:58 -0800 (PST) Date: Tue, 3 Dec 2002 11:55:58 -0800 (PST) From: Stephan Szabo To: Tomasz Myrta Cc: Subject: Re: recreating table and foreign keys In-Reply-To: <20021203202954.M11351@klaster.net> Message-ID: <20021203115400.X73093-100000@megazone23.bigpanda.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/45 X-Sequence-Number: 10633 On Tue, 3 Dec 2002, Tomasz Myrta wrote: > > You'll probably end up using ALTER TABLE ADD CONSTRAINT to add the > > constraints to the new master_table. It's possible that you might > > be able to hack something with the system tables, but that sounds > > dangerous. Or you can upgrade to 7.3 which lets you run alter table > > drop column. :) > If it is the only way, I can create >20 "alter table add constraint...", but > is rather a boring finish :-( > I found, I can dump database - data only. After this I can create all tables > and restore data. Yeah, dump and restore is generally a pretty big thing though. > Any other solution? You might be able to write a function that would duplicate constraints from the table you want to dispose of to the new table, but it might be hairy. If you do this alot, you might want to upgrade to 7.3 (which requires one dump and reload).