8
8
*
9
9
*
10
10
* IDENTIFICATION
11
- * $Header: /cvsroot/pgsql/src/backend/optimizer/util/clauses.c,v 1.126 2003/02/03 21:15:44 tgl Exp $
11
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/util/clauses.c,v 1.127 2003/02/04 00:50:00 tgl Exp $
12
12
*
13
13
* HISTORY
14
14
* AUTHOR DATE MAJOR EVENT
@@ -51,10 +51,9 @@ typedef struct
51
51
52
52
static bool contain_agg_clause_walker (Node * node , void * context );
53
53
static bool contain_distinct_agg_clause_walker (Node * node , void * context );
54
- static bool pull_agg_clause_walker (Node * node , List * * listptr );
54
+ static bool count_agg_clause_walker (Node * node , int * count );
55
55
static bool expression_returns_set_walker (Node * node , void * context );
56
56
static bool contain_subplans_walker (Node * node , void * context );
57
- static bool pull_subplans_walker (Node * node , List * * listptr );
58
57
static bool contain_mutable_functions_walker (Node * node , void * context );
59
58
static bool contain_volatile_functions_walker (Node * node , void * context );
60
59
static bool contain_nonstrict_functions_walker (Node * node , void * context );
@@ -373,31 +372,28 @@ contain_distinct_agg_clause_walker(Node *node, void *context)
373
372
}
374
373
375
374
/*
376
- * pull_agg_clause
377
- * Recursively pulls all Aggref nodes from an expression tree.
378
- *
379
- * Returns list of Aggref nodes found. Note the nodes themselves are not
380
- * copied, only referenced.
375
+ * count_agg_clause
376
+ * Recursively count the Aggref nodes in an expression tree.
381
377
*
382
378
* Note: this also checks for nested aggregates, which are an error.
383
379
*/
384
- List *
385
- pull_agg_clause (Node * clause )
380
+ int
381
+ count_agg_clause (Node * clause )
386
382
{
387
- List * result = NIL ;
383
+ int result = 0 ;
388
384
389
- pull_agg_clause_walker (clause , & result );
385
+ count_agg_clause_walker (clause , & result );
390
386
return result ;
391
387
}
392
388
393
389
static bool
394
- pull_agg_clause_walker (Node * node , List * * listptr )
390
+ count_agg_clause_walker (Node * node , int * count )
395
391
{
396
392
if (node == NULL )
397
393
return false;
398
394
if (IsA (node , Aggref ))
399
395
{
400
- * listptr = lappend ( * listptr , node ) ;
396
+ ( * count ) ++ ;
401
397
402
398
/*
403
399
* Complain if the aggregate's argument contains any aggregates;
@@ -411,8 +407,8 @@ pull_agg_clause_walker(Node *node, List **listptr)
411
407
*/
412
408
return false;
413
409
}
414
- return expression_tree_walker (node , pull_agg_clause_walker ,
415
- (void * ) listptr );
410
+ return expression_tree_walker (node , count_agg_clause_walker ,
411
+ (void * ) count );
416
412
}
417
413
418
414
@@ -511,36 +507,6 @@ contain_subplans_walker(Node *node, void *context)
511
507
return expression_tree_walker (node , contain_subplans_walker , context );
512
508
}
513
509
514
- /*
515
- * pull_subplans
516
- * Recursively pulls all subplans from an expression tree.
517
- *
518
- * Returns list of SubPlan nodes found. Note the nodes themselves
519
- * are not copied, only referenced.
520
- */
521
- List *
522
- pull_subplans (Node * clause )
523
- {
524
- List * result = NIL ;
525
-
526
- pull_subplans_walker (clause , & result );
527
- return result ;
528
- }
529
-
530
- static bool
531
- pull_subplans_walker (Node * node , List * * listptr )
532
- {
533
- if (node == NULL )
534
- return false;
535
- if (is_subplan (node ))
536
- {
537
- * listptr = lappend (* listptr , node );
538
- /* fall through to check args to subplan */
539
- }
540
- return expression_tree_walker (node , pull_subplans_walker ,
541
- (void * ) listptr );
542
- }
543
-
544
510
545
511
/*****************************************************************************
546
512
* Check clauses for mutable functions
0 commit comments