diff --git a/src/backend/nodes/copyfuncs.c b/src/backend/nodes/copyfuncs.c
index 1e2373c25f1859d10c8d91cd5d3411eea5b2fb29..f704bf54b7b3052b44e052e9de2ee162b3f6fc96 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.17 1997/12/18 03:03:31 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.18 1997/12/18 04:33:31 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -1558,7 +1558,8 @@ _copyQuery(Query *from)
 	Node_Copy(from, newnode, groupClause);
 	Node_Copy(from, newnode, havingQual); /* currently ignored */
 
-	Node_Copy(from, newnode, Aggreg);
+	newnode->qry_numAgg = from->qry_numAgg;
+	Node_Copy(from, newnode, qry_aggs);
 
 	return newnode;
 }