Re: multi column foreign key for implicitly unique columns

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
Cc: Markus Bertheau <twanger(at)bluetwanger(dot)de>, Richard Huxton <dev(at)archonet(dot)com>, pgsql-sql(at)postgresql(dot)org
Subject: Re: multi column foreign key for implicitly unique columns
Date: 2004-08-17 15:38:14
Message-ID: 4876.1092757094@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com> writes:
> ... It sounds like it'd be a pain at best.

Also, that would directly violate the SQL spec's model of dependencies,
with possibly unpleasant consequences. The current implementation does
exactly what SQL says to do. I cite from SQL99 11.99 DROP CONSTRAINT:

3) If TC is a unique constraint and RC is a referential constraint
whose referenced table is T and whose referenced columns are the
unique columns of TC, then RC is said to be dependent on TC.

...

6) If RESTRICT is specified, then:

a) No table constraint shall be dependent on TC.

NOTE 195 - If CASCADE is specified, then any such dependent
object will be dropped by the effective execution of the
<alter table statement> specified in the General Rules of this
Subclause.

regards, tom lane

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Jean-Luc Lachance 2004-08-17 15:54:14 Re: SELECT MAX(c) FROM (SELECT ... FOR UPDATE) AS foo
Previous Message Stephan Szabo 2004-08-17 15:24:18 Re: multi column foreign key for implicitly unique columns