RE: prefer (+) oracle notation - Mailing list pgsql-general

From Edmar Wiggers
Subject RE: prefer (+) oracle notation
Date
Msg-id NEBBIAKDCDHFGJMLHCKIEEHHCAAA.edmar@brasmap.com
Whole thread Raw
In response to Re: prefer (+) oracle notation  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: prefer (+) oracle notation
List 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 by date:

Previous
From: Philip Hallstrom
Date:
Subject: Re: Any risk in increasing BLCKSZ to get larger tuples?
Next
From: Bruce Momjian
Date:
Subject: Re: prefer (+) oracle notation