pgsql: Allow FDWs to push down quals without breaking EvalPlanQual rech

From: Robert Haas <rhaas(at)postgresql(dot)org>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Allow FDWs to push down quals without breaking EvalPlanQual rech
Date: 2015-10-15 17:14:37
Message-ID: E1Zmm6v-0005nx-AM@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/5fc4c26db5120bd90348b6ee3101fcddfdf54800

Modified Files
--------------
contrib/file_fdw/file_fdw.c | 3 ++-
contrib/postgres_fdw/postgres_fdw.c | 14 +++++++++++---
doc/src/sgml/fdwhandler.sgml | 9 +++++++++
src/backend/executor/nodeForeignscan.c | 19 +++++++++++++++++--
src/backend/nodes/copyfuncs.c | 1 +
src/backend/nodes/outfuncs.c | 1 +
src/backend/nodes/readfuncs.c | 1 +
src/backend/optimizer/plan/createplan.c | 7 ++++++-
src/backend/optimizer/plan/setrefs.c | 4 +++-
src/backend/optimizer/plan/subselect.c | 16 ++++++++++++----
src/include/nodes/execnodes.h | 1 +
src/include/nodes/plannodes.h | 6 ++++++
src/include/optimizer/planmain.h | 2 +-
13 files changed, 71 insertions(+), 13 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Robert Haas 2015-10-15 17:16:23 pgsql: Revert "Have dtrace depend on object files directly, not objfile
Previous Message Tom Lane 2015-10-15 17:01:59 Re: [COMMITTERS] pgsql: Have dtrace depend on object files directly, not objfiles.txt