model-writtenrun 8638 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Andres Freund discovered that ScanPgRelation() used an unregistered catalog snapshot, allowing invalidations to reset xmin or overwrite the snapshot, and proposed passing NULL to systable_beginscan() in the normal case while strengthening snapshot assertions #1.
- Andres traced the mistake to overlapping historical-snapshot and SnapshotNow changes, then found a broader problem during temporary-table cleanup: catalog lookups could release their snapshots before subsequent updates, leaving tuple identifiers vulnerable to pruning or reuse #2.
- Andres concluded that isolated registrations were insufficient when catalog and user snapshots had different horizons, and proposed deferring xmin reset until a command boundary as an alternative to auditing every lookup-and-modification sequence #3.
- Andres committed the narrow ScanPgRelation() fix as 42750b08d9, with backpatches, and announced it while requesting input on the remaining issues #4.
- Andres posted temporary registrations plus stronger assertions to demonstrate the broader problem, then rebased them with minor assertion and comment adjustments; he explicitly described the patches as unsuitable for application and said more aggressive invalidation testing was needed #5 #6.
- Robert Haas favored explicitly holding snapshots across catalog lookup-and-update sequences, observing that open scans already provide protection while SearchSysCacheCopy-based updates can lack it; Andres countered that mixed snapshot types make this difficult to enforce reliably #7 #8.
- Tom Lane supported associating snapshots with open catalog scans, suggested CommandCounterIncrement as a possible release boundary, and proposed preventing catcache-based updates by omitting cached tuple identifiers #9.
- The thread ended with the narrow fix landed but the broader approach unresolved: Andres suggested combining explicit snapshot retention with deferred xmin reset and asked how to handle operations using different snapshot types #10.