Re: plpgsq_plugin's stmt_end() is not called when an error is caught - Mailing list pgsql-hackers

From Tom Lane
Subject Re: plpgsq_plugin's stmt_end() is not called when an error is caught
Date
Msg-id 3371138.1671119379@sss.pgh.pa.us
Whole thread Raw
In response to Re: plpgsq_plugin's stmt_end() is not called when an error is caught  (Masahiko Sawada <sawada.mshk@gmail.com>)
Responses Re: plpgsq_plugin's stmt_end() is not called when an error is caught  ("David G. Johnston" <david.g.johnston@gmail.com>)
Re: plpgsq_plugin's stmt_end() is not called when an error is caught  (Masahiko Sawada <sawada.mshk@gmail.com>)
List pgsql-hackers
Masahiko Sawada <sawada.mshk@gmail.com> writes:
> I don't think we need additional PG_TRY() for that since exec_stmts()
> is already called in PG_TRY() if there is an exception block. I meant
> to call stmt_end() in PG_CATCH() in exec_stmt_block() (i.e. only when
> an error is caught by the exception block). Currently, if an error is
> caught, we call stmt_begin() and stmt_end() for statements executed
> inside the exception block but call only stmt_begin() for the
> statement that raised an error.

I fail to see anything wrong with that.  We never completed execution
of the statement that raised an error, but calling stmt_end for it
would imply that we did.  I think changing this will break more things
than it fixes, completely independently of whatever cost it would add.

Or in other words: the initial complaint describes a bug in pg_hint_plan,
not one in plpgsql.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Matthias van de Meent
Date:
Subject: Re: New strategies for freezing, advancing relfrozenxid early
Next
From: Justin Pryzby
Date:
Subject: Re: [PATCH] psql: \dn+ to show size of each schema (and \dA+ for AMs)