Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1idLOS-00023G-7n for pgsql-docs@arkaria.postgresql.org; Fri, 06 Dec 2019 21:44:08 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1idLOQ-0003p0-Pz for pgsql-docs@arkaria.postgresql.org; Fri, 06 Dec 2019 21:44:06 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1idLOQ-0003oT-IB for pgsql-docs@lists.postgresql.org; Fri, 06 Dec 2019 21:44:06 +0000 Received: from mail-oln040092009084.outbound.protection.outlook.com ([40.92.9.84] helo=NAM04-BN3-obe.outbound.protection.outlook.com) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1idLOO-0004ks-8S for pgsql-docs@lists.postgresql.org; Fri, 06 Dec 2019 21:44:06 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=E7b/N2Qc1tSCNQN0bfKyh42M/I6r0erUBRMvBkcGUgZU7Mo16V4ikcvzEQpXNxSecrGAoKwD9VVivzG34EM3zsnEoA8nSdaL6h2p7bLIMCyV9hROQHcWBX13whxZtYivChzut/NAGy+9Pow4sQf18QqIRTOw6RwdQrYRn57czBKO4Zo0yBSse+hQ2gUhYd+zDZSeIJLBVp+I8g/myX317+5y4ACNUdPNYmx9MTjAnDsomdHFP7vFnUQH1GciC2PCIgod1RRY16WXw8Zaak/yjnfiwS6Dpd3h/zs0+xyj6su0GTlg96+t0uFmDpIuKyY+ejj4fFQ574KE2erLS1AZNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=k5W99jDBYFvwrtMeOpIwamtjJyLn/HbVyt4jchR6PwQ=; b=Vr920x23s/VCofnR69yqyzDHnasaY5+RErq/fvQj3H49EzC7pVxdm7U5j9u7jw1zogqyCPKhLk5QADpW1hhyOX81NhVWbrT/QEca3DoU/uPRDJ3RGgs2eUpZUDdUY+6O362T1R2IZn/3ZUXrxX9wj9C5/7JFYheZbzZPXJZHN5fLo4oXfynIIxVENh4Fm3JlPowuXv6kz0d18mnsWRYkVaYwtl2evGVzK5kKKeETEGuZclPO0z5/PdDlURbM7HrV6ZIFEe+aHgDOKoYfnyUv17REcPDrEnREXrBou8QHj4ykZvSQ0NZ6bPhxZih9ox9ZZP7/pncvSTcwaKtNkY0Eww== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hotmail.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=k5W99jDBYFvwrtMeOpIwamtjJyLn/HbVyt4jchR6PwQ=; b=R2TK+0UyGZl02Ncy8gFTPD2bYU8lEKpl+tzvelThHif/VIBbvspPc8SbqLN1A5xGgnYAKsFSULgrjEwX0UUB++2Jkl9aojg6taa4iPOLTj6K0PLr5MDZRSWLf/CSUtNz5Ux3tw7qvu6UcW4aOsiIAYZ/KCffkB6hsQ/5jJkZGazhz4UIfaRoswtZw0wEnFHb/hpwzxuiw2ZXUJihRmrAJ3Fu7T4c0tmfUurnvGPUTcIaenbAuuVhH2XTSS5KzgJ8PiD+GRDckkuQojLpA8s7af+cUw/uB/NlKRS1xRPBw7p1asnir6C129KLOcXWAbv5ozYoFAW7wHd1jChBE9zoWA== Received: from BN3NAM04FT039.eop-NAM04.prod.protection.outlook.com (10.152.92.51) by BN3NAM04HT056.eop-NAM04.prod.protection.outlook.com (10.152.93.186) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2495.18; Fri, 6 Dec 2019 21:44:00 +0000 Received: from DM6PR06MB5562.namprd06.prod.outlook.com (10.152.92.56) by BN3NAM04FT039.mail.protection.outlook.com (10.152.93.3) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2495.18 via Frontend Transport; Fri, 6 Dec 2019 21:44:00 +0000 Received: from DM6PR06MB5562.namprd06.prod.outlook.com ([fe80::8535:8b16:da9b:d2b7]) by DM6PR06MB5562.namprd06.prod.outlook.com ([fe80::8535:8b16:da9b:d2b7%6]) with mapi id 15.20.2516.014; Fri, 6 Dec 2019 21:43:59 +0000 From: John Lumby To: "pgsql-docs@lists.postgresql.org" CC: "David G. Johnston" , Tom Lane Subject: Re: description of Aggregate Expressions Thread-Topic: description of Aggregate Expressions Thread-Index: AQHVq8Cfp39padbrW02rHVPPdQZZdaetcyGAgAAI/4CAAAlrq4AAHqS6 Date: Fri, 6 Dec 2019 21:43:59 +0000 Message-ID: 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> <2A91BEF8171A5349931391E0C721CC53757055C3@CPEMS-KPN501.KPNCNL.LOCAL> ,<382.1575659855@sss.pgh.pa.us>, In-Reply-To: Accept-Language: en-CA, en-US Content-Language: en-CA X-MS-Has-Attach: X-MS-TNEF-Correlator: x-incomingtopheadermarker: OriginalChecksum:E6C64DD28CFA011300D28E6A3D9EDAB463910CE94A0B6A1AB550D97D84B9D2FA;UpperCasedChecksum:BE975D5A4C5DAF0856769A6D83ECBB42C6DB96F3313BDB016F98AA5002C6B80A;SizeAsReceived:7922;Count:46 x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [r0F10iooU56SJGt4za2SgSEtp2P+nWtb] x-ms-publictraffictype: Email x-incomingheadercount: 46 x-eopattributedmessage: 0 x-ms-office365-filtering-correlation-id: 4c448ee5-ab28-464f-91ef-08d77a956758 x-ms-traffictypediagnostic: BN3NAM04HT056: x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: hl3fEBvT9Qe9Ds7GgS9Mj0MTr0vTl8BXAwIf1ngVEdvo9faBtsA3R6GujNaSVo/RjXMVLxv4JExE7urpV13ZXmmnb+++ZnoTQVHCXacZOATei2g9EgDYxUFIG2iUKQRLyYejmGfcZx3RDxPb282fmYWFC7DWPAS0flbBJHKDvfdlKdqk3Ye4/YPO+renh8RO x-ms-exchange-transport-forked: True Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: hotmail.com X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-Network-Message-Id: 4c448ee5-ab28-464f-91ef-08d77a956758 X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Dec 2019 21:43:59.8208 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN3NAM04HT056 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk John Lumby wrote:=0A= < =0A= < Tom Lane wrote=0A= < =0A= < > > How about replacing "expression [ , ... ]" by "parameter_list" in th= e description, =0A= < > > and then stating that parameter_list can be either a single expressio= n or , =0A= < > > if the particular aggregate function accepts it (for which, consul= t that function's reference),=0A= < > > a comma-separated list of expressions.=0A= < > =0A= < > That's just as wrong. As we tried to explain before, the=0A= < > parenthesized-list syntax is a row constructor, so it only works=0A= < > in cases where the aggregate function can accept a composite=0A= < > argument type. Most don't.=0A= < >=0A= < =0A= < But surely not *all* cases of a multi-expression parameter list of an agg= regate function are row constructors are they? What about=0A= < =0A= < select parent_id, name, GROUPING(parent_id , name), count(*) FROM mytable= GROUP BY ROLLUP(parent_id , name);=0A= < =0A= < In the piece "GROUPING(parent_id , name)" ,=0A= < is "(parent_id , name)" a row constructor or a list of two expressions= ?=0A= < =0A= < Or are you saying those are one and the same thing?=0A= < =0A= =0A= I think I can answer my own question - No they are not the same - bec= ause :=0A= =0A= select parent_id, name, GROUPING(ROW(parent_id , name)), count(*) FROM myta= ble GROUP BY ROLLUP(parent_id , name);=0A= ERROR: arguments to GROUPING must be grouping expressions of the associate= d query level=0A= LINE 1: select parent_id, name, GROUPING(ROW(parent_id , name)), cou...=0A= ^=0A= =0A= =0A=