postgresql/src/backend
Tom Lane 0075d78947 Allow "internal" subtransactions in parallel mode.
Allow use of BeginInternalSubTransaction() in parallel mode, so long
as the subtransaction doesn't attempt to acquire an XID or increment
the command counter.  Given those restrictions, the other parallel
processes don't need to know about the subtransaction at all, so
this should be safe.  The benefit is that it allows subtransactions
intended for error recovery, such as pl/pgsql exception blocks,
to be used in PARALLEL SAFE functions.

Another reason for doing this is that the API of
BeginInternalSubTransaction() doesn't allow reporting failure.
pl/python for one, and perhaps other PLs, copes very poorly with an
error longjmp out of BeginInternalSubTransaction().  The headline
feature of this patch removes the only easily-triggerable failure
case within that function.  There remain some resource-exhaustion
and similar cases, which we now deal with by promoting them to FATAL
errors, so that callers need not try to clean up.  (It is likely
that such errors would leave us with corrupted transaction state
inside xact.c, making recovery difficult if not impossible anyway.)

Although this work started because of a report of a pl/python crash,
we're not going to do anything about that in the back branches.
Back-patching this particular fix is obviously not very wise.
While we could contemplate some narrower band-aid, pl/python is
already an untrusted language, so it seems okay to classify this
as a "so don't do that" case.

Patch by me, per report from Hao Zhang.  Thanks to Robert Haas for
review.

Discussion: https://postgr.es/m/CALY6Dr-2yLVeVPhNMhuBnRgOZo1UjoTETgtKBx1B2gUi8yy+3g@mail.gmail.com
2024-03-28 12:43:10 -04:00
..
access Allow "internal" subtransactions in parallel mode. 2024-03-28 12:43:10 -04:00
archive Add macro for customizing an archiving WARNING message. 2024-03-04 15:41:42 -06:00
backup Revert "Temporary patch to help debug pg_walsummary test failures." 2024-03-20 11:34:00 -05:00
bootstrap Remove unused #include's from backend .c files 2024-03-04 12:02:20 +01:00
catalog Change last_inactive_time to inactive_since in pg_replication_slots. 2024-03-27 09:27:44 +05:30
commands ALTER TABLE: rework determination of access method ID 2024-03-28 16:51:20 +01:00
executor Fix unnecessary use of moving-aggregate mode with non-moving frame. 2024-03-27 13:39:03 -04:00
foreign Remove unused #include's from backend .c files 2024-03-04 12:02:20 +01:00
jit Add SQL/JSON query functions 2024-03-21 17:07:03 +09:00
lib Remove unused #include's from backend .c files 2024-03-04 12:02:20 +01:00
libpq Revert "Add notBefore and notAfter to SSL cert info display" 2024-03-22 22:58:41 +01:00
main Remove unused #include's from backend .c files 2024-03-04 12:02:20 +01:00
nodes Do not output actual value of location fields in node serialization by default 2024-03-22 09:49:12 +01:00
optimizer Update comment in set_dummy_rel_pathlist(). 2024-03-28 11:44:00 -04:00
parser Allow planner to use Merge Append to efficiently implement UNION 2024-03-25 14:31:14 +13:00
partitioning Remove unused #include's from backend .c files 2024-03-04 12:02:20 +01:00
po Update copyright for 2024 2024-01-03 20:49:05 -05:00
port Remove unused #include's from backend .c files 2024-03-04 12:02:20 +01:00
postmaster Avoid overflow in MaybeRemoveOldWalSummaries(). 2024-03-20 13:31:58 -05:00
regex Support C.UTF-8 locale in the new builtin collation provider. 2024-03-19 15:24:41 -07:00
replication Change last_inactive_time to inactive_since in pg_replication_slots. 2024-03-27 09:27:44 +05:30
rewrite Add RETURNING support to MERGE. 2024-03-17 13:58:59 +00:00
snowball Remove unused #include's from backend .c files 2024-03-04 12:02:20 +01:00
statistics Make stxstattarget nullable 2024-03-17 12:26:26 +01:00
storage Rework lwlocknames.txt to become lwlocklist.h 2024-03-20 11:55:20 +01:00
tcop Do not output actual value of location fields in node serialization by default 2024-03-22 09:49:12 +01:00
tsearch Remove unused #include's from backend .c files 2024-03-04 12:02:20 +01:00
utils Rename COMPAT_OPTIONS_CLIENT to COMPAT_OPTIONS_OTHER. 2024-03-27 10:45:28 -04:00
.gitignore
Makefile Rework lwlocknames.txt to become lwlocklist.h 2024-03-20 11:55:20 +01:00
common.mk Blind attempt to fix LLVM dependency in the backend 2022-09-15 10:53:48 +07:00
meson.build Remove AIX support 2024-02-28 15:17:23 +04:00
nls.mk Remove distprep 2023-11-06 15:18:04 +01:00