postgresql/src
Heikki Linnakangas c3928b467a Fix segfault during EvalPlanQual with mix of local and foreign partitions.
It's not sensible to re-evaluate a direct-modify Foreign Update or Delete
during EvalPlanQual. However, ExecInitForeignScan() can still get called
if a table mixes local and foreign partitions. EvalPlanQualStart() left
the es_result_relations array uninitialized in the child EPQ EState, but
ExecInitForeignScan() still expected to find it. That caused a segfault.

Fix by skipping the es_result_relations lookup during EvalPlanQual
processing. To make things a bit more robust, also skip the
BeginDirectModify calls, and add a runtime check that ExecForeignScan()
is not called on direct-modify foreign scans during EvalPlanQual
processing.

This is new in v14, commit 1375422c78. Before that, EvalPlanQualStart()
copied the whole ResultRelInfo array to the EPQ EState. Backpatch to v14.

Report and diagnosis by Andrey Lepikhov.

Discussion: https://www.postgresql.org/message-id/cb2b808d-cbaa-4772-76ee-c8809bafcf3d%40postgrespro.ru
2021-08-12 11:02:29 +03:00
..
backend Fix segfault during EvalPlanQual with mix of local and foreign partitions. 2021-08-12 11:02:29 +03:00
bin Add tab completion for DECLARE .. ASENSITIVE in psql 2021-08-10 15:54:42 +09:00
common Simplify error handing of jsonapi.c for the frontend 2021-07-02 09:35:12 +09:00
fe_utils Skip trailing whitespaces when parsing integer options 2021-07-27 10:39:05 +09:00
include Let regexp_replace() make use of REG_NOSUB when feasible. 2021-08-09 20:53:25 -04:00
interfaces interval: round values when spilling to months 2021-08-03 12:10:29 -04:00
makefiles Add NO_INSTALL option to pgxs 2021-05-27 13:58:29 +02:00
pl Fix corner-case uninitialized-variable issues in plpgsql. 2021-07-20 13:01:48 -04:00
port Add POPCNT support for MSVC x86_64 builds 2021-08-09 15:23:48 +12:00
template
test Remove unused regression test certificate server-ss 2021-08-10 11:15:02 +02:00
timezone
tools Remove some special cases from MSVC build scripts 2021-08-09 19:45:26 +12:00
tutorial
.gitignore
DEVELOPERS
Makefile
Makefile.global.in Fix prove_installcheck to use correct paths when used with PGXS 2021-07-01 09:02:46 -04:00
Makefile.shlib
nls-global.mk