aboutsummaryrefslogtreecommitdiff
path: root/src/backend/executor/nodeAppend.c
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>1998-07-15 22:16:21 +0000
committerBruce Momjian <bruce@momjian.us>1998-07-15 22:16:21 +0000
commitc1f1a2e03a78d52dc8e177d15e5822a0e8fbea4a (patch)
tree8ce7498698f01dfad25782cf70ab3bc5d6be2377 /src/backend/executor/nodeAppend.c
parent2077ce123b7ff86d047ced2849c0e44472d231ad (diff)
downloadpostgresql-c1f1a2e03a78d52dc8e177d15e5822a0e8fbea4a.tar.gz
postgresql-c1f1a2e03a78d52dc8e177d15e5822a0e8fbea4a.zip
Allow UNION/UNION ALL in subselects.
Diffstat (limited to 'src/backend/executor/nodeAppend.c')
-rw-r--r--src/backend/executor/nodeAppend.c27
1 files changed, 25 insertions, 2 deletions
diff --git a/src/backend/executor/nodeAppend.c b/src/backend/executor/nodeAppend.c
index a1c21e88939..aea18739344 100644
--- a/src/backend/executor/nodeAppend.c
+++ b/src/backend/executor/nodeAppend.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/nodeAppend.c,v 1.13 1998/07/15 14:54:30 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeAppend.c,v 1.14 1998/07/15 22:16:18 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -15,6 +15,7 @@
* ExecInitAppend - initialize the append node
* ExecProcAppend - retrieve the next tuple from the node
* ExecEndAppend - shut down the append node
+ * ExecReScanAppend - rescan the append node
*
* NOTES
* Each append node contains a list of one or more subplans which
@@ -34,7 +35,7 @@
* nil nil ... ... ...
* subplans
*
- * Append nodes are currently used to unions, and to support inheritance
+ * Append nodes are currently used for unions, and to support inheritance
* queries, where several relations need to be scanned.
* For example, in our standard person/student/employee/student-emp
* example, where student and employee inherit from person
@@ -500,3 +501,25 @@ ExecEndAppend(Append *node)
* appendstate->as_junkfilter_list here
*/
}
+void
+ExecReScanAppend(Append *node, ExprContext *exprCtxt, Plan *parent)
+{
+ AppendState *appendstate = node->appendstate;
+ int nplans = length(node->appendplans);
+ int i;
+
+ for (i = 0; i < nplans; i++)
+ {
+ Plan *rescanNode;
+
+ appendstate->as_whichplan = i;
+ rescanNode = (Plan *) nth(i, node->appendplans);
+ if (rescanNode->chgParam == NULL)
+ {
+ exec_append_initialize_next(node);
+ ExecReScan((Plan *)rescanNode, exprCtxt, (Plan *) node);
+ }
+ }
+ appendstate->as_whichplan = 0;
+ exec_append_initialize_next(node);
+}