Re: Add PRODUCT() aggregate function - Mailing list pgsql-hackers

From Isaac Morland
Subject Re: Add PRODUCT() aggregate function
Date
Msg-id CAMsGm5dCGJpu590LY+0Eqjryo0qAFKRh4rc3euGCGT_xdvgfdQ@mail.gmail.com
Whole thread
In response to Re: Add PRODUCT() aggregate function  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Why clearing the VM doesn't require registering vm buffer in wal record
List pgsql-hackers
On Thu, 10 Sept 2026 at 19:29, Vik Fearing <vik@postgresfriends.org> wrote:

On 10/09/2026 18:16, Tom Lane wrote:
> Vik Fearing <vik@postgresfriends.org> writes:
>> It should be called PRODUCT and it should accept the syntax
>>       PRODUCT(col, 1 ON EMPTY)
>> for when there are no non-nulls in the input.
> Sigh.  The committee really loves to invent randomly creative syntax,
> don't they.  At least this one won't force us to create any new
> fully-reserved words.


Yes.  I tried to fight back on it but I was overruled.

Out of curiosity, was there any thought given to the idea that it should be an attribute of the aggregate itself? The following seem to me to be pretty hard to dispute: max -> -infinity; min -> infinity; sum -> 0; product -> 1; string_agg -> ''; array_agg -> []. Of course there is legacy behaviour that can't just be erased, but an option with just two choices defaulting to the NULL result could handle that.

pgsql-hackers by date:

Previous
From: Fujii Masao
Date:
Subject: Re: fixes for a few GUC descriptions
Next
From: "Hayato Kuroda (Fujitsu)"
Date:
Subject: RE: Review items for EXCEPT TABLE publication