Re: Fix overflow in DecodeInterval - Mailing list pgsql-hackers

From Joseph Koshakow
Subject Re: Fix overflow in DecodeInterval
Date
Msg-id CAAvxfHfKYHw8n19s7eAcDo_B2T1SS22O1p0X4OE5_WBK230O+Q@mail.gmail.com
Whole thread Raw
In response to Re: Fix overflow in DecodeInterval  (Andres Freund <andres@anarazel.de>)
Responses Re: Fix overflow in DecodeInterval
List pgsql-hackers
Ok, so I've attached a patch with my final unprompted changes. It
contains the following two changes:

1. I found some more overflows with the ISO8601 formats and have
included some fixes.
2. I reverted the overflow checks for the seconds field. It's actually a
bit more complicated than I thought. For example consider the following
query:
    postgres=# SELECT INTERVAL '0.99999999 min 2147483647 sec';
            interval
    ----------------------
    -596523:13:09.000001
    (1 row)
This query will overflow the tm_sec field of the struct pg_tm, however
it's not actually out of range for the Interval. I'm not sure the best
way to handle this right now, but I think it would be best to leave it
for a future patch. Perhaps the time related fields in struct pg_tm
need to be changed to 64 bit ints.

- Joe Koshakow

Attachment

pgsql-hackers by date:

Previous
From: Fujii Masao
Date:
Subject: Re: Support escape sequence for cluster_name in postgres_fdw.application_name
Next
From: Ajin Cherian
Date:
Subject: Re: Logical replication timeout problem