1 /*-------------------------------------------------------------------------
4 * Declarations for function cache records.
6 * The first time any Oper or Func node is evaluated, we compute a cache
7 * record for the function being invoked, and save a pointer to the cache
8 * record in the Oper or Func node. This saves repeated lookup of info
11 * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
12 * Portions Copyright (c) 1994, Regents of the University of California
14 * $Id: fcache.h,v 1.20 2001/11/05 17:46:36 momjian Exp $
16 *-------------------------------------------------------------------------
22 #include "nodes/execnodes.h"
25 * A FunctionCache record is built for all functions regardless of language.
27 * We store the fmgr lookup info to avoid recomputing it on each call.
29 * We also need to store argument values across calls when evaluating a
30 * function-returning-set. This is pretty ugly (and not re-entrant);
31 * current-evaluation info should be somewhere in the econtext, not in
32 * the querytree. As it stands, a function-returning-set can't safely be
33 * recursive, at least not if it's in plpgsql which will try to re-use
34 * the querytree at multiple execution nesting levels. FIXME someday.
37 typedef struct FunctionCache
40 * Function manager's lookup info for the target function.
45 * setArgsValid is true when we are evaluating a set-valued function
46 * and we are in the middle of a call series; we want to pass the same
47 * argument values to the function again (and again, until it returns
53 * Flag to remember whether we found a set-valued argument to the
54 * function. This causes the function result to be a set as well.
55 * Valid only when setArgsValid is true.
57 bool setHasSetArg; /* some argument returns a set */
60 * Current argument data for a set-valued function; contains valid
61 * data only if setArgsValid is true.
63 FunctionCallInfoData setArgs;
67 extern FunctionCachePtr init_fcache(Oid foid, int nargs,
68 MemoryContext fcacheCxt);