Re: description of Aggregate Expressions

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>
Cc: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: description of Aggregate Expressions
Date: 2019-12-06 21:43:59
Message-ID: DM6PR06MB55625AB1CB94FD039E1EEB0BA35F0@DM6PR06MB5562.namprd06.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-docs

John Lumby wrote:
<
< Tom Lane wrote
<
< > > How about replacing "expression [ , ... ]" by "parameter_list" in the description,
< > > and then stating that parameter_list can be either a single expression or ,
< > > if the particular aggregate function accepts it (for which, consult that function's reference),
< > > a comma-separated list of expressions.
< >
< > That's just as wrong. As we tried to explain before, the
< > parenthesized-list syntax is a row constructor, so it only works
< > in cases where the aggregate function can accept a composite
< > argument type. Most don't.
< >
<
< But surely not *all* cases of a multi-expression parameter list of an aggregate function are row constructors are they? What about
<
< select parent_id, name, GROUPING(parent_id , name), count(*) FROM mytable GROUP BY ROLLUP(parent_id , name);
<
< In the piece "GROUPING(parent_id , name)" ,
< is "(parent_id , name)" a row constructor or a list of two expressions?
<
< Or are you saying those are one and the same thing?
<

I think I can answer my own question - No they are not the same - because :

select parent_id, name, GROUPING(ROW(parent_id , name)), count(*) FROM mytable GROUP BY ROLLUP(parent_id , name);
ERROR: arguments to GROUPING must be grouping expressions of the associated query level
LINE 1: select parent_id, name, GROUPING(ROW(parent_id , name)), cou...
^

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Vasanth Kumar Pediseti 2019-12-06 21:45:06 Re: SSL - automatic entry of certificate passphrase in PostgreSQL 10?
Previous Message John Lumby 2019-12-06 20:01:14 Re: description of Aggregate Expressions

Browse pgsql-docs by date

  From Date Subject
Next Message Tatsuo Ishii 2019-12-07 11:05:00 Typo in perform.sgml?
Previous Message John Lumby 2019-12-06 20:01:14 Re: description of Aggregate Expressions