Fix pg_dump bug in the database-level collation patch. "datcollate" and
[PostgreSQL.git] / src / include / nodes / params.h
blob2b08b48cb240607d10282a5a330ee283fe64622f
1 /*-------------------------------------------------------------------------
3 * params.h
4 * Support for finding the values associated with Param nodes.
7 * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
8 * Portions Copyright (c) 1994, Regents of the University of California
10 * $PostgreSQL$
12 *-------------------------------------------------------------------------
14 #ifndef PARAMS_H
15 #define PARAMS_H
18 /* ----------------
19 * ParamListInfo
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
31 * of the parameter).
33 * Although the data structure is really an array, not a list, we keep
34 * the old typedef name to avoid unnecessary code changes.
35 * ----------------
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 */
46 } ParamExternData;
48 typedef struct ParamListInfoData
50 int numParams; /* number of ParamExternDatas following */
51 ParamExternData params[1]; /* VARIABLE LENGTH ARRAY */
52 } ParamListInfoData;
54 typedef ParamListInfoData *ParamListInfo;
57 /* ----------------
58 * ParamExecData
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
70 * when needed.
71 * ----------------
74 typedef struct ParamExecData
76 void *execPlan; /* should be "SubPlanState *" */
77 Datum value;
78 bool isnull;
79 } ParamExecData;
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);
88 #endif /* PARAMS_H */