Re: SQL feature requests

From: "Florian G(dot) Pflug" <fgp(at)phlo(dot)org>
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 02:31:47
Message-ID: 46CCF193.7000701@phlo.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Ben Tilly wrote:
> On 8/22/07, Gregory Stark <stark(at)enterprisedb(dot)com> wrote:
>> "Ben Tilly" <btilly(at)gmail(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Glaesemann 2007-08-23 03:51:07 Re: SQL feature requests
Previous Message Ben Tilly 2007-08-23 01:49:50 Re: SQL feature requests