pgsql: Initialize FOUND to false in PL/pgSQL event trigger functions.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Initialize FOUND to false in PL/pgSQL event trigger functions.
Date: 2026-10-26 21:15:41
Message-ID: E1xLS2f-00000000sqm-33bC@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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 <jeevan(dot)chalke(at)enterprisedb(dot)com>
Reviewed-by: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Discussion: https://postgr.es/m/CAM2+6=U_=hZmgs1v1JJ-XJk2bpbfqQPP9MNRDbp5RoEsOW8xsQ@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(+)

Browse pgsql-committers by date

  From Date Subject
Next Message Jeff Davis 2026-10-26 22:12:13 pgsql: Fix pg_iswcased() for some libc case mappings.
Previous Message Daniel Gustafsson 2026-10-26 21:10:33 pgsql: ssl: Don't disable SSL for all hosts when one SNI host fails to