From: | Peter Eisentraut <peter_e(at)gmx(dot)net> |
---|---|
To: | PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | age() function not to spec, date subtraction? |
Date: | 2001-02-16 20:19:22 |
Message-ID: | Pine.LNX.4.30.0102162108560.1009-100000@peter.localdomain |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
The age() function is documented as "Calculate time difference while
retaining year/month fields", but it doesn't seem to do anything different
from a plain date subtraction with a few time zone problems added in:
select age(date '1999-05-17', date '1957-06-13');
age
-------------------------------
41 years 11 mons 3 days 23:00
(1 row)
peter=# select age(date '1999-05-17', date '1999-06-13');
age
----------
-27 days
(1 row)
But then again, date subtraction has seen better days, too:
peter=# select date '1999-08-13' - date '1989-06-13';
?column?
----------
3713
(1 row)
peter=# select date '1999-08-13' - date '1999-06-13';
?column?
----------
61
(1 row)
As opposed to:
peter=# select timestamp '1999-08-13' - timestamp '1999-06-13';
?column?
----------
61 days
(1 row)
SQL sez date - date returns interval, btw.
--
Peter Eisentraut peter_e(at)gmx(dot)net http://yi.org/peter-e/
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Eisentraut | 2001-02-16 20:43:34 | Re: Backup from within Postgres |
Previous Message | Thomas Lockhart | 2001-02-16 20:18:58 | Re: extract vs date_part |