Skip site navigation (1) Skip section navigation (2)

INTERVAL problems with greater than 2^32 seconds

From: Darcy Buskermolen <darcy(at)wavefire(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: INTERVAL problems with greater than 2^32 seconds
Date: 2002-10-31 17:03:52
Message-ID: 200210310903.52326.darcy@wavefire.com (view raw or flat)
Thread:
Lists: pgsql-bugs
it apears that date/time math using intervals of more than 2^32 seconds get 
truncated to 2^32 seconds.

psql=# SELECT version();
                               version                               
---------------------------------------------------------------------
 PostgreSQL 7.3b3 on i386-unknown-freebsd4.7, compiled by GCC 2.95.4
(1 row)

psql=# SELECT '1900-01-01'::DATE + (2^32 || ' seconds')::INTERVAL,  
'1900-01-01'::DATE + ((2^32)+1 || ' seconds')::INTERVAL, '1900-01-01'::DATE + 
(9999999999999 || ' seconds')::INTERVAL
psql-# ;
      ?column?       |      ?column?       |      ?column?       
---------------------+---------------------+---------------------
 1968-01-20 03:14:07 | 1968-01-20 03:14:07 | 1968-01-20 03:14:07
(1 row)

psql=# SELECT (2^32 || ' seconds')::INTERVAL, ((2^32)+1 || ' 
seconds')::INTERVAL, (9999999999999 || ' seconds')::INTERVAL;
      interval       |      interval       |      interval       
---------------------+---------------------+---------------------
 24855 days 03:14:07 | 24855 days 03:14:07 | 24855 days 03:14:07
(1 row)



-- 
Darcy Buskermolen
Wavefire Technologies Corp.
ph: 250.717.0200
fx:  250.763.1759
http://www.wavefire.com

pgsql-bugs by date

Next:From: Stefan SchwarzerDate: 2002-10-31 18:33:56
Subject: Bug with child tables referencing parent table?
Previous:From: Tom LaneDate: 2002-10-31 16:47:30
Subject: Re: 7.3b1 panic in vacuum

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group