]> granicus.if.org Git - postgresql/commit
Allow foreign and custom joins to handle EvalPlanQual rechecks.
authorRobert Haas <rhaas@postgresql.org>
Tue, 8 Dec 2015 17:31:03 +0000 (12:31 -0500)
committerRobert Haas <rhaas@postgresql.org>
Tue, 8 Dec 2015 17:31:03 +0000 (12:31 -0500)
commit385f337c9f39b21dca96ca4770552a10a6d5af24
tree5ca533100c4e832f830540b230ebd0bbe81aed05
parentedca44b1525b3d591263d032dc4fe500ea771e0e
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.
12 files changed:
contrib/file_fdw/file_fdw.c
contrib/postgres_fdw/postgres_fdw.c
doc/src/sgml/fdwhandler.sgml
src/backend/executor/execScan.c
src/backend/executor/nodeForeignscan.c
src/backend/nodes/outfuncs.c
src/backend/optimizer/plan/createplan.c
src/backend/optimizer/util/pathnode.c
src/include/foreign/fdwapi.h
src/include/nodes/relation.h
src/include/optimizer/pathnode.h
src/include/optimizer/planmain.h