Re: Unique Keys

From: Kenneth Downs <firstinit.lastname_at_lastnameplusfam.net>
Date: Fri, 26 Nov 2004 07:00:40 -0500
Message-ID: <8gij72-46a.ln1_at_pluto.downsfam.net>


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?";?>
Received on Fri Nov 26 2004 - 13:00:40 CET

Original text of this message