Make the transition state of avg(int2)/avg(int4)/sum(int2)/sum(int4) internal

From: Andrei Lepikhov <lepihov(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Andres Freund <andres(at)anarazel(dot)de>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>, Michael Paquier <michael(at)paquier(dot)xyz>, David Rowley <dgrowleyml(at)gmail(dot)com>
Subject: Make the transition state of avg(int2)/avg(int4)/sum(int2)/sum(int4) internal
Date: 2026-09-04 14:06:02
Message-ID: 762e811a-6584-4b03-a6ca-52600adcd6e9@gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

In the thread [1], there we couple of opinions [2,3] to make transition states
internal. Since it is a separate topic from the overflow bug, so here is a
separate thread.

Attached is a draft implementation for the two families that still keep their
transition state in an int8[]: avg(int2), avg(int4). These aggregates'
transition type is now declared as INTERNAL that doesn't correspond to any SQL
data type and can't be called outside.

This is kinda of the continuation of 69c8fbac201, which did the same thing for
the numeric aggregates.

After this patch only float8 built-in aggregates still keep their transition
state in an array. Does it make sense to fold float8 into this patch, or keep it
separate?

[1]
https://www.postgresql.org/message-id/1ddc2a6f-4b26-43d9-9f3b-5b5db98a486d%40gmail.com
[2]
https://www.postgresql.org/message-id/lbvjl22swi3p3sf7nmmrlx2cq5aa55ry3c5ore2rpylsmi6s5j%40xrrahkipnsce
[3] https://www.postgresql.org/message-id/1412049.1788396306%40sss.pgh.pa.us

--
regards, Andrei Lepikhov,
pgEdge

Attachment Content-Type Size
v0-0001-Make-the-transition-state-of-avg-int2-avg-int4-su.patch text/plain 26.6 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Diego 2026-09-04 14:06:06 [PATCH] libpq: Add PQpassfileLookup()
Previous Message Fujii Masao 2026-09-04 14:02:44 Re: Stabilize 026_overwrite_contrecord test