Re: SUM(int2)/SUM(int4) do not detect overflow of the int8 accumulator

From: David Rowley <dgrowleyml(at)gmail(dot)com>
To: Andrei Lepikhov <lepihov(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Michael Paquier <michael(at)paquier(dot)xyz>, Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Andres Freund <andres(at)anarazel(dot)de>, Nathan Bossart <nathandbossart(at)gmail(dot)com>
Subject: Re: SUM(int2)/SUM(int4) do not detect overflow of the int8 accumulator
Date: 2026-10-15 10:51:46
Message-ID: CAApHDvrbSDzA+a8Oko6a2YbER7MqFKBRGdc10dSdMRdS3HdiEg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, 7 Sept 2026 at 23:52, Andrei Lepikhov <lepihov(at)gmail(dot)com> wrote:
>
> On 07/09/2026 10:25, Andrei Lepikhov wrote:
> > Removed. Adding a regression test alongside a bug fix is just my default habit,
> > so I followed it here without thinking it through - happy to drop them.
> It looks like I mistakenly sent the old version as v2. Here is the actual
> version (v3) of the patch.

I was thinking that this might only be worth fixing on master. I'd say
it's increasingly likely as we make the software faster and computers
get faster, plus more efficient tableAMs, will result in overflows
being more likely in the future. That might mean it's inevitable that
we will need to fix it at some point.

The concern I have with backpatching is around the new
PG_RETURN_INPUT() macro. That existing in backbranches but not all
minor versions of the given release could lead to any extension that
opts to use the macro not compiling on older minor versions that don't
have the macro defined.

Any other ideas?

David

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Nisha Moond 2026-10-15 11:12:53 Re: Proposal: Conflict log history table for Logical Replication
Previous Message David Rowley 2026-10-15 10:43:21 Re: Avoid repeated scans of the output buffer in oidvectortypes()