Re: PL/Python: Fix return in the middle of PG_TRY() block. - Mailing list pgsql-hackers

From Tom Lane
Subject Re: PL/Python: Fix return in the middle of PG_TRY() block.
Date
Msg-id 1864041.1673882943@sss.pgh.pa.us
Whole thread Raw
In response to Re: PL/Python: Fix return in the middle of PG_TRY() block.  (Xing Guo <higuoxing@gmail.com>)
Responses Re: PL/Python: Fix return in the middle of PG_TRY() block.
Re: PL/Python: Fix return in the middle of PG_TRY() block.
List 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



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: pgsql: Add new GUC createrole_self_grant.
Next
From: "David G. Johnston"
Date:
Subject: Re: pgsql: Add new GUC createrole_self_grant.