aboutsummaryrefslogtreecommitdiff
path: root/src/backend/nodes/copyfuncs.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>1999-03-03 00:02:42 +0000
committerTom Lane <tgl@sss.pgh.pa.us>1999-03-03 00:02:42 +0000
commite0345e09bf420833ce0647c616414a2913148f1e (patch)
tree7b94d17e81719dfe431dfc9ce099bfa1d58b0549 /src/backend/nodes/copyfuncs.c
parentb204d10c79b5177026565a0db531a86f585f09f4 (diff)
downloadpostgresql-e0345e09bf420833ce0647c616414a2913148f1e.tar.gz
postgresql-e0345e09bf420833ce0647c616414a2913148f1e.zip
Partial fix for copied-plan bugs reported by Hiroshi Inoue:
_copyResult didn't copy subPlan structure completely. _copyAgg is still busted, apparently because of changes from EXCEPT/INTERSECT patch (get_agg_tlist_references is no longer sufficient to find all aggregates). No time to look at that tonight, however.
Diffstat (limited to 'src/backend/nodes/copyfuncs.c')
-rw-r--r--src/backend/nodes/copyfuncs.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/backend/nodes/copyfuncs.c b/src/backend/nodes/copyfuncs.c
index 8f8e65c374a..426a953891f 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.75 1999/03/01 00:10:30 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.76 1999/03/03 00:02:42 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -30,6 +30,7 @@
#include "catalog/pg_type.h"
#include "storage/lmgr.h"
#include "optimizer/planmain.h"
+#include "optimizer/subselect.h"
/*
* listCopy
@@ -78,8 +79,6 @@ listCopy(List *list)
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;
@@ -93,7 +92,7 @@ CopyPlanFields(Plan *from, Plan *newnode)
newnode->chgParam = listCopy(from->chgParam);
Node_Copy(from, newnode, initPlan);
if (from->subPlan != NULL)
- newnode->subPlan = SS_pull_subplan(newnode->qual);
+ newnode->subPlan = SS_pull_subplan((Node*) newnode->qual);
else
newnode->subPlan = NULL;
newnode->nParamExec = from->nParamExec;
@@ -139,6 +138,11 @@ _copyResult(Result *from)
*/
Node_Copy(from, newnode, resconstantqual);
+ /* We must add subplans in resconstantqual to the new plan's subPlan list
+ */
+ newnode->plan.subPlan = nconc(newnode->plan.subPlan,
+ SS_pull_subplan(newnode->resconstantqual));
+
return newnode;
}