Re: Silent overflow of interval type

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andrey Borodin <amborodin86(at)gmail(dot)com>
Cc: Nikolai <pgnickb(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Silent overflow of interval type
Date: 2023-02-16 00:12:45
Message-ID: 2155716.1676506365@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Andrey Borodin <amborodin86(at)gmail(dot)com> writes:
> On Wed, Feb 15, 2023 at 7:08 AM Nikolai <pgnickb(at)gmail(dot)com> wrote:
>> The patch attached simply throws an error when an overflow is
>> detected. However I'm not sure this is a reasonable approach for a
>> code path that could be very hot in some workloads.

> Given the extraordinary amount of overflow checks in the nearby code
> of timestamp.c, I'd say that this case should not be an exception.

Yeah, I don't think this would create a performance problem, at least not
if you're using a compiler that implements pg_sub_s64_overflow reasonably.
(And if you're not, and this bugs you, the answer is to get a better
compiler.)

> By chance did you look at all other nearby cases, is it the only place
> with overflow?

That was my immediate reaction as well.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2023-02-16 00:34:51 Re: Normalization of utility queries in pg_stat_statements
Previous Message Nathan Bossart 2023-02-16 00:06:59 Re: DDL result is lost by CREATE DATABASE with WAL_LOG strategy