*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.37 1998/02/10 04:00:44 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.38 1998/02/13 03:27:42 vadim Exp $
*
*-------------------------------------------------------------------------
*/
static void
CopyPlanFields(Plan *from, Plan *newnode)
{
+ extern List *SS_pull_subplan (void *expr);
+
newnode->cost = from->cost;
newnode->plan_size = from->plan_size;
newnode->plan_width = from->plan_width;
newnode->qual = copyObject(from->qual);
newnode->lefttree = copyObject(from->lefttree);
newnode->righttree = copyObject(from->righttree);
+ newnode->extParam = listCopy (from->extParam);
+ newnode->locParam = listCopy (from->locParam);
+ newnode->chgParam = listCopy (from->chgParam);
+ Node_Copy(from, newnode, initPlan);
+ if ( from->subPlan != NULL )
+ newnode->subPlan = SS_pull_subplan (newnode->qual);
+ else
+ newnode->subPlan = NULL;
+ newnode->nParamExec = from->nParamExec;
}
/* ----------------
return newnode;
}
+static SubPlan *
+_copySubPlan(SubPlan *from)
+{
+ SubPlan *newnode = makeNode(SubPlan);
+
+ Node_Copy(from, newnode, plan);
+ newnode->plan_id = from->plan_id;
+ Node_Copy(from, newnode, rtable);
+ newnode->setParam = listCopy (from->setParam);
+ newnode->parParam = listCopy (from->parParam);
+ Node_Copy(from, newnode, sublink);
+ newnode->shutdown = from->shutdown;
+
+ return newnode;
+}
+
/* ****************************************************************
* primnodes.h copy functions
* ****************************************************************
case T_Hash:
retval = _copyHash(from);
break;
+ case T_SubPlan:
+ retval = _copySubPlan(from);
+ break;
/*
* PRIMITIVE NODES
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.14 1998/02/10 04:00:47 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.15 1998/02/13 03:27:44 vadim Exp $
*
*-------------------------------------------------------------------------
*/
return (false);
break;
case PARAM_NUM:
+ case PARAM_EXEC:
if (a->paramid != b->paramid)
return (false);
break;
return (true);
}
+static bool
+_equalSubPlan(SubPlan *a, SubPlan *b)
+{
+ if (a->plan_id != b->plan_id)
+ return (false);
+
+ if (!equal((a->sublink->oper), (b->sublink->oper)))
+ return (false);
+
+ return (true);
+}
+
static bool
_equalJInfo(JInfo *a, JInfo *b)
{
case T_IndexScan:
retval = _equalIndexScan(a, b);
break;
+ case T_SubPlan:
+ retval = _equalSubPlan(a, b);
+ break;
case T_JInfo:
retval = _equalJInfo(a, b);
break;
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.29 1998/02/10 16:03:21 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.30 1998/02/13 03:27:45 vadim Exp $
*
* NOTES
* Every (plan) node in POSTGRES has an associated "out" routine which
_outNode(str, node->lefttree);
appendStringInfo(str, " :righttree ");
_outNode(str, node->righttree);
-
+ appendStringInfo(str, " :extprm ");
+ _outIntList(str, node->extParam);
+ appendStringInfo(str, " :locprm ");
+ _outIntList(str, node->locParam);
+ appendStringInfo(str, " :initplan ");
+ _outNode(str, node->initPlan);
+ sprintf(buf, " :nprm %d ", node->nParamExec);
+ appendStringInfo(str, buf);
}
/*
appendStringInfo(str, buf);
}
+static void
+_outSubPlan(StringInfo str, SubPlan *node)
+{
+ char buf[500];
+
+ appendStringInfo(str, "SUBPLAN");
+ appendStringInfo(str, " :plan ");
+ _outNode(str, node->plan);
+ sprintf(buf, " :planid %u ", node->plan_id);
+ appendStringInfo(str, buf);
+ appendStringInfo(str, " :rtable ");
+ _outNode(str, node->rtable);
+ appendStringInfo(str, " :setprm ");
+ _outIntList (str, node->setParam);
+ appendStringInfo(str, " :parprm ");
+ _outIntList (str, node->parParam);
+ appendStringInfo(str, " :slink ");
+ _outNode(str, node->sublink);
+}
+
/*
* Scan is a subclass of Node
*/
case NOT_EXPR:
opstr = "not";
break;
+ case SUBPLAN_EXPR:
+ opstr = "subp";
+ break;
}
appendStringInfo(str, " :opType ");
appendStringInfo(str, opstr);
case T_Hash:
_outHash(str, obj);
break;
+ case T_SubPlan:
+ _outSubPlan(str, obj);
+ break;
case T_Tee:
_outTee(str, obj);
break;
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.24 1998/02/10 16:03:23 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.25 1998/02/13 03:27:47 vadim Exp $
*
* NOTES
* Most of the read functions for plan nodes are tested. (In fact, they
{
local_node->opType = NOT_EXPR;
}
+ else if (!strncmp(token, "subp", 4))
+ {
+ local_node->opType = SUBPLAN_EXPR;
+ }
token = lsptok(NULL, &length); /* eat :oper */
local_node->oper = nodeRead(true);