Aggregate expression syntax

From: Thom Brown <thom(at)linux(dot)com>
To: pgsql-docs <pgsql-docs(at)postgresql(dot)org>
Subject: Aggregate expression syntax
Date: 2015-01-20 13:50:22
Message-ID: CAA-aLv7A9uqH=U=Czp5UBbukJW6_ip7NDZsAMf6-F72s6Ls+LA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

Hi all,

Looking at the syntax for aggregate expressions in the docs, it seems the
first three forms could perhaps be merged since the ALL and DISTINCT
keywords are effectively optional.

Currently:

aggregate_name (expression [ , ... ] [ order_by_clause ] ) [ FILTER ( WHERE
filter_clause ) ]
aggregate_name (ALL expression [ , ... ] [ order_by_clause ] ) [ FILTER (
WHERE filter_clause ) ]
aggregate_name (DISTINCT expression [ , ... ] [ order_by_clause ] ) [
FILTER ( WHERE filter_clause ) ]

Proposed:

aggregate_name ( [ ALL | DISTINCT ] expression [ , ... ] [ order_by_clause
] ) [ FILTER ( WHERE filter_clause ) ]

I've also found a precedent for this on the SELECT statement page:

[ { UNION | INTERSECT | EXCEPT } [ ALL | DISTINCT ] select ]

Patch attached with the proposed change.

Opinions?

Thom

Attachment Content-Type Size
agg_exp_docs.patch text/x-patch 2.5 KB

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message Tom Lane 2015-01-20 14:48:41 Re: Aggregate expression syntax
Previous Message Marko Tiikkaja 2015-01-19 17:10:59 Re: PL/PgSQL: stmt_fors and variable value after loop