Gokulakannan Somasundaram <gokul...@gmail.com> writes: > I noticed a problem with the source code of 9.0Alpha 4. In parse_agg.c, > there is a call made to transformSortClause. > ... > Here agg->aggorder should be a List of SortGroupClause pointers, whereas > transformSortClause expects the second argument as a list of SortBy > pointers.
Uh, no, read the comment at the head of transformAggregateCall: * parse_func.c has recognized the function as an aggregate, and has set * up all the fields of the Aggref except aggdistinct and agglevelsup. * However, the args list is just bare expressions, and the aggorder list * hasn't been transformed at all. * * Here we convert the args list into a targetlist by inserting TargetEntry * nodes, and then transform the aggorder and agg_distinct specifications to * produce lists of SortGroupClause nodes. (That might also result in adding * resjunk expressions to the targetlist.) transformSortClause is passed the untransformed aggorder list, which is in fact a list of SortBy nodes, and it returns the transformed list (SortGroupClause nodes), which is stored back into the aggorder field a bit further down. There are a number of regression tests that would fail in obvious ways if this code didn't work. regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers