Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id C75B9475A9E for ; Thu, 2 Jan 2003 04:42:57 -0500 (EST) Received: from megazone.bigpanda.com (megazone.bigpanda.com [63.150.15.178]) by postgresql.org (Postfix) with ESMTP id 5B3FD475A3F for ; Thu, 2 Jan 2003 04:42:57 -0500 (EST) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id A3445D61A; Thu, 2 Jan 2003 01:42:58 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id 94BCC5C03; Thu, 2 Jan 2003 01:42:58 -0800 (PST) Date: Thu, 2 Jan 2003 01:42:58 -0800 (PST) From: Stephan Szabo To: Evgen Potemkin Cc: Subject: Re: Reference integrity question In-Reply-To: Message-ID: <20030102013805.A87429-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: 200301/15 X-Sequence-Number: 10880 On Fri, 27 Dec 2002, Evgen Potemkin wrote: > Good time of day! > > I have two tables > news(newsid int4, newscltid int4 references clt(cltid) match full,newstext text) > and > clt(cltid int4, somedata text). > after clt is renamed , for ex. to clt_old, newscltid start to reference to clt_old.cltid. > i'm create new table clt(cltid int4, anotherdata text); > > is there any way to make newscltid reference to newly created clt, beside > recreation of news ? If you mean that all newscltids should reference the new table (presumably already loaded)... Since you haven't given a version, let's guess 7.3, in which case the constraint should probably be named "$1" and you can do an ALTER TABLE news drop constraint "$1"; ALTER TABLE news add foreign key (newscltid) references clt(cltid) match full; but it's tougher in older versions.