diff options
author | unknown <petr/cps@outpost.site> | 2006-11-06 00:11:34 +0300 |
---|---|---|
committer | unknown <petr/cps@outpost.site> | 2006-11-06 00:11:34 +0300 |
commit | e5bd94b2d4fd6937a0f5ff53a295fe14a83ccaef (patch) | |
tree | 30d8ec2b0bdec298709d288e24cd14d7fd20989c /mysql-test/t | |
parent | b4973524581aa65edd0ccef339bc2e47c2351602 (diff) | |
parent | c96eaa43ab1c486fb729ca099ccdb1f7336525eb (diff) | |
download | mariadb-git-e5bd94b2d4fd6937a0f5ff53a295fe14a83ccaef.tar.gz |
Merge pchardin@bk-internal.mysql.com:/home/bk/mysql-5.0-runtime
into outpost.site:/home/cps/mysql/trees/5.0-runtime-bug9191
configure.in:
Auto merged
sql/mysql_priv.h:
Auto merged
Diffstat (limited to 'mysql-test/t')
-rw-r--r-- | mysql-test/t/func_time.test | 52 | ||||
-rw-r--r-- | mysql-test/t/timezone.test | 7 | ||||
-rw-r--r-- | mysql-test/t/timezone2.test | 10 | ||||
-rw-r--r-- | mysql-test/t/timezone4-master.opt | 1 | ||||
-rw-r--r-- | mysql-test/t/timezone4.test | 13 |
5 files changed, 69 insertions, 14 deletions
diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test index 2b3fb86829d..500eb8ac9c7 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 # diff --git a/mysql-test/t/timezone.test b/mysql-test/t/timezone.test index 34bbb365c70..157b18f57fa 100644 --- a/mysql-test/t/timezone.test +++ b/mysql-test/t/timezone.test @@ -52,11 +52,12 @@ INSERT INTO t1 (ts) VALUES ('2003-03-30 01:59:59'), DROP TABLE t1; # -# Test for fix for Bug#2523 +# Test for fix for Bug#2523 Check that boundary dates are processed +# correctly. # select unix_timestamp('1970-01-01 01:00:00'), unix_timestamp('1970-01-01 01:00:01'), - unix_timestamp('2038-01-01 00:59:59'), - unix_timestamp('2038-01-01 01:00:00'); + unix_timestamp('2038-01-19 04:14:07'), + unix_timestamp('2038-01-19 04:14:08'); # End of 4.1 tests diff --git a/mysql-test/t/timezone2.test b/mysql-test/t/timezone2.test index bfc909d6995..75e5d4bfe81 100644 --- a/mysql-test/t/timezone2.test +++ b/mysql-test/t/timezone2.test @@ -113,21 +113,21 @@ create table t1 (ts timestamp); set time_zone='UTC'; insert into t1 values ('0000-00-00 00:00:00'),('1969-12-31 23:59:59'), ('1970-01-01 00:00:00'),('1970-01-01 00:00:01'), - ('2037-12-31 23:59:59'),('2038-01-01 00:00:00'); + ('2038-01-19 03:14:07'),('2038-01-19 03:14:08'); select * from t1; delete from t1; # MET time zone has range shifted by one hour set time_zone='MET'; insert into t1 values ('0000-00-00 00:00:00'),('1970-01-01 00:30:00'), ('1970-01-01 01:00:00'),('1970-01-01 01:00:01'), - ('2038-01-01 00:59:59'),('2038-01-01 01:00:00'); + ('2038-01-19 04:14:07'),('2038-01-19 04:14:08'); select * from t1; delete from t1; # same for +01:30 time zone set time_zone='+01:30'; insert into t1 values ('0000-00-00 00:00:00'),('1970-01-01 01:00:00'), ('1970-01-01 01:30:00'),('1970-01-01 01:30:01'), - ('2038-01-01 01:29:59'),('2038-01-01 01:30:00'); + ('2038-01-19 04:44:07'),('2038-01-19 04:44:08'); select * from t1; drop table t1; @@ -177,8 +177,8 @@ select convert_tz('2003-10-26 01:00:00', 'MET', 'UTC'); select convert_tz('2003-10-26 02:00:00', 'MET', 'UTC'); select convert_tz('2003-10-26 02:59:59', 'MET', 'UTC'); select convert_tz('2003-10-26 04:00:00', 'MET', 'UTC'); -select convert_tz('2038-01-01 00:59:59', 'MET', 'UTC'); -select convert_tz('2038-01-01 01:00:00', 'MET', 'UTC'); +select convert_tz('2038-01-19 04:14:07', 'MET', 'UTC'); +select convert_tz('2038-01-19 04:14:08', 'MET', 'UTC'); select convert_tz('2103-01-01 04:00:00', 'MET', 'UTC'); # Let us test variable time zone argument diff --git a/mysql-test/t/timezone4-master.opt b/mysql-test/t/timezone4-master.opt new file mode 100644 index 00000000000..d1ab6207933 --- /dev/null +++ b/mysql-test/t/timezone4-master.opt @@ -0,0 +1 @@ +--timezone=GMT+10 diff --git a/mysql-test/t/timezone4.test b/mysql-test/t/timezone4.test new file mode 100644 index 00000000000..d7372c75d5a --- /dev/null +++ b/mysql-test/t/timezone4.test @@ -0,0 +1,13 @@ +# +# Tests for time functions. The difference from func_time test is the +# timezone. In func_time it's GMT-3. In our case it's GMT+10 +# + +# +# Test for bug bug #9191 "TIMESTAMP/from_unixtime() no longer accepts 2^31-1" +# + +select from_unixtime(0); +# check 0 boundary +select unix_timestamp('1969-12-31 14:00:01'); + |