Re: FILTER for aggregates [was Re: Department of Redundancy Department: makeNode(FuncCall) division] - Mailing list pgsql-hackers

From Tom Lane
Subject Re: FILTER for aggregates [was Re: Department of Redundancy Department: makeNode(FuncCall) division]
Date
Msg-id 8783.1372167730@sss.pgh.pa.us
Whole thread Raw
In response to Re: FILTER for aggregates [was Re: Department of Redundancy Department: makeNode(FuncCall) division]  (Dean Rasheed <dean.a.rasheed@gmail.com>)
Responses Re: FILTER for aggregates [was Re: Department of Redundancy Department: makeNode(FuncCall) division]  (Pavel Stehule <pavel.stehule@gmail.com>)
List pgsql-hackers
Dean Rasheed <dean.a.rasheed@gmail.com> writes:
> On 24 June 2013 03:50, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Going on the same principle, we could probably let FILTER be an
>> unreserved keyword while FILTER_FOLLOWED_BY_PAREN could be a
>> type_func_name_keyword.  (I've not tried this though.)

> I've not tried either, but wouldn't that mean that "SELECT * FROM
> list_filters() filter" would be legal, whereas "SELECT * FROM
> list_filters() filter(id, val)" would be a syntax error? If so, I
> don't think that would be an improvement.

Hm, good point.  The SQL committee really managed to choose some
unfortunate syntax here, didn't they.

I know it's heresy in these parts, but maybe we should consider
adopting a non-spec syntax for this feature?  In particular, it's
really un-obvious why the FILTER clause shouldn't be inside rather
than outside the aggregate's parens, like ORDER BY.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: PostgreSQL 9.3 latest dev snapshot
Next
From: Pavel Stehule
Date:
Subject: Re: FILTER for aggregates [was Re: Department of Redundancy Department: makeNode(FuncCall) division]