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 1v2nLT-007VSH-O5 for pgsql-hackers@arkaria.postgresql.org; Sun, 28 Sep 2025 09:05:28 +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 1v2nLR-00DqD8-PE for pgsql-hackers@arkaria.postgresql.org; Sun, 28 Sep 2025 09:05:26 +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 1v2nLR-00DqD0-E5 for pgsql-hackers@lists.postgresql.org; Sun, 28 Sep 2025 09:05:26 +0000 Received: from mail-pl1-x62d.google.com ([2607:f8b0:4864:20::62d]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1v2nLP-000WP2-1t for pgsql-hackers@postgresql.org; Sun, 28 Sep 2025 09:05:25 +0000 Received: by mail-pl1-x62d.google.com with SMTP id d9443c01a7336-269af38418aso46225225ad.1 for ; Sun, 28 Sep 2025 02:05:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1759050321; x=1759655121; darn=postgresql.org; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:from:to:cc:subject:date:message-id:reply-to; bh=F3+KRI+pTynSNzsInof2YvQA9ZBsffTLyVkqL4s+BLI=; b=Pi5W8crR7E7gOsrW31pAZZgZDsP51/wcCsi4bn6bGrkvu1P7rqPQ3XS27rDFEGQYpS 4oRc+GIEBQLFHJ0vKZtll+mR6/CtiahxgGA+NwW6mS3Uc5LCedOdWPb7xCAMv+hv1KBx ZZMhzC/TRe88zqzePXurhSAwrmbFSlk/SZgf1iyi9GnTGsEY86WxVN54n+S4XrZRRyAx wuNqAMGjFkFI4E8ekv9eV3BYj1ra5rRhS9JVxbxp544yyHlsO/xDEQzYDtUeEymzZyfX kyXCqgCem9kVEe6uSB+tKYhNnRrV4LuOMg9UTma4c+7/61R2bnnvx9vsMnlGGuKgOF/x Syvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1759050321; x=1759655121; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=F3+KRI+pTynSNzsInof2YvQA9ZBsffTLyVkqL4s+BLI=; b=rjewAVVtn68XibSvM4QpTGX78yV5EaGXDSLjnXGhqKWA81qC+YrfEWgkXgny3A1xZx ftTRz6VjxrBVRn9P75CVPY6Rn/no1oGQ9opxMiC+lDaonPuNwMknuI96szI371k+l/LH nPj+95eFQin3IhgNJmUH+4pyPdJRo6Pn9Rsc4gqjE/JdbSuJKP5ArAHGTMPdUCgj0YHx vDtGrj7nWUHbRFEYXNGGDCOnZWuaVxpGo0vFtWiXK8uPdYHZ4FeRP7Bks14qIVAsnykO Yo/X+Kj7Gd8oYBSbL/szDXqFcmGn6IZ2AimqRVrugMEwBsXtArEfI+OZOLhmuuQ5ExDS ndqA== X-Forwarded-Encrypted: i=1; AJvYcCXJB9t09bTWJxuTFcMhCPTEu36x9hZ/ij8aFChXIeNnjti7zCc5mJsdsCnqjGdC5oV6rSIQco69EH8Oo1Qf@postgresql.org X-Gm-Message-State: AOJu0YwrkVVdWRj8IF6M8bwhlhCo1wVl2TcdNC1V8om8HxeuWg1/vqIq xU1LJJBX9iiyKAC31k/B2CGnYC+o2oCB4hUCkSg7QQ8sloDci4nYrfeg X-Gm-Gg: ASbGncu/xyZXbx/IA+mYMsHutkQm+gFZlLW3Xiu0IGd8sOEpJj2yTVsDk9CVahMc2ke LDpdcvF69MR4A+PttmSdll8QpfFNsnVO1GbPYsA74gCOgmCUZG7FZgNJB4zQFd+CUjG0csKiwQc 4xtO9C9ECYqHuAl+XHH+qqu09VdxCQK55WEA+MWaNOKojJvMH4WdAwUTRw+Z2D45caU38IBvpmJ ahkA9rzOXP46L1n6N4nXcqHhiAeDslzObTEUZ395PvVa0cORLib4adilOL4ehyy2h8k+qw/aszi B1qy2Iwri2p2GHhcoqISjMJvUJI3RRK3wWEFK65VKoTvuZX0useolBilxe/rHqOUFeboIPvYsIn wmri7t1VanpGdWjcdvoIb4hVAssjWIG42 X-Google-Smtp-Source: AGHT+IEhigdEzPrjQ60Z5uxccPNYWU0MQPV8645eEXz+Aaqz7VmT8XBhaWtnKxgMDo5IckLpCb+Yhg== X-Received: by 2002:a17:903:3bcc:b0:26c:2e56:ec27 with SMTP id d9443c01a7336-27ed4a01452mr143897515ad.19.1759050321579; Sun, 28 Sep 2025 02:05:21 -0700 (PDT) Received: from smtpclient.apple ([142.171.105.12]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-27ed66d3cafsm100387455ad.14.2025.09.28.02.05.18 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 28 Sep 2025 02:05:21 -0700 (PDT) From: Chao Li Message-Id: Content-Type: multipart/alternative; boundary="Apple-Mail=_6887E3A5-EA0D-43D2-92D2-7DFBAED3AFBE" Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.700.81\)) Subject: Re: [PATCH] GROUP BY ALL Date: Sun, 28 Sep 2025 17:05:04 +0800 In-Reply-To: <702762.1759011796@sss.pgh.pa.us> Cc: Peter Eisentraut , David Christensen , Andrey Borodin , pgsql-hackers , "David G. Johnston" , Jelte Fennema-Nio To: Tom Lane References: <4D2047B0-E8D8-472B-B7E8-61206B1E6AFA@yandex-team.ru> <4083063.1758902694@sss.pgh.pa.us> <4085064.1758903815@sss.pgh.pa.us> <167505.1758988990@sss.pgh.pa.us> <702762.1759011796@sss.pgh.pa.us> X-Mailer: Apple Mail (2.3826.700.81) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --Apple-Mail=_6887E3A5-EA0D-43D2-92D2-7DFBAED3AFBE Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Sep 28, 2025, at 06:23, Tom Lane wrote: >=20 > + /* Iterate over targets, adding acceptable ones to the = result list */ > + foreach_ptr(TargetEntry, tle, *targetlist) > + { > + /* Ignore junk TLEs */ > + if (tle->resjunk) > + continue; Do we want to specifically check =E2=80=9Cctid=E2=80=9D? If a user does: ``` select ctid, col1, col2, ... from t group by all; ``` It would be equivalent to no group by. Combing =E2=80=9Cselect ctid=E2=80=9D= with =E2=80=9Cgroup by all=E2=80=9D seems totally useless, but when = users do such things, we can optimize that. Best regards, -- Chao Li (Evan) HighGo Software Co., Ltd. https://www.highgo.com/ --Apple-Mail=_6887E3A5-EA0D-43D2-92D2-7DFBAED3AFBE Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8

On Sep 28, 2025, at 06:23, Tom Lane = <tgl@sss.pgh.pa.us> wrote:

+ = /* Iterate over targets, = adding acceptable ones to the result list */
+ = foreach_ptr(TargetEntry, = tle, *targetlist)
+ = {
+ = /* = Ignore junk TLEs */
+ = if = (tle->resjunk)
+ = continue;

= Do we want to specifically check =E2=80=9Cctid=E2=80=9D?

If a user does:

```
select = ctid, col1, col2, ... from t group by = all;
```

It would be equivalent to no group by. = Combing =E2=80=9Cselect ctid=E2=80=9D with =E2=80=9Cgroup by all=E2=80=9D = seems totally useless, but when users do such things, we can optimize = that.

Best regards,
--
Chao Li (Evan)
HighGo Software = Co., Ltd.
https://www.highgo.com/




= --Apple-Mail=_6887E3A5-EA0D-43D2-92D2-7DFBAED3AFBE--