I'm using postgresql-7.1.3 and I'm trying to keep track of uptimes for
various devices by using an interval data type.
I've done some test cases and the way interval works with 'integer
seconds' is different from the way it acts with a raw int. I notice
that there is no interval(int) function.
How can one tell which function converted to?
* Seem the same but they are oddly different representations.
select interval(31900879);
interval
------------------------
1 year 4 days 05:21:19
select interval('31900879 seconds');
interval
-------------------
369 days 05:21:19
* Represenations really bite me here
select interval('31900879 seconds') - interval(31900879);
?column?
--------------------
-1 years +365 days
* more tests....
select extract(epoch from interval('31900879 seconds'));
date_part
-----------
31900879
select extract(epoch from interval(31900879));
date_part
-----------
31900879
test_network=# select extract(epoch from interval(31900879));
date_part
-----------
31922479
(1 row)
select extract(epoch from interval('31900879 seconds')) -
extract(epoch from interval(31900879));
?column?
----------
-21600
--
Chris Green <cmg@uab.edu>
To err is human, to moo bovine.