Re: age() function documentation

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Thomas Lockhart <lockhart(at)alumni(dot)caltech(dot)edu>
Cc: <lockhart(at)fourpalms(dot)org>, Hackers List <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: age() function documentation
Date: 2001-04-12 15:47:40
Message-ID: Pine.LNX.4.30.0104121739300.1148-100000@peter.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)gmx(dot)net http://yi.org/peter-e/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Lockhart 2001-04-12 16:07:10 Re: age() function documentation
Previous Message Thomas Lockhart 2001-04-12 12:43:50 Re: AW: AW: AW: Truncation of char, varchar types