Re: Window-functions patch handling of aggregates

From: "Hitoshi Harada" <umi(dot)tanuki(at)gmail(dot)com>
To: "Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com>
Cc: "Greg Stark" <greg(dot)stark(at)enterprisedb(dot)com>, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Gregory Stark" <stark(at)enterprisedb(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Window-functions patch handling of aggregates
Date: 2008-12-25 14:59:10
Message-ID: e08cc0400812250659u45355f55j55e18bbf755b41c9@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2008/12/25 Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>:
> 2008/12/25 Hitoshi Harada <umi(dot)tanuki(at)gmail(dot)com>:
>> 2008/12/25 Greg Stark <greg(dot)stark(at)enterprisedb(dot)com>:
>>> Yeah, it seems like adding a flag like iswindowable to aggregate functions
>>> is the safest option.
>>>
>>> It would be nice if it represented an abstract property of the state
>>> function or final function rather than just "works with the implementation
>>> of window functions". I'm not sure what that property is though -
>>> isidempotent? isreentrant? Maybe just a vague isrepeatable?
>>
>> No, I meant wrinting such like:
>>
>> Datum
>> some_trans_fn(PG_FUNCTION_ARGS)
>> {
>> if (fcinfo->context && IsA(fcinfo->context, WindowAggState))
>> elog(ERROR, "some_agg does not support window aggregate");
>>
>> ...
>> }
>>
>> rather than adding column to catalog. To add flag you must add new
>> syntax for CREATE AGGREGATE, which is slightly more painful.
>>
>
> enhancing of CREATE AGGREGATE syntax should be better, it could solve
> problem with compatibility.
>

Most of the aggregates have no problem with this issue and the rest
are fixable like array_agg. So adding a column and syntax is too much,
I guess. My suggestion of raising error is urgent patch for third
party aggregates that are copied from contrib/intagg.

But if there is a chance of general approach to call repeatable
aggregate other than WindowAgg, that should be considered.

Regards,

--
Hitoshi Harada

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2008-12-25 15:47:57 Re: Proposed Patch to Improve Performance of Multi-BatchHash Join for Skewed Data Sets
Previous Message Pavel Stehule 2008-12-25 13:02:43 Re: Window-functions patch handling of aggregates