Join syntax - Mailing list pgsql-hackers

From Thomas Lockhart
Subject Join syntax
Date
Msg-id 37E05E18.F827BA41@alumni.caltech.edu
Whole thread Raw
Responses Re: [HACKERS] Join syntax
List pgsql-hackers
I've been playing with selects using explicit join syntax, and have
some initial results for inner joins (haven't done anything more about
outer joins yet; inner joins are tough enough for now).

It's a real pita to flatten the join expressions into the traditional
Postgres query tree. It would be nice to start thinking about how to
represent general subqueries or intermediate queries in the parse
tree.

Anyway, some examples below...
                       - Thomas

postgres=> select * from t1;
i| j
-+--
1|10
2|20
3|30
(3 rows)

postgres=> select * from t2;
i|  x
-+---
1|100
3|300
(2 rows)

postgres=> select * from t1 natural join t2;
i| j|  x
-+--+---
1|10|100
3|30|300
(2 rows)

postgres=> select * from t1 join t2 using (i);
i| j|  x
-+--+---
1|10|100
3|30|300
(2 rows)

postgres=> select * from t1 join t2 on (t1.i = t2.i);
i| j|i|  x
-+--+-+---
1|10|1|100
3|30|3|300
(2 rows)

postgres=> select * from t1 natural join t2 natural join t1;
pqReadData() -- backend closed the channel unexpectedly.       This probably means the backend terminated abnormally
  before or while processing the request.
 
We have lost the connection to the backend, so further processing is
impossible.  Terminating.

Oh well. Was on a roll 'til then ;)

-- 
Thomas Lockhart                lockhart@alumni.caltech.edu
South Pasadena, California


pgsql-hackers by date:

Previous
From: The Hermit Hacker
Date:
Subject: patches -- sucker for punishment?
Next
From: Leon
Date:
Subject: Re: [HACKERS] patches