Re: SQL feature requests
От | Florian G. Pflug |
---|---|
Тема | Re: SQL feature requests |
Дата | |
Msg-id | 46CCF193.7000701@phlo.org обсуждение исходный текст |
Ответ на | Re: SQL feature requests ("Ben Tilly" <btilly@gmail.com>) |
Ответы |
Re: SQL feature requests
|
Список | pgsql-hackers |
Ben Tilly wrote: > On 8/22/07, Gregory Stark <stark@enterprisedb.com> wrote: >> "Ben Tilly" <btilly@gmail.com> writes: >>> 2. Why is 'non-integer constant in GROUP BY' an error? >> Hm... I was a bit surprised by this warning myself. IIRC there was an >> implementation convenience issue. > > If your implementation accepts: > > group by case when true then 'foo' end > > how much harder can it be to accept: > > group by 'foo' This is not about hardness of the implementation, but rather about non-confusing behaviour I think. AFAIK, "group by 1" means "group by the first selected column", not "group all rows together". But "group by 'foo'" would carry the second meaning - "group all rows together". This is so totally counter-intuitive, that it's not even funny... "group by case when true then 'foo' end" looks different enough compared to "group by 1" to make this less of a footgun. Seems that the "group by <integer>" syntax predates the appearance of aliases in the sql standard... greetings, Florian flug
В списке pgsql-hackers по дате отправления: