Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6cc88f0

Browse files
committed
Provide a function hook to let plug-ins get control around ExecutorRun.
ITAGAKI Takahiro
1 parent8d7af89 commit6cc88f0

File tree

2 files changed

+31
-2
lines changed

2 files changed

+31
-2
lines changed

‎src/backend/executor/execMain.c

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
*
2727
*
2828
* IDENTIFICATION
29-
* $PostgreSQL: pgsql/src/backend/executor/execMain.c,v 1.309 2008/05/12 20:02:00 alvherre Exp $
29+
* $PostgreSQL: pgsql/src/backend/executor/execMain.c,v 1.310 2008/07/18 18:23:46 tgl Exp $
3030
*
3131
*-------------------------------------------------------------------------
3232
*/
@@ -58,6 +58,9 @@
5858
#include"utils/tqual.h"
5959

6060

61+
/* Hook for plugins to get control in ExecutorRun() */
62+
ExecutorRun_hook_typeExecutorRun_hook=NULL;
63+
6164
typedefstructevalPlanQual
6265
{
6366
Indexrti;
@@ -214,11 +217,28 @@ ExecutorStart(QueryDesc *queryDesc, int eflags)
214217
*Note: count = 0 is interpreted as no portal limit, i.e., run to
215218
*completion.
216219
*
220+
*We provide a function hook variable that lets loadable plugins
221+
*get control when ExecutorRun is called. Such a plugin would
222+
*normally call standard_ExecutorRun().
223+
*
217224
* ----------------------------------------------------------------
218225
*/
219226
TupleTableSlot*
220227
ExecutorRun(QueryDesc*queryDesc,
221228
ScanDirectiondirection,longcount)
229+
{
230+
TupleTableSlot*result;
231+
232+
if (ExecutorRun_hook)
233+
result= (*ExecutorRun_hook) (queryDesc,direction,count);
234+
else
235+
result=standard_ExecutorRun(queryDesc,direction,count);
236+
returnresult;
237+
}
238+
239+
TupleTableSlot*
240+
standard_ExecutorRun(QueryDesc*queryDesc,
241+
ScanDirectiondirection,longcount)
222242
{
223243
EState*estate;
224244
CmdTypeoperation;

‎src/include/executor/executor.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $PostgreSQL: pgsql/src/include/executor/executor.h,v 1.147 2008/03/28 00:21:56 tgl Exp $
10+
* $PostgreSQL: pgsql/src/include/executor/executor.h,v 1.148 2008/07/18 18:23:47 tgl Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -60,6 +60,13 @@
6060
((*(expr)->evalfunc) (expr, econtext, isNull, isDone))
6161

6262

63+
/* Hook for plugins to get control in ExecutorRun() */
64+
typedefTupleTableSlot*(*ExecutorRun_hook_type) (QueryDesc*queryDesc,
65+
ScanDirectiondirection,
66+
longcount);
67+
externPGDLLIMPORTExecutorRun_hook_typeExecutorRun_hook;
68+
69+
6370
/*
6471
* prototypes from functions in execAmi.c
6572
*/
@@ -136,6 +143,8 @@ extern HeapTuple ExecRemoveJunk(JunkFilter *junkfilter, TupleTableSlot *slot);
136143
externvoidExecutorStart(QueryDesc*queryDesc,inteflags);
137144
externTupleTableSlot*ExecutorRun(QueryDesc*queryDesc,
138145
ScanDirectiondirection,longcount);
146+
externTupleTableSlot*standard_ExecutorRun(QueryDesc*queryDesc,
147+
ScanDirectiondirection,longcount);
139148
externvoidExecutorEnd(QueryDesc*queryDesc);
140149
externvoidExecutorRewind(QueryDesc*queryDesc);
141150
externvoidInitResultRelInfo(ResultRelInfo*resultRelInfo,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp