model-writtenrun 5460 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Justin Pryzby reported that starting PostgreSQL with min_dynamic_shared_memory=1MB triggered a relptr assertion, and Tom Lane traced it to the base address and NULL sharing the same encoding #1 #2.
- Kyotaro Horiguchi explained why preallocated shared memory exposed the problem and supplied a patch moving FreePageManager by MAXALIGN bytes, with a startup regression test; the adjustment did not reduce usable page capacity #3 #4.
- Robert Haas explained that direct access to the stored offset had concealed the ambiguity, while Tom Lane opposed simply removing the assertion and warned that changing NULL's encoding would lose compatibility with zero-initialized memory; Thomas Munro argued that the allocator should support placement at its base address #5 #6 #7.
- Thomas Munro proposed one-based offsets to preserve zero as NULL, and Robert Haas clarified why the otherwise ambiguous address before the segment was outside the valid range; Tom Lane accepted that reasoning, while his speculative self-relative-pointer alternative remained outside the immediate fix #11 #13 #14 #15 #16.
- Kyotaro Horiguchi supplied an alternative patch using (Size) -1 for NULL, replacing his placement workaround with a change to relptr itself #18.
- After a three-week gap, John Naylor sought resolution of the release open item and favored the localized placement workaround, with Tom Lane reiterating the value of zero representing NULL; Thomas Munro instead supplied the discussed one-based encoding, updated raw-offset users, and immediately corrected its remaining assertion #20 #21 #22 #23.
- Robert Haas endorsed the final approach, and Thomas Munro committed #23 unchanged as 7201cd1862, superseding the placement workaround, its startup test, and the alternative NULL sentinel #24 #25.
- The thread ended with Thomas Munro confirming the fix and its backport to PostgreSQL 14, where min_dynamic_shared_memory originated; he also noted a remaining pgindent formatting limitation involving relptr declarations, without proposing further patch work #25.