Re: cal I pass arguments directly to final function in aggregates - Mailing list pgsql-general

From Tom Lane
Subject Re: cal I pass arguments directly to final function in aggregates
Date
Msg-id 2620.1368919571@sss.pgh.pa.us
Whole thread Raw
In response to cal I pass arguments directly to final function in aggregates  (Nicklas Avén <nicklas.aven@jordogskog.no>)
Responses Re: cal I pass arguments directly to final function in aggregates  (Nicklas Avén <nicklas.aven@jordogskog.no>)
List 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 by date:

Previous
From: Nicklas Avén
Date:
Subject: cal I pass arguments directly to final function in aggregates
Next
From: S H
Date:
Subject: Re: Vacuum problem