pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jan Wieck <JanWieck@Yahoo.com>
To: olly@lfix.co.uk
Cc: Josh Berkus <josh@agliodbs.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: multi column foreign key for implicitly unique columns
Date: Thu, 19 Aug 2004 17:41:07 -0400
Message-ID: <41251E73.6070001@Yahoo.com> (raw)
In-Reply-To: <1092934366.19834.88.camel@braydb>
References: <1092734724.2627.4.camel@dicaprio.akademie1.de>
	<200408181155.34472.josh@agliodbs.com>
	<4123D91D.8060601@Yahoo.com>
	<200408190921.59529.josh@agliodbs.com>
	<1092934366.19834.88.camel@braydb>

On 8/19/2004 12:52 PM, Oliver Elphick wrote:
> On Thu, 2004-08-19 at 17:21, Josh Berkus wrote:
>> Jan,
>> 
>> > 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.
>> 
>> And in the absence of that constraint, what ensures that b.y = a.y, exactly?
> 
> In the absence of b.y, it would be impossible for it to be anything
> else.  Isn't that the point?

Precisely. I meant that the entire column is redundant and obsolete. 
Without the column, no need for any constraint.

> It seems to me that he was trying to use the database to show errors in
> his source data, but since his constraint would reject the data, he
> wouldn't be able to enter it; all he could do would be to see the
> error.  So he might as well turn it round, normalise the data properly
> and use the database to tell the rest of the system what the data ought
> to be.

I assumed he often queries b, and to avoid joining a all the time he 
duplicates values from a into b and then tries to ensure that they stay 
in sync with constraints.


Jan

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



view thread (38+ messages)  latest in thread

Message-ID: <41251E73.6070001@Yahoo.com>
Permalink:  ../41251E73.6070001@Yahoo.com/
Also on:    postgresql.org/message-id/41251E73.6070001@Yahoo.com

 · 

reply

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: JanWieck@Yahoo.com, olly@lfix.co.uk, josh@agliodbs.com
  Subject: Re: multi column foreign key for implicitly unique columns
  In-Reply-To: <41251E73.6070001@Yahoo.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