Re: swap relations to be able to execute a left join

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jaime Casanova <systemguards(at)gmail(dot)com>
Cc: David Rio Deiros <driodeiros(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org, is04607(at)salleurl(dot)edu
Subject: Re: swap relations to be able to execute a left join
Date: 2005-12-09 17:47:19
Message-ID: 29660.1134150439@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Jaime Casanova <systemguards(at)gmail(dot)com> writes:
> On 12/9/05, David Rio Deiros <driodeiros(at)gmail(dot)com> wrote:
>> I am sure there is a good reason why you have to swap the relations
>> in PostgreSQL. Anyone?

> Because PostgreSQL is not broken...

> What i see in this SELECT is an LEFT JOIN between AT and U (note that
> the other relations in the FROM are separated by commas so they have
> nothing to do with LEFT JOIN) and is using a JOIN clause from a
> relation that has nothing to do with the LEFT JOIN...

Right. MySQL apparently thinks that JOIN has the same precedence as
comma in a FROM-list, but anyone who has bothered to read the SQL
standard knows that JOIN is supposed to bind tighter than comma.
Your coworker is depending on a flat-out-incorrect behavior of MySQL.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Michael Fuhr 2005-12-09 18:58:05 Re: swap relations to be able to execute a left join
Previous Message Jaime Casanova 2005-12-09 17:36:21 Re: swap relations to be able to execute a left join