aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/backend/commands/copy.c6
-rw-r--r--src/backend/executor/execQual.c138
-rw-r--r--src/backend/nodes/copyfuncs.c4
-rw-r--r--src/backend/nodes/equalfuncs.c10
-rw-r--r--src/backend/nodes/makefuncs.c13
-rw-r--r--src/backend/nodes/outfuncs.c3
-rw-r--r--src/backend/nodes/readfuncs.c3
-rw-r--r--src/backend/optimizer/path/clausesel.c5
-rw-r--r--src/backend/optimizer/path/indxpath.c8
-rw-r--r--src/backend/optimizer/prep/preptlist.c10
-rw-r--r--src/backend/optimizer/prep/prepunion.c6
-rw-r--r--src/backend/optimizer/util/clauses.c14
-rw-r--r--src/backend/parser/gram.y8
-rw-r--r--src/backend/parser/parse_coerce.c11
-rw-r--r--src/backend/parser/parse_node.c12
-rw-r--r--src/backend/utils/adt/ruleutils.c4
-rw-r--r--src/backend/utils/adt/selfuncs.c4
-rw-r--r--src/backend/utils/cache/lsyscache.c6
-rw-r--r--src/include/nodes/execnodes.h12
-rw-r--r--src/include/nodes/makefuncs.h6
-rw-r--r--src/include/nodes/params.h83
-rw-r--r--src/include/nodes/primnodes.h41
22 files changed, 159 insertions, 248 deletions
diff --git a/src/backend/commands/copy.c b/src/backend/commands/copy.c
index b0dd47f945a..39f13e5a3e5 100644
--- a/src/backend/commands/copy.c
+++ b/src/backend/commands/copy.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.181 2002/11/23 03:59:07 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.182 2002/11/25 21:29:34 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -860,9 +860,7 @@ CopyFrom(Relation rel, List *attnumlist, bool binary, bool oids,
attr[i]->attlen,
(Datum) 0,
true, /* is null */
- attr[i]->attbyval,
- false, /* not a set */
- false); /* not coerced */
+ attr[i]->attbyval);
node = coerce_type_constraints((Node *) con, attr[i]->atttypid,
COERCE_IMPLICIT_CAST);
diff --git a/src/backend/executor/execQual.c b/src/backend/executor/execQual.c
index 1612a2d9ea2..d41ae779e47 100644
--- a/src/backend/executor/execQual.c
+++ b/src/backend/executor/execQual.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/execQual.c,v 1.109 2002/11/15 02:50:06 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/execQual.c,v 1.110 2002/11/25 21:29:35 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -392,40 +392,32 @@ ExecEvalVar(Var *variable, ExprContext *econtext, bool *isNull)
* Returns the value of a parameter. A param node contains
* something like ($.name) and the expression context contains
* the current parameter bindings (name = "sam") (age = 34)...
- * so our job is to replace the param node with the datum
- * containing the appropriate information ("sam").
+ * so our job is to find and return the appropriate datum ("sam").
*
* Q: if we have a parameter ($.foo) without a binding, i.e.
* there is no (foo = xxx) in the parameter list info,
* is this a fatal error or should this be a "not available"
- * (in which case we shoud return a Const node with the
- * isnull flag) ? -cim 10/13/89
- *
- * Minor modification: Param nodes now have an extra field,
- * `paramkind' which specifies the type of parameter
- * (see params.h). So while searching the paramList for
- * a paramname/value pair, we have also to check for `kind'.
- *
- * NOTE: The last entry in `paramList' is always an
- * entry with kind == PARAM_INVALID.
+ * (in which case we could return NULL)? -cim 10/13/89
* ----------------------------------------------------------------
*/
Datum
ExecEvalParam(Param *expression, ExprContext *econtext, bool *isNull)
{
- char *thisParameterName;
- int thisParameterKind = expression->paramkind;
- AttrNumber thisParameterId = expression->paramid;
- int matchFound;
- ParamListInfo paramList;
+ int thisParamKind = expression->paramkind;
+ AttrNumber thisParamId = expression->paramid;
- if (thisParameterKind == PARAM_EXEC)
+ if (thisParamKind == PARAM_EXEC)
{
+ /*
+ * PARAM_EXEC params (internal executor parameters) are stored in
+ * the ecxt_param_exec_vals array, and can be accessed by array index.
+ */
ParamExecData *prm;
- prm = &(econtext->ecxt_param_exec_vals[thisParameterId]);
+ prm = &(econtext->ecxt_param_exec_vals[thisParamId]);
if (prm->execPlan != NULL)
{
+ /* Parameter not evaluated yet, so go do it */
ExecSetParamPlan(prm->execPlan, econtext);
/* ExecSetParamPlan should have processed this param... */
Assert(prm->execPlan == NULL);
@@ -433,82 +425,56 @@ ExecEvalParam(Param *expression, ExprContext *econtext, bool *isNull)
*isNull = prm->isnull;
return prm->value;
}
-
- thisParameterName = expression->paramname;
- paramList = econtext->ecxt_param_list_info;
-
- *isNull = false;
-
- /*
- * search the list with the parameter info to find a matching name. An
- * entry with an InvalidName denotes the last element in the array.
- */
- matchFound = 0;
- if (paramList != NULL)
+ else
{
/*
- * search for an entry in 'paramList' that matches the
- * `expression'.
+ * All other parameter types must be sought in ecxt_param_list_info.
+ * NOTE: The last entry in the param array is always an
+ * entry with kind == PARAM_INVALID.
*/
- while (paramList->kind != PARAM_INVALID && !matchFound)
+ ParamListInfo paramList = econtext->ecxt_param_list_info;
+ char *thisParamName = expression->paramname;
+ bool matchFound = false;
+
+ if (paramList != NULL)
{
- switch (thisParameterKind)
+ while (paramList->kind != PARAM_INVALID && !matchFound)
{
- case PARAM_NAMED:
- if (thisParameterKind == paramList->kind &&
- strcmp(paramList->name, thisParameterName) == 0)
- matchFound = 1;
- break;
- case PARAM_NUM:
- if (thisParameterKind == paramList->kind &&
- paramList->id == thisParameterId)
- matchFound = 1;
- break;
- case PARAM_OLD:
- case PARAM_NEW:
- if (thisParameterKind == paramList->kind &&
- paramList->id == thisParameterId)
+ if (thisParamKind == paramList->kind)
+ {
+ switch (thisParamKind)
{
- matchFound = 1;
-
- /*
- * sanity check
- */
- if (strcmp(paramList->name, thisParameterName) != 0)
- {
- elog(ERROR,
- "ExecEvalParam: new/old params with same id & diff names");
- }
+ case PARAM_NAMED:
+ if (strcmp(paramList->name, thisParamName) == 0)
+ matchFound = true;
+ break;
+ case PARAM_NUM:
+ if (paramList->id == thisParamId)
+ matchFound = true;
+ break;
+ default:
+ elog(ERROR, "ExecEvalParam: invalid paramkind %d",
+ thisParamKind);
}
- break;
- default:
+ }
+ if (!matchFound)
+ paramList++;
+ } /* while */
+ } /* if */
- /*
- * oops! this is not supposed to happen!
- */
- elog(ERROR, "ExecEvalParam: invalid paramkind %d",
- thisParameterKind);
- }
- if (!matchFound)
- paramList++;
- } /* while */
- } /* if */
+ if (!matchFound)
+ {
+ if (thisParamKind == PARAM_NAMED)
+ elog(ERROR, "ExecEvalParam: Unknown value for parameter %s",
+ thisParamName);
+ else
+ elog(ERROR, "ExecEvalParam: Unknown value for parameter %d",
+ thisParamId);
+ }
- if (!matchFound)
- {
- /*
- * ooops! we couldn't find this parameter in the parameter list.
- * Signal an error
- */
- elog(ERROR, "ExecEvalParam: Unknown value for parameter %s",
- thisParameterName);
+ *isNull = paramList->isnull;
+ return paramList->value;
}
-
- /*
- * return the value.
- */
- *isNull = paramList->isnull;
- return paramList->value;
}
diff --git a/src/backend/nodes/copyfuncs.c b/src/backend/nodes/copyfuncs.c
index 0f02b5d119b..a678d6326b1 100644
--- a/src/backend/nodes/copyfuncs.c
+++ b/src/backend/nodes/copyfuncs.c
@@ -15,7 +15,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.222 2002/11/25 03:33:27 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.223 2002/11/25 21:29:36 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -769,8 +769,6 @@ _copyConst(Const *from)
COPY_SCALAR_FIELD(constisnull);
COPY_SCALAR_FIELD(constbyval);
- COPY_SCALAR_FIELD(constisset);
- COPY_SCALAR_FIELD(constiscast);
return newnode;
}
diff --git a/src/backend/nodes/equalfuncs.c b/src/backend/nodes/equalfuncs.c
index f417dec4886..83c2cb4245c 100644
--- a/src/backend/nodes/equalfuncs.c
+++ b/src/backend/nodes/equalfuncs.c
@@ -20,7 +20,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.168 2002/11/25 03:33:27 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.169 2002/11/25 21:29:36 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -190,7 +190,6 @@ _equalConst(Const *a, Const *b)
COMPARE_SCALAR_FIELD(constlen);
COMPARE_SCALAR_FIELD(constisnull);
COMPARE_SCALAR_FIELD(constbyval);
- /* XXX What about constisset and constiscast? */
/*
* We treat all NULL constants of the same type as equal. Someday this
@@ -212,19 +211,12 @@ _equalParam(Param *a, Param *b)
switch (a->paramkind)
{
case PARAM_NAMED:
- case PARAM_NEW:
- case PARAM_OLD:
COMPARE_STRING_FIELD(paramname);
break;
case PARAM_NUM:
case PARAM_EXEC:
COMPARE_SCALAR_FIELD(paramid);
break;
- case PARAM_INVALID:
- /*
- * XXX: Hmmm... What are we supposed to return in this case ??
- */
- break;
default:
elog(ERROR, "_equalParam: Invalid paramkind value: %d",
a->paramkind);
diff --git a/src/backend/nodes/makefuncs.c b/src/backend/nodes/makefuncs.c
index b92011445e3..a97a6df2fda 100644
--- a/src/backend/nodes/makefuncs.c
+++ b/src/backend/nodes/makefuncs.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/nodes/makefuncs.c,v 1.35 2002/09/18 21:35:21 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/nodes/makefuncs.c,v 1.36 2002/11/25 21:29:36 tgl Exp $
*/
#include "postgres.h"
@@ -157,9 +157,7 @@ makeConst(Oid consttype,
int constlen,
Datum constvalue,
bool constisnull,
- bool constbyval,
- bool constisset,
- bool constiscast)
+ bool constbyval)
{
Const *cnst = makeNode(Const);
@@ -168,8 +166,7 @@ makeConst(Oid consttype,
cnst->constvalue = constvalue;
cnst->constisnull = constisnull;
cnst->constbyval = constbyval;
- cnst->constisset = constisset;
- cnst->constiscast = constiscast;
+
return cnst;
}
@@ -188,9 +185,7 @@ makeNullConst(Oid consttype)
(int) typLen,
(Datum) 0,
true,
- typByVal,
- false,
- false);
+ typByVal);
}
/*
diff --git a/src/backend/nodes/outfuncs.c b/src/backend/nodes/outfuncs.c
index 3302e5f942c..11572a4ebad 100644
--- a/src/backend/nodes/outfuncs.c
+++ b/src/backend/nodes/outfuncs.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.182 2002/11/25 18:12:09 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.183 2002/11/25 21:29:36 tgl Exp $
*
* NOTES
* Every node type that can appear in stored rules' parsetrees *must*
@@ -735,7 +735,6 @@ _outConst(StringInfo str, Const *node)
WRITE_INT_FIELD(constlen);
WRITE_BOOL_FIELD(constbyval);
WRITE_BOOL_FIELD(constisnull);
- /* XXX what about constisset, constiscast? */
appendStringInfo(str, " :constvalue ");
if (node->constisnull)
diff --git a/src/backend/nodes/readfuncs.c b/src/backend/nodes/readfuncs.c
index ab5d1821ce5..eca2e3017b0 100644
--- a/src/backend/nodes/readfuncs.c
+++ b/src/backend/nodes/readfuncs.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.139 2002/11/25 18:12:10 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.140 2002/11/25 21:29:38 tgl Exp $
*
* NOTES
* Path and Plan nodes do not have any readfuncs support, because we
@@ -390,7 +390,6 @@ _readConst(void)
READ_INT_FIELD(constlen);
READ_BOOL_FIELD(constbyval);
READ_BOOL_FIELD(constisnull);
- /* XXX what about constisset, constiscast? */
token = pg_strtok(&length); /* skip :constvalue */
if (local_node->constisnull)
diff --git a/src/backend/optimizer/path/clausesel.c b/src/backend/optimizer/path/clausesel.c
index 8a1ab28ac1e..d0976ca4219 100644
--- a/src/backend/optimizer/path/clausesel.c
+++ b/src/backend/optimizer/path/clausesel.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/path/clausesel.c,v 1.52 2002/10/19 02:56:16 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/path/clausesel.c,v 1.53 2002/11/25 21:29:39 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -29,8 +29,7 @@
/* note that pg_type.h hardwires size of bool as 1 ... duplicate it */
#define MAKEBOOLCONST(val,isnull) \
- ((Node *) makeConst(BOOLOID, 1, (Datum) (val), \
- (isnull), true, false, false))
+ ((Node *) makeConst(BOOLOID, 1, (Datum) (val), (isnull), true))
/*
diff --git a/src/backend/optimizer/path/indxpath.c b/src/backend/optimizer/path/indxpath.c
index ae5db3634ff..c0241bb9ef3 100644
--- a/src/backend/optimizer/path/indxpath.c
+++ b/src/backend/optimizer/path/indxpath.c
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.125 2002/11/24 21:52:14 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.126 2002/11/25 21:29:39 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -2167,7 +2167,7 @@ network_prefix_quals(Var *leftop, Oid expr_op, Datum rightop)
op = makeOper(opr1oid, InvalidOid, BOOLOID, false);
expr = make_opclause(op, leftop,
(Var *) makeConst(datatype, -1, opr1right,
- false, false, false, false));
+ false, false));
result = makeList1(expr);
/* create clause "key <= network_scan_last( rightop )" */
@@ -2182,7 +2182,7 @@ network_prefix_quals(Var *leftop, Oid expr_op, Datum rightop)
op = makeOper(opr2oid, InvalidOid, BOOLOID, false);
expr = make_opclause(op, leftop,
(Var *) makeConst(datatype, -1, opr2right,
- false, false, false, false));
+ false, false));
result = lappend(result, expr);
return result;
@@ -2233,5 +2233,5 @@ string_to_const(const char *str, Oid datatype)
Datum conval = string_to_datum(str, datatype);
return makeConst(datatype, ((datatype == NAMEOID) ? NAMEDATALEN : -1),
- conval, false, false, false, false);
+ conval, false, false);
}
diff --git a/src/backend/optimizer/prep/preptlist.c b/src/backend/optimizer/prep/preptlist.c
index 95687cb0d0d..68895143061 100644
--- a/src/backend/optimizer/prep/preptlist.c
+++ b/src/backend/optimizer/prep/preptlist.c
@@ -15,7 +15,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/prep/preptlist.c,v 1.57 2002/09/18 21:35:21 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/prep/preptlist.c,v 1.58 2002/11/25 21:29:40 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -183,9 +183,7 @@ expand_targetlist(List *tlist, int command_type,
att_tup->attlen,
(Datum) 0,
true, /* isnull */
- att_tup->attbyval,
- false, /* not a set */
- false);
+ att_tup->attbyval);
if (!att_tup->attisdropped)
new_expr = coerce_type_constraints(new_expr,
atttype,
@@ -198,9 +196,7 @@ expand_targetlist(List *tlist, int command_type,
att_tup->attlen,
(Datum) 0,
true, /* isnull */
- att_tup->attbyval,
- false, /* not a set */
- false);
+ att_tup->attbyval);
else
new_expr = (Node *) makeVar(result_relation,
attrno,
diff --git a/src/backend/optimizer/prep/prepunion.c b/src/backend/optimizer/prep/prepunion.c
index 914b0eee618..79063c02806 100644
--- a/src/backend/optimizer/prep/prepunion.c
+++ b/src/backend/optimizer/prep/prepunion.c
@@ -14,7 +14,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/prep/prepunion.c,v 1.80 2002/09/18 21:35:21 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/prep/prepunion.c,v 1.81 2002/11/25 21:29:40 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -448,9 +448,7 @@ generate_setop_tlist(List *colTypes, int flag,
sizeof(int4),
Int32GetDatum(flag),
false,
- true,
- false,
- false);
+ true);
tlist = lappend(tlist, makeTargetEntry(resdom, expr));
}
diff --git a/src/backend/optimizer/util/clauses.c b/src/backend/optimizer/util/clauses.c
index e7b4e3b5dbc..2bc1c2afbec 100644
--- a/src/backend/optimizer/util/clauses.c
+++ b/src/backend/optimizer/util/clauses.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/util/clauses.c,v 1.111 2002/11/15 02:50:07 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/util/clauses.c,v 1.112 2002/11/25 21:29:40 tgl Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
@@ -36,8 +36,7 @@
/* note that pg_type.h hardwires size of bool as 1 ... duplicate it */
#define MAKEBOOLCONST(val,isnull) \
- ((Node *) makeConst(BOOLOID, 1, (Datum) (val), \
- (isnull), true, false, false))
+ ((Node *) makeConst(BOOLOID, 1, (Datum) (val), (isnull), true))
typedef struct
{
@@ -666,7 +665,8 @@ check_subplans_for_ungrouped_vars_walker(Node *node,
if (node == NULL)
return false;
- if (IsA(node, Const) ||IsA(node, Param))
+ if (IsA(node, Const) ||
+ IsA(node, Param))
return false; /* constants are always acceptable */
/*
@@ -1286,8 +1286,8 @@ eval_const_expressions_mutator(Node *node, void *context)
* Make the constant result node.
*/
return (Node *) makeConst(result_typeid, resultTypLen,
- const_val, const_is_null,
- resultTypByVal, false, false);
+ const_val, const_is_null,
+ resultTypByVal);
}
break;
}
@@ -1734,7 +1734,7 @@ simplify_op_or_func(Expr *expr, List *args)
*/
return (Expr *) makeConst(result_typeid, resultTypLen,
const_val, const_is_null,
- resultTypByVal, false, false);
+ resultTypByVal);
}
diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y
index df09e0177cc..d4c879f7702 100644
--- a/src/backend/parser/gram.y
+++ b/src/backend/parser/gram.y
@@ -11,7 +11,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.382 2002/11/25 03:36:50 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.383 2002/11/25 21:29:40 tgl Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
@@ -4437,8 +4437,6 @@ select_limit_value:
n->constvalue = Int32GetDatum($1);
n->constisnull = FALSE;
n->constbyval = TRUE;
- n->constisset = FALSE;
- n->constiscast = FALSE;
$$ = (Node *)n;
}
| ALL
@@ -4451,8 +4449,6 @@ select_limit_value:
n->constvalue = (Datum) 0;
n->constisnull = TRUE;
n->constbyval = TRUE;
- n->constisset = FALSE;
- n->constiscast = FALSE;
$$ = (Node *)n;
}
| PARAM
@@ -4479,8 +4475,6 @@ select_offset_value:
n->constvalue = Int32GetDatum($1);
n->constisnull = FALSE;
n->constbyval = TRUE;
- n->constisset = FALSE;
- n->constiscast = FALSE;
$$ = (Node *)n;
}
| PARAM
diff --git a/src/backend/parser/parse_coerce.c b/src/backend/parser/parse_coerce.c
index a24af2de3e1..e6559086286 100644
--- a/src/backend/parser/parse_coerce.c
+++ b/src/backend/parser/parse_coerce.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/parse_coerce.c,v 2.86 2002/11/15 02:50:09 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/parse_coerce.c,v 2.87 2002/11/25 21:29:41 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -161,7 +161,6 @@ coerce_type(Node *node, Oid inputTypeId, Oid targetTypeId,
newcon->constlen = typeLen(targetType);
newcon->constbyval = typeByVal(targetType);
newcon->constisnull = con->constisnull;
- newcon->constisset = false;
if (!con->constisnull)
{
@@ -553,9 +552,7 @@ coerce_type_typmod(Node *node, Oid targetTypeId, int32 targetTypMod,
sizeof(int32),
Int32GetDatum(targetTypMod),
false,
- true,
- false,
- false);
+ true);
args = makeList2(node, cons);
@@ -566,9 +563,7 @@ coerce_type_typmod(Node *node, Oid targetTypeId, int32 targetTypMod,
sizeof(bool),
BoolGetDatum(cformat != COERCE_IMPLICIT_CAST),
false,
- true,
- false,
- false);
+ true);
args = lappend(args, cons);
}
diff --git a/src/backend/parser/parse_node.c b/src/backend/parser/parse_node.c
index 608a67921c1..088aaafb0b3 100644
--- a/src/backend/parser/parse_node.c
+++ b/src/backend/parser/parse_node.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/parse_node.c,v 1.73 2002/11/15 02:50:09 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/parse_node.c,v 1.74 2002/11/25 21:29:41 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -293,9 +293,7 @@ transformArraySubscripts(ParseState *pstate,
sizeof(int32),
Int32GetDatum(1),
false,
- true, /* pass by value */
- false,
- false);
+ true); /* pass by value */
}
lowerIndexpr = lappend(lowerIndexpr, subexpr);
}
@@ -444,8 +442,6 @@ make_const(Value *value)
-1,
(Datum) NULL,
true,
- false,
- false,
false);
return con;
}
@@ -454,9 +450,7 @@ make_const(Value *value)
typelen,
val,
false,
- typebyval,
- false, /* not a set */
- false); /* not coerced */
+ typebyval);
return con;
}
diff --git a/src/backend/utils/adt/ruleutils.c b/src/backend/utils/adt/ruleutils.c
index 9250faff27a..01aac333b5e 100644
--- a/src/backend/utils/adt/ruleutils.c
+++ b/src/backend/utils/adt/ruleutils.c
@@ -3,7 +3,7 @@
* back to source text
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/ruleutils.c,v 1.125 2002/11/15 02:50:09 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/ruleutils.c,v 1.126 2002/11/25 21:29:41 tgl Exp $
*
* This software is copyrighted by Jan Wieck - Hamburg.
*
@@ -2243,8 +2243,6 @@ get_rule_expr(Node *node, deparse_context *context,
switch (param->paramkind)
{
case PARAM_NAMED:
- case PARAM_NEW:
- case PARAM_OLD:
appendStringInfo(buf, "$%s", param->paramname);
break;
case PARAM_NUM:
diff --git a/src/backend/utils/adt/selfuncs.c b/src/backend/utils/adt/selfuncs.c
index 23e012c64e9..827b000d229 100644
--- a/src/backend/utils/adt/selfuncs.c
+++ b/src/backend/utils/adt/selfuncs.c
@@ -15,7 +15,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v 1.121 2002/11/19 23:21:59 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v 1.122 2002/11/25 21:29:42 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -3730,7 +3730,7 @@ string_to_const(const char *str, Oid datatype)
Datum conval = string_to_datum(str, datatype);
return makeConst(datatype, ((datatype == NAMEOID) ? NAMEDATALEN : -1),
- conval, false, false, false, false);
+ conval, false, false);
}
/*-------------------------------------------------------------------------
diff --git a/src/backend/utils/cache/lsyscache.c b/src/backend/utils/cache/lsyscache.c
index ae77dacd13a..cd7dc8d549f 100644
--- a/src/backend/utils/cache/lsyscache.c
+++ b/src/backend/utils/cache/lsyscache.c
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/cache/lsyscache.c,v 1.85 2002/09/19 23:40:56 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/cache/lsyscache.c,v 1.86 2002/11/25 21:29:42 tgl Exp $
*
* NOTES
* Eventually, the index information should go through here, too.
@@ -1047,9 +1047,7 @@ get_typdefault(Oid typid)
type->typlen,
datum,
false,
- type->typbyval,
- false, /* not a set */
- false);
+ type->typbyval);
pfree(strDefaultVal);
}
else
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;
/*