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

From Nicklas Avén
Subject cal I pass arguments directly to final function in aggregates
Date
Msg-id 51980B67.3040803@jordogskog.no
Whole thread Raw
In response to Undefined reference with libpq on Visual Studio 2012  (David Demelier <demelier.david@gmail.com>)
Responses Re: cal I pass arguments directly to final function in aggregates  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
Hallo

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 type state_data_type"

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

I was looking at string_agg but that was doing all the processing in the SFUNC if I understand it right.

But to use it as example, if it instead would have collected all strings in an array and added the delimiter in the final function, would that be possible?

I would expect the definition of the aggregate to look something like:

CREATE AGGREGATE string_agg(text, text) (
  SFUNC=string_agg_transfn($1),
  STYPE=internal,
  FINALFUNC=string_agg_finalfn($2)
);

Am I missing something or am I just thinking in irregular circles (that happens now and then)


Best Regards

Nicklas Avén

pgsql-general by date:

Previous
From: hubert depesz lubaczewski
Date:
Subject: Re: Why does row estimation on nested loop make no sense to me
Next
From: Tom Lane
Date:
Subject: Re: cal I pass arguments directly to final function in aggregates