model-writtenrun 1741 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Yuhang Qiu reported two GROUP BY ROLLUP result differences between v17 and newer branches, with reproductions and bisected causes, in #1.
- David Rowley explained that the first difference reflected an intentional correctness fix whose query-tree changes could not be backpatched, and Bruce Momjian clarified the release-note convention in #2 and #3.
- Tom Lane confirmed that the second query incorrectly pushed HAVING below aggregation, allowing a synthesized row to escape filtering, while David Rowley demonstrated that the problem also affected variable-free stable-function expressions and favored reverting the optimization in #5, #6, and #7.
- Richard Guo proposed retaining variable-free HAVING clauses whenever nonempty grouping sets exist and attached the initial fix in #8 and #9; wenhui qiu endorsed the reasoning in #10.
- David Rowley questioned the confidence needed to ship a fix in v18, Tom Lane wanted an explicit connection to empty grouping sets, and Richard Guo explained his conservative restriction while remaining open to reverting in #12, #13, #14, and #15.
- After discussion resumed in October, Tom Lane briefly revisited the first query but withdrew that concern after recognizing that GROUP BY 1 references the first output column in #17 and #18.
- Tom Lane argued that empty grouping sets should determine whether HAVING must be retained, then supplied a replacement that also copied qualifying clauses into WHERE to avoid unnecessary scans in #19 and #20.
- Richard Guo found that Tom Lane's detector mishandled combinations such as rollup(a), b, and replaced it by expanding grouping sets before HAVING optimization in #21.
- Tom Lane accepted the expansion approach, requested clearer comments and a regression case, and deferred storing the expanded representation in a new PlannerInfo field because that structural change was unsuitable for v18 in #22.
- Tom Lane supplied the comment, test, and initialization cleanup in #23; Richard Guo added coverage for degenerate HAVING without empty grouping sets in #24, and Tom Lane approved that version in #25.
- Richard Guo committed #24 unchanged as 18d2614093 and confirmed its v18 backpatch in #26, preserving the optimization rather than reverting it.
- Richard Guo reported a v18 regression-output mistake in #27, and Tom Lane emphasized testing back branches in #28; ee49f2cf44 removed expected Replaces output from a feature unavailable in v18.
- The thread ends with Richard Guo confirming that the v18 test correction was pushed and awaiting buildfarm results in #29; the functional fix and test correction had landed, with the representation cleanup left for future work.