From: | Vitaly Burovoy <vitaly(dot)burovoy(at)gmail(dot)com> |
---|---|
To: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | [PATCH] Supporting +-Infinity values by to_timestamp(float8) |
Date: | 2016-02-27 06:57:40 |
Message-ID: | CAKOSWN=qbbnF_oRue4rfsMmWb+7wkBN6fq5XNHgt5vR0TiAA5g@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
Attachment | Content-Type | Size |
---|---|---|
to_timestamp_infs.v001.patch | application/octet-stream | 10.6 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Vitaly Burovoy | 2016-02-27 07:12:38 | Re: [PATCH] Supporting +-Infinity values by to_timestamp(float8) |
Previous Message | Kartyshov Ivan | 2016-02-27 06:52:40 | Re: proposal: get oldest LSN - function |