Join syntax

From: Thomas Lockhart <lockhart(at)alumni(dot)caltech(dot)edu>
To: Postgres Hackers List <hackers(at)postgresql(dot)org>
Subject: Join syntax
Date: 1999-09-16 03:03:53
Message-ID: 37E05E18.F827BA41@alumni.caltech.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)alumni(dot)caltech(dot)edu
South Pasadena, California

Browse pgsql-hackers by date

  From Date Subject
Next Message Leon 1999-09-16 07:32:20 Re: [HACKERS] patches
Previous Message The Hermit Hacker 1999-09-16 00:40:09 patches -- sucker for punishment?