Re: Unique Keys

From: Kenneth Downs <firstinit.lastname_at_lastnameplusfam.net>
Date: Sat, 27 Nov 2004 16:39:32 -0500
Message-ID: <kp8n72-hl9.ln1_at_pluto.downsfam.net>


Mikito Harakiri wrote:

>

>> yes, but that is not a unique constraint.  Is there anyway at all to
>> imagine it as a declarative unique constraint?

>
> This question, although perfectly valid, looks tough. Could interval
> domain be mapped into some fancy custom made domain such that interval
> overlapping corresponds to identity?

Not a domain, but a datatype.

In another subthread of this thread I suggested a datatype interval, composed of an ordered pair of any two values of the same base type, (a,b) where a<=b. Equality could then be defined as:

where x = (a,b)
and   y = (c,d)

x = y iff (a <= c <= b) OR (a <= d <= b)

This allows the declarative Unique and RI constraints.

The actual purpose of the thread was to ask if anyone thought this possible in any form. All positive answers led towards a datatype, which was what I wanted to find out.

FWIW, this entire thing has only encouraged me to believe even more that many 'special' constraints can be reduced to unique and referential, with the possibility of a few carefully chosen new data types becoming an important part of the solution.

-- 
Kenneth Downs
<?php $sig_block="Variable scope? What's that?";?>
Received on Sat Nov 27 2004 - 22:39:32 CET

Original text of this message