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
Views: Raw Message | Whole Thread | Download mbox | Resend email
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

Browse pgsql-bugs by date

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