From: Robert Haas <rhaas@postgresql.org>
To: pgsql-committers@postgresql.org
Subject: pgsql: Allow FDWs to push down quals without breaking EvalPlanQual rech
Date: Thu, 15 Oct 2015 17:14:37 +0000
Message-ID: <E1Zmm6v-0005ny-AY@gemulon.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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
------
REL9_5_STABLE
Details
-------
http://git.postgresql.org/pg/commitdiff/5043193b78919a1bd144563aadc2f7f726549913
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/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 +-
12 files changed, 70 insertions(+), 13 deletions(-)
--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: rhaas@postgresql.org
Subject: Re: pgsql: Allow FDWs to push down quals without breaking EvalPlanQual rech
In-Reply-To: <E1Zmm6v-0005ny-AY@gemulon.postgresql.org>
References: <E1Zmm6v-0005ny-AY@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox