Re: relations aren't types?

From: Bob Badour <bbadour_at_golden.net>
Date: Fri, 19 Dec 2003 21:20:46 -0500
Message-ID: <Cq2dncXBedGNL36iRVn-vw_at_golden.net>


"Adrian Kubala" <adrian_at_sixfingeredman.net> wrote in message news:slrnbu76ps.j10.adrian_at_sixfingeredman.net...
> I've heard this a few places. A type is a set of values with operators.
> A relation is a set of values (tuples) with operators. While viewing a
> relation as a type seems pretty unenlightening, I don't see why it's
> outright *wrong*. Can anyone illuminate me?

Hi Adrian,

You are using terms somewhat sloppily. A relation is a value, and every value has a most specific type. The type of a relation depends on the types of its attributes. A relation variable or relvar is a variable declared to contain values of a specific type as is the case in any strongly typed language.

As in any other strongly typed language, the value stored in a variable may actually have a most specific type that is a subtype of the variable's declared type. Some languages confuse type and representation. Thus, while a floating point variable may contain an integer value, such as 5, most languages fail to recognize that fact, and this applies equally to relational languages that do not support type inheritance..

The relational operations are defined for sets of types and not just sets of values, and the types returned by the operations depend on the types of their operands in ways that generally do not involve subtypes and supertypes at all.

Thus "relation" refers to values of a generic type and not to a specific type, per se. The relational operations are generic operations.

One can define an n-adic JOIN for n operands of any relation type. One can define an n-adic UNION or INTERSECT for n operands of a common relation type.

If we consider the declared type of a specific relvar, we could say that the generic operations define operations for that type. UNION and INTERSECT define specific operations for that type, but JOIN still defines a generic operation because the other operands can be any instance of the generic type.

Cheers,
Bob Received on Sat Dec 20 2003 - 03:20:46 CET

Original text of this message