Re: [HACKERS] Aggregate FILTER option is broken in v10

2017-10-16 Thread Andres Freund
On 2017-10-16 11:12:09 -0400, Tom Lane wrote: > I wrote: > > I think possibly the best answer is to revert 8ed3f11bb. We could > > think about some compromise solution like merging the projections > > only for aggregates without FILTER. But that would require two > > code paths through the releva

Re: [HACKERS] Aggregate FILTER option is broken in v10

2017-10-16 Thread Tom Lane
I wrote: > I think possibly the best answer is to revert 8ed3f11bb. We could > think about some compromise solution like merging the projections > only for aggregates without FILTER. But that would require two > code paths through the relevant functions in nodeAgg.c, which would > be a substantia

[HACKERS] Aggregate FILTER option is broken in v10

2017-10-16 Thread Tom Lane
Consider regression=# select sum(1/ten) filter (where ten>0) from tenk1; ERROR: division by zero This query works without error in versions before 10. It was evidently broken by commit 8ed3f11bb, which rearranged nodeAgg.c to evaluate all aggregate input expressions before considering any FILTE