aboutsummaryrefslogtreecommitdiff
path: root/src/backend/nodes
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/nodes')
-rw-r--r--src/backend/nodes/copyfuncs.c44
-rw-r--r--src/backend/nodes/equalfuncs.c33
-rw-r--r--src/backend/nodes/makefuncs.c21
-rw-r--r--src/backend/nodes/outfuncs.c36
-rw-r--r--src/backend/nodes/readfuncs.c70
5 files changed, 116 insertions, 88 deletions
diff --git a/src/backend/nodes/copyfuncs.c b/src/backend/nodes/copyfuncs.c
index 2def370e9fb..33b630c7934 100644
--- a/src/backend/nodes/copyfuncs.c
+++ b/src/backend/nodes/copyfuncs.c
@@ -19,7 +19,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.118 2000/07/22 04:22:46 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.119 2000/08/08 15:41:23 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -717,14 +717,8 @@ _copyOper(Oper *from)
newnode->opno = from->opno;
newnode->opid = from->opid;
newnode->opresulttype = from->opresulttype;
- newnode->opsize = from->opsize;
-
- /*
- * NOTE: shall we copy the cache structure or just the pointer ?
- * Alternatively we can set 'op_fcache' to NULL, in which case the
- * executor will initialize it when it needs it...
- */
- newnode->op_fcache = from->op_fcache;
+ /* Do not copy the run-time state, if any */
+ newnode->op_fcache = NULL;
return newnode;
}
@@ -797,7 +791,6 @@ _copyParam(Param *from)
if (from->paramname != NULL)
newnode->paramname = pstrdup(from->paramname);
newnode->paramtype = from->paramtype;
- Node_Copy(from, newnode, param_tlist);
return newnode;
}
@@ -817,11 +810,8 @@ _copyFunc(Func *from)
*/
newnode->funcid = from->funcid;
newnode->functype = from->functype;
- newnode->funcisindex = from->funcisindex;
- newnode->funcsize = from->funcsize;
- newnode->func_fcache = from->func_fcache;
- Node_Copy(from, newnode, func_tlist);
- Node_Copy(from, newnode, func_planlist);
+ /* Do not copy the run-time state, if any */
+ newnode->func_fcache = NULL;
return newnode;
}
@@ -873,6 +863,27 @@ _copySubLink(SubLink *from)
}
/* ----------------
+ * _copyFieldSelect
+ * ----------------
+ */
+static FieldSelect *
+_copyFieldSelect(FieldSelect *from)
+{
+ FieldSelect *newnode = makeNode(FieldSelect);
+
+ /* ----------------
+ * copy remainder of node
+ * ----------------
+ */
+ Node_Copy(from, newnode, arg);
+ newnode->fieldnum = from->fieldnum;
+ newnode->resulttype = from->resulttype;
+ newnode->resulttypmod = from->resulttypmod;
+
+ return newnode;
+}
+
+/* ----------------
* _copyRelabelType
* ----------------
*/
@@ -1710,6 +1721,9 @@ copyObject(void *from)
case T_Iter:
retval = _copyIter(from);
break;
+ case T_FieldSelect:
+ retval = _copyFieldSelect(from);
+ break;
case T_RelabelType:
retval = _copyRelabelType(from);
break;
diff --git a/src/backend/nodes/equalfuncs.c b/src/backend/nodes/equalfuncs.c
index b85c410c253..701e6511e44 100644
--- a/src/backend/nodes/equalfuncs.c
+++ b/src/backend/nodes/equalfuncs.c
@@ -24,7 +24,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.70 2000/07/22 04:22:46 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.71 2000/08/08 15:41:24 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -154,7 +154,7 @@ _equalOper(Oper *a, Oper *b)
return false;
/*
- * We do not examine opid, opsize, or op_fcache, since these are
+ * We do not examine opid or op_fcache, since these are
* logically derived from opno, and they may not be set yet depending
* on how far along the node is in the parse/plan pipeline.
*
@@ -195,8 +195,6 @@ _equalParam(Param *a, Param *b)
return false;
if (a->paramtype != b->paramtype)
return false;
- if (!equal(a->param_tlist, b->param_tlist))
- return false;
switch (a->paramkind)
{
@@ -233,15 +231,7 @@ _equalFunc(Func *a, Func *b)
return false;
if (a->functype != b->functype)
return false;
- if (a->funcisindex != b->funcisindex)
- return false;
- if (a->funcsize != b->funcsize)
- return false;
- /* Note we do not look at func_fcache */
- if (!equal(a->func_tlist, b->func_tlist))
- return false;
- if (!equal(a->func_planlist, b->func_planlist))
- return false;
+ /* Note we do not look at func_fcache; see notes for _equalOper */
return true;
}
@@ -282,6 +272,20 @@ _equalSubLink(SubLink *a, SubLink *b)
}
static bool
+_equalFieldSelect(FieldSelect *a, FieldSelect *b)
+{
+ if (!equal(a->arg, b->arg))
+ return false;
+ if (a->fieldnum != b->fieldnum)
+ return false;
+ if (a->resulttype != b->resulttype)
+ return false;
+ if (a->resulttypmod != b->resulttypmod)
+ return false;
+ return true;
+}
+
+static bool
_equalRelabelType(RelabelType *a, RelabelType *b)
{
if (!equal(a->arg, b->arg))
@@ -787,6 +791,9 @@ equal(void *a, void *b)
case T_Iter:
retval = _equalIter(a, b);
break;
+ case T_FieldSelect:
+ retval = _equalFieldSelect(a, b);
+ break;
case T_RelabelType:
retval = _equalRelabelType(a, b);
break;
diff --git a/src/backend/nodes/makefuncs.c b/src/backend/nodes/makefuncs.c
index 4bad2008d77..45e1c03738c 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.21 2000/04/12 17:15:16 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/nodes/makefuncs.c,v 1.22 2000/08/08 15:41:24 tgl Exp $
*
* NOTES
* Creator functions in POSTGRES 4.2 are generated automatically. Most of
@@ -29,17 +29,14 @@
Oper *
makeOper(Oid opno,
Oid opid,
- Oid opresulttype,
- int opsize,
- FunctionCachePtr op_fcache)
+ Oid opresulttype)
{
Oper *oper = makeNode(Oper);
oper->opno = opno;
oper->opid = opid;
oper->opresulttype = opresulttype;
- oper->opsize = opsize;
- oper->op_fcache = op_fcache;
+ oper->op_fcache = NULL;
return oper;
}
@@ -99,8 +96,6 @@ makeResdom(AttrNumber resno,
Oid restype,
int32 restypmod,
char *resname,
- Index reskey,
- Oid reskeyop,
bool resjunk)
{
Resdom *resdom = makeNode(Resdom);
@@ -111,12 +106,14 @@ makeResdom(AttrNumber resno,
resdom->resname = resname;
/*
- * For historical reasons, ressortgroupref defaults to 0 while
- * reskey/reskeyop are passed in explicitly. This is pretty silly.
+ * We always set the sorting/grouping fields to 0. If the caller wants
+ * to change them he must do so explicitly. Few if any callers should
+ * be doing that, so omitting these arguments reduces the chance of error.
*/
resdom->ressortgroupref = 0;
- resdom->reskey = reskey;
- resdom->reskeyop = reskeyop;
+ resdom->reskey = 0;
+ resdom->reskeyop = InvalidOid;
+
resdom->resjunk = resjunk;
return resdom;
}
diff --git a/src/backend/nodes/outfuncs.c b/src/backend/nodes/outfuncs.c
index 155aae37ad2..14f2ab106c7 100644
--- a/src/backend/nodes/outfuncs.c
+++ b/src/backend/nodes/outfuncs.c
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.124 2000/07/22 04:22:46 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.125 2000/08/08 15:41:26 tgl Exp $
*
* NOTES
* Every (plan) node in POSTGRES has an associated "out" routine which
@@ -758,6 +758,19 @@ _outSubLink(StringInfo str, SubLink *node)
}
/*
+ * FieldSelect
+ */
+static void
+_outFieldSelect(StringInfo str, FieldSelect *node)
+{
+ appendStringInfo(str, " FIELDSELECT :arg ");
+ _outNode(str, node->arg);
+
+ appendStringInfo(str, " :fieldnum %d :resulttype %u :resulttypmod %d ",
+ node->fieldnum, node->resulttype, node->resulttypmod);
+}
+
+/*
* RelabelType
*/
static void
@@ -802,19 +815,9 @@ _outArrayRef(StringInfo str, ArrayRef *node)
static void
_outFunc(StringInfo str, Func *node)
{
- appendStringInfo(str,
- " FUNC :funcid %u :functype %u :funcisindex %s :funcsize %d ",
+ appendStringInfo(str, " FUNC :funcid %u :functype %u ",
node->funcid,
- node->functype,
- node->funcisindex ? "true" : "false",
- node->funcsize);
-
- appendStringInfo(str, " :func_fcache @ 0x%x :func_tlist ",
- (int) node->func_fcache);
- _outNode(str, node->func_tlist);
-
- appendStringInfo(str, " :func_planlist ");
- _outNode(str, node->func_planlist);
+ node->functype);
}
/*
@@ -840,9 +843,7 @@ _outParam(StringInfo str, Param *node)
node->paramkind,
node->paramid);
_outToken(str, node->paramname);
- appendStringInfo(str, " :paramtype %u :param_tlist ",
- node->paramtype);
- _outNode(str, node->param_tlist);
+ appendStringInfo(str, " :paramtype %u ", node->paramtype);
}
/*
@@ -1482,6 +1483,9 @@ _outNode(StringInfo str, void *obj)
case T_SubLink:
_outSubLink(str, obj);
break;
+ case T_FieldSelect:
+ _outFieldSelect(str, obj);
+ break;
case T_RelabelType:
_outRelabelType(str, obj);
break;
diff --git a/src/backend/nodes/readfuncs.c b/src/backend/nodes/readfuncs.c
index c663ba304fc..17e0396e5fe 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.94 2000/07/22 04:22:46 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.95 2000/08/08 15:41:27 tgl Exp $
*
* NOTES
* Most of the read functions for plan nodes are tested. (In fact, they
@@ -942,29 +942,7 @@ _readFunc()
token = lsptok(NULL, &length); /* now read it */
local_node->functype = (Oid) atol(token);
- token = lsptok(NULL, &length); /* get :funcisindex */
- token = lsptok(NULL, &length); /* now read it */
-
- if (!strncmp(token, "true", 4))
- local_node->funcisindex = true;
- else
- local_node->funcisindex = false;
-
- token = lsptok(NULL, &length); /* get :funcsize */
- token = lsptok(NULL, &length); /* now read it */
- local_node->funcsize = atol(token);
-
- token = lsptok(NULL, &length); /* get :func_fcache */
- token = lsptok(NULL, &length); /* get @ */
- token = lsptok(NULL, &length); /* now read it */
-
- local_node->func_fcache = (FunctionCache *) NULL;
-
- token = lsptok(NULL, &length); /* get :func_tlist */
- local_node->func_tlist = nodeRead(true); /* now read it */
-
- token = lsptok(NULL, &length); /* get :func_planlist */
- local_node->func_planlist = nodeRead(true); /* now read it */
+ local_node->func_fcache = NULL;
return local_node;
}
@@ -996,11 +974,7 @@ _readOper()
token = lsptok(NULL, &length); /* now read it */
local_node->opresulttype = (Oid) atol(token);
- /*
- * NOTE: Alternatively we can call 'replace_opid' which initializes
- * both 'opid' and 'op_fcache'.
- */
- local_node->op_fcache = (FunctionCache *) NULL;
+ local_node->op_fcache = NULL;
return local_node;
}
@@ -1039,9 +1013,6 @@ _readParam()
token = lsptok(NULL, &length); /* now read it */
local_node->paramtype = (Oid) atol(token);
- token = lsptok(NULL, &length); /* get :param_tlist */
- local_node->param_tlist = nodeRead(true); /* now read it */
-
return local_node;
}
@@ -1122,6 +1093,39 @@ _readSubLink()
}
/* ----------------
+ * _readFieldSelect
+ *
+ * FieldSelect is a subclass of Node
+ * ----------------
+ */
+static FieldSelect *
+_readFieldSelect()
+{
+ FieldSelect *local_node;
+ char *token;
+ int length;
+
+ local_node = makeNode(FieldSelect);
+
+ token = lsptok(NULL, &length); /* eat :arg */
+ local_node->arg = nodeRead(true); /* now read it */
+
+ token = lsptok(NULL, &length); /* eat :fieldnum */
+ token = lsptok(NULL, &length); /* get fieldnum */
+ local_node->fieldnum = (AttrNumber) atoi(token);
+
+ token = lsptok(NULL, &length); /* eat :resulttype */
+ token = lsptok(NULL, &length); /* get resulttype */
+ local_node->resulttype = (Oid) atol(token);
+
+ token = lsptok(NULL, &length); /* eat :resulttypmod */
+ token = lsptok(NULL, &length); /* get resulttypmod */
+ local_node->resulttypmod = atoi(token);
+
+ return local_node;
+}
+
+/* ----------------
* _readRelabelType
*
* RelabelType is a subclass of Node
@@ -1781,6 +1785,8 @@ parsePlanString(void)
return_value = _readAggref();
else if (length == 7 && strncmp(token, "SUBLINK", length) == 0)
return_value = _readSubLink();
+ else if (length == 11 && strncmp(token, "FIELDSELECT", length) == 0)
+ return_value = _readFieldSelect();
else if (length == 11 && strncmp(token, "RELABELTYPE", length) == 0)
return_value = _readRelabelType();
else if (length == 3 && strncmp(token, "AGG", length) == 0)