Re: SQL feature requests - Mailing list pgsql-hackers

From Florian G. Pflug
Subject Re: SQL feature requests
Date
Msg-id 46CCF193.7000701@phlo.org
Whole thread Raw
In response to Re: SQL feature requests  ("Ben Tilly" <btilly@gmail.com>)
Responses Re: SQL feature requests  ("Zeugswetter Andreas ADI SD" <Andreas.Zeugswetter@s-itsolutions.at>)
List 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 by date:

Previous
From: "Ben Tilly"
Date:
Subject: Re: SQL feature requests
Next
From: Michael Glaesemann
Date:
Subject: Re: SQL feature requests