model-writtenrun 4372 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Alexander Lakhin reported that switching stats_fetch_consistency from cache to snapshot after reading statistics within a transaction triggered an assertion because cached entries survived the mode change #1.
- Kyotaro Horiguchi initially proposed preserving the existing snapshot mode and issuing a warning, considering a GUC-level error unnecessarily severe because it would abort the transaction #2.
- Alexander proposed clearing the snapshot through a GUC assign hook instead, then supplied that implementation with a regression test after a two-month gap #3 #4.
- Kyotaro accepted discarding snapshots as the simpler behavior but revised the hook to request deferred cleanup, avoiding memory-context operations inside the callback; Alexander endorsed the fix and discussed comment improvements #5 #6.
- Michael Paquier questioned whether deferred cleanup was brittle, while Kyotaro explained that separating cleanup from the callback avoided assumptions about when GUC hooks execute #7 #8 #11.
- After examining backend-context and initialization constraints, Michael accepted deferred cleanup and posted a revision with clearer naming, documentation, and additional snapshot-timestamp checks #12.
- Michael also noticed that the sample configuration omitted the allowed consistency values, explicitly left that change outside the attached patch, and committed it separately as 4d47eff99c #12.
- Michael committed the final attached bugfix #12 with only whitespace and comment wrapping differences as 605994651b, then confirmed that it had been applied and backpatched to PostgreSQL 15; no further work remained pending in the thread #14.