Initialize FOUND to false in PL/pgSQL event trigger functions. The documentation says that FOUND starts out false within each PL/pgSQL function call. plpgsql_exec_function() and plpgsql_exec_trigger() do set it so, but plpgsql_exec_event_trigger() did not, leaving it NULL until the first statement that sets it.
Fix this by initializing FOUND to false, as the other two entry points do. While at it, also set estate.err_text to "during function entry" during this action and the subsequent instrumentation plugin call, again to match the other two routines. Back-patch to v19, but no further. It seems unlikely that any user code is depending on the current behavior, but just in case, let's not touch the stable branches. Author: Jeevan Chalke <[email protected]> Reviewed-by: Tom Lane <[email protected]> Discussion: https://postgr.es/m/CAM2+6=U_=hzmgs1v1jj-xjk2bpbfqqpp9mnrdbp5roesow8...@mail.gmail.com Backpatch-through: 19 Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/1dc45adefa076e9377718ee9529b375a70108734 Modified Files -------------- src/pl/plpgsql/src/pl_exec.c | 7 +++++++ 1 file changed, 7 insertions(+)
