Re: [HACKERS] Join syntax

From: Thomas Lockhart <lockhart(at)alumni(dot)caltech(dot)edu>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Postgres Hackers List <hackers(at)postgreSQL(dot)org>
Subject: Re: [HACKERS] Join syntax
Date: 1999-09-17 05:58:19
Message-ID: 37E1D87B.DA85C685@alumni.caltech.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> > ... represent general subqueries or intermediate queries in the
> > parse tree.
> Maybe it's time to bite the bullet and do it. You have any thoughts
> on what the representation should look like?

I was hoping you would tell me ;)

I don't have a good feel for the current parse tree (which of course
hasn't kept me from fooling around with it). But I'll definitely need
something extra or different to implement outer joins. If I were
keeping everything else the same, I was thinking of propagating a
"join expression" into the planner/optimizer in the same area as the
existing qualification nodes. One of the differences would be that the
JE marks a node around which the optimizer is not allowed to reorder
the plan (since outer joins must be evaluated in a specific order to
get the right result). But I could just as easily represent this as a
subquery node somewhere else in the parse tree.

afaik the planner/optimizer already has the notion of
merging/joining/scanning intermediate results, so teaching it to
invoke these explicitly from the query tree rather than just
implicitly may not be a huge stretch.

btw I'm currently rewriting the join syntax in gram.y to conform
better to a closer reading of the SQL92 standard. One annoyance is
that the standard allows table *and* column aliasing *everywhere*.
e.g.

select * from (t1 as x1 (i,j,k) join t2 using (i)) as r1 (a,b,c,d)

is (apparently) legal syntax, resulting in rows labeled a-d. Ugh.

- Thomas

--
Thomas Lockhart lockhart(at)alumni(dot)caltech(dot)edu
South Pasadena, California

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Vadim Mikheev 1999-09-17 06:15:13 Re: [HACKERS] Join syntax
Previous Message Bruce Momjian 1999-09-17 04:45:49 Re: [QUESTIONS] errors on transactions and locks ?