Re: Window-functions patch handling of aggregates

From: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Greg Stark <greg(dot)stark(at)enterprisedb(dot)com>, Hitoshi Harada <umi(dot)tanuki(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Window-functions patch handling of aggregates
Date: 2008-12-26 19:29:21
Message-ID: 1230319761.6674.2.camel@jd-laptop.pragmaticzealot.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, 2008-12-26 at 14:17 -0500, Tom Lane wrote:
> Greg Stark <greg(dot)stark(at)enterprisedb(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2008-12-26 19:46:48 Re: Window-functions patch handling of aggregates
Previous Message Tom Lane 2008-12-26 19:17:29 Re: Window-functions patch handling of aggregates