pgsql: Fix bogus ctid requirement for dummy-root partitioned targets
pgsql: Fix bogus ctid requirement for dummy-root partitioned targets
От:
Amit Langote <amitlan@postgresql.org>
Дата:
Fix bogus ctid requirement for dummy-root partitioned targets ExecInitModifyTable() unconditionally required a ctid junk column even when the target was a partitioned table. This led to spurious "could not find junk ctid column" errors when all children were excluded and only the dummy root result relation remained. A partitioned table only appears in the result relations list when all leaf partitions have been pruned, leaving the dummy root as the sole entry. Assert this invariant (nrels == 1) and skip the ctid requirement. Also adjust ExecModifyTable() to tolerate invalid ri_RowIdAttNo for partitioned tables, which is safe since no rows will be processed in this case. Bug: #19099 Reported-by: Alexander Lakhin Author: Amit Langote Reviewed-by: Tender Wang Reviewed-by: Kirill Reshke Reviewed-by: Tom Lane Discussion: https://postgr.es/m/19099-e05dcfa022fe553d%40postgresql.org Backpatch-through: 14 Branch ------ REL_15_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/687533b39ecf437388821eed5e93a277c0170853 Modified Files -------------- contrib/file_fdw/expected/file_fdw.out | 15 +++++++++++++++ contrib/file_fdw/sql/file_fdw.sql | 18 ++++++++++++++++++ src/backend/executor/nodeModifyTable.c | 19 ++++++++++++++++--- 3 files changed, 49 insertions(+), 3 deletions(-)