diff options
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/executor/executor.h | 11 | ||||
-rw-r--r-- | src/include/executor/tuptable.h | 3 | ||||
-rw-r--r-- | src/include/nodes/execnodes.h | 31 |
3 files changed, 28 insertions, 17 deletions
diff --git a/src/include/executor/executor.h b/src/include/executor/executor.h index 7788a22b76c..65e7e4041d6 100644 --- a/src/include/executor/executor.h +++ b/src/include/executor/executor.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/executor/executor.h,v 1.149 2008/07/26 19:15:35 tgl Exp $ + * $PostgreSQL: pgsql/src/include/executor/executor.h,v 1.150 2008/10/28 22:02:05 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -176,16 +176,9 @@ extern Datum GetAttributeByNum(HeapTupleHeader tuple, AttrNumber attrno, bool *isNull); extern Datum GetAttributeByName(HeapTupleHeader tuple, const char *attname, bool *isNull); -extern void init_fcache(Oid foid, FuncExprState *fcache, - MemoryContext fcacheCxt); -extern Datum ExecMakeFunctionResult(FuncExprState *fcache, - ExprContext *econtext, - bool *isNull, - ExprDoneCond *isDone); extern Tuplestorestate *ExecMakeTableFunctionResult(ExprState *funcexpr, ExprContext *econtext, - TupleDesc expectedDesc, - TupleDesc *returnDesc); + TupleDesc expectedDesc); extern Datum ExecEvalExprSwitchContext(ExprState *expression, ExprContext *econtext, bool *isNull, ExprDoneCond *isDone); extern ExprState *ExecInitExpr(Expr *node, PlanState *parent); diff --git a/src/include/executor/tuptable.h b/src/include/executor/tuptable.h index 9b8cb46a74b..337f537272d 100644 --- a/src/include/executor/tuptable.h +++ b/src/include/executor/tuptable.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/executor/tuptable.h,v 1.38 2008/01/01 19:45:57 momjian Exp $ + * $PostgreSQL: pgsql/src/include/executor/tuptable.h,v 1.39 2008/10/28 22:02:05 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -160,6 +160,7 @@ extern HeapTuple ExecCopySlotTuple(TupleTableSlot *slot); extern MinimalTuple ExecCopySlotMinimalTuple(TupleTableSlot *slot); extern HeapTuple ExecFetchSlotTuple(TupleTableSlot *slot); extern MinimalTuple ExecFetchSlotMinimalTuple(TupleTableSlot *slot); +extern Datum ExecFetchSlotTupleDatum(TupleTableSlot *slot); extern HeapTuple ExecMaterializeSlot(TupleTableSlot *slot); extern TupleTableSlot *ExecCopySlot(TupleTableSlot *dstslot, TupleTableSlot *srcslot); diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h index 5b46f6e7087..ccc5963121e 100644 --- a/src/include/nodes/execnodes.h +++ b/src/include/nodes/execnodes.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/nodes/execnodes.h,v 1.191 2008/10/23 14:34:34 tgl Exp $ + * $PostgreSQL: pgsql/src/include/nodes/execnodes.h,v 1.192 2008/10/28 22:02:05 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -538,13 +538,29 @@ typedef struct FuncExprState /* * Function manager's lookup info for the target function. If func.fn_oid - * is InvalidOid, we haven't initialized it yet. + * is InvalidOid, we haven't initialized it yet (nor any of the following + * fields). */ FmgrInfo func; /* - * We also need to store argument values across calls when evaluating a - * function-returning-set. + * For a set-returning function (SRF) that returns a tuplestore, we + * keep the tuplestore here and dole out the result rows one at a time. + * The slot holds the row currently being returned. + */ + Tuplestorestate *funcResultStore; + TupleTableSlot *funcResultSlot; + + /* + * In some cases we need to compute a tuple descriptor for the function's + * output. If so, it's stored here. + */ + TupleDesc funcResultDesc; + bool funcReturnsTuple; /* valid when funcResultDesc isn't NULL */ + + /* + * We need to store argument values across calls when evaluating a SRF + * that uses value-per-call mode. * * setArgsValid is true when we are evaluating a set-valued function and * we are in the middle of a call series; we want to pass the same @@ -556,14 +572,15 @@ typedef struct FuncExprState /* * Flag to remember whether we found a set-valued argument to the * function. This causes the function result to be a set as well. Valid - * only when setArgsValid is true. + * only when setArgsValid is true or funcResultStore isn't NULL. */ bool setHasSetArg; /* some argument returns a set */ /* * Flag to remember whether we have registered a shutdown callback for - * this FuncExprState. We do so only if setArgsValid has been true at - * least once (since all the callback is for is to clear setArgsValid). + * this FuncExprState. We do so only if funcResultStore or setArgsValid + * has been set at least once (since all the callback is for is to release + * the tuplestore or clear setArgsValid). */ bool shutdown_reg; /* a shutdown callback is registered */ |