Re: creating a new aggregate function

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: creating a new aggregate function
Дата
Msg-id 20952.1393892275@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: creating a new aggregate function  (Seb <spluque@gmail.com>)
Список pgsql-sql
Seb <spluque@gmail.com> writes:
> Thanks for that suggestion.  It seemed as if array_agg would allow me to
> define a new aggregate for avg as follows:

> CREATE AGGREGATE avg (angle_vector)
> (
>   sfunc=array_agg,
>   stype=anyarray,
>   finalfunc=angle_vector_avg
> );

That's not going to work, for exactly this reason:

> ERROR:  cannot determine transition data type
> DETAIL:  An aggregate using a polymorphic transition type must have at least one polymorphic argument.

I see no reason to use a polymorphic type here anyway ... why not just
declare the transition data type as angle_vector[] ?
        regards, tom lane



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

Предыдущее
От: Seb
Дата:
Сообщение: Re: creating a new aggregate function
Следующее
От: Sebastian P. Luque
Дата:
Сообщение: Re: creating a new aggregate function