Join syntax

Поиск
Список
Период
Сортировка
От Thomas Lockhart
Тема Join syntax
Дата
Msg-id 37E05E18.F827BA41@alumni.caltech.edu
обсуждение исходный текст
Ответы Re: [HACKERS] Join syntax  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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 по дате отправления:

Предыдущее
От: The Hermit Hacker
Дата:
Сообщение: patches -- sucker for punishment?
Следующее
От: Leon
Дата:
Сообщение: Re: [HACKERS] patches