postgresql/src
Tom Lane a54a873207 Ensure that plpgsql cleans up cleanly during parallel-worker exit.
plpgsql_xact_cb ought to treat events XACT_EVENT_PARALLEL_COMMIT and
XACT_EVENT_PARALLEL_ABORT like XACT_EVENT_COMMIT and XACT_EVENT_ABORT
respectively, since its goal is to do process-local cleanup.  This
oversight caused plpgsql's end-of-transaction cleanup to not get done
in parallel workers.  Since a parallel worker will exit just after the
transaction cleanup, the effects of this are limited.  I couldn't find
any case in the core code with user-visible effects, but perhaps there
are some in extensions.  In any case it's wrong, so let's fix it before
it bites us not after.

In passing, add some comments around the handling of expression
evaluation resources in DO blocks.  There's no live bug there, but it's
quite unobvious what's happening; at least I thought so.  This isn't
related to the other issue, except that I found both things while poking
at expression-evaluation performance.

Back-patch the plpgsql_xact_cb fix to 9.5 where those event types
were introduced, and the DO-block commentary to v11 where DO blocks
gained the ability to issue COMMIT/ROLLBACK.

Discussion: https://postgr.es/m/10353.1585247879@sss.pgh.pa.us
2020-03-26 18:06:55 -04:00
..
backend Drop slot's LWLock before returning from SaveSlotToPath() 2020-03-26 13:31:07 +01:00
bin pg_upgrade: make get_major_server_version() err msg consistent 2020-03-19 15:20:55 -04:00
common Fix command-line colorization on Windows with VT100-compatible environments 2020-03-02 15:46:24 +09:00
fe_utils Fix parallel restore of FKs to partitioned tables 2019-10-17 09:58:01 +02:00
include Re-implement the ereport() macro using __VA_ARGS__. 2020-03-24 11:48:33 -04:00
interfaces Stamp 12.2. 2020-02-10 17:14:51 -05:00
makefiles Select CFLAGS_SL at configure time, not in platform-specific Makefiles. 2019-10-21 12:32:35 -04:00
pl Ensure that plpgsql cleans up cleanly during parallel-worker exit. 2020-03-26 18:06:55 -04:00
port Fix our getopt_long's behavior for a command line argument of just "-". 2020-03-23 11:58:01 -04:00
template Select CFLAGS_SL at configure time, not in platform-specific Makefiles. 2019-10-21 12:32:35 -04:00
test Add regression tests for constraint errors in partitioned tables. 2020-03-23 14:52:17 -07:00
timezone Update time zone data files to tzdata release 2019c. 2019-09-20 19:53:52 -04:00
tools Turn off deprecated bison warnings under MSVC 2020-03-20 14:02:05 -04:00
tutorial Phase 2 pgindent run for v12. 2019-05-22 13:04:48 -04:00
.gitignore
DEVELOPERS
Makefile Fix partial-build problems introduced by having more generated headers. 2018-04-09 16:42:10 -04:00
Makefile.global.in Select CFLAGS_SL at configure time, not in platform-specific Makefiles. 2019-10-21 12:32:35 -04:00
Makefile.shlib Ensure static libraries have correct mod time even if ranlib messes it up. 2018-11-29 15:53:44 -05:00
nls-global.mk NLS: Fix backend gettext triggers 2019-09-23 09:05:50 +02:00