model-writtenrun 5826 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Justin Pryzby reported that extended-statistics objects on partitioned tables were no longer populated and demonstrated the resulting GROUP BY estimation regression, while questioning how ordinary inheritance should be handled #1.
- Tomas Vondra proposed adding stxdinherit to pg_statistic_ext_data so one statistics definition could hold both table-only and inherited data, posting a proof of concept that passed make check but still needed catalog-row management work #2.
- Justin requested a backpatchable partitioning fix because partitioned parents contain no rows, and Tomas supplied a small analyze.c alternative that chooses which statistics to build according to relation kind #3 #4.
- Justin argued for preserving ordinary-inheritance behavior in stable releases, then demonstrated a second bug: table-only statistics were incorrectly used for whole-inheritance-tree estimates; he also identified missing inheritance handling for expression statistics #5 #6.
- Justin assembled both backpatchable fixes, Tomas's catalog change, additional inheritance corrections, regression tests, and an ACL cleanup into one series, later clarifying that only the catalog-dependent work was restricted to the development branch #8 #10.
- Tomas's review called for moving relation-wide inheritance checks outside statistics loops and replacing awkward iteration over both inheritance flags; Justin supplied helper-function changes and confirmed that retaining old inherited statistics matched existing column-statistics behavior #11 #12 #14.
- After a December rebase, Zhihong Yu questioned commented-out error handling and repeated key accumulation, and Tomas consolidated the series, processed keys and expressions once, exposed inheritance in pg_stats_ext_exprs, and moved statistics-data creation from CREATE STATISTICS to ANALYZE #15 #16 #17.
- Zhihong reviewed wording and inheritance-check style, Tomas explained why mismatched inheritance statistics should be silently skipped, and Tom Lane supported explicit RangeTblEntry variables for readability #18 #21 #22 #23 #25.
- Justin found expression-statistics guards that still blocked valid inherited or partitioned-table cases and recommended using rte->inh directly; Tomas corrected the partitioning exception and then removed the remaining obsolete guard after Justin's follow-up #24 #26 #30 #32.
- Justin proposed using a LEFT JOIN in regression checks to distinguish a statistics definition from its absent data row, and explained why this mattered once the catalogs no longer had a one-to-one relationship #24 #28.
- Justin questioned the usefulness of inherited dependencies and MCV statistics when qualifications are pushed down to child scans; Tomas kept broader collection and planner changes outside this fix and favored separate follow-up work #27 #29 #31 #33.
- Tomas committed the inheritance-estimation fix from #32 as 36c4bc6e72, retaining its backend logic while expanding tests to cover dependency estimates, and Justin acknowledged that landing #34.
- Tomas committed the partitioned-table statistics fix from #32 as 20b9fa308e, with light test cleanup and an ANALYZE recommendation, then posted the two remaining patches with updated tests #35.
- Both bugfixes were backpatched through PostgreSQL 10, and Tomas explained that he added check_estimated_rows() to the older branches rather than dropping or substantially rewriting their regression tests #36.
- Tomas committed the catalog component of #35 as 269b532aef, adding the catalog-version bump and minor cleanup so the development branch could store both inherited and non-inherited statistics #37.
- The thread closed as committed, with the ACL refactoring explicitly declined because it addressed only some similar code and would complicate backpatching; Tomas invited a separate submission if Justin wanted to pursue it #37.