Re: Detecting change in event properties

Поиск
Список
Период
Сортировка
От David Johnston
Тема Re: Detecting change in event properties
Дата
Msg-id 1382737636849-5775977.post@n5.nabble.com
обсуждение исходный текст
Ответ на Re: Detecting change in event properties  (Elliot <yields.falsehood@gmail.com>)
Список pgsql-general
Elliot wrote
> Maybe a custom aggregate that takes the last item in a set?
>
> CREATE OR REPLACE FUNCTION public.last_agg ( anyelement, anyelement )
> RETURNS anyelement LANGUAGE sql IMMUTABLE STRICT AS $$
>          SELECT $2;
> $$;
>
> CREATE AGGREGATE public.last (
>          sfunc    = public.last_agg,
>          basetype = anyelement,
>          stype    = anyelement
> );

Conceptually similar to my array_last_nonnull(array_agg(...)) methodology
and the GUC methodology but has the advantage of saving minimal state
(compared to the array_agg()) and not abusing GUC for storage of the
single-value state.

The example would need the same alteration to the frame clause but otherwise
would appear to work in the manner presumed by the OP's original question.

David J.




--
View this message in context:
http://postgresql.1045698.n5.nabble.com/Detecting-change-in-event-properties-tp5775959p5775977.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.


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

Предыдущее
От: David Johnston
Дата:
Сообщение: Re: Detecting change in event properties
Следующее
От: Patrick Dung
Дата:
Сообщение: Re: (collation) Building postgresql on FreeBSD, the pros and cons of icu