Re: Silent overflow of interval type
Nick Babadzhanian <pgnickb@gmail.com>
From: Nick Babadzhanian <pgnickb@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Andrey Borodin <amborodin86@gmail.com>, pgsql-hackers@lists.postgresql.org
Date: 2023-02-16T13:00:23Z
Lists: pgsql-hackers
Attachments
- v2-0001-Fix-interval-silent-overflow.patch (text/x-patch) patch v2-0001
On Thu, Feb 16, 2023 at 1:12 AM Tom Lane <tgl@sss.pgh.pa.us> wrote: > 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 Please find attached the v2 of the said patch with the tests added. I tested and it applies with all tests passing both on REL_14_STABLE, REL_15_STABLE and master. I don't know how the decision on backpatching is made and whether it makes sense here or not. If any additional work is required, please let me know. > By chance did you look at all other nearby cases, is it the only place > with overflow? Not really, no. The other place where it could overflow was in the interval justification function and it was fixed about a year ago. That wasn't backpatched afaict. See https://postgr.es/m/CAAvxfHeNqsJ2xYFbPUf_8nNQUiJqkag04NW6aBQQ0dbZsxfWHA@mail.gmail.com Regards, Nick
Commits
-
Detect overflow in timestamp[tz] subtraction.
- 8028e294b456 16.0 landed