=?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