Re: left outer join fails because "column .. does not exist in left table?" - Mailing list pgsql-general

From Scott Marlowe
Subject Re: left outer join fails because "column .. does not exist in left table?"
Date
Msg-id AANLkTikB8i29Vwf1WTduHdkO1C5KfUfYhqMp5gPuJZgn@mail.gmail.com
Whole thread Raw
In response to Re: left outer join fails because "column .. does not exist in left table?"  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
On Wed, Jun 30, 2010 at 8:05 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Rick.Casey@colorado.edu writes:
>> SELECT S.subjectid,STY.studyabrv,labID,boxnumber,wellrow,wellcolumn
>> FROM DNASample D, IBG_Studies STY, Subjects S, ibg_projects P
>>   LEFT OUTER JOIN ibg_ps_join IPJ USING (dnasampleid)
>> WHERE
>>       D.subjectidkey=S.id
>>       AND STY.studyindex=D.studyindex
>>       AND IPJ.projects_index=P.ibg_projects_index
>> ORDER BY studyabrv,boxnumber,wellcolumn,wellrow
>> ERROR:  column "dnasampleid" specified in USING clause does not exist in
>> left table
>
>> I am rather mystified by this, since this field is definitely in the
>> dnasample table, as the primary key.
>
> It appears you're used to mysql, which processes commas and JOINs
> left-to-right (more or less, I've never bothered to figure out their
> behavior exactly).

Note that even MySQL now follows the standard on this, without needing
some special strict switch or anything.  Of course, a lot of folks are
still using older versions that are in fact still broken.

pgsql-general by date:

Previous
From: Phil Jackson
Date:
Subject: Re: Cannot open table in new database
Next
From: Tim Landscheidt
Date:
Subject: Re: loading many queries from a file