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 |