pgsql: Fix thinko in plpgsql memory leak fix.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix thinko in plpgsql memory leak fix.
Date: 2020-12-28 16:41:39
Message-ID: E1ktvaV-00030K-Eq@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix thinko in plpgsql memory leak fix.

Commit a6b1f5365 intended to place the transient "target" list of
a CALL statement in the function's statement-lifespan context,
but I fat-fingered that and used get_eval_mcontext() instead of
get_stmt_mcontext(). The eval_mcontext belongs to the "simple
expression" infrastructure, which is destroyed at transaction end.
The net effect is that a CALL in a procedure to another procedure
that has OUT or INOUT parameters would fail if the called procedure
did a COMMIT.

Per report from Peter Eisentraut. Back-patch to v11, like the
prior patch.

Discussion: https://postgr.es/m/f075f7be-c654-9aa8-3ffc-e9214622f02a@enterprisedb.com

Branch
------
REL_12_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/fd1347f9d8def3a892a7335ec026bff0227db1af

Modified Files
--------------
src/pl/plpgsql/src/expected/plpgsql_call.out | 21 +++++++++++++++++++++
src/pl/plpgsql/src/pl_exec.c | 4 ++--
src/pl/plpgsql/src/sql/plpgsql_call.sql | 24 ++++++++++++++++++++++++
3 files changed, 47 insertions(+), 2 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2020-12-28 16:42:22 Re: pgsql: Fix memory leak in plpgsql's CALL processing.
Previous Message Bruce Momjian 2020-12-28 15:39:51 Re: pgsql: Add pg_alterckey utility to change the cluster key