pgsql: Further fix for EvalPlanQual with mix of local and foreign parti

Поиск
Список
Период
Сортировка
От Etsuro Fujita
Тема pgsql: Further fix for EvalPlanQual with mix of local and foreign parti
Дата
Msg-id E1nFVWE-0001jB-9n@gemulon.postgresql.org
обсуждение исходный текст
Ответы Re: pgsql: Further fix for EvalPlanQual with mix of local and foreign parti  (Andres Freund <andres@anarazel.de>)
Список pgsql-committers
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

Branch
------
REL_14_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/7b0cec2fa05a123ed96163d7ac8485384570b3e0

Modified Files
--------------
src/backend/executor/nodeForeignscan.c | 30 +++++++++++++++++++++++++-----
1 file changed, 25 insertions(+), 5 deletions(-)


В списке pgsql-committers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: pgsql: Remove configure's check for rl_completion_append_character.
Следующее
От: Peter Eisentraut
Дата:
Сообщение: pgsql: Add UNIQUE null treatment option