Re: Strange interval arithmetic - Mailing list pgsql-hackers

From Michael Fuhr
Subject Re: Strange interval arithmetic
Date
Msg-id 20051127154517.GA34720@winnie.fuhr.org
Whole thread Raw
In response to Strange interval arithmetic  (Christopher Kings-Lynne <chriskl@familyhealth.com.au>)
Responses Re: Strange interval arithmetic
List pgsql-hackers
On Sun, Nov 27, 2005 at 11:15:04PM +0800, Christopher Kings-Lynne wrote:
> What's going on here?  Some sort of integer wraparound?
[...]
> test=# select interval '2378234234 seconds';
>    interval
> --------------
>  596523:14:07
> (1 row)

Looks like the value is stuck at 2^31 - 1 seconds:

test=> select interval '2147483646 seconds';  -- 2^31 - 2  interval   
--------------596523:14:06
(1 row)

test=> select interval '2147483647 seconds';  -- 2^31 - 1  interval   
--------------596523:14:07
(1 row)

test=> select interval '2147483648 seconds';  -- 2^31  interval   
--------------596523:14:07
(1 row)

-- 
Michael Fuhr


pgsql-hackers by date:

Previous
From: Christopher Kings-Lynne
Date:
Subject: Strange interval arithmetic
Next
From: Andreas Pflug
Date:
Subject: Re: Windows installation notes