Re: Remove dependence on integer wrapping - Mailing list pgsql-hackers

From Joseph Koshakow
Subject Re: Remove dependence on integer wrapping
Date
Msg-id CAAvxfHcJp9WUazAMx3UPFjt8rP3JTdNUB5kXwaiyWFrNA82iOQ@mail.gmail.com
Whole thread Raw
In response to Re: Remove dependence on integer wrapping  (Nathan Bossart <nathandbossart@gmail.com>)
List pgsql-hackers


On Wed, Aug 21, 2024 at 11:37 AM Nathan Bossart <nathandbossart@gmail.com> wrote:
>
> Hm.  It seems pretty clear that removing -fwrapv won't be happening anytime
> soon.  I don't mind trying to fix a handful of cases from time to time, but
> unless there's a live bug, I'm probably not going to treat this stuff as
> high priority.

I think I'm also going to take a step back because I'm a bit
fatigued on the overflow work. My goal here wasn't necessarily to
remove -fwrapv, because I think it will always be a useful safeguard.
Instead I wanted to add -ftrapv to builds with asserts enabled to try
and prevent future overflow based bugs. Though, it looks like that
won't happen anytime soon either.

FWIW, Matthew's patch actually does resolve a bug with `to_timestamp`
and `to_date`. It converts the following incorrect queries

    test=# SELECT to_timestamp('2147483647,999', 'Y,YYY');
              to_timestamp          
    ---------------------------------
     0001-01-01 00:00:00-04:56:02 BC
    (1 row)
   
    test=# SELECT to_date('-2147483648', 'CC');
      to_date  
    ------------
     0001-01-01
    (1 row)

into errors

    test=# SELECT to_timestamp('2147483647,999', 'Y,YYY');
    ERROR:  invalid input string for "Y,YYY"
    test=# SELECT to_date('-2147483648', 'CC');
    ERROR:  date out of range: "-2147483648"

So, it might be worth committing only his changes before moving on.


Thanks,
Joseph Koshakow

pgsql-hackers by date:

Previous
From: "Joel Jacobson"
Date:
Subject: Re: Optimising numeric division
Next
From: Alena Rybakina
Date:
Subject: Re: POC, WIP: OR-clause support for indexes