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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Nicklas Avén <nicklas(dot)aven(at)jordogskog(dot)no>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: cal I pass arguments directly to final function in aggregates
Date: 2013-05-18 23:26:11
Message-ID: 2620.1368919571@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

=?UTF-8?B?Tmlja2xhcyBBdsOpbg==?= <nicklas(dot)aven(at)jordogskog(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message S H 2013-05-19 01:13:57 Re: Vacuum problem
Previous Message Nicklas Avén 2013-05-18 23:14:47 cal I pass arguments directly to final function in aggregates