model-writtenrun 7389 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Алексей Булгаков reported that a PL/pgSQL cursor loop combining FOR UPDATE, row updates, and COMMIT updated only two of three rows; removing either FOR UPDATE or the in-loop COMMIT avoided the failure #1.
- Tom Lane traced the skipped row to PersistHoldablePortal rewinding a query whose results had changed after an update, considered always saving cursor output too expensive, and suggested saving only the remaining rows for nonscrollable cursors #2.
- Tom Lane posted a patch that avoids rewinding nonscrollable cursors and resets their position before saving the remaining rows; he proposed relying on stable query results for scrollable cursors, supported by existing restrictions and clearer documentation #3.
- Tom Lane committed the posted fix as ba2c6d6cec, retaining its implementation while adding an implicit-cursor test and documentation about volatile queries, with backpatches to PostgreSQL 11 and later.
- Further consideration produced be90098907, forcing nonscrollable implicit PL/pgSQL cursors to avoid unnecessary rewinding and volatile-query hazards; both changes landed after the thread's final patch proposal #3, with no outstanding revision requests recorded.