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 80B5E5E37CE for ; Thu, 19 Aug 2004 18:41:29 -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 91639-10 for ; Thu, 19 Aug 2004 21:41:21 +0000 (GMT) Received: from smtp104.mail.sc5.yahoo.com (smtp104.mail.sc5.yahoo.com [66.163.169.223]) by svr1.postgresql.org (Postfix) with SMTP id 3ED745E3639 for ; Thu, 19 Aug 2004 18:41:19 -0300 (ADT) Received: from unknown (HELO jupiter.black-lion.info) (janwieck@68.80.245.191 with login) by smtp104.mail.sc5.yahoo.com with SMTP; 19 Aug 2004 21:41:21 -0000 Received: from [172.21.8.18] ([192.168.192.101]) (authenticated bits=0) by jupiter.black-lion.info (8.12.10/8.12.9) with ESMTP id i7JLfDT7074684; Thu, 19 Aug 2004 17:41:19 -0400 (EDT) (envelope-from JanWieck@Yahoo.com) Message-ID: <41251E73.6070001@Yahoo.com> Date: Thu, 19 Aug 2004 17:41:07 -0400 From: Jan Wieck User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.1) Gecko/20040707 X-Accept-Language: en-us, en MIME-Version: 1.0 To: olly@lfix.co.uk Cc: Josh Berkus , pgsql-sql@postgresql.org Subject: Re: multi column foreign key for implicitly unique columns 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> In-Reply-To: <1092934366.19834.88.camel@braydb> Content-Type: text/plain; charset=us-ascii; format=flowed 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/221 X-Sequence-Number: 18718 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 #