aboutsummaryrefslogtreecommitdiff
path: root/src/backend/executor/execMain.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2008-07-18 18:23:47 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2008-07-18 18:23:47 +0000
commit6cc88f0af5b12b22ce1826a26b1a953c434bd165 (patch)
tree98a83af76e29e4be154878d014436c1aebe95eef /src/backend/executor/execMain.c
parent8d7af89016ad92afc922cfce5d0f93f95d34cf90 (diff)
downloadpostgresql-6cc88f0af5b12b22ce1826a26b1a953c434bd165.tar.gz
postgresql-6cc88f0af5b12b22ce1826a26b1a953c434bd165.zip
Provide a function hook to let plug-ins get control around ExecutorRun.
ITAGAKI Takahiro
Diffstat (limited to 'src/backend/executor/execMain.c')
-rw-r--r--src/backend/executor/execMain.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/backend/executor/execMain.c b/src/backend/executor/execMain.c
index 7da618033d8..93f78046707 100644
--- a/src/backend/executor/execMain.c
+++ b/src/backend/executor/execMain.c
@@ -26,7 +26,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/executor/execMain.c,v 1.309 2008/05/12 20:02:00 alvherre Exp $
+ * $PostgreSQL: pgsql/src/backend/executor/execMain.c,v 1.310 2008/07/18 18:23:46 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -58,6 +58,9 @@
#include "utils/tqual.h"
+/* Hook for plugins to get control in ExecutorRun() */
+ExecutorRun_hook_type ExecutorRun_hook = NULL;
+
typedef struct evalPlanQual
{
Index rti;
@@ -214,12 +217,29 @@ ExecutorStart(QueryDesc *queryDesc, int eflags)
* Note: count = 0 is interpreted as no portal limit, i.e., run to
* completion.
*
+ * We provide a function hook variable that lets loadable plugins
+ * get control when ExecutorRun is called. Such a plugin would
+ * normally call standard_ExecutorRun().
+ *
* ----------------------------------------------------------------
*/
TupleTableSlot *
ExecutorRun(QueryDesc *queryDesc,
ScanDirection direction, long count)
{
+ TupleTableSlot *result;
+
+ if (ExecutorRun_hook)
+ result = (*ExecutorRun_hook) (queryDesc, direction, count);
+ else
+ result = standard_ExecutorRun(queryDesc, direction, count);
+ return result;
+}
+
+TupleTableSlot *
+standard_ExecutorRun(QueryDesc *queryDesc,
+ ScanDirection direction, long count)
+{
EState *estate;
CmdType operation;
DestReceiver *dest;