Re: Add PRODUCT() aggregate function
Re: Add PRODUCT() aggregate function
От:
Vik Fearing <vik@postgresfriends.org>
Дата:
On 10/09/2026 17:11, Jeevan Chalke wrote:
Hello Vik,On Thu, Sep 10, 2026 at 8:22 PM Vik Fearing <vik@postgresfriends.org> wrote:and it should accept the syntax
PRODUCT(col, 1 ON EMPTY)
for when there are no non-nulls in the input.
This will be required by the next edition of the SQL standard. The exact
value "1" is required by the standard, but I think we should allow any
a_expr there.Regarding the
ON EMPTYclause, I have actually already proposed a patch for that here: https://www.postgresql.org/message-id/CAM2+6=VS=fSKxfimW6Th9iu_xjbxOEAKg4eYwaa=SMg3X8pHaQ@mail.gmail.comIt is designed to be applicable to any aggregate function. Note that in its current form, the patch accepts any arbitrary expression (constant) for the return value, rather than restricting it to a hard-coded literal.
I would really appreciate it if you could take a look at those changes and share your reviews, feedback, or suggestions on that thread.
I will definitely take a look at it.
I can't keep up with this mailing list, so thank you for the pointer.
--
Vik Fearing