I saw in the docs for CREATE AGGREGATE, under argmode, "Aggregate functions
do not support OUT arguments".
And because I tend to poke things I'm told not to poke, I thought "but
wait, the CREATE AGGREGATE doesn't have much to say about the return type
anyway, that's just the FINALFUNC's return type." And I made an aggregate
with a finalfunc that has OUT parameters, and lo, it works, and a record
is returned with the expected aggregate results.
The only flaw seems to be that the result can't be accessed by field,
because its tupledesc isn't known. I /suspect/ (haven't chased it down
though) that the finalfunc produces a blessed tupledesc for its result,
but the identifying typmod is not propagated along to the aggregate result.
Does that sound close? Would it possibly be that simple to make such
aggregates usable? Or is there a larger can of worms I'm overlooking?
Regards,
-Chap