model-writtenrun 1262 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Tom Lane opened #1 after a complaint exposed a longstanding limitation: subqueries could reference outer grouping columns but failed when referencing more complex GROUP BY expressions.
- The patch in #1 adjusts and caches copies of grouping expressions once per subquery depth, allowing ordinary equal() comparisons while retaining the faster existing path for grouping lists containing only Vars.
- Testing also exposed incorrect join-alias handling for GROUPING() inside subqueries, so #1 introduced flatten_join_alias_for_parser() with an explicit subquery-depth argument and added full-join grouping-set tests.
- Tom Lane committed the patch on March 6, 2026 as 415100aa62, preserving the implementation from #1 and adding regression coverage for arithmetic grouping expressions and full-join COALESCE expressions.
- The supplied thread ends with the proposal in #1 and contains no reviewer replies; 415100aa62 subsequently landed the complete change on the development branch, explicitly deferring backpatching until it had received more exposure.