RE: prefer (+) oracle notation

Поиск
Список
Период
Сортировка
От Edmar Wiggers
Тема RE: prefer (+) oracle notation
Дата
Msg-id NEBBIAKDCDHFGJMLHCKIEEHHCAAA.edmar@brasmap.com
обсуждение исходный текст
Ответ на Re: prefer (+) oracle notation  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: prefer (+) oracle notation  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
Sorry, maybe I confused you.

The Oracle way:
I failed to mention that (+) are specific to outer joins.
There is no way to express a join in the from clause.
Everything goes on the where clause: joins and "filter conditions".
In the where clause, it is common practice to express to specify first
your joins and after your filters.

Example:

select a.id,a.size,b.*,c.id,c.color
from table_a a, table_b b, table_c c
where
 a.b_id = b.id and
 a.c_id = c.id(+) and
 a.size < 1000 and
 b.weight > 10;

This is a select from 3 tables, where a and b are regularly joined, but c is
outer joined. That is, the query is likely to return null values on c.id and
c.color.

When you are joining 8 tables, that syntax becomes clearer.

I believe the standard syntax for that might be:

select a.id,a.size,b.*,c.id,c.color
from ((table_a a join table_b b on a.b_id = b.id) outer join table_c c on
a.c_id = b.id)
where
 a.size < 1000 and
 b.weight > 10;

To me, not so readable. But of course I can live with that.


В списке pgsql-general по дате отправления:

Предыдущее
От: Philip Hallstrom
Дата:
Сообщение: Re: Any risk in increasing BLCKSZ to get larger tuples?
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: prefer (+) oracle notation