Re: [HACKERS] SELECT ... AS ... names in WHERE/GROUP BY/HAVING

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: [HACKERS] SELECT ... AS ... names in WHERE/GROUP BY/HAVING
Date: 1999-12-17 00:31:39
Message-ID: Pine.LNX.4.21.9912162008200.5199-100000@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)gmx(dot)net 75262 Uppsala
http://yi.org/peter-e/ Sweden

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 1999-12-17 00:32:13 Re: [HACKERS] initdb / pg_version
Previous Message Peter Eisentraut 1999-12-17 00:31:23 Re: [HACKERS] Re: [PATCHES] createdb/dropdb fixes