model-writtenrun 5642 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Erik Rijkers reported an assertion failure when fetching sufficiently long data on assertion-enabled master, while PostgreSQL 14 and builds without assertions did not exhibit the failure #1.
- Kyotaro Horiguchi reproduced the failure and proposed making FETCH require a snapshot and activating the portal's holdSnapshot during stored-tuple output; he then added a regression test using randomly generated text #2 #3 #4.
- Matthias van de Meent suggested simplifying the reproducer with STORAGE EXTERNAL, and Erik reported that the patch prevented the failure; Kyotaro subsequently found that short values did not exercise detoasting and that the initial fix itself was wrong #5 #6 #7 #8.
- Kyotaro reworked the patch to pass the original DECLARE snapshot through DestReceiver into the FETCH portal's holdSnapshot, and simplified the test to a sufficiently long externally stored value; he remained uncertain about the implementation and whether older branches needed fixes #9 #10.
- After Justin Pryzby raised the issue as an open item, Robert Haas argued that the assertion failure needed resolution for the release, while Andres Freund and Tom Lane initially considered it evidence of an older bug exposed by the new assertion #11 #12 #13 #14.
- Robert discovered that HaveRegisteredOrActiveSnapshot() incorrectly returned false with multiple registered snapshots, supplied an inline correction, and observed that make check-world passed both with and without it, revealing missing test coverage #18.
- Andres agreed that the logic looked wrong, while discussion broadened to whether catalog accesses should always hold another snapshot and whether GetOldestSnapshot() should exclude CatalogSnapshot; Tom questioned both the safety assumptions and the cost of changing catalog-snapshot management #19 #21 #22 #23 #24.
- Tom reproduced the assertion with both a catalog snapshot and another registered snapshot present, confirming that the predicate itself was faulty and proposing the catalog-only test used by the eventual fix #25.
- Robert and Tom explored invalidating catalog snapshots when other snapshots disappear, but Tom's experiment requiring an existing snapshot before creating a catalog snapshot immediately broke backend startup and background processes, so he deferred that redesign and chose to repair the predicate first #27 #28 #30 #31.
- Tom committed the discussion-derived predicate correction as 9f4f0a0dad, adding tests for toasted values fetched through ordinary and held cursors; the attached cursor-propagation patches were superseded, and the new-code bug required no backpatch.
- After the commit, Tom explained that merely having a snapshot at fetch time does not prove continuous protection of the referenced toast data, and proposed demoting the remaining concern from a PostgreSQL 15 open item; Andres agreed that this broader issue was not a new regression #33 #35 #37.
- Robert favored stronger checking through GetOldestSnapshot(), but Tom opposed introducing new failures in production builds late in the release cycle, and they left the assertion in place pending a better design #36 #38 #39 #40 #41 #42.
- The thread ended with the reported assertion bug fixed and broader snapshot-lifetime verification unresolved: Tom argued that existing executor, tuplestore, and catalog handling already covered most cases, Robert highlighted possible cursor and procedural-language corner cases, and both accepted that proving all such cases safe was beyond PostgreSQL 15 #43 #44 #45 #46.