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

2022-12-15 Thread Masahiko Sawada
On Fri, Dec 16, 2022 at 12:49 AM Tom Lane wrote: > > Masahiko Sawada 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 whe

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

2022-12-15 Thread David G. Johnston
On Thu, Dec 15, 2022 at 8:49 AM Tom Lane wrote: > Masahiko Sawada 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

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

2022-12-15 Thread Tom Lane
Masahiko Sawada 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, i

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

2022-12-15 Thread Pavel Stehule
čt 15. 12. 2022 v 12:51 odesílatel Masahiko Sawada napsal: > On Thu, Dec 15, 2022 at 4:53 PM Kyotaro Horiguchi > wrote: > > > > At Thu, 15 Dec 2022 08:41:21 +0100, Pavel Stehule < > pavel.steh...@gmail.com> wrote in > > > čt 15. 12. 2022 v 8:25 odesílatel Masahiko Sawada < > sawada.m...@gmail.co

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

2022-12-15 Thread Masahiko Sawada
On Thu, Dec 15, 2022 at 4:53 PM Kyotaro Horiguchi wrote: > > At Thu, 15 Dec 2022 08:41:21 +0100, Pavel Stehule > wrote in > > čt 15. 12. 2022 v 8:25 odesílatel Masahiko Sawada > > napsal: > > > Is this a bug in plpgsql? > > > > > > > I think it is by design. There is not any callback that is c

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

2022-12-15 Thread Pavel Stehule
čt 15. 12. 2022 v 9:34 odesílatel Kyotaro Horiguchi napsal: > At Thu, 15 Dec 2022 09:03:12 +0100, Pavel Stehule > wrote in > > I found some solution based by using fmgr hook > > > > > https://github.com/okbob/plpgsql_check/commit/9a17e97354a48913de5219048ee3be6f8460bae9 > > Oh! Thanks for the po

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

2022-12-15 Thread Kyotaro Horiguchi
At Thu, 15 Dec 2022 09:03:12 +0100, Pavel Stehule wrote in > I found some solution based by using fmgr hook > > https://github.com/okbob/plpgsql_check/commit/9a17e97354a48913de5219048ee3be6f8460bae9 Oh! Thanks for the pointer, will look into that. By the way, It seems to me that the tool is u

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

2022-12-15 Thread Pavel Stehule
čt 15. 12. 2022 v 8:53 odesílatel Kyotaro Horiguchi napsal: > At Thu, 15 Dec 2022 08:41:21 +0100, Pavel Stehule > wrote in > > čt 15. 12. 2022 v 8:25 odesílatel Masahiko Sawada > > > napsal: > > > Is this a bug in plpgsql? > > > > > > > I think it is by design. There is not any callback that i

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

2022-12-14 Thread Kyotaro Horiguchi
At Thu, 15 Dec 2022 08:41:21 +0100, Pavel Stehule wrote in > čt 15. 12. 2022 v 8:25 odesílatel Masahiko Sawada > 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 statemen

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

2022-12-14 Thread Pavel Stehule
čt 15. 12. 2022 v 8:25 odesílatel Masahiko Sawada napsal: > Hi, > > While investigating the issue reported on pg_hint_plan[1], I realized > that stmt_end() callback is not called if an error raised during the > statement execution is caught. I've attached the patch to check when > stmt_beg() and

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

2022-12-14 Thread Masahiko Sawada
Hi, While investigating the issue reported on pg_hint_plan[1], I realized that stmt_end() callback is not called if an error raised during the statement execution is caught. I've attached the patch to check when stmt_beg() and stmt_end() are called. Here is an example: postgres(1:3220232)=# creat