diff options
| author | Tom Lane | 2002-11-25 21:29:42 +0000 |
|---|---|---|
| committer | Tom Lane | 2002-11-25 21:29:42 +0000 |
| commit | f893ee271f1a500f7eb3f68de311080abfde8869 (patch) | |
| tree | b45af28758b2e2e7258d44eef359ef23938a2e7a /src/include | |
| parent | dbe100c4022e0125c103c3c0818ac5b327cc8283 (diff) | |
Remove unused constisset and constiscast fields of Const nodes. Clean
up code and documentation associated with Param nodes.
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/nodes/execnodes.h | 12 | ||||
| -rw-r--r-- | src/include/nodes/makefuncs.h | 6 | ||||
| -rw-r--r-- | src/include/nodes/params.h | 83 | ||||
| -rw-r--r-- | src/include/nodes/primnodes.h | 41 |
4 files changed, 67 insertions, 75 deletions
diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h index c9781b7255f..6ee39b98182 100644 --- a/src/include/nodes/execnodes.h +++ b/src/include/nodes/execnodes.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: execnodes.h,v 1.79 2002/11/22 22:10:01 tgl Exp $ + * $Id: execnodes.h,v 1.80 2002/11/25 21:29:42 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -281,14 +281,15 @@ typedef struct ResultRelInfo * * direction direction of the scan * + * snapshot time qual to use + * * range_table array of scan relation information * * result_relation information for insert/update/delete queries * * into_relation_descriptor relation being retrieved "into" * - * param_list_info information needed to transform - * Param nodes into Const nodes + * param_list_info information about Param values * * tupleTable this is a pointer to an array * of pointers to tuples used by @@ -307,8 +308,8 @@ typedef struct EState * elt */ JunkFilter *es_junkFilter; /* currently active junk filter */ Relation es_into_relation_descriptor; - ParamListInfo es_param_list_info; - ParamExecData *es_param_exec_vals; /* this is for subselects */ + ParamListInfo es_param_list_info; /* values of external params */ + ParamExecData *es_param_exec_vals; /* values of internal params */ TupleTable es_tupleTable; uint32 es_processed; /* # of tuples processed */ Oid es_lastoid; /* last oid processed (by INSERT) */ @@ -322,6 +323,7 @@ typedef struct EState * needed. */ ExprContext *es_per_tuple_exprcontext; + /* Below is to re-evaluate plan qual in READ COMMITTED mode */ struct Plan *es_origPlan; Pointer es_evalPlanQual; diff --git a/src/include/nodes/makefuncs.h b/src/include/nodes/makefuncs.h index e7c9c29413c..68f0dcda49a 100644 --- a/src/include/nodes/makefuncs.h +++ b/src/include/nodes/makefuncs.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: makefuncs.h,v 1.41 2002/09/18 21:35:24 tgl Exp $ + * $Id: makefuncs.h,v 1.42 2002/11/25 21:29:42 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -45,9 +45,7 @@ extern Const *makeConst(Oid consttype, int constlen, Datum constvalue, bool constisnull, - bool constbyval, - bool constisset, - bool constiscast); + bool constbyval); extern Const *makeNullConst(Oid consttype); diff --git a/src/include/nodes/params.h b/src/include/nodes/params.h index 1aa17964d65..ef0e0682be6 100644 --- a/src/include/nodes/params.h +++ b/src/include/nodes/params.h @@ -1,13 +1,13 @@ /*------------------------------------------------------------------------- * * params.h - * Declarations/definitions of stuff needed to handle parameterized plans. + * Declarations of stuff needed to handle parameterized plans. * * * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: params.h,v 1.17 2002/06/20 20:29:51 momjian Exp $ + * $Id: params.h,v 1.18 2002/11/25 21:29:42 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -16,66 +16,55 @@ #include "access/attnum.h" -/* ---------------------------------------------------------------- - * + +/* ---------------- * The following are the possible values for the 'paramkind' * field of a Param node. * * PARAM_NAMED: The parameter has a name, i.e. something * like `$.salary' or `$.foobar'. - * In this case field `paramname' must be a valid Name. - * and field `paramid' must be == 0. + * In this case field `paramname' must be a valid name. * * PARAM_NUM: The parameter has only a numeric identifier, * i.e. something like `$1', `$2' etc. - * The number is contained in the `parmid' field. + * The number is contained in the `paramid' field. * - * PARAM_NEW: Used in PRS2 rule, similar to PARAM_NAMED. - * The `paramname' & `paramid' refer to the "NEW" tuple - * `paramname' is the attribute name and `paramid' its - * attribute number. + * PARAM_EXEC: The parameter is an internal executor parameter. + * It has a number contained in the `paramid' field. * - * PARAM_OLD: Same as PARAM_NEW, but in this case we refer to - * the "OLD" tuple. - * - * PARAM_EXEC: Evaluated by executor. Used for subselect... + * PARAM_INVALID should never appear in a Param node; it's used to mark + * the end of a ParamListInfo array. * + * NOTE: As of PostgreSQL 7.3, named parameters aren't actually used and + * so the code that handles PARAM_NAMED cases is dead code. We leave it + * in place since it might be resurrected someday. + * ---------------- */ #define PARAM_NAMED 11 #define PARAM_NUM 12 -#define PARAM_NEW 13 -#define PARAM_OLD 14 #define PARAM_EXEC 15 #define PARAM_INVALID 100 -/* ---------------------------------------------------------------- +/* ---------------- * ParamListInfo * - * Information needed in order for the executor to handle - * parameterized plans (you know, $.salary, $.name etc. stuff...). - * - * ParamListInfoData contains information needed when substituting a - * Param node with a Const node. + * ParamListInfo entries are used to pass parameters into the executor + * for parameterized plans. Each entry in the array defines the value + * to be substituted for a PARAM_NAMED or PARAM_NUM parameter. * - * kind : the kind of parameter. - * name : the parameter name (valid if kind == PARAM_NAMED, - * PARAM_NEW or PARAM_OLD) + * kind : the kind of parameter (PARAM_NAMED or PARAM_NUM) + * name : the parameter name (valid if kind == PARAM_NAMED) * id : the parameter id (valid if kind == PARAM_NUM) - * or the attrno (if kind == PARAM_NEW or PARAM_OLD) - * type : PG_TYPE OID of the value - * length : length in bytes of the value - * isnull : true if & only if the value is null (if true then - * the fields 'length' and 'value' are undefined). + * isnull : true if the value is null (if so 'value' is undefined) * value : the value that has to be substituted in the place * of the parameter. * * ParamListInfo is to be used as an array of ParamListInfoData - * records. An 'InvalidName' in the name field of such a record - * indicates that this is the last record in the array. - * - * ---------------------------------------------------------------- + * records. A dummy record with kind == PARAM_INVALID marks the end + * of the array. + * ---------------- */ typedef struct ParamListInfoData @@ -83,19 +72,33 @@ typedef struct ParamListInfoData int kind; char *name; AttrNumber id; - Oid type; - Size length; bool isnull; - bool byval; Datum value; } ParamListInfoData; typedef ParamListInfoData *ParamListInfo; + +/* ---------------- + * ParamExecData + * + * ParamExecData entries are used for executor internal parameters + * (that is, values being passed into or out of a sub-query). The + * paramid of a PARAM_EXEC Param is a (zero-based) index into an + * array of ParamExecData records, which is referenced through + * es_param_exec_vals or ecxt_param_exec_vals. + * + * If execPlan is not NULL, it points to a SubPlan node that needs to + * be executed to produce the value. (This is done so that we can have + * lazy evaluation of InitPlans: they aren't executed until/unless a + * result value is needed.) Otherwise the value is assumed to be valid + * when needed. + * ---------------- + */ + typedef struct ParamExecData { - void *execPlan; /* plan must be executed to get param - * value */ + void *execPlan; /* should be "SubPlan *" */ Datum value; bool isnull; } ParamExecData; diff --git a/src/include/nodes/primnodes.h b/src/include/nodes/primnodes.h index 1d7c5115b64..f0f37c3d9d3 100644 --- a/src/include/nodes/primnodes.h +++ b/src/include/nodes/primnodes.h @@ -10,7 +10,7 @@ * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: primnodes.h,v 1.68 2002/09/18 21:35:24 tgl Exp $ + * $Id: primnodes.h,v 1.69 2002/11/25 21:29:42 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -267,20 +267,16 @@ typedef struct Var typedef struct Const { NodeTag type; - Oid consttype; /* PG_TYPE OID of the constant's value */ - int constlen; /* length in bytes of the constant's value */ + Oid consttype; /* PG_TYPE OID of the constant's datatype */ + int constlen; /* typlen of the constant's datatype */ Datum constvalue; /* the constant's value */ bool constisnull; /* whether the constant is null (if true, - * the other fields are undefined) */ - bool constbyval; /* whether the information in constvalue - * if passed by value. If true, then all - * the information is stored in the datum. - * If false, then the datum contains a + * constvalue is undefined) */ + bool constbyval; /* whether this datatype is passed by value. + * If true, then all the information is + * stored in the Datum. + * If false, then the Datum contains a * pointer to the information. */ - bool constisset; /* whether the const represents a set. The - * const value corresponding will be the - * query that defines the set. */ - bool constiscast; } Const; /* ---------------- @@ -290,31 +286,24 @@ typedef struct Const * * PARAM_NAMED: The parameter has a name, i.e. something * like `$.salary' or `$.foobar'. - * In this case field `paramname' must be a valid Name. + * In this case field `paramname' must be a valid name. * * PARAM_NUM: The parameter has only a numeric identifier, * i.e. something like `$1', `$2' etc. * The number is contained in the `paramid' field. * - * PARAM_NEW: Used in PRS2 rule, similar to PARAM_NAMED. - * The `paramname' and `paramid' refer to the "NEW" tuple - * The `pramname' is the attribute name and `paramid' - * is the attribute number. + * PARAM_EXEC: The parameter is an internal executor parameter. + * It has a number contained in the `paramid' field. * - * PARAM_OLD: Same as PARAM_NEW, but in this case we refer to - * the "OLD" tuple. * ---------------- */ typedef struct Param { NodeTag type; - int paramkind; /* specifies the kind of parameter. See - * above */ - AttrNumber paramid; /* numeric identifier for literal-constant - * parameters ("$1") */ - char *paramname; /* attribute name for tuple-substitution - * parameters ("$.foo") */ - Oid paramtype; /* PG_TYPE OID of the parameter's value */ + int paramkind; /* kind of parameter. See above */ + AttrNumber paramid; /* numeric ID for parameter ("$1") */ + char *paramname; /* name for parameter ("$.foo") */ + Oid paramtype; /* PG_TYPE OID of parameter's datatype */ } Param; /* |
