Re: age() function documentation

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

> 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
>
> In the case for the DATE type, the result is an integer value (not an
> interval) which I believe was done intentionally but I'm not recalling
> exactly why; I can research it if necessary:
>
> lockhart=# select date 'today' - date '1957-06-13';
> ----------
>     16008
>
> returns the number of days (which is also an absolute, quantitative
> time).

ISTM that this is more a result of

a) timestamp subtraction not implemented per spec

b) date substraction not implemented at all (it does date - integer)

c) implicit type conversions running wild

d) intervals not implemented per spec

(spec == SQL).  Lots of fun projects here... ;-)

-- 
Peter Eisentraut      peter_e@gmx.net       http://yi.org/peter-e/



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

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