From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Gokulakannan Somasundaram <gokul007(at)gmail(dot)com> |
Cc: | pgsql-hackers list <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Bug in 9.0Alpha4 |
Date: | 2010-03-16 16:04:48 |
Message-ID: | 9920.1268755488@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Gokulakannan Somasundaram <gokul007(at)gmail(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Gokulakannan Somasundaram | 2010-03-16 16:13:24 | Re: Bug in 9.0Alpha4 |
Previous Message | Tom Lane | 2010-03-16 15:55:26 | Re: An idle thought |