[PATCH] Supporting +-Infinity values by to_timestamp(float8)

Поиск
Список
Период
Сортировка
От Vitaly Burovoy
Тема [PATCH] Supporting +-Infinity values by to_timestamp(float8)
Дата
Msg-id CAKOSWN=qbbnF_oRue4rfsMmWb+7wkBN6fq5XNHgt5vR0TiAA5g@mail.gmail.com
обсуждение исходный текст
Ответы Re: [PATCH] Supporting +-Infinity values by to_timestamp(float8)  (Vitaly Burovoy <vitaly.burovoy@gmail.com>)
Re: [PATCH] Supporting +-Infinity values by to_timestamp(float8)  (Vitaly Burovoy <vitaly.burovoy@gmail.com>)
Re: [PATCH] Supporting +-Infinity values by to_timestamp(float8)  (Anastasia Lubennikova <a.lubennikova@postgrespro.ru>)
Список pgsql-hackers
Hello, Hackers!

I worked on a patch[1] allows "EXTRACT(epoch FROM
+-Inf::timestamp[tz])" to return "+-Inf::float8".
There is an opposite function "to_timestamp(float8)" which now defined as:
SELECT ('epoch'::timestamptz + $1 * '1 second'::interval)

Since intervals do not support infinity values, it is impossible to do
something like:
SELECT to_timestamp('infinity'::float8);

... which is not good.

Supporting of such converting is in the TODO list[2] (by "converting
between infinity timestamp and float8").

Proposed patch implements it.

There is an other patch in the CF[3] 2016-03 implements checking of
timestamp[tz] for being in allowed range. Since it is wise to set
(fix) the upper boundary of timestamp[tz]s, I've included the file
"src/include/datatype/timestamp.h" from there to check that an input
value and a result are in the allowed range.

There is no changes in a documentation because allowed range is the
same as officially supported[4] (i.e. until 294277 AD).


[1]http://git.postgresql.org/pg/commitdiff/647d87c56ab6da70adb753c08d7cdf7ee905ea8a
[2]https://wiki.postgresql.org/wiki/Todo#Dates_and_Times
[3]https://commitfest.postgresql.org/9/540/
[4]http://www.postgresql.org/docs/devel/static/datatype-datetime.html

--
Best regards,
Vitaly Burovoy

Вложения

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

Предыдущее
От: Kartyshov Ivan
Дата:
Сообщение: Re: proposal: get oldest LSN - function
Следующее
От: Vitaly Burovoy
Дата:
Сообщение: Re: [PATCH] Supporting +-Infinity values by to_timestamp(float8)