postgresql/src/backend
Etsuro Fujita f862d57057 Further fix for EvalPlanQual with mix of local and foreign partitions.
We assume that direct-modify ForeignScan nodes cannot be re-evaluated
during EvalPlanQual processing, but the rework for inherited
UPDATE/DELETE in commit 86dc90056 changed things, without considering
that, so that such ForeignScan nodes get called as part of the
EvalPlanQual subtree during EvalPlanQual processing in the case of an
inherited UPDATE/DELETE where the inheritance set contains foreign
target relations.  To avoid re-evaluating such ForeignScan nodes during
EvalPlanQual processing, commit c3928b467 modified nodeForeignscan.c,
but the assumption made there that ExecForeignScan() should never be
called for such ForeignScan nodes during EvalPlanQual processing turned
out to be wrong in some cases, leading to a segmentation fault or a
"cannot re-evaluate a Foreign Update or Delete during EvalPlanQual"
error.

Fix by modifying nodeForeignscan.c further to avoid re-evaluating such
ForeignScan nodes even in ExecForeignScan()/ExecReScanForeignScan()
during EvalPlanQual processing.  Since this makes non-reachable the
test-and-elog added to ForeignNext() by commit c3928b467 that produced
the aforesaid error, convert the test-and-elog to an Assert.

Per bug #17355 from Alexander Lakhin.  Back-patch to v14 where both
commits came in.

Patch by me, reviewed and tested by Alexander Lakhin and Amit Langote.

Discussion: https://postgr.es/m/17355-de8e362eb7001a96@postgresql.org
2022-02-03 15:15:00 +09:00
..
access Remove xloginsert.h from xlog.h 2022-01-30 12:25:24 -03:00
bootstrap pg_upgrade: Preserve relfilenodes and tablespace OIDs. 2022-01-17 13:40:27 -05:00
catalog Change collate and ctype fields to type text 2022-01-27 08:54:25 +01:00
commands Some cleanup for change of collate and ctype fields to type text 2022-02-02 11:58:55 +01:00
executor Further fix for EvalPlanQual with mix of local and foreign partitions. 2022-02-03 15:15:00 +09:00
foreign Update copyright for 2022 2022-01-07 19:04:57 -05:00
jit Update copyright for 2022 2022-01-07 19:04:57 -05:00
lib Update copyright for 2022 2022-01-07 19:04:57 -05:00
libpq Fix pg_hba_file_rules for authentication method cert 2022-01-26 09:58:59 +01:00
main windows: Improve crash / assert / exception handling. 2022-02-02 18:33:25 -08:00
nodes Fix for new Boolean node 2022-01-17 13:59:46 +01:00
optimizer Consider parallel awareness when removing single-child Appends 2022-01-25 21:10:03 +13:00
parser Fix failure to validate the result of select_common_type(). 2022-01-29 11:41:18 -05:00
partitioning Update copyright for 2022 2022-01-07 19:04:57 -05:00
po Translation updates 2021-06-21 12:33:50 +02:00
port Update copyright for 2022 2022-01-07 19:04:57 -05:00
postmaster Fix comments about bgworker registration before MaxBackends initialization 2022-01-29 10:47:36 +09:00
regex Call pg_newlocale_from_collation() also with default collation 2022-01-20 09:50:18 +01:00
replication Fix server crash bug in 'server' backup target. 2022-02-02 13:50:33 -05:00
rewrite Update copyright for 2022 2022-01-07 19:04:57 -05:00
snowball Update copyright for 2022 2022-01-07 19:04:57 -05:00
statistics Fix various typos, grammar and code style in comments and docs 2022-01-25 09:40:04 +09:00
storage Remove xloginsert.h from xlog.h 2022-01-30 12:25:24 -03:00
tcop Update copyright for 2022 2022-01-07 19:04:57 -05:00
tsearch Update copyright for 2022 2022-01-07 19:04:57 -05:00
utils Simplify coding around path_contains_parent_reference(). 2022-01-31 13:53:38 -05:00
.gitignore Add .gitignore entries for AIX-specific intermediate build artifacts. 2015-07-08 20:44:22 -04:00
Makefile Server-side gzip compression. 2022-01-24 15:13:18 -05:00
common.mk Remove PARTIAL_LINKING build mode. 2018-03-30 17:33:04 -07:00
nls.mk Report progress of startup operations that take a long time. 2021-10-25 11:51:57 -04:00