77 *
88 *
99 * IDENTIFICATION
10- * $Header: /cvsroot/pgsql/src/backend/parser/parse_agg.c,v 1.31 1999/12/10 07:37:35 tgl Exp $
10+ * $Header: /cvsroot/pgsql/src/backend/parser/parse_agg.c,v 1.32 1999/12/13 01:26:58 tgl Exp $
1111 *
1212 *-------------------------------------------------------------------------
1313 */
@@ -28,38 +28,11 @@ typedef struct {
2828List * groupClauses ;
2929}check_ungrouped_columns_context ;
3030
31- static bool contain_agg_clause (Node * clause );
32- static bool contain_agg_clause_walker (Node * node ,void * context );
3331static void check_ungrouped_columns (Node * node ,ParseState * pstate ,
3432List * groupClauses );
3533static bool check_ungrouped_columns_walker (Node * node ,
3634check_ungrouped_columns_context * context );
3735
38- /*
39- * contain_agg_clause
40- * Recursively find aggref nodes within a clause.
41- *
42- * Returns true if any aggregate found.
43- *
44- * NOTE: we assume that the given clause has been transformed suitably for
45- * parser output. This means we can use the planner's expression_tree_walker.
46- */
47- static bool
48- contain_agg_clause (Node * clause )
49- {
50- return contain_agg_clause_walker (clause ,NULL );
51- }
52-
53- static bool
54- contain_agg_clause_walker (Node * node ,void * context )
55- {
56- if (node == NULL )
57- return false;
58- if (IsA (node ,Aggref ))
59- return true;/* abort the tree traversal and return true */
60- return expression_tree_walker (node ,contain_agg_clause_walker ,context );
61- }
62-
6336/*
6437 * check_ungrouped_columns -
6538 * Scan the given expression tree for ungrouped variables (variables
@@ -232,7 +205,8 @@ ParseAgg(ParseState *pstate, char *aggname, Oid basetype,
232205 * Since "1" never evaluates as null, we currently have no need of
233206 * the "usenulls" flag, but it should be kept around; in fact, we should
234207 * extend the pg_aggregate table to let usenulls be specified as an
235- * attribute of user-defined aggregates.
208+ * attribute of user-defined aggregates. In the meantime, usenulls
209+ * is just always set to "false".
236210 */
237211
238212aggform = (Form_pg_aggregate )GETSTRUCT (theAggTuple );
@@ -264,14 +238,8 @@ ParseAgg(ParseState *pstate, char *aggname, Oid basetype,
264238aggref -> aggtype = fintype ;
265239aggref -> target = lfirst (args );
266240aggref -> usenulls = usenulls ;
267-
268- /*
269- * We should store agg_star and agg_distinct into the Aggref node,
270- * and let downstream processing deal with them. Currently, agg_star
271- * is ignored and agg_distinct is not implemented...
272- */
273- if (agg_distinct )
274- elog (ERROR ,"aggregate(DISTINCT ...) is not implemented yet" );
241+ aggref -> aggstar = agg_star ;
242+ aggref -> aggdistinct = agg_distinct ;
275243
276244pstate -> p_hasAggs = true;
277245