pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedReference integrity question
3+ messages / 2 participants
[nested] [flat]
* Reference integrity question
@ 2002-12-27 13:32 Evgen Potemkin <evgent@ns.terminal.ru>
0 siblings, 1 reply; 3+ messages in thread
From: Evgen Potemkin @ 2002-12-27 13:32 UTC (permalink / raw)
To: pgsql-sql
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 ?
thank in advance,
---
.evgen
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Reference integrity question
@ 2003-01-02 09:42 Stephan Szabo <sszabo@megazone23.bigpanda.com>
parent: Evgen Potemkin <evgent@ns.terminal.ru>
0 siblings, 0 replies; 3+ messages in thread
From: Stephan Szabo @ 2003-01-02 09:42 UTC (permalink / raw)
To: Evgen Potemkin <evgent@ns.terminal.ru>; +Cc: pgsql-sql
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.
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Reference integrity question
@ 2003-01-04 15:16 Stephan Szabo <sszabo@megazone23.bigpanda.com>
0 siblings, 0 replies; 3+ messages in thread
From: Stephan Szabo @ 2003-01-04 15:16 UTC (permalink / raw)
To: Evgen Potemkin <evgent@ns.terminal.ru>; +Cc: pgsql-sql
On Sat, 4 Jan 2003, Evgen Potemkin wrote:
> > > 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;
> >
> v 7.3, but i'm upgraded from 7.2
> \d news
> shows that there is no constraints, but constraint triggers a la
> RI_ConstraintTrigger_262762.
> when i'm dumps schema, first of trigger func parameters is '<unnamed>', so i
> guess it's a contraint name.
In that case you'll need to drop the triggers manually (there are three
triggers, one on the fk table and two on the pw table) and add the
constraint using ALTER TABLE. For info on the triggers, there's a couple
of documents on techdocs.
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2003-01-04 15:16 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-12-27 13:32 Reference integrity question Evgen Potemkin <evgent@ns.terminal.ru>
2003-01-02 09:42 ` Stephan Szabo <sszabo@megazone23.bigpanda.com>
2003-01-04 15:16 Re: Reference integrity question Stephan Szabo <sszabo@megazone23.bigpanda.com>
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