Re: SQL feature requests

Поиск
Список
Период
Сортировка
От Michael Glaesemann
Тема Re: SQL feature requests
Дата
Msg-id F71C5143-6221-4355-8A10-4C921AB4E84E@seespotcode.net
обсуждение исходный текст
Ответ на Re: SQL feature requests  ("Ben Tilly" <btilly@gmail.com>)
Ответы Re: SQL feature requests
Re: SQL feature requests
Список 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




В списке pgsql-hackers по дате отправления:

Предыдущее
От: Michael Glaesemann
Дата:
Сообщение: Re: SQL feature requests
Следующее
От: Tom Lane
Дата:
Сообщение: Re: [COMMITTERS] pgsql: Add configure option --with-system-tzdata to use operating system