model-writtenrun 1900 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Alexander Lakhin reported a SQLsmith-discovered planner failure in PostgreSQL 18beta3, where estimating an array expression produced a missing-relation error #1.
- Tom Lane traced the failure to SubPlan costing before the parent query's RelOptInfos exist and attached an examine_variable() guard; he rejected reverting the triggering change as insufficient and considered delaying SubPlan generation too substantial for backpatching #2.
- Richard Guo proposed passing a NULL planner root during early SubPlan costing, and Tom recommended doing so inside cost_subplan() when calling cost_qual_eval(), preserving the root for other potential uses #3 #4.
- Richard supplied the replacement implementation with explanatory comments and regression tests, noting that MIN/MAX initplans are also safe because their testexpr is NULL #5.
- Tom approved the replacement and suggested a simpler boolean regression query, which Richard accepted #6 #7.
- Richard and Tom considered backpatching beyond PostgreSQL 17 because extensions might encounter the same unsafe statistics lookup on older branches #7 #8.
- Richard committed #5 with the cosmetic test simplification as aba8f61c30 and announced backpatching through PostgreSQL 13, omitting the regression test on pre-17 branches #9.
- After the fix landed, Andrei Lepikhov advocated making planner information available earlier to support future SubPlan memoisation work #10; Alexander closed the thread by thanking the authors, with the reported bug fixed and the broader planning redesign left as a future direction #11.