From: Stephan Szabo <sszabo@megazone23.bigpanda.com>
To: Evgen Potemkin <evgent@ns.terminal.ru>
Cc: pgsql-sql@postgresql.org
Subject: Re: Reference integrity question
Date: Thu, 2 Jan 2003 01:42:58 -0800 (PST)
Message-ID: <20030102013805.A87429-100000@megazone23.bigpanda.com> (raw)
In-Reply-To: <Pine.LNX.4.33.0212271659220.19571-100000@ns.terminal.ru>
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.
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: sszabo@megazone23.bigpanda.com, evgent@ns.terminal.ru
Subject: Re: Reference integrity question
In-Reply-To: <20030102013805.A87429-100000@megazone23.bigpanda.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