]> granicus.if.org Git - postgresql/commitdiff
Fix replace_agg_clause() for unary operators.
authorVadim B. Mikheev <vadim4o@yahoo.com>
Thu, 12 Jun 1997 17:26:15 +0000 (17:26 +0000)
committerVadim B. Mikheev <vadim4o@yahoo.com>
Thu, 12 Jun 1997 17:26:15 +0000 (17:26 +0000)
src/backend/optimizer/plan/setrefs.c

index bf8c60b9e64e31dff7ba9375bb28cce09b328cf9..4527837e9d4055429f683379141b91b3d699a880 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *    $Header: /cvsroot/pgsql/src/backend/optimizer/plan/setrefs.c,v 1.3 1997/04/24 15:54:52 vadim Exp $
+ *    $Header: /cvsroot/pgsql/src/backend/optimizer/plan/setrefs.c,v 1.4 1997/06/12 17:26:15 vadim Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -690,10 +690,13 @@ replace_agg_clause(Node *clause, List *subplanTargetList)
         * This is an operator. Recursively call this routine
         * for both its left and right operands
         */
-       replace_agg_clause((Node*)get_leftop((Expr*)clause),
-                          subplanTargetList);
-       replace_agg_clause((Node*)get_rightop((Expr*)clause),
-                          subplanTargetList);
+       Node *left = (Node*)get_leftop((Expr*)clause);
+       Node *right = (Node*)get_rightop((Expr*)clause);
+       
+       if ( left != (Node*) NULL )
+           replace_agg_clause(left, subplanTargetList);
+       if ( right != (Node*) NULL )
+           replace_agg_clause(right, subplanTargetList);
     } else if (IsA(clause,Param) || IsA(clause,Const)) {
        /* do nothing! */
     } else {