summaryrefslogtreecommitdiff
path: root/mysql-test/t/func_time.test
diff options
context:
space:
mode:
authorunknown <petr/cps@owlet.local>2006-11-01 18:18:01 +0300
committerunknown <petr/cps@owlet.local>2006-11-01 18:18:01 +0300
commit60e315c53d60d1337f71405472189bb353100237 (patch)
tree7a5f2fe23939ea4eb1a8b2fdd922f3d3a91fb230 /mysql-test/t/func_time.test
parent3ce0cadd05e00b31934af0bbf3b1f18891404a8e (diff)
parentb2c40c169869f7df93342b434b84af4fb26acbe2 (diff)
downloadmariadb-git-60e315c53d60d1337f71405472189bb353100237.tar.gz
Merge mysql.com:/home/cps/mysql/trees/5.0-runtime-bug9191
into mysql.com:/home/cps/mysql/trees/5.1-runtime-bug9191 configure.in: Auto merged mysql-test/r/func_time.result: Auto merged mysql-test/r/timezone2.result: Auto merged mysql-test/t/func_time.test: Auto merged mysql-test/t/timezone2.test: Auto merged sql/item_timefunc.cc: Auto merged sql-common/my_time.c: Auto merged sql/mysql_priv.h: Auto merged sql/time.cc: Auto merged sql/tztime.cc: Auto merged include/my_time.h: manual merge
Diffstat (limited to 'mysql-test/t/func_time.test')
-rw-r--r--mysql-test/t/func_time.test52
1 files changed, 46 insertions, 6 deletions
diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test
index d49a4fed9d2..4ff549a33d0 100644
--- a/mysql-test/t/func_time.test
+++ b/mysql-test/t/func_time.test
@@ -255,17 +255,57 @@ select unix_timestamp(@a);
select unix_timestamp('1969-12-01 19:00:01');
#
-# Test for bug #6439 "unix_timestamp() function returns wrong datetime
-# values for too big argument" and bug #7515 "from_unixtime(0) now
-# returns NULL instead of the epoch". unix_timestamp() should return error
-# for too big or negative argument. It should return Epoch value for zero
-# argument since it seems that many user's rely on this fact.
+# Tests for bug #6439 "unix_timestamp() function returns wrong datetime
+# values for too big argument", bug #7515 "from_unixtime(0) now
+# returns NULL instead of the epoch" and bug #9191
+# "TIMESTAMP/from_unixtime() no longer accepts 2^31-1."
+# unix_timestamp() should return error for too big or negative argument.
+# It should return Epoch value for zero argument since it seems that many
+# users rely on this fact, from_unixtime() should work with values
+# up to INT_MAX32 because of the same reason.
#
select from_unixtime(-1);
-select from_unixtime(2145916800);
+# check for from_unixtime(2^31-1) and from_unixtime(2^31)
+select from_unixtime(2147483647);
+select from_unixtime(2147483648);
select from_unixtime(0);
#
+# Some more tests for bug #9191 "TIMESTAMP/from_unixtime() no
+# longer accepts 2^31-1". Here we test that from_unixtime and
+# unix_timestamp are consistent, when working with boundary dates.
+#
+select unix_timestamp(from_unixtime(2147483647));
+select unix_timestamp(from_unixtime(2147483648));
+
+# check for invalid dates
+
+# bad year
+select unix_timestamp('2039-01-20 01:00:00');
+select unix_timestamp('1968-01-20 01:00:00');
+# bad month
+select unix_timestamp('2038-02-10 01:00:00');
+select unix_timestamp('1969-11-20 01:00:00');
+# bad day
+select unix_timestamp('2038-01-20 01:00:00');
+select unix_timestamp('1969-12-30 01:00:00');
+
+#
+# Check negative shift (we subtract several days for boundary dates during
+# conversion).
+select unix_timestamp('2038-01-17 12:00:00');
+
+#
+# Check positive shift. (it happens only on
+# platfroms with unsigned time_t, such as QNX)
+#
+select unix_timestamp('1970-01-01 03:00:01');
+
+# check bad date, close to the boundary (we cut them off in the very end)
+select unix_timestamp('2038-01-19 07:14:07');
+
+
+#
# Test types from + INTERVAL
#