postgresql/contrib/file_fdw
Amit Langote fab386f748 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 <exclusion@gmail.com>
Author: Amit Langote <amitlangote09@gmail.com>
Reviewed-by: Tender Wang <tndrwang@gmail.com>
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/19099-e05dcfa022fe553d%40postgresql.org
Backpatch-through: 14
2026-01-23 10:23:18 +09:00
..
data Add a DEFAULT option to COPY FROM 2023-03-13 10:01:56 -04:00
expected Fix bogus ctid requirement for dummy-root partitioned targets 2026-01-23 10:23:18 +09:00
sql Fix bogus ctid requirement for dummy-root partitioned targets 2026-01-23 10:23:18 +09:00
.gitignore Support "make check" in contrib 2011-04-25 22:27:11 +03:00
file_fdw--1.0.sql Throw a useful error message if an extension script file is fed to psql. 2011-10-12 15:45:03 -04:00
file_fdw.c Improve several permission-related error messages. 2023-03-17 10:33:09 +01:00
file_fdw.control Add contrib/file_fdw foreign-data wrapper for reading files via COPY. 2011-02-20 14:06:59 -05:00
Makefile Remove dynamic translation of regression test scripts, step 2. 2021-12-20 14:15:52 -05:00
meson.build Update copyright for 2023 2023-01-02 15:00:37 -05:00