On Sep 28, 2025, at 06:23, Tom Lane <[email protected]> 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 “ctid”?

If a user does:

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

It would be equivalent to no group by. Combing “select ctid” with “group by all” 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/