Re: [HACKERS] Parser bug: alias is a "non-group column"?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] Parser bug: alias is a "non-group column"?
Date: 1999-05-10 16:38:51
Message-ID: 7640.926354331@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us> writes:
> Where did we leave this?

It's still broken. I have the following notes in my todo list:

Inconsistent handling of attribute renaming:
create table t1 (name text, value float8);
select name as n1 from t1 where n1 = 'one' ;
ERROR: attribute 'n1' not found
but
SELECT name AS tempname, value FROM t1 GROUP BY name, value ;
SELECT name AS tempname, value FROM t1 GROUP BY tempname, value ;
both work. Even stranger,
SELECT name AS tempname, value FROM t1 GROUP BY name, value
HAVING value/AVG(value) > 0.75;
ERROR: Illegal use of aggregates or non-group column in target list
(it thinks tempname is not in the GROUP BY list) but
SELECT name AS tempname, value FROM t1 GROUP BY tempname, value
HAVING value/AVG(value) > 0.75;
works! (6.4.2 has same behavior for all cases...)

Looks like the parser has some problems in the presence of column
renaming. Since 6.4.2 has the same bug I doubt this qualifies as a
showstopper for 6.5; I have other todo items that I consider higher
priority. If someone else wants to dig into this, be my guest...

regards, tom lane

Browse pgsql-hackers by date

  From Date Subject
Next Message Ulf Mehlig 1999-05-10 16:38:57 Re: [GENERAL] cluster truncates table name?
Previous Message Bruce Momjian 1999-05-10 16:37:04 Re: [HACKERS] numeric & decimal