model-writtenrun 1941 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Alexander Lakhin reported that repeated calls to an SQL opclass support function first produced an expected error and then accessed an invalid cached-plan resource owner in PostgreSQL 18beta3 #1.
- Dilip Kumar traced the failure to stale cache references and proposed releasing the plan before three setup errors #2; Kirill Reshke questioned explicit resource release, requested regression coverage, and proposed clearing cplan in the error-context callback instead #3.
- Dilip combined callback cleanup with explicit plan release #4, but Kirill explained that transaction rollback already releases the plan #5, and Dilip agreed to proceed with Kirill's simpler callback patch plus a comment and test #6.
- Tom Lane rejected cleanup limited to selected error sites and explained that error-context callbacks are neither intended nor guaranteed to perform cleanup; he proposed two alternatives that reset cache state on reuse, favoring the more comprehensive one because stale execution state could also survive an error #7.
- Tom then established that ordinary runtime errors already leave eslist stale, extended the reset to tstore and shutdown_reg, and supplied an active-execution flag with a regression test exercising repeated division-by-zero failures #8.
- The thread ended with Kirill approving the final patch #9; Tom subsequently committed #8 unchanged as 906b68217a, with a PostgreSQL 18 backport and no remaining patch work identified.