postgresql/src/include/optimizer
Etsuro Fujita 730f983eff 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:06 +09:00
..
appendinfo.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
clauses.h Fix pull_varnos' miscomputation of relids set for a PlaceHolderVar. 2021-01-21 15:37:23 -05:00
cost.h Remove hashagg_avoid_disk_plan GUC. 2020-07-27 17:53:17 -07:00
geqo.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
geqo_copy.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
geqo_gene.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
geqo_misc.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
geqo_mutation.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
geqo_pool.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
geqo_random.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
geqo_recombination.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
geqo_selection.h Update copyrights for 2020 2020-01-01 12:21:45 -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 copyrights for 2020 2020-01-01 12:21:45 -05:00
optimizer.h Fix incorrect tests for SRFs in relation_can_be_sorted_early(). 2022-08-03 17:33:42 -04:00
orclauses.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
paramassign.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
pathnode.h Fix missing outfuncs.c support for IncrementalSortPath. 2020-11-30 16:33:09 -05:00
paths.h Fix planner failure in some cases of sorting by an aggregate. 2021-04-20 11:32:02 -04:00
placeholder.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
plancat.h Fix calculation of which GENERATED columns need to be updated. 2023-01-05 14:12:17 -05:00
planmain.h Fix pull_varnos' miscomputation of relids set for a PlaceHolderVar. 2021-01-21 15:37:23 -05:00
planner.h Allow the planner-related functions and hook to accept the query string. 2020-03-30 13:51:05 +09:00
prep.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
restrictinfo.h Disallow replacing joins with scans in problematic cases. 2023-07-28 15:45:06 +09:00
subselect.h Fix MULTIEXPR_SUBLINK with partitioned target tables, yet again. 2023-02-25 14:44:14 -05:00
tlist.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00