summaryrefslogtreecommitdiff
path: root/mysql-test/t/func_time.test
diff options
context:
space:
mode:
authorunknown <petr/cps@outpost.site>2006-11-06 00:05:02 +0300
committerunknown <petr/cps@outpost.site>2006-11-06 00:05:02 +0300
commit6cf8ceebbfa7c73d933e970c38c3c6aa5a3483c7 (patch)
tree2ea2865a3f7ab2aa574df1b7ebb91036b1e2dce8 /mysql-test/t/func_time.test
parent0d92b17851f8a42f25bcb44695a5a653b85750a5 (diff)
parente32e7ca0603a70a260194de269899882dd5b8f3a (diff)
downloadmariadb-git-6cf8ceebbfa7c73d933e970c38c3c6aa5a3483c7.tar.gz
Merge pchardin@bk-internal.mysql.com:/home/bk/mysql-4.1-runtime
into outpost.site:/home/cps/mysql/trees/4.1-runtime-bug9191 mysql-test/r/func_time.result: Auto merged mysql-test/t/func_time.test: Auto merged sql/item_timefunc.cc: Auto merged sql/mysql_priv.h: Auto merged
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 714379d0fb3..f4dd8e3065f 100644
--- a/mysql-test/t/func_time.test
+++ b/mysql-test/t/func_time.test
@@ -236,17 +236,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
#