Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 0f57641

Browse files
committed
Fix replace_agg_clause() for unary operators.
1 parent 8f846a3 commit 0f57641

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/backend/optimizer/plan/setrefs.c

+8-5
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/setrefs.c,v 1.3 1997/04/24 15:54:52 vadim Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/setrefs.c,v 1.4 1997/06/12 17:26:15 vadim Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -690,10 +690,13 @@ replace_agg_clause(Node *clause, List *subplanTargetList)
690690
* This is an operator. Recursively call this routine
691691
* for both its left and right operands
692692
*/
693-
replace_agg_clause((Node*)get_leftop((Expr*)clause),
694-
subplanTargetList);
695-
replace_agg_clause((Node*)get_rightop((Expr*)clause),
696-
subplanTargetList);
693+
Node *left = (Node*)get_leftop((Expr*)clause);
694+
Node *right = (Node*)get_rightop((Expr*)clause);
695+
696+
if ( left != (Node*) NULL )
697+
replace_agg_clause(left, subplanTargetList);
698+
if ( right != (Node*) NULL )
699+
replace_agg_clause(right, subplanTargetList);
697700
} else if (IsA(clause,Param) || IsA(clause,Const)) {
698701
/* do nothing! */
699702
} else {

0 commit comments

Comments
 (0)