]> granicus.if.org Git - postgresql/commit
Allow FDWs to push down quals without breaking EvalPlanQual rechecks.
authorRobert Haas <rhaas@postgresql.org>
Thu, 15 Oct 2015 17:00:40 +0000 (13:00 -0400)
committerRobert Haas <rhaas@postgresql.org>
Thu, 15 Oct 2015 17:00:40 +0000 (13:00 -0400)
commit5fc4c26db5120bd90348b6ee3101fcddfdf54800
tree36f2df5232f8c58de77536cfd4d0e11889253b49
parent817588bc2bd684b630da11ca068505dbd985de10
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.
13 files changed:
contrib/file_fdw/file_fdw.c
contrib/postgres_fdw/postgres_fdw.c
doc/src/sgml/fdwhandler.sgml
src/backend/executor/nodeForeignscan.c
src/backend/nodes/copyfuncs.c
src/backend/nodes/outfuncs.c
src/backend/nodes/readfuncs.c
src/backend/optimizer/plan/createplan.c
src/backend/optimizer/plan/setrefs.c
src/backend/optimizer/plan/subselect.c
src/include/nodes/execnodes.h
src/include/nodes/plannodes.h
src/include/optimizer/planmain.h