Re: cal I pass arguments directly to final function in aggregates

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: cal I pass arguments directly to final function in aggregates
Дата
Msg-id 2620.1368919571@sss.pgh.pa.us
обсуждение исходный текст
Ответ на cal I pass arguments directly to final function in aggregates  (Nicklas Avén <nicklas.aven@jordogskog.no>)
Ответы Re: cal I pass arguments directly to final function in aggregates  (Nicklas Avén <nicklas.aven@jordogskog.no>)
Список pgsql-general
=?UTF-8?B?Tmlja2xhcyBBdsOpbg==?= <nicklas.aven@jordogskog.no> writes:
> I am trying to create an aggregate function.

> One of the arguments is static and is not needed until the final function.
>  From the doc I see that the final function " must take a single
> argument of typestate_data_type"

> Is it not possible to just pass this arguments directly to the final
> function?

No.  There is no expectation in the aggregate infrastructure that any
argument position would have a fixed value across all rows, which is
what you'd need for such a thing to be well-defined.

Perhaps you could construct your usage like this:

    post_process_function(aggregate_function(...), fixed_argument)

where the aggregate_function just collects the varying values
and then the post_process_function does what you were thinking
of as the final function.

            regards, tom lane


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

Предыдущее
От: Nicklas Avén
Дата:
Сообщение: cal I pass arguments directly to final function in aggregates
Следующее
От: S H
Дата:
Сообщение: Re: Vacuum problem