On Fri, Feb 27, 2026 at 3:27 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
> The problem is obvious after looking at parseCheckAggregates: the
> RTE_GROUP RTE is manufactured using the groupClauses list after we
> have flattened that, which we are only doing for comparison purposes;
> it shouldn't affect what goes into the parse tree. I experimented
> with just changing the order of operations, and that seems to fix it.
Right. We should keep the unmodified GROUP BY expressions in the
parse tree, and then rely on the planner to flatten the join alias
vars within them.
+1 to the fix.
> The lack of any effect on check-world shows we need more test cases
> here ...
How about this new test case in the attached (parse_agg.c untouched)?
- Richard