Peter Eisentraut <peter_e@gmx.net> writes:
> Sure, you create a (static) global variable and reallocate memory for it
> in each call and free it by the finalizer function.
A static would be a bad idea (consider a query with multiple instances
of this aggregate being evaluated in parallel).
But there's no reason that the transition function can't palloc a larger
and larger chunk of memory for each result (as long as you don't run out
of memory, anyway).
regards, tom lane