As the documentation describes the AGE() function -
there are two signatures:
- AGE(timestamp, timestamp).
I think the documentation is misleading, because AGE(timestamp) is actually
converted to AGE(current_date, timestamp), and not to AGE(now(), timestamp).
So for example:
test=> select age(now());
I'm actually receiving the *age* of now() compared to the start of the day
test=> select age(now() - interval '1 day');
returns not an age of 1 day but the age of yesterday's timestamp compared to
0:00 of today.
test=> select age(now(), now() - interval '1 day');
Which is correct.
As I initially understood the docs, the second form of age(timestamp,
timestamp) is the same as the first one - age(timestamp), with the exception
that the counting is not started from *today* but from custom timestamp
instead; and because the arguments are of type 'timestamp' and not 'date' I
supposed that now() is applied as a default first argument.
I am not sure what is the right behaviour of this function (I think it's not
correct now), but at least there have to be some explanations in the
pgsql-bugs by date
|Next:||From: Tom Lane||Date: 2004-11-29 15:59:25|
|Subject: Re: BUG #1331: after update: vacuum blocks parallel to select |
|Previous:||From: PostgreSQL Bugs List||Date: 2004-11-29 11:37:50|
|Subject: BUG #1332: wrong results from age function|