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.96) (envelope-from ) id 1wxR5r-002iSe-15 for pgsql-hackers@arkaria.postgresql.org; Fri, 21 Aug 2026 15:23:43 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wxR5p-00Dous-0I for pgsql-hackers@arkaria.postgresql.org; Fri, 21 Aug 2026 15:23:41 +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.96) (envelope-from ) id 1wxR2l-00Dlaj-16 for pgsql-hackers@lists.postgresql.org; Fri, 21 Aug 2026 15:20:31 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wxR2j-00000001l9V-39qm for pgsql-hackers@lists.postgresql.org; Fri, 21 Aug 2026 15:20:30 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.18.1/8.18.1) with ESMTP id 67LFKSTH4078102; Fri, 21 Aug 2026 11:20:28 -0400 From: Tom Lane To: Andrei Lepikhov cc: David Rowley , PostgreSQL Hackers , Corey Huinker Subject: Re: Allow a prosupport function to be attached to an aggregate In-reply-to: <1f2140fe-e4ae-4a52-9365-d5cbadcf5ae4@gmail.com> References: <8f58c96d-d3c7-4c0f-9898-116f00eeaff6@gmail.com> <1379592.1787063701@sss.pgh.pa.us> <3f63c035-e0a6-4dc6-a34e-743df8c19d50@gmail.com> <3954875.1787255265@sss.pgh.pa.us> <4008013.1787256399@sss.pgh.pa.us> <1f2140fe-e4ae-4a52-9365-d5cbadcf5ae4@gmail.com> Comments: In-reply-to Andrei Lepikhov message dated "Fri, 21 Aug 2026 17:06:42 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <4078100.1787325628.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Fri, 21 Aug 2026 11:20:28 -0400 Message-ID: <4078101.1787325628@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Andrei Lepikhov writes: > Thanks. For aggregates that an extension defines itself, this is clearly= the > right approach, and the pg_dump part is exactly what v0 was missing. > It does leave out the case I started with, though: attaching a support f= unction > to an existing aggregate. How so? The expectation is that you'd issue CREATE OR REPLACE AGGREGATE. It is a bit tedious to have to re-specify all the existing properties, but that's the way previous extensions of aggregate options have been handled. I don't feel that this one new feature is a big enough deal to redesign that (especially not this late in beta). > What I want to optimise is the built-in functions like > sum(), avg(), and similar ones, because those are what users > actually use. For those, wouldn't we just modify the initial contents of pg_proc? > With > only CREATE OR REPLACE AGGREGATE available, an extension would have to r= estate > the whole definition of pg_catalog.sum(numeric), including sfunc, combin= efunc, > and so on, and keep that copy updated with every major release. I'm not particularly on board with this goal: I think letting extensions modify built-in aggregates is fraught with all sorts of issues. (To name only one, there's no way for multiple extensions to each attach new behaviors to the same aggregate.) I'm certainly not going to risk putting in half-considered support for such a thing at this stage of the release cycle. There's enough risk in adding what I proposed yesterday. regards, tom lane