model-writtenrun 7959 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
Sep - Dec 2020 · 16 entries
- Jaime Casanova reported a sqlsmith query that failed with an ORDER/GROUP BY target-list error when incremental sort was enabled, then supplied a reduced reproducer in #1 and #3.
- James Coleman reproduced the failure with ordinary sorting too, identifying a volatile sort expression below a parallel join plan in #4, and Tomas Vondra traced the regression to the expansion of sort-path generation in #5.
- Tomas proposed rejecting mutable expressions in #8, but the discussion established that volatile expressions must be evaluated at the correct join level; switching to sort_pathkeys did not fix the ORDER BY and GROUP BY variants in #13.
- James proposed checking whether the expression already existed in the relation target in #17, prototyped that approach in #18, and replaced pointer comparisons with equal() and a separate helper in #20 to avoid changing postgres_fdw behavior.
- James refined the helper to follow prepare_sort_from_pathkeys, allowing nonvolatile expressions to be computed for sorting while requiring existing target entries for volatile expressions, and added regression coverage across #23, #26, and #27.
- Jaime confirmed that the earlier single-patch version fixed his original query and the other supplied examples in #28.
- Robert Haas warned that evaluating expressions below the top of a join tree might violate planner assumptions and suggested considering a revert in #30; James and Tomas debated those assumptions and retained the targeted fix in #32 and #34.
- With the minor release approaching, Tomas separated unrelated projection commentary from the fix and questioned its constant-member and relids checks in #35; James explained their relationship to existing sort preparation and added relabel stripping in #36 and #38.
- Tomas prepared the final volatility fix alongside an optional relocation of the old helper back to postgres_fdw in #39, but committed only the first patch as ebb7ae839d, leaving the relocation and projection comments unresolved in #40.
- A report of an uninitialized SubPlan on PostgreSQL 13.1 reopened the safety issue in #41, prompting Tomas to post an is_parallel_safe check in #42 while questioning which helper should enforce it.
- Robert clarified that the expression-evaluation boundary applies separately to each subquery's join tree in #48, helping James distinguish general expression propagation from the requirements for safe sort pushdown in #49.
- Tom Lane explained the planner's projection rules and the separate volatility and parallel-safety constraints in #50, and observed that the committed helper's volatile target-list search appeared unreachable and could be removed.
- James confirmed that parallel-safety development had moved to thread #43279 in #51, while Tom explained that SRF sort keys should be handled by a final Sort above ProjectSet in #52.
- James demonstrated that the parallel-safety patch still allowed an SRF sort below Gather Merge in #53, then showed the corrected plan after restricting SRFs in #54.
- The related Gather Merge invariant check landed as 6bc2769832, replacing the fallback Sort with an error; its attribution favors the later work in thread #43279, although the supplied materials do not identify its exact source attachment.
- Tomas announced the remaining safety fixes in #58, and the SRF restriction subsequently landed as fac1b470a9 from the later matching submission #464814 in thread #43279.
Mar 2021 · 1 entry
- When a user asked about the fix again, Tomas stated that all bug fixes were committed and included in PostgreSQL 13.2 in #60; the final reply confirmed that the affected Google Cloud SQL instance was still on 13.1 in #61.