From 5043193b78919a1bd144563aadc2f7f726549913 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. --- doc/src/sgml/fdwhandler.sgml | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'doc/src') diff --git a/doc/src/sgml/fdwhandler.sgml b/doc/src/sgml/fdwhandler.sgml index 4c410c79168..1533a6bf80c 100644 --- a/doc/src/sgml/fdwhandler.sgml +++ b/doc/src/sgml/fdwhandler.sgml @@ -1135,6 +1135,15 @@ GetForeignServerByName(const char *name, bool missing_ok); evaluation of the fdw_exprs expression tree. + + Any clauses removed from the plan node's qual list must instead be added + to fdw_recheck_quals in order to ensure correct behavior + at the READ COMMITTED isolation level. When a concurrent + update occurs for some other table involved in the query, the executor + may need to verify that all of the original quals are still satisfied for + the tuple, possibly against a different set of parameter values. + + Another ForeignScan field that can be filled by FDWs is fdw_scan_tlist, which describes the tuples returned by -- cgit v1.2.3