(1 row)
-- edge cases
-SELECT to_timestamp(-1e20::float8); -- error, out of range
-ERROR: timestamp out of range: "-1e+20"
-SELECT to_timestamp(-210866803200.0625); -- error, out of range
-ERROR: timestamp out of range: "-2.10867e+11"
SELECT to_timestamp(-210866803200); -- 4714-11-24 00:00:00+00 BC
to_timestamp
---------------------------------
Mon Nov 24 00:00:00 4714 UTC BC
(1 row)
--- The upper boundary differs between integer and float timestamps, so check the biggest one
-SELECT to_timestamp(185331707078400::float8); -- error, out of range
-ERROR: timestamp out of range: "1.85332e+14"
+-- upper limit varies between integer and float timestamps, so hard to test
-- nonfinite values
SELECT to_timestamp(' Infinity'::float);
to_timestamp
SELECT to_timestamp( 946684800); -- 2000-01-01 00:00:00+00
SELECT to_timestamp(1262349296.7890123); -- 2010-01-01 12:34:56.789012+00
-- edge cases
-SELECT to_timestamp(-1e20::float8); -- error, out of range
-SELECT to_timestamp(-210866803200.0625); -- error, out of range
SELECT to_timestamp(-210866803200); -- 4714-11-24 00:00:00+00 BC
--- The upper boundary differs between integer and float timestamps, so check the biggest one
-SELECT to_timestamp(185331707078400::float8); -- error, out of range
+-- upper limit varies between integer and float timestamps, so hard to test
-- nonfinite values
SELECT to_timestamp(' Infinity'::float);
SELECT to_timestamp('-Infinity'::float);