Re: [SQL] 7.3 GROUP BY differs from 7.2

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
Cc: Dan Langille <dan(at)langille(dot)org>, pgsql-bugs(at)postgresql(dot)org, pgsql-sql(at)postgresql(dot)org
Subject: Re: [SQL] 7.3 GROUP BY differs from 7.2
Date: 2003-02-22 08:05:32
Message-ID: 12329.1045901132@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-sql

Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com> writes:
> On Fri, 21 Feb 2003, Tom Lane wrote:
>> Anyone care to offer a gloss on the spec to prove that this behavior
>> is correct or not correct?

> Hmm, I'd read SQL92 Section 7.5 (joined tables) Syntax Rules as saying
> that the non natural/using case is separate from the other cases.

> Syntax rule 5 seems to say that A JOIN B ON (...) should have the same
> column descriptors as A,B and it explicitly doesn't cover NATURAL or
> USING (covered by rule 6).

Yeah, but those rules only define the names and types of the JOIN's
output columns. They don't say anything about the visibility of those
names, nor the visibility of the underlying-table column names, nor
particularly about semantic equivalence of the two sets of names.

I spent some time digging around in the verbiage about name scopes,
but didn't find any joy. It does seem clear that if you stick an
alias on the JOIN as a whole, that that hides the individual table
names/aliases, which would render the issue moot. But Dan didn't
do that in his example, so he is allowed to access both the join
columns and the underlying columns. Question is, are they equivalent
for the purposes of the grouped-column-reference rules, or not?

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tatsuo Ishii 2003-02-22 08:52:05 Re: Bug #898: client_encoding can't support GB18030
Previous Message Stephan Szabo 2003-02-22 07:57:48 Re: [SQL] 7.3 GROUP BY differs from 7.2

Browse pgsql-sql by date

  From Date Subject
Next Message Edipo E. F. Melo 2003-02-22 11:01:54 SORT with accents
Previous Message Stephan Szabo 2003-02-22 07:57:48 Re: [SQL] 7.3 GROUP BY differs from 7.2