postgresql/src/include/optimizer
Etsuro Fujita 9edf72aa76 Disallow replacing joins with scans in problematic cases.
Commit e7cb7ee14, which introduced the infrastructure for FDWs and
custom scan providers to replace joins with scans, failed to add support
handling of pseudoconstant quals assigned to replaced joins in
createplan.c, leading to an incorrect plan without a gating Result node
when postgres_fdw replaced a join with such a qual.

To fix, we could add the support by 1) modifying the ForeignPath and
CustomPath structs to store the list of RestrictInfo nodes to apply to
the join, as in JoinPaths, if they represent foreign and custom scans
replacing a join with a scan, and by 2) modifying create_scan_plan() in
createplan.c to use that list in that case, instead of the
baserestrictinfo list, to get pseudoconstant quals assigned to the join;
but #1 would cause an ABI break.  So fix by modifying the infrastructure
to just disallow replacing joins with such quals.

Back-patch to all supported branches.

Reported by Nishant Sharma.  Patch by me, reviewed by Nishant Sharma and
Richard Guo.

Discussion: https://postgr.es/m/CADrsxdbcN1vejBaf8a%2BQhrZY5PXL-04mCd4GDu6qm6FigDZd6Q%40mail.gmail.com
2023-07-28 15:45:08 +09:00
..
appendinfo.h Phase 2 pgindent run for v12. 2019-05-22 13:04:48 -04:00
clauses.h Fix pull_varnos' miscomputation of relids set for a PlaceHolderVar. 2021-01-21 15:37:23 -05:00
cost.h Fix many typos and inconsistencies 2019-07-01 10:00:23 +09:00
geqo.h Phase 2 pgindent run for v12. 2019-05-22 13:04:48 -04:00
geqo_copy.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
geqo_gene.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
geqo_misc.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
geqo_mutation.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
geqo_pool.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
geqo_random.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
geqo_recombination.h Phase 2 pgindent run for v12. 2019-05-22 13:04:48 -04:00
geqo_selection.h Phase 2 pgindent run for v12. 2019-05-22 13:04:48 -04:00
inherit.h Phase 2 pgindent run for v12. 2019-05-22 13:04:48 -04:00
joininfo.h Phase 2 pgindent run for v12. 2019-05-22 13:04:48 -04:00
optimizer.h Fix pull_varnos' miscomputation of relids set for a PlaceHolderVar. 2021-01-21 15:37:23 -05:00
orclauses.h Rename nodes/relation.h to nodes/pathnodes.h. 2019-01-29 16:49:25 -05:00
paramassign.h Phase 2 pgindent run for v12. 2019-05-22 13:04:48 -04:00
pathnode.h Fix many typos and inconsistencies 2019-07-01 10:00:23 +09:00
paths.h Fix pull_varnos' miscomputation of relids set for a PlaceHolderVar. 2021-01-21 15:37:23 -05:00
placeholder.h Fix more typos and inconsistencies in the tree 2019-06-17 16:13:16 +09:00
plancat.h Phase 2 pgindent run for v12. 2019-05-22 13:04:48 -04:00
planmain.h Fix pull_varnos' miscomputation of relids set for a PlaceHolderVar. 2021-01-21 15:37:23 -05:00
planner.h Phase 2 pgindent run for v12. 2019-05-22 13:04:48 -04:00
prep.h Rename nodes/relation.h to nodes/pathnodes.h. 2019-01-29 16:49:25 -05:00
restrictinfo.h Disallow replacing joins with scans in problematic cases. 2023-07-28 15:45:08 +09:00
subselect.h Fix MULTIEXPR_SUBLINK with partitioned target tables, yet again. 2023-02-25 14:44:14 -05:00
tlist.h Phase 2 pgindent run for v12. 2019-05-22 13:04:48 -04:00