Skip site navigation (1) Skip section navigation (2)

Re: multi column foreign key for implicitly unique columns

From: Jan Wieck <JanWieck(at)Yahoo(dot)com>
To: josh(at)agliodbs(dot)com
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Richard Huxton <dev(at)archonet(dot)com>,Markus Bertheau <twanger(at)bluetwanger(dot)de>, olly(at)lfix(dot)co(dot)uk,pgsql-sql(at)postgresql(dot)org, Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Subject: Re: multi column foreign key for implicitly unique columns
Date: 2004-08-18 22:33:01
Message-ID: 4123D91D.8060601@Yahoo.com (view raw or flat)
Thread:
Lists: pgsql-sql
On 8/18/2004 2:55 PM, Josh Berkus wrote:
> Jan,
>>
>> If a.x is unique, then (b.x, b.y) references (a.x, a.y) is only ensuring
>> that the redundant copy of y in b.y stays in sync with a.y.
> 
> So?  What's denormalized about that?  His other choice is to use a trigger.

Because the value in b.y is redundant. b.x->a.x->a.y is exactly the same 
  value and he even wants to ensure this with the constraint.


Jan

> 
> What he's trying to do is ensure that the class selected for the FK 
> class_name, field_name relates to the same class_name in objects.
> 


-- 
#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#================================================== JanWieck(at)Yahoo(dot)com #

In response to

Responses

pgsql-sql by date

Next:From: Theo GalanakisDate: 2004-08-19 01:10:00
Subject: Function Issue!
Previous:From: Theo GalanakisDate: 2004-08-18 22:29:13
Subject: Re:

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group