Re: description of Aggregate Expressions
Tom Lane <[email protected]> Thu, 05 Dec 2019 18:29:34 -0500
| Newsgroups | gmane.comp.db.postgresql.devel.documentation |
|---|---|
| Message-ID | <[email protected]> |
"David G. Johnston" <[email protected]> writes: > On Thu, Dec 5, 2019 at 3:18 PM John Lumby <[email protected]> wrote: >> whereas >> select count(DISTINCT ( parent_id , name) ) from mytable >> is accepted. > Correct, converting the two individual columns into a "tuple" allows the > default tuple distinct-making infrastructure to be used to execute the > query. Yeah. This might be more intelligible if it were written select count(DISTINCT ROW(parent_id, name) ) from mytable However, the SQL committee in their finite wisdom have decreed that the ROW keyword is optional. (As long as there's more than one column expression; the need for that special case is another reason why omitting ROW isn't really a nice thing to do.) regards, tom lane