postgresql/src/include/optimizer
Etsuro Fujita d642d23064 Disallow collecting transition tuples from child foreign tables.
Commit 9e6104c66 disallowed transition tables on foreign tables, but
failed to account for cases where a foreign table is a child table of a
partitioned/inherited table on which transition tables exist, leading to
incorrect transition tuples collected from such foreign tables for
queries on the parent table triggering transition capture.  This
occurred not only for inherited UPDATE/DELETE but for partitioned INSERT
later supported by commit 3d956d956, which should have handled it at
least for the INSERT case, but didn't.

To fix, modify ExecAR*Triggers to throw an error if the given relation
is a foreign table requesting transition capture.  Also, this commit
fixes make_modifytable so that in case of an inherited UPDATE/DELETE
triggering transition capture, FDWs choose normal operations to modify
child foreign tables, not DirectModify; which is needed because they
would otherwise skip the calls to ExecAR*Triggers at execution, causing
unexpected behavior.

Author: Etsuro Fujita <etsuro.fujita@gmail.com>
Reviewed-by: Amit Langote <amitlangote09@gmail.com>
Discussion: https://postgr.es/m/CAPmGK14QJYikKzBDCe3jMbpGENnQ7popFmbEgm-XTNuk55oyHg%40mail.gmail.com
Backpatch-through: 13
2025-08-08 10:50:03 +09:00
..
appendinfo.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
clauses.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
cost.h Revert "Optimize order of GROUP BY keys". 2022-10-03 10:56:16 -04:00
geqo.h Apply PGDLLIMPORT markings broadly. 2022-04-08 08:16:38 -04:00
geqo_copy.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
geqo_gene.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
geqo_misc.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
geqo_mutation.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
geqo_pool.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
geqo_random.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
geqo_recombination.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
geqo_selection.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
inherit.h Fix calculation of which GENERATED columns need to be updated. 2023-01-05 14:12:17 -05:00
joininfo.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
optimizer.h Ensure we preprocess expressions before checking their volatility. 2023-11-16 10:05:14 -05:00
orclauses.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
paramassign.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
pathnode.h Teach planner and executor about monotonic window funcs 2022-04-08 10:34:36 +12:00
paths.h Revert "Optimize order of GROUP BY keys". 2022-10-03 10:56:16 -04:00
placeholder.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
plancat.h Disallow collecting transition tuples from child foreign tables. 2025-08-08 10:50:03 +09:00
planmain.h Account for optimized MinMax aggregates during SS_finalize_plan. 2024-05-18 14:31:35 -04:00
planner.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
prep.h Add support for MERGE SQL command 2022-03-28 16:47:48 +02:00
restrictinfo.h Disallow replacing joins with scans in problematic cases. 2023-07-28 15:45:02 +09:00
subselect.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
tlist.h Update copyright for 2022 2022-01-07 19:04:57 -05:00