Re: age() function documentation

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема Re: age() function documentation
Дата
Msg-id Pine.LNX.4.30.0104121928450.1148-100000@peter.localdomain
обсуждение исходный текст
Ответ на Re: age() function documentation  (Thomas Lockhart <lockhart@alumni.caltech.edu>)
Список pgsql-hackers
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/



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: Re: age() function documentation
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: AW: AW: AW: Truncation of char, varchar types