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

From: Jaime Casanova <systemguards(at)gmail(dot)com>
To: David Rio Deiros <driodeiros(at)gmail(dot)com>
Cc: 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:36:21
Message-ID: c2d9e70e0512090936m2dfabcafscbd5b1d18b3a8752@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 12/9/05, David Rio Deiros <driodeiros(at)gmail(dot)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 ;)

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2005-12-09 17:47:19 Re: swap relations to be able to execute a left join
Previous Message William 2005-12-09 17:28:07 Re: PgSQL 8.1.0 Solaris w/ Sun's cc