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

From David Rio Deiros
Subject swap relations to be able to execute a left join
Date
Msg-id 20051209171615.GA30790@milhouse.digitaria.com
Whole thread Raw
Responses Re: swap relations to be able to execute a left join
Re: swap relations to be able to execute a left join
List pgsql-general
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
        AR.artifact_id,
        AT.type_nm,
        AR.title,
        U.dept,
    FROM
        Artifact_Revisions AR,
        Revisions_to_Types RTT,
        Artifact_Types AT
    LEFT JOIN
        Users U
        on (U.user_id = AR.principal_user_id)
    WHERE
        AR.revision_id = RTT.revision_id
        AND RTT.type_id = AT.type_id
        AND AR.revision_id = 28403;

Apparently, once he swapped the 1st (AR) and the 3rd (AT) relation in
the FROM, the query worked.

He took the opportunity to tell how much he doesn't like PostgreSQL and
how much he loves mysql. Apparently, he told me (I didn't confirm it)
in mysql you wouldn't need to swap the order of the relations
to execute the query.

I am sure there is a good reason why you have to swap the relations
in PostgreSQL. Anyone?

Thanks,

David


pgsql-general by date:

Previous
From: William
Date:
Subject: Solaris 10 Sun Studio 11 compile error configtest
Next
From: Tom Lane
Date:
Subject: Re: Solaris 10 Sun Studio 11 compile error configtest