Re: [PATCH] Negative Transition Aggregate Functions (WIP)

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [PATCH] Negative Transition Aggregate Functions (WIP)
Дата
Msg-id 11275.1389365375@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: [PATCH] Negative Transition Aggregate Functions (WIP)  (Florian Pflug <fgp@phlo.org>)
Ответы Re: [PATCH] Negative Transition Aggregate Functions (WIP)  (Florian Pflug <fgp@phlo.org>)
Список pgsql-hackers
Florian Pflug <fgp@phlo.org> writes:
> On Jan10, 2014, at 09:34 , David Rowley <dgrowleyml@gmail.com> wrote:
>> I just don't quite know yet the base way for the inverse transition function to communicate this to the caller yet.
Ifyou have any ideas on the best way to do this then I'd really like to hear them.
 

> Could they maybe just return NULL as the new state? It would mean that
> aggregates that do want to provide an inverse transition function couldn't
> use NULL as a valid aggregate state, but do we need to support that?

Yeah, I was going to suggest the same.  Seems like it wouldn't be that
difficult to come up with some alternative representation for "everything
seen so far was NULL", if you needed to.

> Looking at the code it seems that for quite a few existing aggregates,
> the state remains NULL until the first non-NULL input is processed. But
> that doesn't hurt much - those aggregates can remain as they are until
> someone wants to add an inverse transfer function. Once that happens,
> there's a choice between living with needless rescans on trailing NULL
> inputs or changing the state type.

Also, it might be reasonable for both the regular and the inverse
transition functions to be strict.  If a null entering the window
does not matter, then a null exiting the window doesn't either, no?
        regards, tom lane



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Merlin Moncure
Дата:
Сообщение: Re: array_length(anyarray)
Следующее
От: Heikki Linnakangas
Дата:
Сообщение: Re: INSERT...ON DUPLICATE KEY LOCK FOR UPDATE