Re: description of Aggregate Expressions

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: John Lumby <johnlumby(at)hotmail(dot)com>, "pgsql-docs(at)lists(dot)postgresql(dot)org" <pgsql-docs(at)lists(dot)postgresql(dot)org>
Subject: Re: description of Aggregate Expressions
Date: 2019-12-05 23:29:34
Message-ID: 25458.1575588574@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-docs

"David G. Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> writes:
> On Thu, Dec 5, 2019 at 3:18 PM John Lumby <johnlumby(at)hotmail(dot)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

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Martin Goodson 2019-12-06 13:25:24 SSL - automatic entry of certificate passphrase in PostgreSQL 10?
Previous Message David G. Johnston 2019-12-05 23:06:12 Re: description of Aggregate Expressions

Browse pgsql-docs by date

  From Date Subject
Next Message Michael Paquier 2019-12-06 03:04:45 Re: monitoring-stats.html is too impenetrable
Previous Message David G. Johnston 2019-12-05 23:06:12 Re: description of Aggregate Expressions