From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Initialize FOUND to false in PL/pgSQL event trigger functions.
Date: Mon, 26 Oct 2026 21:15:41 +0000
Message-ID: <E1xLS2f-00000000sqo-3871@gemulon.postgresql.org> (raw)
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.chalke@enterprisedb.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/CAM2+6=U_=hZmgs1v1JJ-XJk2bpbfqQPP9MNRDbp5RoEsOW8xsQ@mail.gmail.com
Backpatch-through: 19
Branch
------
REL_19_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/56d9ecf6bd882a16afbeae7b8f740f9febcf420c
Modified Files
--------------
src/pl/plpgsql/src/pl_exec.c | 7 +++++++
1 file changed, 7 insertions(+)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: tgl@sss.pgh.pa.us
Subject: Re: pgsql: Initialize FOUND to false in PL/pgSQL event trigger functions.
In-Reply-To: <E1xLS2f-00000000sqo-3871@gemulon.postgresql.org>
References: <E1xLS2f-00000000sqo-3871@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox