model-writtenrun 5672 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Yaoguang Chen reported a PostgreSQL 14beta2 assertion failure involving nested GROUPING() in #1, and Michael Paquier reproduced it and confirmed that older versions were affected in #2.
- Tom Lane reduced the report to two queries exposing an assertion failure and an invalid subplan reference, tracing the problem to unprocessed SubLinks inside an outer GroupingFunc in #3.
- Andrew Gierth explained that GroupingFunc arguments remain available for EXPLAIN and deparsing in #4; when Tom proposed changing default tree traversal in #5, Andrew explained why recursion was usually necessary in #6, and Tom accepted that rationale in #7.
- Richard Guo proposed processing GroupingFunc arguments in build_subplan in #8, added the complementary protection against premature recursion in #9, and supplied comments and regression tests in #10.
- After several months, Kyotaro Horiguchi reviewed and tested the patch successfully against all three reported examples in #11.
- Tom Lane resumed the work in #12, retained Richard's fix, and extended GroupingFunc handling to set-returning checks, cost estimation, and deparsing parentheses, announcing that he would back-patch the result.
- The complete patch from #12 landed unchanged as 2591ee8ec4, credited to Richard Guo and Tom Lane and backported to all supported branches; no remaining patch work was identified.