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

From: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(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 05:03:22
Message-ID: 199905100503.BAA24000@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Where did we leave this?

> Given
> create table t1 (name text, value float8);
>
> this works:
> SELECT name, value FROM t1 GROUP BY name, value
> HAVING value/AVG(value) > 0.75;
>
> but this doesn't:
> 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
>
> Curiously, it's fine if the HAVING clause is omitted ... since name is
> not mentioned in the HAVING clause, I don't see the connection ...
>
> 6.4.2 and current sources show the same behavior.
>
> regards, tom lane
>
>

--
Bruce Momjian | http://www.op.net/~candle
maillist(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 1999-05-10 05:05:48 Re: [HACKERS] "op must return bool to be used with subquery"?
Previous Message Bruce Momjian 1999-05-10 05:00:45 Re: [HACKERS] ecpg fixes