FAQ

I'd like to get the difference between two timestamp columns expressed
as an interval with units "year to month." ...
What is the proper way to express this in Postgres? Will the standard
form be supported at some point?
lockhart=# select age('today', '1957-06-13');
age
-----------------------
44 years 1 mon 3 days
(1 row)

lockhart=# select date_trunc('month', age('today', '1957-06-13'));
date_trunc
----------------
44 years 1 mon
(1 row)

Note that if the age() function is not used, and instead you use the
subtraction operator, then the result is zero, since the operator gives
a days/hours/min/sec result and does not preserve *any* year or month
information.

"Standard form", that is SQL9x rather than Ingres, will likely be
supported at some point, maybe sooner rather than later if the syntax
can fit into our parser.

hth

- Thomas

Search Discussions

Discussion Posts

Previous

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 3 of 3 | next ›
Discussion Overview
grouppgsql-general @
categoriespostgresql
postedJul 16, '01 at 3:45p
activeJul 17, '01 at 11:43a
posts3
users3
websitepostgresql.org
irc#postgresql

People

Translate

site design / logo © 2021 Grokbase