Received: from megazone.bigpanda.com (megazone.bigpanda.com [63.150.15.178]) by postgresql.org (Postfix) with ESMTP id 41508476CBD for ; Wed, 13 Mar 2002 11:02:27 -0500 (EST) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id E3060D5F7; Wed, 13 Mar 2002 08:02:28 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id D889C5BFD; Wed, 13 Mar 2002 08:02:28 -0800 (PST) Date: Wed, 13 Mar 2002 08:02:28 -0800 (PST) From: Stephan Szabo To: Charles Hauser Cc: Subject: Re: ALTER CONSTRAINT FOREIGN KEY In-Reply-To: Message-ID: <20020313075909.F81426-100000@megazone23.bigpanda.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Archive-Number: 200203/149 X-Sequence-Number: 7029 On Thu, 7 Mar 2002, Charles Hauser wrote: > When I created a TABLE clone I initially defined a column: > gb_accessions_id INTEGER REFERENCES gb_accessions(gb_accessions_id) NULL > > > I have renamed TABLE gb_accessions to TABLE gb, and its column > gb_accessions_id to gb_id. > > I next renamed the column 'gb_accessions_id' in TABLE clone to 'gb_id'. > In renaming this column in TABLE clone I appear to have lost the > reference to TABLE gb (see below). > > Questions: > > 1. During which step in my renaming did this occur? As soon as you renamed either the table or column the constraint got broken. > 2. How should I have carried this out? Pretty much you need to kill the references constraint that was there. This involes dropping the triggeres involved in the constraint (see techdocs.postgresql.org for more details - they've got some writings that will help) > 3. Can I add back REFERENCES gb(gb_id)? Yes, use alter table add constraint to add the constraint back.