Re: [HACKERS] SELECT ... AS ... names in WHERE/GROUP BY/HAVING - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: [HACKERS] SELECT ... AS ... names in WHERE/GROUP BY/HAVING
Date
Msg-id Pine.LNX.4.21.9912162008200.5199-100000@localhost.localdomain
Whole thread Raw
In response to SELECT ... AS ... names in WHERE/GROUP BY/HAVING  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On 1999-12-15, Tom Lane mentioned:

> Next question is, do we want to leave the code as-is, or tighten up
> the parser to reject AS-names and column numbers in GROUP BY?
> It seems to me we should change it, because there are cases where the
> existing code will do the wrong thing according to the SQL spec.
> If "foo" is a column name and also an AS-name for something else,
> "GROUP BY foo" should group on the raw column according to the spec,
> but right now we will pick the SELECT result value instead.

The AS-names are way too convenient to drop them. In the particular
example of ambiguity you could send a notice or a reject it. (What does
ORDER BY foo do in this case? Same problem.)

Perhaps it's really time for the --enable-sql option. :)

-- 
Peter Eisentraut                  Sernanders väg 10:115
peter_e@gmx.net                   75262 Uppsala
http://yi.org/peter-e/            Sweden




pgsql-hackers by date:

Previous
From: Lamar Owen
Date:
Subject: Re: [HACKERS] ordering RH6.1
Next
From: Peter Eisentraut
Date:
Subject: Re: [HACKERS] Re: [PATCHES] createdb/dropdb fixes