Re: swap relations to be able to execute a left join - Mailing list pgsql-general

From Jaime Casanova
Subject Re: swap relations to be able to execute a left join
Date
Msg-id c2d9e70e0512090936m2dfabcafscbd5b1d18b3a8752@mail.gmail.com
Whole thread Raw
In response to swap relations to be able to execute a left join  (David Rio Deiros <driodeiros@gmail.com>)
Responses Re: swap relations to be able to execute a left join
List pgsql-general
On 12/9/05, David Rio Deiros <driodeiros@gmail.com> wrote:
> Hi there,
>
> The other day, a coworker who loves mysql was complaining to me because
> he had a hard time to find out why this query didn't work on PostgreSQL:
>
[..select..]
>    FROM
>        Artifact_Revisions AR,
>        Revisions_to_Types RTT,
>        Artifact_Types AT
>    LEFT JOIN
>        Users U
>        on (U.user_id = AR.principal_user_id)
[..where..]
>
> Apparently, once he swapped the 1st (AR) and the 3rd (AT) relation in
> the FROM, the query worked.
>
[..snip..]
>
> 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...

This is just a bug in MySQL and i see no way to say it's a feature...

--
Atentamente,
Jaime Casanova
(DBA: DataBase Aniquilator ;)

pgsql-general by date:

Previous
From: William
Date:
Subject: Re: PgSQL 8.1.0 Solaris w/ Sun's cc
Next
From: Tom Lane
Date:
Subject: Re: swap relations to be able to execute a left join