Path: dp-news.maxwell.syr.edu!spool.maxwell.syr.edu!drn.maxwell.syr.edu!news.maxwell.syr.edu!fu-berlin.de!uni-berlin.de!not-for-mail
From: Kenneth Downs <firstinit.lastname@lastnameplusfam.net>
Newsgroups: comp.databases.theory
Subject: Re: Unique Keys
Date: Fri, 26 Nov 2004 07:00:40 -0500
Lines: 33
Message-ID: <8gij72-46a.ln1@pluto.downsfam.net>
References: <j8vf72-eg5.ln1@pluto.downsfam.net> <1101387601.990897.214300@f14g2000cwb.googlegroups.com> <kp6h72-slm.ln1@pluto.downsfam.net> <1101395692.845672.222270@z14g2000cwz.googlegroups.com> <04eh72-nan.ln1@pluto.downsfam.net> <1101405872.089624.49260@z14g2000cwz.googlegroups.com> <stgi72-b6p.ln1@pluto.downsfam.net> <1101463721.289490.232110@f14g2000cwb.googlegroups.com>
Reply-To: sameas@email.address
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7Bit
X-Trace: news.uni-berlin.de HDGZStJzYHaRntdNDzCI/AauJMsg9bmY7qTawDWDOjW3DYxYL/
X-Orig-Path: pluto.downsfam.net!news
User-Agent: KNode/0.7.7
Xref: dp-news.maxwell.syr.edu comp.databases.theory:28641

Tony Andrews wrote:

> Kenneth Downs wrote:
>> I would suggest it is more useful to define the equality operator as
> such:
>>
>> where x = (a,b)
>> and   y = (c,d)
>>
>> x = y iff (a <= c <= b) OR (a <= d <= b)
>>
>> It is the equality operator definition that makes it a declarative
> unique
>> constraint exactly the same as any other, and also makes possible
> simple
>> foreign keys.  Now we have:
>>
>> CREATE TABLE reservations (
>>  hotel_room char(4),
>>  span DATEINTERVAL )
>>  PRIMARY KEY (hotel_room,span)
> 
> Yes, but only by subverting the traditional meaning of "equals"!  So
> what do you do now if you want to know if the 2 DATEINTERVALs really
> are the same?
> 

Perhaps you would be more comfortable with the OO term?  Operator
Overloading?

-- 
Kenneth Downs
<?php $sig_block="Variable scope? What's that?";?>
