summaryrefslogtreecommitdiff
path: root/src/test/regress/sql/timestamptz.sql
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2016-03-29 17:09:21 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2016-03-29 17:09:29 -0400
commite511d878f3bbc205cd260a79740e646eea3c1cd3 (patch)
tree89a142f73641afe47d816117b08fbf01ce465258 /src/test/regress/sql/timestamptz.sql
parent96f8373cad5d6066baeb7a1c5a88f6f5c9661974 (diff)
downloadpostgresql-e511d878f3bbc205cd260a79740e646eea3c1cd3.tar.gz
Allow to_timestamp(float8) to convert float infinity to timestamp infinity.
With the original SQL-function implementation, such cases failed because we don't support infinite intervals. Converting the function to C lets us bypass the interval representation, which should be a bit faster as well as more flexible. Vitaly Burovoy, reviewed by Anastasia Lubennikova
Diffstat (limited to 'src/test/regress/sql/timestamptz.sql')
-rw-r--r--src/test/regress/sql/timestamptz.sql15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/test/regress/sql/timestamptz.sql b/src/test/regress/sql/timestamptz.sql
index 5ec92e55c8..35470ce7c9 100644
--- a/src/test/regress/sql/timestamptz.sql
+++ b/src/test/regress/sql/timestamptz.sql
@@ -403,6 +403,21 @@ SELECT '2007-12-09 04:00:00'::timestamp AT TIME ZONE 'VET';
SELECT make_timestamptz(2007, 12, 9, 2, 0, 0, 'VET');
SELECT make_timestamptz(2007, 12, 9, 3, 0, 0, 'VET');
+SELECT to_timestamp( 0); -- 1970-01-01 00:00:00+00
+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
+-- nonfinite values
+SELECT to_timestamp(' Infinity'::float);
+SELECT to_timestamp('-Infinity'::float);
+SELECT to_timestamp('NaN'::float);
+
+
SET TimeZone to 'Europe/Moscow';
SELECT '2011-03-26 21:00:00 UTC'::timestamptz;