From: | John Lumby <johnlumby(at)hotmail(dot)com> |
---|---|
To: | "pgsql-docs(at)lists(dot)postgresql(dot)org" <pgsql-docs(at)lists(dot)postgresql(dot)org> |
Subject: | description of Aggregate Expressions |
Date: | 2019-12-05 22:18:42 |
Message-ID: | DM6PR06MB55622DFEE2755236B8A810A0A35C0@DM6PR06MB5562.namprd06.prod.outlook.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin pgsql-docs |
In PostgreSQL 12.1 Documentation chapter 4.2.7. Aggregate Expressions it says
The syntax of an aggregate expression is one of the following:
...
aggregate_name (DISTINCT expression [ , ... ] [ order_by_clause ] ) [ FILTER ( WHERE filter_clause ) ]
...
I believe this is incorrect in the case where the DISTINCT is on a comma-separated list of expressions.
It would imply that this is legal
select count(DISTINCT parent_id , name) from mytable
but that is rejected with
ERROR: function count(bigint, text) does not exist
whereas
select count(DISTINCT ( parent_id , name) ) from mytable
is accepted.
So I think to handle all cases the line in the doc should read
aggregate_name (DISTINCT ( expression [ , ... ] ) [ order_by_clause ] ) [ FILTER ( WHERE filter_clause ) ]
I don't know how to indicate that those extra parentheses can be omitted if the list has only one expression.
Cheers, John Lumby
From | Date | Subject | |
---|---|---|---|
Next Message | David G. Johnston | 2019-12-05 23:06:12 | Re: description of Aggregate Expressions |
Previous Message | soumik.bhattacharjee | 2019-12-05 16:28:03 | RE: Postgres and Java Microservices Multithreading |
From | Date | Subject | |
---|---|---|---|
Next Message | David G. Johnston | 2019-12-05 23:06:12 | Re: description of Aggregate Expressions |
Previous Message | PG Doc comments form | 2019-12-05 20:43:33 | Description of Authentication Methods Supported for Map is Misleading |