Re: Table name scope (was Re: Outer joins aren't working with views)
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Thomas Lockhart <lockhart@alumni.caltech.edu>
Cc: pgsql-bugs@postgresql.org, pgsql-hackers@postgresql.org
Date: 2000-12-17T18:34:42Z
Lists: pgsql-bugs, pgsql-hackers
I said: > The <select sublist> is equivalent to a <value expression> > sequence in which each <value expression> is a column > reference CR that references a column of TQ that is not > a common column of a <joined table>. > which is essentially taken from 7.9.4 of the old spec. This is a mess; In fact, after looking at it again, I realize that the quoted text is *wrong*, because it does not say what they presumably intended. As written, it appears that SELECT J.* FROM (A NATURAL JOIN B) J should omit the common column(s). They're common columns of a <joined table>, aren't they? A lawyer would probably point out that 7.7 does not define the phrase "common column". It defines "common column name". Common column name clearly applies to all three tables involved (both input tables and the output table), but it's not so clear whether "common column" is intended to do so. One could also wonder about the intended behavior of multi-level joins. Does a column of a base table become inaccessible if it is used as a common column several JOIN levels up? At best, this part of the spec is extremely poorly written. regards, tom lane