Fix formatting of Interval output - Mailing list pgsql-hackers

From Joseph Koshakow
Subject Fix formatting of Interval output
Date
Msg-id CAAvxfHfjBGpsXccdbWyMMDXg8bn48ptfnEag9qwk8m5sziVs2A@mail.gmail.com
Whole thread Raw
Responses Re: Fix formatting of Interval output
List pgsql-hackers
When formatting the output of an Interval, we call abs() on the hours
field of the Interval. Calling abs(INT_MIN) returns back INT_MIN
causing the output to contain two '-' characters. The attached patch
fixes that issue by special casing INT_MIN hours.

Here is an example of the issue:
    postgres=# SELECT INTERVAL '-2147483648 hrs';
          interval
    --------------------
     --2147483648:00:00
    (1 row)


Cheers,
Joe Koshakow

Attachment

pgsql-hackers by date:

Previous
From: Justin Pryzby
Date:
Subject: Re: Assert in pageinspect with NULL pages
Next
From: Fujii Masao
Date:
Subject: Re: Fix CheckIndexCompatible comment