Re: Types and "join compatibility"

From: DBMS_Plumber <paul_geoffrey_brown_at_yahoo.com>
Date: 30 Jul 2005 23:02:13 -0700
Message-ID: <1122788399.465628.165620_at_f14g2000cwb.googlegroups.com>


Marshall Spight Sayeth:
> André Nęss Asks:

>> I'm interesting in both theoretical considerations as well as practical
>> experiences. Does there exist any (prototype) implementations of the
>>  relational algebra coupled with a fairly powerful type system?

> You'd think there would be, but I'm not aware of any.

Erm. Postgres? Since - lilke, about 1992?

In the example being posed, Postgres would (IIRC) do the following:

  1. Looks for an explicit function of the form Equal ( Circle, Ellipse ).
  2. If one is not found, it begins to search the hierarchy. As Circle is a subtype, it will look at Circle's super type first, and find a function/method Equal (Ellipse, Ellipse). All of the type promotion stuff is bound into this mechanism.
  3. If no match is found it them begins to look for casts.

 Now, of course, Postgres implemented that beastly SQL language where there is no such concept as a "natural join". You express the join predicates explicitly. And were you to try to build a natural join on this foundation you would quickly run in to situations where the 'natural join' semantics become ambiguous, and you need to use some kind of ad hoc rule to break the tie.

 Specifically, in what order do you begin to look for equality? There could be several candidate join predicates in the lattice. Received on Sun Jul 31 2005 - 08:02:13 CEST

Original text of this message