postgresql/src/backend
Heikki Linnakangas 6458ed18fe 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:13:38 +03:00
..
access Message style improvements 2021-08-07 12:09:22 +02:00
bootstrap Rethink definition of pg_attribute.attcompression. 2021-05-27 13:24:27 -04:00
catalog Add missing message punctuation 2021-08-06 22:11:02 +02:00
commands Use ExplainPropertyInteger for queryid in EXPLAIN 2021-08-09 15:46:28 +12:00
executor Fix segfault during EvalPlanQual with mix of local and foreign partitions. 2021-08-12 11:13:38 +03:00
foreign Update copyright for 2021 2021-01-02 13:06:25 -05:00
jit jit: Don't inline functions that access thread-locals. 2021-07-22 15:08:10 +12:00
lib Fix typo in comment 2021-04-20 14:35:16 +02:00
libpq Don't assume GSSAPI result strings are null-terminated. 2021-06-23 14:01:32 -04:00
main Update copyright for 2021 2021-01-02 13:06:25 -05:00
nodes Change the name of the Result Cache node to Memoize 2021-07-14 12:45:00 +12:00
optimizer Fix incorrect comment for get_agg_clause_costs 2021-07-26 14:56:09 +12:00
parser Don't elide casting to typmod -1. 2021-08-06 17:32:54 -04:00
partitioning Avoid using ambiguous word "non-negative" in error messages. 2021-07-28 01:21:35 +09:00
po Translation updates 2021-08-09 11:51:59 +02:00
port Initial pgindent and pgperltidy run for v14. 2021-05-12 13:14:10 -04:00
postmaster Remove unnecessary assertion in postmaster.c 2021-07-15 15:00:52 +09:00
regex Rethink regexp engine's backref-related compilation state. 2021-08-08 11:56:29 -04:00
replication Remove unused argument in apply_handle_commit_internal(). 2021-07-30 08:21:59 +05:30
rewrite Reject cases where a query in WITH rewrites to just NOTIFY. 2021-07-09 11:02:26 -04:00
snowball Update snowball 2021-02-19 08:10:15 +01:00
statistics Error message refactoring 2021-06-27 09:41:16 +02:00
storage Deduplicate choice of horizon for a relation procarray.c. 2021-07-24 20:30:26 -07:00
tcop Use elog, not Assert, to report failure to provide an outer snapshot. 2021-07-31 11:50:14 -04:00
tsearch Fix typos and grammar in comments and docs 2021-04-19 11:32:30 +09:00
utils Adjust the integer overflow tests in the numeric code. 2021-08-06 21:30:25 +01:00
.gitignore Add .gitignore entries for AIX-specific intermediate build artifacts. 2015-07-08 20:44:22 -04:00
common.mk Remove PARTIAL_LINKING build mode. 2018-03-30 17:33:04 -07:00
Makefile Use sort_template.h for qsort_tuple() and qsort_ssup(). 2021-03-03 17:02:32 +13:00
nls.mk Translation updates 2021-05-10 14:36:21 +02:00