Shouldn't this be invalid? - Mailing list pgsql-hackers

From Tom Lane
Subject Shouldn't this be invalid?
Date
Msg-id 12529.925603767@sss.pgh.pa.us
Whole thread Raw
List pgsql-hackers
I notice that both 6.4.2 and 6.5-current make no complaint if I do

create table t1 (a int4, b int4);

select a+1,b from t1 group by b;

Shouldn't this draw "Illegal use of aggregates or non-group column in
target list"?  It does if there's an aggregate nearby:

select sum(a),a+1,b from t1 group by b;
ERROR:  Illegal use of aggregates or non-group column in target list
select sum(a),b from t1 group by b;
[ no problem ]

I think the system is simply failing to apply the check in the case
where there's a GROUP BY but no aggregate functions.  Comments?
        regards, tom lane


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [HACKERS] views and group by (formerly: create view as selec
Next
From: Bruce Momjian
Date:
Subject: query dumping core