Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rkfeH-00ERcf-3y for pgsql-general@arkaria.postgresql.org; Thu, 14 Mar 2024 07:37:10 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rkfeD-00FmGX-Ke for pgsql-general@arkaria.postgresql.org; Thu, 14 Mar 2024 07:37:06 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rkfeD-00FmGP-7x for pgsql-general@lists.postgresql.org; Thu, 14 Mar 2024 07:37:05 +0000 Received: from jan-kohnert.de ([2001:4ba0:ffa6:da::1]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rkfe9-004QK6-7J for pgsql-general@lists.postgresql.org; Thu, 14 Mar 2024 07:37:04 +0000 X-Virus-Scanned: amavisd-new at jan-kohnert.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jan-kohnert.de; s=20191; t=1710401818; bh=cuj8xxo39cXwZQ3g/KVzxs0KPwXORpmFwfcRTjqOQWo=; h=From:To:Subject:Date:In-Reply-To:References:From; b=apkVV3ayr29NZXUhstCITLsc7jaWohMdMwR0UpyQhfVY44kFHl7WGgNwSX6MYI4xI 0x8U+PXrKya92z9RHSaSQfzNKIkoLiQpsllHXGljYoDJj995exhz51baBmBgA/u5j2 TxWiWfyL+RG6nE3X1QuKcwiDtAWKSs6DWiN6YxC+RfMqgcEl8Z8q9sXUKwkPqCKtRz yA84JpziaZLeizzWleZg6Ew8k0sqT4JI+o56aO6s7yEnaKKcj2+LsSq5NP5dC9lQMs 6DNq+Tkt6amMvlAj3/HoNUzEazir7EupGsF1+pyTzatixAZgf4qFRQ7Cnu8yZMyn59 RXx6KVLGh+0DQ== Received: from kohni-mobil.localnet (p200300cb872c61cfe983a99575520c97.dip0.t-ipconnect.de [IPv6:2003:cb:872c:61cf:e983:a995:7552:c97]) by srv21636.dus4.fastwebserver.de (Postfix) with ESMTPSA id 150887C007D for ; Thu, 14 Mar 2024 08:36:58 +0100 (CET) From: Jan Kohnert To: pgsql-general@lists.postgresql.org Subject: Re: Implementing product-aggregate Date: Thu, 14 Mar 2024 08:36:57 +0100 Message-ID: <9247987.CDJkKcVGEf@kohni-mobil> In-Reply-To: <2176491.irdbgypaU6@kohni-mobil> References: <2176491.irdbgypaU6@kohni-mobil> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="nextPart3211581.5fSG56mABF" Content-Transfer-Encoding: 7Bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --nextPart3211581.5fSG56mABF Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Hi again, Am Montag, 11. M=C3=A4rz 2024, 10:16:33 CET schrieb Jan Kohnert: > create aggregate prod(numeric) (sfunc =3D numeric_mul, stype =3D numeric) my basic idea was creating a function create function multiply(arg1 numeric, arg2 numeric) returns numeric=20 language sql immutable returns null on null input return arg1 * arg2; and use that function instead of the undocumented numeric_mul as the sfunc = in=20 the aggregate definition. Then again, this seems odd, too, since we're only reimplementing basic stuf= f that's=20 already there. I'm still undecided... =2D-=20 MfG Jan --nextPart3211581.5fSG56mABF Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset="utf-8"

Hi again,


Am Montag, 11. M=C3=A4rz 2024, 10:16:33 CET schrieb Jan Kohnert:

>= ; create aggregate prod(numeric) (sfunc =3D numeric_mul, stype =3D numeric)=


my basic idea was creating a function


create function multiply(arg1 numeric, arg2 numeric)

&nb= sp;   returns numeric

&nb= sp;   language sql

&nb= sp;   immutable

&nb= sp;   returns null on null input

&nb= sp;   return arg1 * arg2;


and use that function instead of the undocumented numeric_mul as the sfu= nc in the aggregate definition.


Then again, this seems odd, too, since we're only reimplementing basic s= tuff that's already there.


I'm still undecided...


--

MfG= Jan

--nextPart3211581.5fSG56mABF--