Re: foreign key constraint versus referential integrity constraint

From: Bob Badour <bbadour_at_pei.sympatico.ca>
Date: Sun, 25 Oct 2009 11:40:45 -0300
Message-ID: <4ae46371$0$23769$9a566e8b_at_news.aliant.net>


paul c wrote:

> Bob Badour wrote:
>

>> paul c wrote:
>>
>>> Bob Badour wrote:
>>> ...
>>>
>>>> You asked about semantic joinability. Semantically, the join works 
>>>> if like-named attributes have an equality comparison defined and not 
>>>> if they don't.
>>>> ...
>>>
>>> In RT, how could they not define equality?
>>
>> What reason would one have to define an equality comparison to compare 
>> employee ids with department ids or with names? Or charge with current 
>> or potential? Or age with price?

>
> None in theory, I thought you were talking about attributes in the same
> domain.

Nope. Natural join doesn't care about attributes in the same domain per se. It compares like named attributes regardless of domain.

TTM explains when and how the most specific types can differ and still have an equality comparison return true: they must share some common supertype other than the universal supertype. In this case, the MST of the join will be the most specific common supertype. If the MSTs of the original relations are mutually exclusive, the body will be empty. If not, the join body will consist of values drawn from subtypes of both MSTs and that appear in both relations.

Otherwise, the body of the join will be empty and the type of the like named attribute will be the universal supertype. As a type with a set of values and a set of operations, the universal supertype's set of values is the union of all values, and its set of operations is empty.

I expect most implementations would treat an attribute with the universal supertype as an error, or at least complain loudly with a warning. Received on Sun Oct 25 2009 - 15:40:45 CET

Original text of this message