model-writtenrun 9498 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Julian Schauder reported that cancelling CALL statements could crash PostgreSQL during portal cleanup #1; Michael Paquier requested a reproducible example after his nested-procedure cancellation tests failed to reproduce it #2.
- Tom Lane traced the failure to marking a portal auto-held before HoldPortal() succeeded and posted an ordering fix, noting that ordinary execution errors could trigger the same problem #3.
- Tom supplied a self-contained reproducer #4, and Julian confirmed that the initial patch fixed both his original code and minimal cases #5.
- Tom then identified a broader problem with leaving portal preservation to individual procedural languages when procedures nest across languages; he considered transaction-end hooks but questioned running user code after transaction abort had begun #6.
- Tom's final patch assigned portal preservation to SPI before transaction state changes, retained the original fix, checked portal readiness, and added regression tests; procedural languages bypassing SPI remained responsible for preservation themselves #7.
- The thread ended with that full patch proposed #7, and Tom subsequently committed it unchanged as 4d5840cea9, with a backport to PostgreSQL 11.