On Fri, 2008-12-26 at 14:17 -0500, Tom Lane wrote:
> Greg Stark <greg.stark@enterprisedb.com> writes:
> > Yeah, it seems like adding a flag like iswindowable to aggregate
> > functions is the safest option.
>
> So the alternatives I see are:
>
> 1. Go back to Hitoshi's plan of passing WindowAggState to the
> aggregates. This will require changing every one of the ten aggregates
> in the core distro, as well as every third-party aggregate that has
> a similar optimization; and we just have to keep our fingers crossed
> that anyone who's taking a short-cut will fix their code before it
> fails in the field.
>
> 2. Use an intermediate dummy AggState as I have in my version, but
> document some convention for telling this from a "real" AggState
> when needed. (Not hard, we just pick some field that would never be
> zero in a real AggState and document testing that.) This is certainly
> on the ugly side, but it would very substantially cut the number of
> places that need changes. Only aggregates that are doing something
> irreversible in their final-functions would need to be touched.
>
> If we were working in a green field then #1 would clearly be the
> preferable choice, but worrying about compatibility with existing
> third-party aggregates is making me lean to #2. Comments?
>
> regards, tom lane
>
I believe the goal should be correctness but why not both? Fix what we
can and put in place a "work around" that would be removed in 8.5?
Joshua D. Drake
--
PostgreSQL Consulting, Development, Support, Training 503-667-4564 - http://www.commandprompt.com/ The PostgreSQL
Company,serving since 1997