Feature or bug: getting "Inf"::timestamp[tz] by "regular" value

From: Vitaly Burovoy <vitaly(dot)burovoy(at)gmail(dot)com>
To: PostgreSQL Developers <pgsql-hackers(at)postgresql(dot)org>
Subject: Feature or bug: getting "Inf"::timestamp[tz] by "regular" value
Date: 2015-11-18 09:44:03
Message-ID: CAKOSWNmLjs_2EyS4z_bDkp=RfU8s2M2P8joZVt18h+wfszWz7A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hackers!

I'm writing another patch for timestamps and while I tried to cover
corner-cases I found out there is an ability to get
"Infinity"::timestamptz via defining it by a specific (but not
"Infinity") value:

postgres=# SELECT '294277-01-09 04:00:54.775806+00'::timestamptz; -- OK
timestamptz
---------------------------------
294277-01-09 04:00:54.775806+00
(1 row)

postgres=# SELECT '294277-01-09 04:00:54.775807+00'::timestamptz; -- Inf???
timestamptz
-------------
infinity
(1 row)

postgres=# SELECT '294277-01-09 04:00:54.775808+00'::timestamptz; --
Higher values give an error
ERROR: timestamp out of range: "294277-01-09 04:00:54.775808+00"
LINE 1: SELECT '294277-01-09 04:00:54.775808+00'::timestamptz;
^
I could not find a way to get "-Infinity" by similar way.
Is it feature or a bug? Does it worth to insert a check for that
special case to raise an exception "timestamp out of range"?
--
Best regards,
Vitaly Burovoy

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Maeldron T. 2015-11-18 10:13:43 PostgreSQL super HA (High Availability) conception for 9.5+
Previous Message Masahiko Sawada 2015-11-18 08:36:36 Re: Support for N synchronous standby servers - take 2