8
8
*
9
9
*
10
10
* IDENTIFICATION
11
- * $PostgreSQL: pgsql/src/backend/parser/parse_agg.c,v 1.92 2010/02/26 02:00:49 momjian Exp $
11
+ * $PostgreSQL: pgsql/src/backend/parser/parse_agg.c,v 1.93 2010/03/17 16:52:38 tgl Exp $
12
12
*
13
13
*-------------------------------------------------------------------------
14
14
*/
@@ -44,10 +44,11 @@ static bool check_ungrouped_columns_walker(Node *node,
44
44
* transformAggregateCall -
45
45
* Finish initial transformation of an aggregate call
46
46
*
47
- * parse_func.c has recognized the function as an aggregate, and has set
48
- * up all the fields of the Aggref except aggdistinct and agglevelsup.
49
- * However, the args list is just bare expressions, and the aggorder list
50
- * hasn't been transformed at all.
47
+ * parse_func.c has recognized the function as an aggregate, and has set up
48
+ * all the fields of the Aggref except args, aggorder, aggdistinct and
49
+ * agglevelsup. The passed-in args list has been through standard expression
50
+ * transformation, while the passed-in aggorder list hasn't been transformed
51
+ * at all.
51
52
*
52
53
* Here we convert the args list into a targetlist by inserting TargetEntry
53
54
* nodes, and then transform the aggorder and agg_distinct specifications to
@@ -59,7 +60,8 @@ static bool check_ungrouped_columns_walker(Node *node,
59
60
* pstate level.
60
61
*/
61
62
void
62
- transformAggregateCall (ParseState * pstate , Aggref * agg , bool agg_distinct )
63
+ transformAggregateCall (ParseState * pstate , Aggref * agg ,
64
+ List * args , List * aggorder , bool agg_distinct )
63
65
{
64
66
List * tlist ;
65
67
List * torder ;
@@ -75,7 +77,7 @@ transformAggregateCall(ParseState *pstate, Aggref *agg, bool agg_distinct)
75
77
*/
76
78
tlist = NIL ;
77
79
attno = 1 ;
78
- foreach (lc , agg -> args )
80
+ foreach (lc , args )
79
81
{
80
82
Expr * arg = (Expr * ) lfirst (lc );
81
83
TargetEntry * tle = makeTargetEntry (arg , attno ++ , NULL , false);
@@ -96,7 +98,7 @@ transformAggregateCall(ParseState *pstate, Aggref *agg, bool agg_distinct)
96
98
pstate -> p_next_resno = attno ;
97
99
98
100
torder = transformSortClause (pstate ,
99
- agg -> aggorder ,
101
+ aggorder ,
100
102
& tlist ,
101
103
true /* fix unknowns */ ,
102
104
true /* force SQL99 rules */ );
0 commit comments