model-writtenrun 4337 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Tomas Vondra reported that inserting a non-NULL value into an all-NULL BRIN range could make IS NULL queries miss rows, and proposed setting hasnulls in four opclasses in #1; Matthias van de Meent questioned the flag semantics and identified a test cleanup mistake in #2.
- Tomas discovered that the initial fix would mark every newly initialized range as containing NULLs, so #4 instead encoded empty ranges with both NULL flags set and avoided storing empty summaries.
- After further tests exposed failures, Tomas moved NULL preservation into add_values_to_range() and added pageinspect cases in #6; Zhihong Yu suggested simplifying a repeated condition in #7.
- Tomas reconsidered omitting empty summaries because bitmap scans would repeatedly visit empty gaps after bulk deletes, and #8 added an alternative that stored empty summaries and skipped them during scans.
- Justin Pryzby identified missing Meson integration and concurrent CREATE EXTENSION failures in #9; Tomas removed the extra pageinspect suite, retained the stored-summary approach, and added union_tuples() handling in #10.
- Justin's comment corrections in #11 were incorporated into branch-specific fixes in #12, which also supplied diagnostic tests and a randomized stress script; Tomas clarified that individual insertions into existing summaries caused the original failure, while bulk summarization avoided it.
- Further investigation in #13 found that placeholder tuples also needed empty marking and that summary merging required additional cases, with concurrency testing relying on debugger-controlled timing.
- Alvaro Herrera proposed using an unused BRIN tuple-header bit and padding in BrinMemTuple instead of overloading the NULL flags, supplied comment fixups, and supported centralized backbranch NULL handling in #14; Tomas accepted the dedicated-bit direction in #15.
- Tomas implemented the dedicated empty-range flag in #16, simplifying insertion and merging, adding an empty column to brin_page_items(), and reporting about one hundred successful stress runs; the extensive diagnostic tests were explicitly not proposed for commitment as written.
- The revised series in #17 included older-branch adaptations, and Alvaro tested it, endorsed the approach, and discussed comments, structure layout, and pageinspect backports in #18.
- Tom Lane opposed backpatching pageinspect extension-version changes because they could obstruct upgrades to installations lacking the new scripts in #19 and #21; Tomas accepted that concern in #22, leaving the output extension for master.
- Concern about adding a field before a flexible array resurfaced in #25, and Julien Rouhaud identified PostGIS BRIN opclasses that did not access BrinMemTuple in #26; Alvaro resolved the layout concern by confirming the existing three-byte padding hole in #28.
- While preparing the final series, Tomas discovered a separate bug that lost NULL information when merging nonempty summaries, split it into its own first patch, and abandoned the older-branch refactoring in #29.
- The separate merge fix from #29 landed as 3ec8a3bfb5, updating union_tuples() to preserve NULL information in both merge directions; no independent review of that newly split fix appears before commitment.
- The dedicated empty-range fix from #29 landed on the development branch as 3581cbdcd6, preserving the flag-based design with light cleanup; the supplied candidate 6c512fc6e9 is its PostgreSQL 13 counterpart, despite the inconsistent canonical/backport metadata.
- The pageinspect component from #29 landed separately as 428c0cae92, exposing the empty flag with matching SQL, tests, and documentation, and was intentionally not backpatched.
- Tomas confirmed all intended patches had been pushed with minor final tweaks and no initial buildfarm problems in #30; the remaining concerns were a deadlock discussed elsewhere and how to automate precisely timed concurrent BRIN tests.