X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 493F55E40BB for ; Thu, 19 Aug 2004 13:52:49 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 06021-02 for ; Thu, 19 Aug 2004 16:52:48 +0000 (GMT) Received: from anchor-post-37.mail.demon.net (anchor-post-36.mail.demon.net [194.217.242.86]) by svr1.postgresql.org (Postfix) with ESMTP id B8ABC5E40AC for ; Thu, 19 Aug 2004 13:52:39 -0300 (ADT) Received: from mailgate.bray-healthcare.com ([80.177.250.202] helo=solport.bray-healthcare.com) by anchor-post-37.mail.demon.net with esmtp (Exim 3.35 #1) id 1Bxq9e-000OAF-0b; Thu, 19 Aug 2004 16:52:46 +0000 Received: from braydb.bray-healthcare.com ([192.168.1.18]) by solport.bray-healthcare.com with esmtp (Exim 3.36 #1 (Debian)) id 1Bxq9e-0006LG-00; Thu, 19 Aug 2004 17:52:46 +0100 Subject: Re: multi column foreign key for implicitly unique columns From: Oliver Elphick Reply-To: olly@lfix.co.uk To: Josh Berkus Cc: Jan Wieck , pgsql-sql@postgresql.org In-Reply-To: <200408190921.59529.josh@agliodbs.com> References: <1092734724.2627.4.camel@dicaprio.akademie1.de> <200408181155.34472.josh@agliodbs.com> <4123D91D.8060601@Yahoo.com> <200408190921.59529.josh@agliodbs.com> Content-Type: text/plain Message-Id: <1092934366.19834.88.camel@braydb> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 Date: Thu, 19 Aug 2004 17:52:46 +0100 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200408/220 X-Sequence-Number: 18717 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? 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. Oliver Elphick