summaryrefslogtreecommitdiff
path: root/src/backend/utils/cache/fcache.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2001-09-21 00:11:31 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2001-09-21 00:11:31 +0000
commitae3129fd03928c1f5614370c79f1d69bd613f54b (patch)
treea470d068a4a70ac5920d82e5fbdb9455266bf6a5 /src/backend/utils/cache/fcache.c
parentac0c234c16fc94989aa6d695624aca073f0a7ab7 (diff)
Quick-and-dirty fix for recursive plpgsql functions, per bug report from
Frank Miles 7-Sep-01. This is really just sticking a finger in the dike. Frank's case works now, but we still couldn't support a recursive function returning a set. Really need to restructure querytrees and execution state so that the querytree is *read only*. We've run into this over and over and over again ... it has to happen sometime soon.
Diffstat (limited to 'src/backend/utils/cache/fcache.c')
-rw-r--r--src/backend/utils/cache/fcache.c32
1 files changed, 8 insertions, 24 deletions
diff --git a/src/backend/utils/cache/fcache.c b/src/backend/utils/cache/fcache.c
index 91bea5cfc71..bb1ac36f3ef 100644
--- a/src/backend/utils/cache/fcache.c
+++ b/src/backend/utils/cache/fcache.c
@@ -8,7 +8,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/cache/Attic/fcache.c,v 1.39 2001/03/22 03:59:57 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/cache/Attic/fcache.c,v 1.40 2001/09/21 00:11:31 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -17,11 +17,8 @@
#include "utils/fcache.h"
-/*-----------------------------------------------------------------
- *
+/*
* Build a 'FunctionCache' struct given the PG_PROC oid.
- *
- *-----------------------------------------------------------------
*/
FunctionCachePtr
init_fcache(Oid foid, int nargs, MemoryContext fcacheCxt)
@@ -29,6 +26,10 @@ init_fcache(Oid foid, int nargs, MemoryContext fcacheCxt)
MemoryContext oldcontext;
FunctionCachePtr retval;
+ /* Safety check (should never fail, as parser should check sooner) */
+ if (nargs > FUNC_MAX_ARGS)
+ elog(ERROR, "init_fcache: too many arguments");
+
/* Switch to a context long-lived enough for the fcache entry */
oldcontext = MemoryContextSwitchTo(fcacheCxt);
@@ -38,25 +39,8 @@ init_fcache(Oid foid, int nargs, MemoryContext fcacheCxt)
/* Set up the primary fmgr lookup information */
fmgr_info(foid, &(retval->func));
- /* Initialize unvarying fields of per-call info block */
- retval->fcinfo.flinfo = &(retval->func);
- retval->fcinfo.nargs = nargs;
-
- if (nargs > FUNC_MAX_ARGS)
- elog(ERROR, "init_fcache: too many arguments");
-
- /*
- * If function returns set, prepare a resultinfo node for
- * communication
- */
- if (retval->func.fn_retset)
- {
- retval->fcinfo.resultinfo = (Node *) &(retval->rsinfo);
- retval->rsinfo.type = T_ReturnSetInfo;
- }
-
- retval->argsValid = false;
- retval->hasSetArg = false;
+ /* Initialize additional info */
+ retval->setArgsValid = false;
MemoryContextSwitchTo(oldcontext);