model-writtenrun 7293 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Mikhail Gribkov reported three returns inside PL/Python PG_TRY blocks that could leave the exception stack invalid, and separately questioned error handling in jsonb_plpython PG_CATCH code #1.
- Tom Lane confirmed that returning or jumping out of PG_TRY is unsafe, but explained that PG_CATCH and PG_FINALLY restore the relevant state before executing their handlers #2.
- Mikhail Gribkov submitted a minimal patch replacing the three returns with jumps to the ends of their PG_TRY bodies and requested feedback; the supplied thread ends with that proposal awaiting review #3.
- Nathan Bossart subsequently committed Xing Guo's implementation from the later patchset #534325 in thread #47255, with light edits, moving allocations and failure returns before PG_TRY and adding cleanup for the preallocated trigger argument list; the commit credits Mikhail Gribkov as a reporter and links this discussion, but does not derive from its attached patch 57d0051706.
- The committed change addresses the PL/Python returns, was backpatched through PostgreSQL 11, and explicitly leaves compile-time prevention of unsafe PG_TRY exits for future work 57d0051706.