speaking of CREATE AGGREGATE ...

From: Chapman Flack <chap(at)anastigmatix(dot)net>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: speaking of CREATE AGGREGATE ...
Date: 2020-11-19 01:17:00
Message-ID: 5FB5C78C.5020305@anastigmatix.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2020-11-19 01:25:01 Re: CREATE AGGREGATE array_cat
Previous Message Vik Fearing 2020-11-19 00:59:31 Re: CREATE AGGREGATE array_cat