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 1x2WBS-005oXI-22 for pgsql-hackers@arkaria.postgresql.org; Fri, 04 Sep 2026 15:50:30 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1x2WBQ-007dFE-3B for pgsql-hackers@arkaria.postgresql.org; Fri, 04 Sep 2026 15:50:28 +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 1x2WBQ-007dF6-27 for pgsql-hackers@lists.postgresql.org; Fri, 04 Sep 2026 15:50:28 +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 1x2WBO-0000000402U-3Q0X for pgsql-hackers@lists.postgresql.org; Fri, 04 Sep 2026 15:50:27 +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 684FoMxX1571560; Fri, 4 Sep 2026 11:50:22 -0400 From: Tom Lane To: Andres Freund cc: Andrei Lepikhov , PostgreSQL Hackers , Chao Li , Michael Paquier , David Rowley Subject: Re: Make the transition state of avg(int2)/avg(int4)/sum(int2)/sum(int4) internal In-reply-to: References: <762e811a-6584-4b03-a6ca-52600adcd6e9@gmail.com> Comments: In-reply-to Andres Freund message dated "Fri, 04 Sep 2026 11:08:39 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1571558.1788537022.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Fri, 04 Sep 2026 11:50:22 -0400 Message-ID: <1571559.1788537022@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Andres Freund writes: > Seems like if we do this - and I think we should - we should go broader = than > just doing this for int8[]. So yea, let's do it for float8 too. > I think it might make sense to have an opr_sanity.sql check that verifie= s that > we don't add new builtin aggregates that have an array transition state.= Or > perhaps even more strictly, test that aggregates either have an internal > transition state, or the argument type's (for stuff like min/max). On reflection, I'm not sure that such a policy is a win. If you go with an internal-type transition state, then (if you want parallel aggregation support) you need serialize/deserialize functions, and I think also some other stuff that comes for free if the transition state is a real SQL type. So this is not so much a clear win as a tradeoff of which code you want to write. regards, tom lane