Re: Add PRODUCT() aggregate function

Поиск
Список
Период
Сортировка
Искать
От
Jim Jones
Тема
Re: Add PRODUCT() aggregate function
Дата
в 14:02:34
Msg-id
456004d3-b296-4946-b413-1fdda7476e29@uni-muenster.de
Список
Дерево обсуждения
Re: Add PRODUCT() aggregate function Jim Jones <jim.jones@uni-muenster.de>
Re: Add PRODUCT() aggregate function Jeevan Chalke <jeevan.chalke@enterprisedb.com>
Re: Add PRODUCT() aggregate function Jeevan Chalke <jeevan.chalke@enterprisedb.com>
Hi Jeevan

On 23/06/2026 10:37, Dean Rasheed wrote:
> On Tue, 23 Jun 2026 at 08:49, Jeevan Chalke
>  wrote:
>> PRODUCT() returns the product of all non-null input values.  It is defined for
>> int2, int4, int8, float4, float8 and numeric input, and always returns numeric.
> I don't think that you need to define it for all those types. I
> suspect that you could just define it for numeric and float8, and let
> implicit casting do the rest.

+1

I've tested the patch in many different scenarios and all results look
fine -- valgrind also didn't report anything :)

The test coverage is comprehensive! For the sake of completeness I'd add
numeric tests for NaN and Infitinty with positive numeric values in the
set, e.g:

postgres=# WITH j (v) AS (VALUES
('NaN'::numeric),('Infinity'::numeric),(3.14))
SELECT product(v) FROM j;
 product
---------
     NaN
(1 row)

Other than that and the point mentioned by Dean I have nothing to add at
this point.

Thanks for the patch.

Best, Jim


В списке pgsql-hackers по дате отправления
От: Amit Kapila
Дата:
От: Alexandra Wang
Дата:
FAQ