diff options
| author | Tom Lane | 2000-08-24 03:29:15 +0000 |
|---|---|---|
| committer | Tom Lane | 2000-08-24 03:29:15 +0000 |
| commit | 782c16c6a154e760bf1608d633488538cd52da93 (patch) | |
| tree | 902da787593da21a979bd2f74b0b44acf9c427b0 /src/include/nodes | |
| parent | 87523ab8db34859ae3fb980a3fab9f29dfc4c97a (diff) | |
SQL-language functions are now callable in ordinary fmgr contexts ...
for example, an SQL function can be used in a functional index. (I make
no promises about speed, but it'll work ;-).) Clean up and simplify
handling of functions returning sets.
Diffstat (limited to 'src/include/nodes')
| -rw-r--r-- | src/include/nodes/execnodes.h | 27 | ||||
| -rw-r--r-- | src/include/nodes/nodes.h | 6 | ||||
| -rw-r--r-- | src/include/nodes/primnodes.h | 7 |
3 files changed, 35 insertions, 5 deletions
diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h index 1ec14f4a969..9626dbf8b1c 100644 --- a/src/include/nodes/execnodes.h +++ b/src/include/nodes/execnodes.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2000, PostgreSQL, Inc * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: execnodes.h,v 1.47 2000/08/22 04:06:22 tgl Exp $ + * $Id: execnodes.h,v 1.48 2000/08/24 03:29:13 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -120,6 +120,31 @@ typedef struct ExprContext List *ecxt_range_table; } ExprContext; +/* + * Set-result status returned by ExecEvalExpr() + */ +typedef enum +{ + ExprSingleResult, /* expression does not return a set */ + ExprMultipleResult, /* this result is an element of a set */ + ExprEndResult /* there are no more elements in the set */ +} ExprDoneCond; + +/* + * When calling a function that might return a set (multiple rows), + * a node of this type is passed as fcinfo->resultinfo to allow + * return status to be passed back. A function returning set should + * raise an error if no such resultinfo is provided. + * + * XXX this mechanism is a quick hack and probably needs to be redesigned. + */ +typedef struct ReturnSetInfo +{ + NodeTag type; + ExprDoneCond isDone; +} ReturnSetInfo; + + /* ---------------- * ProjectionInfo node information * diff --git a/src/include/nodes/nodes.h b/src/include/nodes/nodes.h index f05e0a0e1c9..d825c8fe395 100644 --- a/src/include/nodes/nodes.h +++ b/src/include/nodes/nodes.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2000, PostgreSQL, Inc * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: nodes.h,v 1.74 2000/08/11 23:46:54 tgl Exp $ + * $Id: nodes.h,v 1.75 2000/08/24 03:29:13 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -227,7 +227,9 @@ typedef enum NodeTag * TAGS FOR FUNCTION-CALL CONTEXT AND RESULTINFO NODES (cf. fmgr.h) *--------------------- */ - T_TriggerData = 800 /* in commands/trigger.h */ + T_TriggerData = 800, /* in commands/trigger.h */ + T_ReturnSetInfo /* in nodes/execnodes.h */ + } NodeTag; /* diff --git a/src/include/nodes/primnodes.h b/src/include/nodes/primnodes.h index 1ad9a3d082a..0ef350687dc 100644 --- a/src/include/nodes/primnodes.h +++ b/src/include/nodes/primnodes.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2000, PostgreSQL, Inc * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: primnodes.h,v 1.46 2000/08/08 15:42:59 tgl Exp $ + * $Id: primnodes.h,v 1.47 2000/08/24 03:29:13 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -16,7 +16,10 @@ #include "access/attnum.h" #include "nodes/pg_list.h" -#include "utils/fcache.h" + +/* FunctionCache is declared in utils/fcache.h */ +typedef struct FunctionCache *FunctionCachePtr; + /* ---------------------------------------------------------------- * node definitions |
