1 /*-------------------------------------------------------------------------
4 * Support for finding the values associated with Param nodes.
7 * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
8 * Portions Copyright (c) 1994, Regents of the University of California
12 *-------------------------------------------------------------------------
21 * ParamListInfo arrays are used to pass parameters into the executor
22 * for parameterized plans. Each entry in the array defines the value
23 * to be substituted for a PARAM_EXTERN parameter. The "paramid"
24 * of a PARAM_EXTERN Param can range from 1 to numParams.
26 * Although parameter numbers are normally consecutive, we allow
27 * ptype == InvalidOid to signal an unused array entry.
29 * PARAM_FLAG_CONST signals the planner that it may treat this parameter
30 * as a constant (i.e., generate a plan that works only for this value
33 * Although the data structure is really an array, not a list, we keep
34 * the old typedef name to avoid unnecessary code changes.
38 #define PARAM_FLAG_CONST 0x0001 /* parameter is constant */
40 typedef struct ParamExternData
42 Datum value
; /* parameter value */
43 bool isnull
; /* is it NULL? */
44 uint16 pflags
; /* flag bits, see above */
45 Oid ptype
; /* parameter's datatype, or 0 */
48 typedef struct ParamListInfoData
50 int numParams
; /* number of ParamExternDatas following */
51 ParamExternData params
[1]; /* VARIABLE LENGTH ARRAY */
54 typedef ParamListInfoData
*ParamListInfo
;
60 * ParamExecData entries are used for executor internal parameters
61 * (that is, values being passed into or out of a sub-query). The
62 * paramid of a PARAM_EXEC Param is a (zero-based) index into an
63 * array of ParamExecData records, which is referenced through
64 * es_param_exec_vals or ecxt_param_exec_vals.
66 * If execPlan is not NULL, it points to a SubPlanState node that needs
67 * to be executed to produce the value. (This is done so that we can have
68 * lazy evaluation of InitPlans: they aren't executed until/unless a
69 * result value is needed.) Otherwise the value is assumed to be valid
74 typedef struct ParamExecData
76 void *execPlan
; /* should be "SubPlanState *" */
82 /* Functions found in src/backend/nodes/params.c */
83 extern ParamListInfo
copyParamList(ParamListInfo from
);
85 extern void getParamListTypes(ParamListInfo params
,
86 Oid
**param_types
, int *num_params
);