pgsql: Fix interaction of foreign tuple routing with remote triggers.

Поиск
Список
Период
Сортировка
От Robert Haas
Тема pgsql: Fix interaction of foreign tuple routing with remote triggers.
Дата
Msg-id E1fDZFR-0001VV-F2@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Fix interaction of foreign tuple routing with remote triggers.

Without these fixes, changes to the inserted tuple made by remote
triggers are ignored when building local RETURNING tuples.

In the core code, call ExecInitRoutingInfo at a later point from
within ExecInitPartitionInfo so that the FDW callback gets invoked
after the returning list has been built.  But move CheckValidResultRel
out of ExecInitRoutingInfo so that it can happen at an earlier stage.

In postgres_fdw, refactor assorted deparsing functions to work with
the RTE rather than the PlannerInfo, which saves us having to
construct a fake PlannerInfo in cases where we don't have a real one.
Then, we can pass down a constructed RTE that yields the correct
deparse result when no real one exists.  Unfortunately, this
necessitates a hack that understands how the core code manages RT
indexes for update tuple routing, which is ugly, but we don't have a
better idea right now.

Original report, analysis, and patch by Etsuro Fujita.  Heavily
refactored by me.  Then worked over some more by Amit Langote.

Discussion: http://postgr.es/m/5AD4882B.10002@lab.ntt.co.jp

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/37a3058bc7c8224d4c0d8b36176d821636a1f90e

Modified Files
--------------
contrib/postgres_fdw/deparse.c                 | 58 +++++++---------
contrib/postgres_fdw/expected/postgres_fdw.out | 93 ++++++++++++++++++++++++++
contrib/postgres_fdw/postgres_fdw.c            | 65 ++++++++++++------
contrib/postgres_fdw/postgres_fdw.h            |  6 +-
contrib/postgres_fdw/sql/postgres_fdw.sql      | 49 ++++++++++++++
src/backend/executor/execPartition.c           | 19 +++---
src/backend/executor/nodeModifyTable.c         | 14 ++--
7 files changed, 234 insertions(+), 70 deletions(-)


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: pgsql: Remove jsonb_plperl test cases for Inf/NaN conversions.
Следующее
От: Tom Lane
Дата:
Сообщение: Re: pgsql: Prevent infinity and NaN in jsonb/plperl transform