From 5fc4c26db5120bd90348b6ee3101fcddfdf54800 Mon Sep 17 00:00:00 2001 From: Robert Haas Date: Thu, 15 Oct 2015 13:00:40 -0400 Subject: Allow FDWs to push down quals without breaking EvalPlanQual rechecks. This fixes a long-standing bug which was discovered while investigating the interaction between the new join pushdown code and the EvalPlanQual machinery: if a ForeignScan appears on the inner side of a paramaterized nestloop, an EPQ recheck would re-return the original tuple even if it no longer satisfied the pushed-down quals due to changed parameter values. This fix adds a new member to ForeignScan and ForeignScanState and a new argument to make_foreignscan, and requires changes to FDWs which push down quals to populate that new argument with a list of quals they have chosen to push down. Therefore, I'm only back-patching to 9.5, even though the bug is not new in 9.5. Etsuro Fujita, reviewed by me and by Kyotaro Horiguchi. --- src/include/optimizer/planmain.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/include/optimizer') diff --git a/src/include/optimizer/planmain.h b/src/include/optimizer/planmain.h index 52b077a1b47..1fb850489fb 100644 --- a/src/include/optimizer/planmain.h +++ b/src/include/optimizer/planmain.h @@ -45,7 +45,7 @@ extern SubqueryScan *make_subqueryscan(List *qptlist, List *qpqual, Index scanrelid, Plan *subplan); extern ForeignScan *make_foreignscan(List *qptlist, List *qpqual, Index scanrelid, List *fdw_exprs, List *fdw_private, - List *fdw_scan_tlist); + List *fdw_scan_tlist, List *fdw_recheck_quals); extern Append *make_append(List *appendplans, List *tlist); extern RecursiveUnion *make_recursive_union(List *tlist, Plan *lefttree, Plan *righttree, int wtParam, -- cgit v1.2.3