model-writtenrun 7127 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Tom Lane proposed removing the obsolete parallel-safety restriction on nodes with initplans in #1, also correcting cost transfers and Result-subquery safety checks; the existing partition-pruning test produced a simpler, faster plan.
- Robert Haas welcomed the change and requested more examples in #2, while Richard Guo reviewed the patch and questioned why initplans could not move to an injected Gather in #3; Tom explained the regression-mode EXPLAIN problem in #4.
- Richard demonstrated incorrect MIN() results after experimentally moving initplans to Gather in #5, investigated worker parameter state in #6, and supplied an inline modification plus regression-test findings identifying missing extParam information in #8.
- Tom initially expected Gather's existing parameter transmission to handle the case in #7, but Richard recommended retaining the original restriction in #10 because of the wrong results and unavoidable EXPLAIN changes.
- Returning to the problem in July, Tom traced the failure to optimized MIN/MAX Aggrefs becoming Params only after SS_finalize_plan had computed parameter sets in #11, and considered an earlier substitution pass, reordered planner passes, and a narrower workaround.
- In #12, Tom rejected the broader restructuring as too messy for possible backpatching and submitted a separate fix teaching SS_finalize_plan about optimized MinMax Params; the accompanying feature revision allowed initplans on injected Gathers only outside regression mode, preserving EXPLAIN visibility.
- Richard confirmed the wrong-result fix and endorsed both patches in #13; Tom committed the two components unchanged as d0d44049d1 and e08d74ca13, then announced completion in #14.
- In May 2024, 779ac2c74b added a regression test showing that the MinMax fix also prevented stale aggregate results under DISTINCT with hash aggregation; this test originated in Hal Takahara's separate bug-report thread thread #72527, rather than this thread.
- The submitted series was fully committed, but the thread ended with Frédéric Yhuel asking in #15 why a nontrivial aggregate initplan still produced a top-level nonparallel Append; no answer or further patch appears in the supplied thread.