Re: Age function

Поиск
Список
Период
Сортировка
От Alban Hertroys
Тема Re: Age function
Дата
Msg-id 446B4A42.1050103@magproductions.nl
обсуждение исходный текст
Ответ на Re: Age function  (Berend Tober <btober@seaworthysys.com>)
Список pgsql-general
Berend Tober wrote:
> Alban Hertroys wrote:
>  > So, One and a half hour in the future is actually 17 days ago?
>  > Interesting... Either I am doing something wrong, or postgres is, I have
>  > my suspicions ;)
>
> <good-natured sarcasm>Your suspicions are correct that you are doing, or
> rather, understanding  something incorrectly. </good-natured sarcasm>

No sarcasm needed, that was exactly what I was referring to ;)

> First of all, the "17" is hours, not days. Look again at the formatted
> output.

Yeah, I "corrected" myself after reading an example in the docs where
the age between two dates was calculated (as opposed to timestamps), and
figured I must've misread that as hours while they were days. That colon
pretty much nails it down as hours though. Silly me...

> Secondly, there are two forms of AGE, taking, respectively two arguments
> and one argument. The latter is a shorthand for the former, assuming the
> current time as the base time. So in your query is equivalent to
>
> ('2006-05-17 00:00:00') - ('2006-05-17 10:02:01.727674-04' + '01:30:00')

Ok, I see now. Actually, now I read it back, the docs for age(timestamp)
say it calculates from current_date - I missed that earlier.

> Looking that the output from :
(...)
> might help, <professorial pontification>as would RTFM
> ("http://www.postgresql.org/docs/8.1/static/functions-datetime.html",
> Table 9-26. Date/Time Functions). </professorial pontification>

I've looked at that table so often that I figured I knew it from the top
of my head. Guess I was wrong...

Actually, IMO those tables could be a bit more readable if the borders
would be simple 1px lines and some padding is added left and right of
the cell contents.

Well, thanks for the pointers.

--
Alban Hertroys
alban@magproductions.nl

magproductions b.v.

T: ++31(0)534346874
F: ++31(0)534346876
M:
I: www.magproductions.nl
A: Postbus 416
    7500 AK Enschede

// Integrate Your World //

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

Предыдущее
От: "Ed L."
Дата:
Сообщение: Re: pg_dump index/constraint creation order
Следующее
От: "venu Vempati"
Дата:
Сообщение: DB structure of PostGRE