postgresql/src/pl
Peter Eisentraut 7a3b7bbfde 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
9ee1cf04ab 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.sahu@enterprisedb.com>
Reviewed-by: Jonathan S. Katz <jkatz@postgresql.org>
2018-08-27 22:16:15 +02:00
..
plperl Allow plperl_sv_to_datum to look through scalar refs. 2018-06-18 15:31:57 -04:00
plpgsql Fix snapshot leak warning for some procedures 2018-08-27 22:16:15 +02:00
plpython Remove test for VA_ARGS, implied by C99. 2018-08-24 10:41:45 -07:00
tcl Deduplicate "invalid input syntax" messages for various types. 2018-07-22 14:58:01 -07:00
Makefile Make distprep and *clean build targets recurse into all subdirectories. 2011-07-03 13:55:12 -04:00