Thread: BUG #6290: converting interval from weeks to days

BUG #6290: converting interval from weeks to days

From
"Alexey Nalbat"
Date:
The following bug has been logged online:

Bug reference:      6290
Logged by:          Alexey Nalbat
Email address:      alexey_nalbat@hotbox.ru
PostgreSQL version: 9.1.1
Operating system:   Ubuntu
Description:        converting interval from weeks to days
Details:

=> select '1000000000 weeks'::interval;
     interval
------------------
 -1589934592 days
(1 row)

Re: BUG #6290: converting interval from weeks to days

From
John R Pierce
Date:
On 11/10/11 1:15 PM, Alexey Nalbat wrote:
> =>  select '1000000000 weeks'::interval;
>       interval
> ------------------
>   -1589934592 days

a billion weeks is like 19 million years.  somehow, I don't think that
postgresql's date math has quite that range.


--
john r pierce                            N 37, W 122
santa cruz ca                         mid-left coast

Re: BUG #6290: converting interval from weeks to days

From
Craig Ringer
Date:
On 11/11/2011 09:35 AM, John R Pierce wrote:
> On 11/10/11 1:15 PM, Alexey Nalbat wrote:
>> => select '1000000000 weeks'::interval;
>> interval
>> ------------------
>> -1589934592 days
>
> a billion weeks is like 19 million years. somehow, I don't think that
> postgresql's date math has quite that range.

It should probably detect overflow and fail with an error like Pg does
with other overflow conditions, though. I think that was probably the point.

--
Craig Ringer