From:
Bruno Wolff III <bruno(at)wolff(dot)to>
To:
Josh Berkus <josh(at)agliodbs(dot)com>
Cc:
Jan Wieck <JanWieck(at)Yahoo(dot)com>,Markus Bertheau <twanger(at)bluetwanger(dot)de>, olly(at)lfix(dot)co(dot)uk,pgsql-sql(at)postgresql(dot)org
Subject:
Re: multi column foreign key for implicitly unique columns
Date:
2004-08-18 19:24:40
Message-ID:
20040818192440.GB21979@wolff.to (view raw or flat )
Thread:
2004-08-17 09:25:24 from Markus Bertheau <twanger(at)bluetwanger(dot)de>
2004-08-17 09:39:36 from Oliver Elphick <olly(at)lfix(dot)co(dot)uk>
2004-08-17 09:49:57 from Markus Bertheau <twanger(at)bluetwanger(dot)de>
2004-08-18 02:45:15 from Josh Berkus <josh(at)agliodbs(dot)com>
2004-08-18 06:00:21 from Markus Bertheau <twanger(at)bluetwanger(dot)de>
2004-08-18 13:33:04 from Jan Wieck <JanWieck(at)Yahoo(dot)com>
2004-08-18 13:49:21 from Markus Bertheau <twanger(at)bluetwanger(dot)de>
2004-08-18 14:06:47 from Jan Wieck <JanWieck(at)Yahoo(dot)com>
2004-08-18 14:28:49 from Markus Bertheau <twanger(at)bluetwanger(dot)de>
2004-08-18 14:38:44 from Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
2004-08-18 15:16:49 from Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
2004-08-18 16:02:42 from Richard Huxton <dev(at)archonet(dot)com>
2004-08-18 16:18:37 from Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
2004-08-18 16:27:40 from Jan Wieck <JanWieck(at)Yahoo(dot)com>
2004-08-18 16:46:14 from Rod Taylor <pg(at)rbt(dot)ca>
2004-08-18 16:46:26 from Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
2004-08-18 17:49:14 from Richard Huxton <dev(at)archonet(dot)com>
2004-08-18 18:01:52 from Jan Wieck <JanWieck(at)Yahoo(dot)com>
2004-08-18 18:55:34 from Josh Berkus <josh(at)agliodbs(dot)com>
2004-08-18 22:33:01 from Jan Wieck <JanWieck(at)Yahoo(dot)com>
2004-08-19 16:21:59 from Josh Berkus <josh(at)agliodbs(dot)com>
2004-08-19 16:52:46 from Oliver Elphick <olly(at)lfix(dot)co(dot)uk>
2004-08-19 21:41:07 from Jan Wieck <JanWieck(at)Yahoo(dot)com>
2004-08-18 15:45:03 from Rod Taylor <pg(at)rbt(dot)ca>
2004-08-18 17:05:13 from Josh Berkus <josh(at)agliodbs(dot)com>
2004-08-18 17:45:35 from Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
2004-08-18 19:24:40 from Bruno Wolff III <bruno(at)wolff(dot)to>
2004-08-18 19:36:14 from Josh Berkus <josh(at)agliodbs(dot)com>
2004-08-20 07:53:58 from Richard Huxton <dev(at)archonet(dot)com>
2004-08-20 15:04:13 from Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
2004-08-17 09:52:29 from Richard Huxton <dev(at)archonet(dot)com>
2004-08-17 14:26:56 from Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
2004-08-17 14:46:35 from Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
2004-08-17 14:57:38 from Markus Bertheau <twanger(at)bluetwanger(dot)de>
2004-08-17 15:06:05 from Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
2004-08-17 15:12:11 from Markus Bertheau <twanger(at)bluetwanger(dot)de>
2004-08-17 15:24:18 from Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
2004-08-17 15:38:14 from Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
2004-09-28 06:14:20 from Achilleus Mantzios <achill(at)matrix(dot)gatewaynet(dot)com>
2004-09-28 14:05:14 from Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
2004-09-28 13:34:43 from Achilleus Mantzios <achill(at)matrix(dot)gatewaynet(dot)com>
2004-09-29 05:36:07 from Achilleus Mantzios <achill(at)matrix(dot)gatewaynet(dot)com>
2004-09-29 13:19:26 from Achilleus Mantzios <achill(at)matrix(dot)gatewaynet(dot)com>
2004-09-30 10:51:53 from Achilleus Mantzios <achill(at)matrix(dot)gatewaynet(dot)com>
Lists:
pgsql-sql
On Wed, Aug 18, 2004 at 10:05:13 -0700,
Josh Berkus <josh(at)agliodbs(dot)com> wrote:
>
> I have my own issue that forced me to use triggers. Given:
>
> table users (
> name
> login PK
> status
> etc. )
>
> table status (
> status
> relation
> label
> definition
> PK status, relation )
>
> the relationship is:
> users.status = status.status AND status.relation = 'users';
>
> This is a mathematically definable constraint, but there is no way in standard
> SQL to create an FK for it. This is one of the places I point to whenever
> we have the "SQL is imperfectly relational" discussion.
If users is supposed to reference status you can do this by adding a relation
column to users, using a constraint to force relation to always be 'users'
and then having (status, relation) being a foreign key.
In response to
Responses
pgsql-sql by date
Next :From: Josh BerkusDate: 2004-08-18 19:36:14
Subject : Re: multi column foreign key for implicitly unique columns
Previous :From : Josh BerkusDate : 2004-08-18 18:55:34
Subject : Re: multi column foreign key for implicitly unique columns