Re: Unique Keys
From: Kenneth Downs <firstinit.lastname_at_lastnameplusfam.net>
Date: Fri, 26 Nov 2004 08:12:44 -0500
Message-ID: <cnmj72-7la.ln1_at_pluto.downsfam.net>
>> Kenneth Downs wrote:
>> such:
>> unique
>> simple
>>
>> 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?
>>
Date: Fri, 26 Nov 2004 08:12:44 -0500
Message-ID: <cnmj72-7la.ln1_at_pluto.downsfam.net>
Kenneth Downs wrote:
> 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? >
oops, I see I missed your question. You want to know how to tell if a=c and b=d? Well, you seem to be a smart guy, maybe you can suggest something?
-- Kenneth Downs <?php $sig_block="Variable scope? What's that?";?>Received on Fri Nov 26 2004 - 14:12:44 CET