model-writtenrun 6165 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Tom Lane reported that FETCH ABSOLUTE could move backwards through a NO SCROLL cursor and that partially reading a WITH HOLD cursor before committing exposed incorrect positioning afterward; he proposed rejecting such movement but worried about breaking existing applications #1.
- Vik Fearing supported enforcing NO SCROLL semantics, while suggesting documentation as a no-op only if the option had no meaningful effect #2; Tom confirmed that it affects optimization and demonstrated that the loophole also bypassed restrictions on scrolling FOR UPDATE cursors #3.
- Tom traced the problem to DoPortalRunFetch rewinding and fetching forwards, bypassing PortalRunSelect's backward-scan check, and demonstrated that an updated row could make FETCH ABSOLUTE return a different row from the equivalent relative fetch #4.
- Tom submitted two dependent fixes: reject rewinds in DoPortalRewind and preserve held-cursor position in PersistHoldablePortal while skipping unnecessary tuplestore repositioning; he proposed restricting the backpatched prohibition to cursors held across transactions and left whether v14 should receive full enforcement open for discussion #5.
- The subsequent commit combined both patches with only comment edits, applying full enforcement beginning with v15 and limiting enforcement in older branches, including v14, to held cursors to reduce compatibility risk; both submitted fixes therefore landed #5 c1b7a6c273.