diff options
author | Robert Haas <rhaas@postgresql.org> | 2015-12-08 12:31:03 -0500 |
---|---|---|
committer | Robert Haas <rhaas@postgresql.org> | 2015-12-08 12:31:03 -0500 |
commit | 385f337c9f39b21dca96ca4770552a10a6d5af24 (patch) | |
tree | 5ca533100c4e832f830540b230ebd0bbe81aed05 /contrib/file_fdw/file_fdw.c | |
parent | edca44b1525b3d591263d032dc4fe500ea771e0e (diff) | |
download | postgresql-385f337c9f39b21dca96ca4770552a10a6d5af24.tar.gz postgresql-385f337c9f39b21dca96ca4770552a10a6d5af24.zip |
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.
Diffstat (limited to 'contrib/file_fdw/file_fdw.c')
-rw-r--r-- | contrib/file_fdw/file_fdw.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/contrib/file_fdw/file_fdw.c b/contrib/file_fdw/file_fdw.c index 5ce8f90cd8b..83bbfa1212b 100644 --- a/contrib/file_fdw/file_fdw.c +++ b/contrib/file_fdw/file_fdw.c @@ -121,7 +121,8 @@ static ForeignScan *fileGetForeignPlan(PlannerInfo *root, Oid foreigntableid, ForeignPath *best_path, List *tlist, - List *scan_clauses); + List *scan_clauses, + Plan *outer_plan); static void fileExplainForeignScan(ForeignScanState *node, ExplainState *es); static void fileBeginForeignScan(ForeignScanState *node, int eflags); static TupleTableSlot *fileIterateForeignScan(ForeignScanState *node); @@ -525,6 +526,7 @@ fileGetForeignPaths(PlannerInfo *root, total_cost, NIL, /* no pathkeys */ NULL, /* no outer rel either */ + NULL, /* no extra plan */ coptions)); /* @@ -544,7 +546,8 @@ fileGetForeignPlan(PlannerInfo *root, Oid foreigntableid, ForeignPath *best_path, List *tlist, - List *scan_clauses) + List *scan_clauses, + Plan *outer_plan) { Index scan_relid = baserel->relid; @@ -564,7 +567,8 @@ fileGetForeignPlan(PlannerInfo *root, NIL, /* no expressions to evaluate */ best_path->fdw_private, NIL, /* no custom tlist */ - NIL /* no remote quals */ ); + NIL, /* no remote quals */ + outer_plan); } /* |