> > If your implementation accepts:
> >
> >   group by case when true then 'foo' end

I think he meant: 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"

Yea, but only because 'foo' is an identifier, and not a string constant.

> 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

I think your example would be easier to understand if you removed the
quotes.
We don't detect the correctness of the above query. You can hardly say
that
this is a feature, but I am not inclined to see it as a troublesome bug
eighter.

Andreas

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
       choose an index scan if your joining column's datatypes do not
       match

Reply via email to