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?