Re: plpgsq_plugin's stmt_end() is not called when an error is caught

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
Cc: sawada(dot)mshk(at)gmail(dot)com, pgsql-hackers(at)postgresql(dot)org
Subject: Re: plpgsq_plugin's stmt_end() is not called when an error is caught
Date: 2022-12-15 08:03:12
Message-ID: CAFj8pRDoZnaszD3Jd=M-6Nxz2h2PqqAv0iLDBrm1NnJQzs3mGg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

čt 15. 12. 2022 v 8:53 odesílatel Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
napsal:

> At Thu, 15 Dec 2022 08:41:21 +0100, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
> wrote in
> > čt 15. 12. 2022 v 8:25 odesílatel Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com
> >
> > napsal:
> > > Is this a bug in plpgsql?
> > >
> >
> > I think it is by design. There is not any callback that is called after
> an
> > exception.
> >
> > It is true, so some callbacks on statement error and function's error can
> > be nice. It can help me to implement profilers, or tracers more simply
> and
> > more robustly.
> >
> > But I am not sure about performance impacts. This is on a critical path.
>
> I didn't searched for, but I guess all of the end-side callback of all
> begin-end type callbacks are not called on exception. Additional
> PG_TRY level wouldn't be acceptable for performance reasons.
>
> What we (pg_hint_plan people) want is any means to know that the
> top-level function is exited, to reset function nest level. It would
> be simpler than calling end callback at every nest level.
>
>
I found some solution based by using fmgr hook

https://github.com/okbob/plpgsql_check/commit/9a17e97354a48913de5219048ee3be6f8460bae9

regards

Pavel

regards.
>
> --
> Kyotaro Horiguchi
> NTT Open Source Software Center
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Hayato Kuroda (Fujitsu) 2022-12-15 08:12:52 RE: Time delayed LR (WAS Re: logical replication restrictions)
Previous Message Kyotaro Horiguchi 2022-12-15 07:53:25 Re: plpgsq_plugin's stmt_end() is not called when an error is caught