From: | Michael Glaesemann <grzm(at)seespotcode(dot)net> |
---|---|
To: | "Ben Tilly" <btilly(at)gmail(dot)com> |
Cc: | "Gregory Stark" <stark(at)enterprisedb(dot)com>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: SQL feature requests |
Date: | 2007-08-23 04:28:23 |
Message-ID: | F71C5143-6221-4355-8A10-4C921AB4E84E@seespotcode.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
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
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2007-08-23 04:37:00 | Re: [COMMITTERS] pgsql: Add configure option --with-system-tzdata to use operating system |
Previous Message | Michael Glaesemann | 2007-08-23 03:51:07 | Re: SQL feature requests |