postgresql/src/backend/optimizer/path
Etsuro Fujita 6f80a8d9c1 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:00 +09:00
..
allpaths.c Fix some typos and some incorrectly duplicated words 2023-04-18 14:03:49 +12:00
clausesel.c Do assorted mop-up in the planner. 2023-01-30 13:44:36 -05:00
costsize.c Pre-beta mechanical code beautification. 2023-05-19 17:24:48 -04:00
equivclass.c Fix filtering of "cloned" outer-join quals some more. 2023-05-25 10:28:33 -04:00
indxpath.c Allow Incremental Sorts on GiST and SP-GiST indexes 2023-07-04 23:08:52 +12:00
joinpath.c Disallow replacing joins with scans in problematic cases. 2023-07-28 15:45:00 +09:00
joinrels.c Avoid compiler warning in non-assert builds. 2023-07-22 10:32:52 -04:00
Makefile Split all OBJS style lines in makefiles into one-line-per-entry style. 2019-11-05 14:41:07 -08:00
meson.build Update copyright for 2023 2023-01-02 15:00:37 -05:00
pathkeys.c Support "Right Anti Join" plan shapes. 2023-04-05 16:59:09 -04:00
tidpath.c Make Vars be outer-join-aware. 2023-01-30 13:16:20 -05:00