pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Robert Haas <rhaas@postgresql.org>
To: pgsql-committers@postgresql.org
Subject: pgsql: Allow foreign and custom joins to handle EvalPlanQual rechecks.
Date: Tue, 08 Dec 2015 17:54:57 +0000
Message-ID: <E1a6MTZ-0006XR-VN@gemulon.postgresql.org> (raw)
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>

Allow foreign and custom joins to handle EvalPlanQual rechecks.

Commit e7cb7ee14555cc9c5773e2c102efd6371f6f2005 provided basic
infrastructure for allowing a foreign data wrapper or custom scan
provider to replace a join of one or more tables with a scan.
However, this infrastructure failed to take into account the need
for possible EvalPlanQual rechecks, and ExecScanFetch would fail
an assertion (or just overwrite memory) if such a check was attempted
for a plan containing a pushed-down join.  To fix, adjust the EPQ
machinery to skip some processing steps when scanrelid == 0, making
those the responsibility of scan's recheck method, which also has
the responsibility in this case of correctly populating the relevant
slot.

To allow foreign scans to gain control in the right place to make
use of this new facility, add a new, optional RecheckForeignScan
method.  Also, allow a foreign scan to have a child plan, which can
be used to correctly populate the slot (or perhaps for something
else, but this is the only use currently envisioned).

KaiGai Kohei, reviewed by Robert Haas, Etsuro Fujita, and Kyotaro
Horiguchi.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/385f337c9f39b21dca96ca4770552a10a6d5af24

Modified Files
--------------
contrib/file_fdw/file_fdw.c             |   10 ++++---
contrib/postgres_fdw/postgres_fdw.c     |   12 ++++++---
doc/src/sgml/fdwhandler.sgml            |   42 ++++++++++++++++++++++++++---
src/backend/executor/execScan.c         |   44 ++++++++++++++++++++++++++++---
src/backend/executor/nodeForeignscan.c  |   32 ++++++++++++++++++++++
src/backend/nodes/outfuncs.c            |    1 +
src/backend/optimizer/plan/createplan.c |   13 ++++++---
src/backend/optimizer/util/pathnode.c   |    2 ++
src/include/foreign/fdwapi.h            |    7 ++++-
src/include/nodes/relation.h            |    1 +
src/include/optimizer/pathnode.h        |    1 +
src/include/optimizer/planmain.h        |    3 ++-
12 files changed, 150 insertions(+), 18 deletions(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


view thread (2+ messages)  latest in thread

Message-ID: <E1a6MTZ-0006XR-VN@gemulon.postgresql.org>
Permalink:  ../E1a6MTZ-0006XR-VN@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1a6MTZ-0006XR-VN@gemulon.postgresql.org

 · 

reply

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 foreign and custom joins to handle EvalPlanQual rechecks.
  In-Reply-To: <E1a6MTZ-0006XR-VN@gemulon.postgresql.org>
  References: <E1a6MTZ-0006XR-VN@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