postgresql/contrib/postgres_fdw
Etsuro Fujita db01f26968 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:09 +09:00
..
expected Disallow replacing joins with scans in problematic cases. 2023-07-28 15:45:09 +09:00
sql Disallow replacing joins with scans in problematic cases. 2023-07-28 15:45:09 +09:00
.gitignore Add postgres_fdw contrib module. 2013-02-21 05:27:16 -05:00
Makefile Prevent accidental linking of system-supplied copies of libpq.so etc. 2018-04-03 16:26:05 -04:00
connection.c postgres_fdw: Fix unexpected reporting of empty message. 2021-12-03 17:37:26 +09:00
deparse.c Fix postgres_fdw to check shippability of sort clauses properly. 2022-03-31 14:29:24 -04:00
option.c Avoid using ambiguous word "non-negative" in error messages. 2021-07-28 01:24:51 +09:00
postgres_fdw--1.0.sql Add postgres_fdw contrib module. 2013-02-21 05:27:16 -05:00
postgres_fdw.c postgres_fdw: Avoid 'variable not found in subplan target list' error. 2022-09-14 18:45:07 +09:00
postgres_fdw.control Add postgres_fdw contrib module. 2013-02-21 05:27:16 -05:00
postgres_fdw.h Fix postgres_fdw to check shippability of sort clauses properly. 2022-03-31 14:29:24 -04:00
shippable.c Update copyright for 2018 2018-01-02 23:30:12 -05:00