Thomas Lockhart writes:
> Typical date/time arithmetic resolves to an absolute time or interval.
> In those cases, *qualitative* quantities such as years and months are
> resolved to a specific absolute interval at the time of calculation.
>
> The age() functions *preserve* the qualitative fields year and month. So
> you see the difference in results:
>
> lockhart=# select age('today', '1957-06-13');
> -------------------------
> 43 years 9 mons 28 days
>
> lockhart=# select timestamp 'today' - timestamp '1957-06-13';
> ------------
> 16008 days
Perhaps age() could be documented along the lines of:
Calculates the difference between the arguments and expresses the
resulting interval in terms of years, months and possibly smaller units.
Ordinary timestamp subtraction is different from age() because it
expresses its result only in days and smaller units.
Plus a contrasting example, such as the above.
--
Peter Eisentraut peter_e@gmx.net http://yi.org/peter-e/