diff options
author | Robert Haas <rhaas@postgresql.org> | 2014-11-07 17:26:02 -0500 |
---|---|---|
committer | Robert Haas <rhaas@postgresql.org> | 2014-11-07 17:34:36 -0500 |
commit | 0b03e5951bf0a1a8868db13f02049cf686a82165 (patch) | |
tree | 3495ca06369ec694e68ac84ed19c296a74521f26 /src/include/nodes/execnodes.h | |
parent | 7250d8535b11d6443a9b27299e586c3df0654302 (diff) |
Introduce custom path and scan providers.
This allows extension modules to define their own methods for
scanning a relation, and get the core code to use them. It's
unclear as yet how much use this capability will find, but we
won't find out if we never commit it.
KaiGai Kohei, reviewed at various times and in various levels
of detail by Shigeru Hanada, Tom Lane, Andres Freund, Álvaro
Herrera, and myself.
Diffstat (limited to 'src/include/nodes/execnodes.h')
-rw-r--r-- | src/include/nodes/execnodes.h | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h index 39d2c10bdfe..b72e605e4fe 100644 --- a/src/include/nodes/execnodes.h +++ b/src/include/nodes/execnodes.h @@ -19,6 +19,7 @@ #include "executor/instrument.h" #include "nodes/params.h" #include "nodes/plannodes.h" +#include "nodes/relation.h" #include "utils/reltrigger.h" #include "utils/sortsupport.h" #include "utils/tuplestore.h" @@ -1504,6 +1505,45 @@ typedef struct ForeignScanState void *fdw_state; /* foreign-data wrapper can keep state here */ } ForeignScanState; +/* ---------------- + * CustomScanState information + * + * CustomScan nodes are used to execute custom code within executor. + * ---------------- + */ +struct CustomExecMethods; +struct ExplainState; /* to avoid to include explain.h here */ + +typedef struct CustomScanState +{ + ScanState ss; + uint32 flags; /* mask of CUSTOMPATH_* flags defined in relation.h*/ + const struct CustomExecMethods *methods; +} CustomScanState; + +typedef struct CustomExecMethods +{ + const char *CustomName; + + /* EXECUTOR methods */ + void (*BeginCustomScan)(CustomScanState *node, + EState *estate, + int eflags); + TupleTableSlot *(*ExecCustomScan)(CustomScanState *node); + void (*EndCustomScan)(CustomScanState *node); + void (*ReScanCustomScan)(CustomScanState *node); + void (*MarkPosCustomScan)(CustomScanState *node); + void (*RestrPosCustomScan)(CustomScanState *node); + + /* EXPLAIN support */ + void (*ExplainCustomScan)(CustomScanState *node, + List *ancestors, + struct ExplainState *es); + Node *(*GetSpecialCustomVar)(CustomScanState *node, + Var *varnode, + PlanState **child_ps); +} CustomExecMethods; + /* ---------------------------------------------------------------- * Join State Information * ---------------------------------------------------------------- |