Avoid ABI break in ModifyTableState from the FDW pruning fix

Commit 1ef917e3a6 fixed the re-indexing of ModifyTable's FDW arrays
when initial runtime pruning removes result relations, but it did so
by adding a new mt_fdwPrivLists field to ModifyTableState.  Although
the field was placed at the end of the struct to keep the offsets of
existing fields stable, it still enlarges sizeof(ModifyTableState),
which the ABI compliance check flags on the buildfarm (e.g. crake).

The field existed only so that show_modifytable_info() could recover the
re-indexed fdw_private after executor startup; the executor-side fix in
ExecInitModifyTable() that actually prevents the crash does not depend on
it.  Remove the field and have show_modifytable_info() instead look up
each kept relation's fdw_private from the original, pre-pruning
node->fdwPrivLists, which is parallel to node->resultRelations and left
intact by pruning.  When nothing was pruned the lookup is a direct index;
otherwise it matches on the range table index.

This is applied to REL_18 only; master keeps the mt_fdwPrivLists field
and is unaffected, so the two diverge slightly here.

Reported on the buildfarm (member crake).

Per a suggestion from Tom Lane.

Reviewed-by: Etsuro Fujita <[email protected]>
Discussion: 
https://postgr.es/m/ca+hiwqehe7-v5q0-ooow3rao4voycgk-jfinbyewxwutdgs...@mail.gmail.com

Branch
------
REL_18_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/bba4e095d25005dd0b2f180187ff2c2adf48a3b3

Modified Files
--------------
src/backend/commands/explain.c         | 36 +++++++++++++++++++++++++++++++++-
src/backend/executor/nodeModifyTable.c |  1 -
src/include/nodes/execnodes.h          |  8 +++-----
3 files changed, 38 insertions(+), 7 deletions(-)

Reply via email to