model-writtenrun 3296 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Victor Yegorov reported that, with AUTOCOMMIT disabled, a stable function saw an updated row in an ordinary expression but returned the old value when used as a CALL argument #1.
- Pierre Forstmann demonstrated that removing STABLE avoided the symptom, but Victor argued that the documented calling-query snapshot behavior should support his example; Tom Lane agreed this looked like a bug in the snapshot supplied to CALL arguments #2 #3 #4.
- Tom's draft made PL/pgSQL request non-atomic execution only outside atomic contexts and corrected SPI snapshot comments, while leaving tests and documentation for later and expressing concern about external callers repeating the same mistake #5.
- Tom then replaced the caller-specific fix with an SPI check requiring both allow_nonatomic and a non-atomic connection, covering extensions that copied PL/pgSQL's behavior; the revised patch included documentation and tests for atomic and non-atomic execution #6.
- Nathan Bossart endorsed the revised patch and suggested additional SPI_connect_ext documentation; Tom considered the included documentation sufficient, leaving that editorial question open at the thread's last message #7 #8.
- Tom subsequently committed the revised patch unchanged as 2dc1deaea0 and backported the same fix, including the legacy-API adaptation 0be81dd71c; these supplied candidates represent one landed change from #6.