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 1sWFhf-00E56q-9V for pgsql-hackers@arkaria.postgresql.org; Tue, 23 Jul 2024 13:37:19 +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 1sWFhd-00Djrm-4o for pgsql-hackers@arkaria.postgresql.org; Tue, 23 Jul 2024 13:37:17 +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 1sWFhc-00Djrd-Qy for pgsql-hackers@lists.postgresql.org; Tue, 23 Jul 2024 13:37:17 +0000 Received: from mail-pj1-x1034.google.com ([2607:f8b0:4864:20::1034]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sWFha-001471-Sf for pgsql-hackers@postgresql.org; Tue, 23 Jul 2024 13:37:16 +0000 Received: by mail-pj1-x1034.google.com with SMTP id 98e67ed59e1d1-2cb4b7fef4aso3203624a91.0 for ; Tue, 23 Jul 2024 06:37:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pgguru-net.20230601.gappssmtp.com; s=20230601; t=1721741833; x=1722346633; darn=postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=PjXSA2D+ngRxyrZKV/8iuY4+z++oI8nzoS6j4xO82po=; b=AEHnE+AyLvkB5sGThUDWaE22A6zKy9wfua2OSqQ5MiIMcZ1w8bDWd+LOp+4bgEFbqH xtEGnRJUTlIBKVyjc+bB+8xcPoC68UNzdZCJZgOopkhCS5cM/FhTCdPCZxCccNbblF/7 AX0RaIlwS4meqx8J/1jeenAyMX2fuOXhmJYxPmALYX41VchHZgKH2spXVYEfuZaVN9H+ Jy0DuQcHOxR5T16q5tm1uxu3XLeVQLC8WYyguC1AWxNyboKI0nAglH0t9qmJkd2NhY7W npNR0krIExKpXHRyUXjRa/pSPkQsia7CukxwZrGg0RgxazJJSNJkfHLGUoLNOFK3k1jP GilA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721741833; x=1722346633; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PjXSA2D+ngRxyrZKV/8iuY4+z++oI8nzoS6j4xO82po=; b=vYQqEmZdb5+6sgSr8BUxSaaB8YKeMDDjRd31BrPC07Mku/WbB2lz26dyW5+n8kNhpJ 2sT26RBf03ZgVm6DHRvglMdicI5GAHPoutjgghcITb5c6uRYL5YRuJO0m7QxndjnIf5/ h2LPZtDbhEZROZ+dk8dIFc6V19HbEpgpZ3+fTu6/sssgErzMUO6Stzks+y/VaPfz5rhO M8s7pDhDAFoO+pEcu2f3x5ihVqxOaaKiueA6rPoDbbzK+XRkskl9QdcEwy1Y6ANitO0a 4/NxPsSTw4FIWJ+YIuiYBo3dLceb6qCwne+8Mnt7PD0RyPqYqm5Z/Gh8baSIZ6CUaVZ8 8n+A== X-Forwarded-Encrypted: i=1; AJvYcCVVc2DIQyKyNktGreQcT34BezPAP7BewCdghtaVJ90pNuQ7wGzjRI8fqn+Oo/7apRGdjiYFoubdHSlkTT3pdM3d2yzQMK0pOLi3n8bm X-Gm-Message-State: AOJu0Yz9jRkJMnF323YlEz0Xstfm83EGiE2nu87cEON29U6VAMf9mHsv Z0oF1bmOvEGqFxpayTJw17l8jCWTeXK+pwuTg8aE7QiSgnvcGJzGp+I5AmjJvr2ZjI9sw1zNu0M PrXRZlI5AZeFh+Fl69gwKnEUXNS3WkHUPAO9s/A== X-Google-Smtp-Source: AGHT+IH5YoViaG51WzkgUrsY91w6QtOxTRGCQakk2tkNLMw4r0s3FR1ldiusLmOog7M+1VoBIJjMnXd7hqlhgHjXs38= X-Received: by 2002:a17:90b:314a:b0:2c9:7fba:d88b with SMTP id 98e67ed59e1d1-2cd2740ff1cmr8790172a91.14.1721741832958; Tue, 23 Jul 2024 06:37:12 -0700 (PDT) MIME-Version: 1.0 References: <931747.1721687375@sss.pgh.pa.us> In-Reply-To: <931747.1721687375@sss.pgh.pa.us> From: David Christensen Date: Tue, 23 Jul 2024 08:37:02 -0500 Message-ID: Subject: Re: [PATCH] GROUP BY ALL To: Tom Lane Cc: "David G. Johnston" , pgsql-hackers Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, Jul 22, 2024 at 5:29=E2=80=AFPM Tom Lane wrote: > > "David G. Johnston" writes: > > On Mon, Jul 22, 2024 at 1:55=E2=80=AFPM David Christensen wrote: > >> I see that there'd been some chatter but not a lot of discussion about > >> a GROUP BY ALL feature/functionality. There certainly is utility in > >> such a construct IMHO. > > > I strongly dislike adding this feature. I'd only consider supporting i= t if > > it was part of the SQL standard. > > Yeah ... my recollection is that we already rejected this idea. > If you want to re-litigate that, "throwing this out there" is > not a sufficient argument. Heh, fair enough. I actually wrote the patch after encountering the syntax in DuckDB and it seemed easy enough to add to Postgres while providing some utility, then ended up seeing a thread about it later. I did not get the sense that this had been globally rejected; though there were definitely voices against it, it seemed to trail off rather than coming to a conclusion. > (Personally, I'd wonder exactly what ALL is quantified over: the > whole output of the FROM clause, or only columns mentioned in the > SELECT tlist, or what? And why that choice rather than another?) My intention here was to basically be a shorthand for "group by specified non-aggregate fields in the select list". Perhaps I'm not being creative enough, but what is the interpretation/use case for anything else? :-) While there are other ways to accomplish these things, making an easy way to GROUP BY with aggregate queries would be useful in the field, particularly when doing iterative discovery work would save a lot of time with a situation that is both detectable and hits users with errors all the time. I'm not married to the exact syntax of this feature; anything else short and consistent could work if `ALL` is considered to potentially gain a different interpretation in the future. David