Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1v29BJ-000kqC-FW for pgsql-hackers@arkaria.postgresql.org; Fri, 26 Sep 2025 14:12:17 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1v29BH-001qop-Et for pgsql-hackers@arkaria.postgresql.org; Fri, 26 Sep 2025 14:12:16 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1v29BH-001qoh-5W for pgsql-hackers@lists.postgresql.org; Fri, 26 Sep 2025 14:12:15 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1v29BF-000ER4-1J for pgsql-hackers@postgresql.org; Fri, 26 Sep 2025 14:12:15 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 58QEBtnw4054710; Fri, 26 Sep 2025 10:11:55 -0400 From: Tom Lane To: Peter Eisentraut cc: pgsql-hackers , "David G. Johnston" , David Christensen , Jelte Fennema-Nio Subject: Re: [PATCH] GROUP BY ALL In-reply-to: <634aca95-6db5-4beb-b18d-67e65582817f@eisentraut.org> References: <931747.1721687375@sss.pgh.pa.us> <634aca95-6db5-4beb-b18d-67e65582817f@eisentraut.org> Comments: In-reply-to Peter Eisentraut message dated "Fri, 26 Sep 2025 09:02:08 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <4054708.1758895915.1@sss.pgh.pa.us> Date: Fri, 26 Sep 2025 10:11:55 -0400 Message-ID: <4054709.1758895915@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Peter Eisentraut writes: > The initially proposed patch appears to have the right idea overall. > But it does not handle more complex cases like > SELECT a, SUM(b)+a FROM t1 GROUP BY ALL; > (For explanation: GROUP BY ALL expands to all select list entries that > do not contain aggregates. So the above would expand to > SELECT a, SUM(b)+a FROM t1 GROUP BY a; > which should then be rejected based on the existing rules.) I thought I understood this definition, up till your last comment. What's invalid about that expanded query? regression=# create table t1 (a int, b int); CREATE TABLE regression=# SELECT a, SUM(b)+a FROM t1 GROUP BY a; a | ?column? ---+---------- (0 rows) regards, tom lane