Re: description of Aggregate Expressions - Mailing list pgsql-docs

From Tom Lane
Subject Re: description of Aggregate Expressions
Date
Msg-id 25458.1575588574@sss.pgh.pa.us
Whole thread Raw
In response to Re: description of Aggregate Expressions  ("David G. Johnston" <david.g.johnston@gmail.com>)
List pgsql-docs
"David G. Johnston" <david.g.johnston@gmail.com> writes:
> On Thu, Dec 5, 2019 at 3:18 PM John Lumby <johnlumby@hotmail.com> 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



pgsql-docs by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: description of Aggregate Expressions
Next
From: Michael Paquier
Date:
Subject: Re: monitoring-stats.html is too impenetrable