Re: Add PRODUCT() aggregate function

From: Vik Fearing <vik(at)postgresfriends(dot)org>
To: Jeevan Chalke <jeevan(dot)chalke(at)enterprisedb(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Add PRODUCT() aggregate function
Date: 2026-09-11 12:22:58
Message-ID: 87c0f867-da3b-408a-ba69-2ad4e75770e5@postgresfriends.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On 10/09/2026 17:11, Jeevan Chalke wrote:
> Hello Vik,
>
> On Thu, Sep 10, 2026 at 8:22 PM Vik Fearing <vik(at)postgresfriends(dot)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 EMPTY| clause, I have actually already proposed a
> patch for that here:
> https://www.postgresql.org/message-id/CAM2+6=VS=fSKxfimW6Th9iu_xjbxOEAKg4eYwaa=SMg3X8pHaQ@mail.gmail.com
> <https://www.postgresql.org/message-id/CAM2+6=VS=fSKxfimW6Th9iu_xjbxOEAKg4eYwaa=SMg3X8pHaQ@mail.gmail.com>
>
> It 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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2026-09-11 12:24:50 Re: pg_get_*_ddl() needs a redesign
Previous Message Vik Fearing 2026-09-11 12:21:15 Re: Add PRODUCT() aggregate function