aboutsummaryrefslogtreecommitdiff
path: root/src/backend/nodes
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/nodes')
-rw-r--r--src/backend/nodes/copyfuncs.c58
-rw-r--r--src/backend/nodes/equalfuncs.c42
-rw-r--r--src/backend/nodes/freefuncs.c54
-rw-r--r--src/backend/nodes/outfuncs.c44
-rw-r--r--src/backend/nodes/print.c5
-rw-r--r--src/backend/nodes/readfuncs.c68
6 files changed, 265 insertions, 6 deletions
diff --git a/src/backend/nodes/copyfuncs.c b/src/backend/nodes/copyfuncs.c
index 5f23a954b13..1b2726f8226 100644
--- a/src/backend/nodes/copyfuncs.c
+++ b/src/backend/nodes/copyfuncs.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.96 1999/11/15 03:28:06 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.97 1999/11/23 20:06:52 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -254,6 +254,32 @@ _copyIndexScan(IndexScan *from)
}
/* ----------------
+ * _copyTidScan
+ * ----------------
+ */
+static TidScan *
+_copyTidScan(TidScan *from)
+{
+ TidScan *newnode = makeNode(TidScan);
+
+ /* ----------------
+ * copy node superclass fields
+ * ----------------
+ */
+ CopyPlanFields((Plan *) from, (Plan *) newnode);
+ CopyScanFields((Scan *) from, (Scan *) newnode);
+ /* ----------------
+ * copy remainder of node
+ * ----------------
+ */
+ newnode->needRescan = from->needRescan;
+ Node_Copy(from, newnode, tideval);
+
+ return newnode;
+}
+
+
+/* ----------------
* CopyJoinFields
*
* This function copies the fields of the Join node. It is used by
@@ -1059,6 +1085,30 @@ _copyIndexPath(IndexPath *from)
}
/* ----------------
+ * _copyTidPath
+ * ----------------
+ */
+static TidPath *
+_copyTidPath(TidPath *from)
+{
+ TidPath *newnode = makeNode(TidPath);
+
+ /* ----------------
+ * copy the node superclass fields
+ * ----------------
+ */
+ CopyPathFields((Path *) from, (Path *) newnode);
+
+ /* ----------------
+ * copy remainder of node
+ * ----------------
+ */
+ Node_Copy(from, newnode, tideval);
+ newnode->unjoined_relids = listCopy(from->unjoined_relids);
+
+ return newnode;
+}
+/* ----------------
* CopyJoinPathFields
*
* This function copies the fields of the JoinPath node. It is used by
@@ -1437,6 +1487,9 @@ copyObject(void *from)
case T_IndexScan:
retval = _copyIndexScan(from);
break;
+ case T_TidScan:
+ retval = _copyTidScan(from);
+ break;
case T_Join:
retval = _copyJoin(from);
break;
@@ -1535,6 +1588,9 @@ copyObject(void *from)
case T_IndexPath:
retval = _copyIndexPath(from);
break;
+ case T_TidPath:
+ retval = _copyTidPath(from);
+ break;
case T_NestPath:
retval = _copyNestPath(from);
break;
diff --git a/src/backend/nodes/equalfuncs.c b/src/backend/nodes/equalfuncs.c
index fccb9d31608..b35b2712754 100644
--- a/src/backend/nodes/equalfuncs.c
+++ b/src/backend/nodes/equalfuncs.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.51 1999/11/15 03:28:06 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.52 1999/11/23 20:06:52 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -331,6 +331,18 @@ _equalIndexPath(IndexPath *a, IndexPath *b)
}
static bool
+_equalTidPath(TidPath *a, TidPath *b)
+{
+ if (!_equalPath((Path *) a, (Path *) b))
+ return false;
+ if (!equal(a->tideval, b->tideval))
+ return false;
+ if (!equali(a->unjoined_relids, b->unjoined_relids))
+ return false;
+ return true;
+}
+
+static bool
_equalJoinPath(JoinPath *a, JoinPath *b)
{
if (!_equalPath((Path *) a, (Path *) b))
@@ -404,6 +416,28 @@ _equalIndexScan(IndexScan *a, IndexScan *b)
}
static bool
+_equalTidScan(TidScan *a, TidScan *b)
+{
+ Assert(IsA(a, TidScan));
+ Assert(IsA(b, TidScan));
+
+ /*
+ * if(a->scan.plan.cost != b->scan.plan.cost) return(false);
+ */
+
+ if (a->needRescan != b->needRescan)
+ return false;
+
+ if (!equal(a->tideval, b->tideval))
+ return false;
+
+ if (a->scan.scanrelid != b->scan.scanrelid)
+ return false;
+
+ return true;
+}
+
+static bool
_equalSubPlan(SubPlan *a, SubPlan *b)
{
/* should compare plans, but have to settle for comparing plan IDs */
@@ -756,6 +790,9 @@ equal(void *a, void *b)
case T_IndexPath:
retval = _equalIndexPath(a, b);
break;
+ case T_TidPath:
+ retval = _equalTidPath(a, b);
+ break;
case T_NestPath:
retval = _equalNestPath(a, b);
break;
@@ -768,6 +805,9 @@ equal(void *a, void *b)
case T_IndexScan:
retval = _equalIndexScan(a, b);
break;
+ case T_TidScan:
+ retval = _equalTidScan(a, b);
+ break;
case T_SubPlan:
retval = _equalSubPlan(a, b);
break;
diff --git a/src/backend/nodes/freefuncs.c b/src/backend/nodes/freefuncs.c
index db09b6700bc..66368afd687 100644
--- a/src/backend/nodes/freefuncs.c
+++ b/src/backend/nodes/freefuncs.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/nodes/Attic/freefuncs.c,v 1.27 1999/11/15 03:28:07 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/nodes/Attic/freefuncs.c,v 1.28 1999/11/23 20:06:53 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -184,6 +184,29 @@ _freeIndexScan(IndexScan *node)
}
/* ----------------
+ * _freeTidScan
+ * ----------------
+ */
+static void
+_freeTidScan(TidScan *node)
+{
+ /* ----------------
+ * free node superclass fields
+ * ----------------
+ */
+ FreePlanFields((Plan *) node);
+ FreeScanFields((Scan *) node);
+
+ /* ----------------
+ * free remainder of node
+ * ----------------
+ */
+ freeObject(node->tideval);
+
+ pfree(node);
+}
+
+/* ----------------
* FreeJoinFields
*
* This function frees the fields of the Join node. It is used by
@@ -782,6 +805,29 @@ _freeIndexPath(IndexPath *node)
}
/* ----------------
+ * _freeTidPath
+ * ----------------
+ */
+static void
+_freeTidPath(TidPath *node)
+{
+ /* ----------------
+ * free the node superclass fields
+ * ----------------
+ */
+ FreePathFields((Path *) node);
+
+ /* ----------------
+ * free remainder of node
+ * ----------------
+ */
+ freeObject(node->tideval);
+ freeList(node->unjoined_relids);
+
+ pfree(node);
+}
+
+/* ----------------
* FreeJoinPathFields
*
* This function frees the fields of the JoinPath node. It is used by
@@ -1079,6 +1125,9 @@ freeObject(void *node)
case T_IndexScan:
_freeIndexScan(node);
break;
+ case T_TidScan:
+ _freeTidScan(node);
+ break;
case T_Join:
_freeJoin(node);
break;
@@ -1177,6 +1226,9 @@ freeObject(void *node)
case T_IndexPath:
_freeIndexPath(node);
break;
+ case T_TidPath:
+ _freeTidPath(node);
+ break;
case T_NestPath:
_freeNestPath(node);
break;
diff --git a/src/backend/nodes/outfuncs.c b/src/backend/nodes/outfuncs.c
index 06c2520d271..789faad772c 100644
--- a/src/backend/nodes/outfuncs.c
+++ b/src/backend/nodes/outfuncs.c
@@ -5,7 +5,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: outfuncs.c,v 1.97 1999/10/07 04:23:04 tgl Exp $
+ * $Id: outfuncs.c,v 1.98 1999/11/23 20:06:53 momjian Exp $
*
* NOTES
* Every (plan) node in POSTGRES has an associated "out" routine which
@@ -452,6 +452,23 @@ _outIndexScan(StringInfo str, IndexScan *node)
}
/*
+ * TidScan is a subclass of Scan
+ */
+static void
+_outTidScan(StringInfo str, TidScan *node)
+{
+ appendStringInfo(str, " TIDSCAN ");
+ _outPlanInfo(str, (Plan *) node);
+
+ appendStringInfo(str, " :scanrelid %u ", node->scan.scanrelid);
+ appendStringInfo(str, " :needrescan %d ", node->needRescan);
+
+ appendStringInfo(str, " :tideval ");
+ _outNode(str, node->tideval);
+
+}
+
+/*
* Noname is a subclass of Plan
*/
static void
@@ -915,6 +932,25 @@ _outIndexPath(StringInfo str, IndexPath *node)
}
/*
+ * TidPath is a subclass of Path.
+ */
+static void
+_outTidPath(StringInfo str, TidPath *node)
+{
+ appendStringInfo(str,
+ " TIDPATH :pathtype %d :cost %f :pathkeys ",
+ node->path.pathtype,
+ node->path.path_cost);
+ _outNode(str, node->path.pathkeys);
+
+ appendStringInfo(str, " :tideval ");
+ _outNode(str, node->tideval);
+
+ appendStringInfo(str, " :un joined_relids ");
+ _outIntList(str, node->unjoined_relids);
+}
+
+/*
* NestPath is a subclass of Path
*/
static void
@@ -1357,6 +1393,9 @@ _outNode(StringInfo str, void *obj)
case T_IndexScan:
_outIndexScan(str, obj);
break;
+ case T_TidScan:
+ _outTidScan(str, obj);
+ break;
case T_Noname:
_outNoname(str, obj);
break;
@@ -1435,6 +1474,9 @@ _outNode(StringInfo str, void *obj)
case T_IndexPath:
_outIndexPath(str, obj);
break;
+ case T_TidPath:
+ _outTidPath(str, obj);
+ break;
case T_NestPath:
_outNestPath(str, obj);
break;
diff --git a/src/backend/nodes/print.c b/src/backend/nodes/print.c
index 9cb04181cde..3241816cd38 100644
--- a/src/backend/nodes/print.c
+++ b/src/backend/nodes/print.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/nodes/print.c,v 1.32 1999/08/16 02:17:43 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/nodes/print.c,v 1.33 1999/11/23 20:06:53 momjian Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
@@ -338,6 +338,9 @@ plannode_type(Plan *p)
case T_Group:
return "GROUP";
break;
+ case T_TidScan:
+ return "TIDSCAN";
+ break;
default:
return "UNKNOWN";
break;
diff --git a/src/backend/nodes/readfuncs.c b/src/backend/nodes/readfuncs.c
index ef62e5a285f..99be5199fa9 100644
--- a/src/backend/nodes/readfuncs.c
+++ b/src/backend/nodes/readfuncs.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.74 1999/10/07 04:23:04 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.75 1999/11/23 20:06:53 momjian Exp $
*
* NOTES
* Most of the read functions for plan nodes are tested. (In fact, they
@@ -542,6 +542,33 @@ _readIndexScan()
}
/* ----------------
+ * _readTidScan
+ *
+ * TidScan is a subclass of Scan
+ * ----------------
+ */
+static TidScan *
+_readTidScan()
+{
+ TidScan *local_node;
+ char *token;
+ int length;
+
+ local_node = makeNode(TidScan);
+
+ _getScan((Scan *) local_node);
+
+ token = lsptok(NULL, &length); /* eat :needrescan */
+ token = lsptok(NULL, &length); /* get needrescan */
+ local_node->needRescan = atoi(token);
+
+ token = lsptok(NULL, &length); /* eat :tideval */
+ local_node->tideval = nodeRead(true); /* now read it */
+
+ return local_node;
+}
+
+/* ----------------
* _readNoname
*
* Noname is a subclass of Plan
@@ -1477,6 +1504,41 @@ _readIndexPath()
}
/* ----------------
+ * _readTidPath
+ *
+ * TidPath is a subclass of Path.
+ * ----------------
+ */
+static TidPath *
+_readTidPath()
+{
+ TidPath *local_node;
+ char *token;
+ int length;
+
+ local_node = makeNode(TidPath);
+
+ token = lsptok(NULL, &length); /* get :pathtype */
+ token = lsptok(NULL, &length); /* now read it */
+ local_node->path.pathtype = atol(token);
+
+ token = lsptok(NULL, &length); /* get :cost */
+ token = lsptok(NULL, &length); /* now read it */
+ local_node->path.path_cost = (Cost) atof(token);
+
+ token = lsptok(NULL, &length); /* get :pathkeys */
+ local_node->path.pathkeys = nodeRead(true); /* now read it */
+
+ token = lsptok(NULL, &length); /* get :tideval */
+ local_node->tideval = nodeRead(true); /* now read it */
+
+ token = lsptok(NULL, &length); /* get :unjoined_relids */
+ local_node->unjoined_relids = toIntList(nodeRead(true));
+
+ return local_node;
+}
+
+/* ----------------
* _readNestPath
*
* NestPath is a subclass of Path
@@ -1801,6 +1863,8 @@ parsePlanString(void)
return_value = _readSeqScan();
else if (!strncmp(token, "INDEXSCAN", length))
return_value = _readIndexScan();
+ else if (!strncmp(token, "TIDSCAN", length))
+ return_value = _readTidScan();
else if (!strncmp(token, "NONAME", length))
return_value = _readNoname();
else if (!strncmp(token, "SORT", length))
@@ -1845,6 +1909,8 @@ parsePlanString(void)
return_value = _readPath();
else if (!strncmp(token, "INDEXPATH", length))
return_value = _readIndexPath();
+ else if (!strncmp(token, "TIDPATH", length))
+ return_value = _readTidPath();
else if (!strncmp(token, "NESTPATH", length))
return_value = _readNestPath();
else if (!strncmp(token, "MERGEPATH", length))