Re: type of result column after heterogeneous join

From: Jan Hidders <jan.hidders_at_pandora.be>
Date: Tue, 09 Sep 2003 20:40:31 GMT
Message-ID: <3Vq7b.11172$fJ3.73801_at_phobos.telenet-ops.be>


Marshall Spight wrote:
>
> Suppose there exists a relational database that supports
> a type system that includes union types. (For example,
> (int|string), "an int or a string" is a valid type.) Now
> suppose one had two tables, the first with one column
> named "a" of type int, the second with one column
> named "a" of type string. Table 1 has exactly one row,
> and that row has a=1. Table 2 has exacly one row, and
> that row has a="hello".
>
> What should be the result of a join/union of the two tables?
> (Join and union are the same in this example.) Specifically,
> what is the column type of the resulting relation?
>
> 1. None; this causes a type error
> 2. (int|string)
> 3. Most specific supertype of int and string. (Possibly 'alpha'.)
> 4. alpha, the maximal supertype.

The correct answer is 2 or 3. Answer 1. is too strict, answer 3. is equivalent with answer 2, and answer 4 is less strict than possible. Pretty basic type theory stuff.

  • Jan Hidders
Received on Tue Sep 09 2003 - 22:40:31 CEST

Original text of this message