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

Поиск
Список
Период
Сортировка
От Jaime Casanova
Тема Re: swap relations to be able to execute a left join
Дата
Msg-id c2d9e70e0512090936m2dfabcafscbd5b1d18b3a8752@mail.gmail.com
обсуждение исходный текст
Ответ на swap relations to be able to execute a left join  (David Rio Deiros <driodeiros@gmail.com>)
Ответы Re: swap relations to be able to execute a left join  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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 по дате отправления:

Предыдущее
От: William
Дата:
Сообщение: Re: PgSQL 8.1.0 Solaris w/ Sun's cc
Следующее
От: Tom Lane
Дата:
Сообщение: Re: swap relations to be able to execute a left join