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.21 2002/02/18 23:11:46 petere 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.
47 * setArgsValid is true when we are evaluating a set-valued function
48 * and we are in the middle of a call series; we want to pass the same
49 * argument values to the function again (and again, until it returns
55 * Flag to remember whether we found a set-valued argument to the
56 * function. This causes the function result to be a set as well.
57 * Valid only when setArgsValid is true.
59 bool setHasSetArg; /* some argument returns a set */
62 * Current argument data for a set-valued function; contains valid
63 * data only if setArgsValid is true.
65 FunctionCallInfoData setArgs;
69 extern FunctionCachePtr init_fcache(Oid foid, int nargs,
70 MemoryContext fcacheCxt);