Re: PL/Python: Fix return in the middle of PG_TRY() block.
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Xing Guo <higuoxing@gmail.com>
Cc: Nathan Bossart <nathandbossart@gmail.com>,
Andres Freund <andres@anarazel.de>, pgsql-hackers@postgresql.org
Date: 2023-01-16T15:29:03Z
Lists: pgsql-hackers
Xing Guo <higuoxing@gmail.com> writes: > Are there any unsafe codes in pltcl.c? The return statement is in the > PG_CATCH() block, I think the exception stack has been recovered in > PG_CATCH block so the return statement in PG_CATCH block should be ok? Yes, the stack has already been unwound at the start of a PG_CATCH (or PG_FINALLY) block, so there is no reason to avoid returning out of those. In principle you could also mess things up with a "continue", "break", or "goto" leading out of PG_TRY. That's probably far less likely than "return", but I wonder whether Andres' compiler hack will catch that. regards, tom lane
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Move return statements out of PG_TRY blocks.
- 0af386b0f4b8 11.20 landed
- 24964394a972 12.15 landed
- 800531846ef7 13.11 landed
- 52c9cf3239b8 14.8 landed
- 825ebc9848fd 15.3 landed
- 57d0051706b8 16.0 landed