Re: SQL feature requests - Mailing list pgsql-hackers

From Florian G. Pflug
Subject Re: SQL feature requests
Date
Msg-id 46CDCC07.7060402@phlo.org
Whole thread Raw
In response to Re: SQL feature requests  ("Ben Tilly" <btilly@gmail.com>)
Responses Re: SQL feature requests  ("Ben Tilly" <btilly@gmail.com>)
Re: SQL feature requests  ("Chuck McDevitt" <cmcdevitt@greenplum.com>)
List pgsql-hackers
Ben Tilly wrote:
> On 8/22/07, Michael Glaesemann <grzm@seespotcode.net> wrote:
>> 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.
> 
> To my eyes it has a very clear meaning, we're grouping on an
> expression that happens to be a constant.  Which happens to be the
> same for all rows.  Which is a spectacularly useless thing to actually
> do, but the ability to do it happens to be convenient when I'm looking
> for something to terminate a series of commas in a dynamically built
> query.

Which is the same very clear meaning that "group by 1" has - we're
grouping on a expression which happens to be the constant 1. Hey,
wait a second. This isn't what "group by 1" means at all - it
rather means group by whatever the fist column in the select list is.

So, yes, "group by 'foo'" *seems* to have a very clear meaning - but
that clearness vanishes as soon as you take into account what "group by 1"
means.

greetings, Florian Pflug


pgsql-hackers by date:

Previous
From: "Ben Tilly"
Date:
Subject: Re: SQL feature requests
Next
From: Josh Berkus
Date:
Subject: Re: SQL feature requests