From: | Peter Eisentraut <peter_e(at)gmx(dot)net> |
---|---|
To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
Subject: | pgsql: Fix snapshot leak warning for some procedures |
Date: | 2018-08-27 20:57:29 |
Message-ID: | E1fuOZl-0006vP-PJ@gemulon.postgresql.org |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
Fix snapshot leak warning for some procedures
The problem arises with the combination of CALL with output parameters
and doing a COMMIT inside the procedure. When a CALL has output
parameters, the portal uses the strategy PORTAL_UTIL_SELECT instead of
PORTAL_MULTI_QUERY. Using PORTAL_UTIL_SELECT causes the portal's
snapshot to be registered with the current resource
owner (portal->holdSnapshot); see
9ee1cf04ab6bcefe03a11837b53f29ca9dc24c7a for the reason.
Normally, PortalDrop() unregisters the snapshot. If not, then
ResourceOwnerRelease() will print a warning about a snapshot leak on
transaction commit. A transaction commit normally drops all
portals (PreCommit_Portals()), except the active portal. So in case of
the active portal, we need to manually release the snapshot to avoid the
warning.
Reported-by: Prabhat Sahu <prabhat(dot)sahu(at)enterprisedb(dot)com>
Reviewed-by: Jonathan S. Katz <jkatz(at)postgresql(dot)org>
Branch
------
REL_11_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/2657d4ea66c775c3334181722115be2d6128c5cd
Modified Files
--------------
src/backend/utils/mmgr/portalmem.c | 14 ++++++++--
.../plpgsql/src/expected/plpgsql_transaction.out | 30 ++++++++++++++++++++++
src/pl/plpgsql/src/sql/plpgsql_transaction.sql | 25 ++++++++++++++++++
3 files changed, 67 insertions(+), 2 deletions(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Thomas Munro | 2018-08-28 00:36:35 | pgsql: Code review for simplehash.h. |
Previous Message | Tom Lane | 2018-08-27 19:11:27 | pgsql: Fix missing dependency for pg_dump's ENABLE ROW LEVEL SECURITY i |