pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: David G. Johnston <david.g.johnston@gmail.com>
Cc: John Lumby <johnlumby@hotmail.com>
Cc: pgsql-docs@lists.postgresql.org <pgsql-docs@lists.postgresql.org>
Subject: Re: description of Aggregate Expressions
Date: Thu, 05 Dec 2019 18:29:34 -0500
Message-ID: <25458.1575588574@sss.pgh.pa.us> (raw)
In-Reply-To: <CAKFQuwZk3Kt4uNktMgLYj5B1Rzrm1R4EMVZQRka189AhnPkM=Q@mail.gmail.com>
References: <2A91BEF8171A5349931391E0C721CC5375705457@CPEMS-KPN501.KPNCNL.LOCAL>
	<251962385fdc49da0da54e22588aabd6fbc2e0fa.camel@osdev.nl>
	<2A91BEF8171A5349931391E0C721CC53757054D3@CPEMS-KPN501.KPNCNL.LOCAL>
	<2CB4B3C9-F43F-49D8-A594-93DBE99EF514@elevated-dev.com>
	<7308f0f3a1674a39bada8571189a3735@CPEMS-KPN509.KPNCNL.LOCAL>
	<91CEBEAA-7260-4503-832F-E5B27B91BE1F@elevated-dev.com>
	<2A91BEF8171A5349931391E0C721CC5375705528@CPEMS-KPN501.KPNCNL.LOCAL>
	<E813B7F6-B641-4739-A209-F0352A780EF8@elevated-dev.com>
	<2A91BEF8171A5349931391E0C721CC53757055C3@CPEMS-KPN501.KPNCNL.LOCAL>
	<DM6PR06MB55622DFEE2755236B8A810A0A35C0@DM6PR06MB5562.namprd06.prod.outlook.com>
	<CAKFQuwZk3Kt4uNktMgLYj5B1Rzrm1R4EMVZQRka189AhnPkM=Q@mail.gmail.com>

"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





view thread (7+ messages)  latest in thread

Message-ID: <25458.1575588574@sss.pgh.pa.us>
Permalink:  ../25458.1575588574@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/25458.1575588574@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: tgl@sss.pgh.pa.us, david.g.johnston@gmail.com, johnlumby@hotmail.com, pgsql-docs@lists.postgresql.org
  Subject: Re: description of Aggregate Expressions
  In-Reply-To: <25458.1575588574@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox