On Aug 22, 2007, at 20:49 , Ben Tilly wrote:
> If your implementation accepts:
>
> group by case when true then 'foo' end
What would that mean? Regardless of whether or not it's accepted, it
should have *some* meaning.
It's not equivalent to GROUP BY "foo"
test=# select record_id as foo , count(observation_id) as bar from observation group by case when true
then 'foo' end;
ERROR: column "observation.record_id" must appear in the GROUP BY
clause or be used in an aggregate function
test=# select record_id , count(observation_id) as bar from observation group by case when true
then 'record_id' end;
ERROR: column "observation.record_id" must appear in the GROUP BY
clause or be used in an aggregate function
*This* seems like a bug:
test=# select record_id , count(observation_id) as bar from observation group by record_id
,case when true then 'foo' end;
record_id | bar
-----------+----- 1 | 4 2 | 4 3 | 2
(3 rows)
And for good measure:
test=# select record_id , count(observation_id) as bar from observation group by case when true
then record_id end;
ERROR: column "observation.record_id" must appear in the GROUP BY
clause or be used in an aggregate function
Michael Glaesemann
grzm seespotcode net