mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Merge pchardin@bk-internal.mysql.com:/home/bk/mysql-4.1
into outpost.site:/home/cps/mysql/trees/4.1-runtime-bug9191 configure.in: Auto merged include/my_time.h: Auto merged mysql-test/r/func_time.result: Auto merged mysql-test/r/rename.result: Auto merged mysql-test/t/func_time.test: Auto merged sql-common/my_time.c: Auto merged sql/item_timefunc.cc: Auto merged sql/time.cc: Auto merged mysql-test/t/rename.test: choose one of the race problem solutions. It was solved differently in -runtime and mainstream
This commit is contained in:
@ -485,12 +485,48 @@ unix_timestamp('1969-12-01 19:00:01')
|
||||
select from_unixtime(-1);
|
||||
from_unixtime(-1)
|
||||
NULL
|
||||
select from_unixtime(2145916800);
|
||||
from_unixtime(2145916800)
|
||||
select from_unixtime(2147483647);
|
||||
from_unixtime(2147483647)
|
||||
2038-01-19 06:14:07
|
||||
select from_unixtime(2147483648);
|
||||
from_unixtime(2147483648)
|
||||
NULL
|
||||
select from_unixtime(0);
|
||||
from_unixtime(0)
|
||||
1970-01-01 03:00:00
|
||||
select unix_timestamp(from_unixtime(2147483647));
|
||||
unix_timestamp(from_unixtime(2147483647))
|
||||
2147483647
|
||||
select unix_timestamp(from_unixtime(2147483648));
|
||||
unix_timestamp(from_unixtime(2147483648))
|
||||
NULL
|
||||
select unix_timestamp('2039-01-20 01:00:00');
|
||||
unix_timestamp('2039-01-20 01:00:00')
|
||||
0
|
||||
select unix_timestamp('1968-01-20 01:00:00');
|
||||
unix_timestamp('1968-01-20 01:00:00')
|
||||
0
|
||||
select unix_timestamp('2038-02-10 01:00:00');
|
||||
unix_timestamp('2038-02-10 01:00:00')
|
||||
0
|
||||
select unix_timestamp('1969-11-20 01:00:00');
|
||||
unix_timestamp('1969-11-20 01:00:00')
|
||||
0
|
||||
select unix_timestamp('2038-01-20 01:00:00');
|
||||
unix_timestamp('2038-01-20 01:00:00')
|
||||
0
|
||||
select unix_timestamp('1969-12-30 01:00:00');
|
||||
unix_timestamp('1969-12-30 01:00:00')
|
||||
0
|
||||
select unix_timestamp('2038-01-17 12:00:00');
|
||||
unix_timestamp('2038-01-17 12:00:00')
|
||||
2147331600
|
||||
select unix_timestamp('1970-01-01 03:00:01');
|
||||
unix_timestamp('1970-01-01 03:00:01')
|
||||
1
|
||||
select unix_timestamp('2038-01-19 07:14:07');
|
||||
unix_timestamp('2038-01-19 07:14:07')
|
||||
0
|
||||
CREATE TABLE t1 (datetime datetime, timestamp timestamp, date date, time time);
|
||||
INSERT INTO t1 values ("2001-01-02 03:04:05", "2002-01-02 03:04:05", "2003-01-02", "06:07:08");
|
||||
SELECT * from t1;
|
||||
|
@ -54,3 +54,4 @@ Tables_in_test
|
||||
t2
|
||||
t4
|
||||
drop table t2, t4;
|
||||
End of 4.1 tests
|
||||
|
@ -41,7 +41,7 @@ Warning 1299 Invalid TIMESTAMP value in column 'ts' at row 2
|
||||
DROP TABLE t1;
|
||||
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('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')
|
||||
0 1 2145916799 0
|
||||
unix_timestamp('2038-01-19 04:14:07'),
|
||||
unix_timestamp('2038-01-19 04:14:08');
|
||||
unix_timestamp('1970-01-01 01:00:00') unix_timestamp('1970-01-01 01:00:01') unix_timestamp('2038-01-19 04:14:07') unix_timestamp('2038-01-19 04:14:08')
|
||||
0 1 2147483647 0
|
||||
|
@ -106,7 +106,7 @@ 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');
|
||||
Warnings:
|
||||
Warning 1264 Data truncated; out of range for column 'ts' at row 2
|
||||
Warning 1264 Data truncated; out of range for column 'ts' at row 3
|
||||
@ -117,13 +117,13 @@ ts
|
||||
0000-00-00 00:00:00
|
||||
0000-00-00 00:00:00
|
||||
1970-01-01 00:00:01
|
||||
2037-12-31 23:59:59
|
||||
2038-01-19 03:14:07
|
||||
0000-00-00 00:00:00
|
||||
delete from t1;
|
||||
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');
|
||||
Warnings:
|
||||
Warning 1264 Data truncated; out of range for column 'ts' at row 2
|
||||
Warning 1264 Data truncated; out of range for column 'ts' at row 3
|
||||
@ -134,13 +134,13 @@ ts
|
||||
0000-00-00 00:00:00
|
||||
0000-00-00 00:00:00
|
||||
1970-01-01 01:00:01
|
||||
2038-01-01 00:59:59
|
||||
2038-01-19 04:14:07
|
||||
0000-00-00 00:00:00
|
||||
delete from t1;
|
||||
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');
|
||||
Warnings:
|
||||
Warning 1264 Data truncated; out of range for column 'ts' at row 2
|
||||
Warning 1264 Data truncated; out of range for column 'ts' at row 3
|
||||
@ -151,7 +151,7 @@ ts
|
||||
0000-00-00 00:00:00
|
||||
0000-00-00 00:00:00
|
||||
1970-01-01 01:30:01
|
||||
2038-01-01 01:29:59
|
||||
2038-01-19 04:44:07
|
||||
0000-00-00 00:00:00
|
||||
drop table t1;
|
||||
show variables like 'time_zone';
|
||||
@ -213,12 +213,12 @@ convert_tz('2003-10-26 02:59:59', 'MET', 'UTC')
|
||||
select convert_tz('2003-10-26 04:00:00', 'MET', 'UTC');
|
||||
convert_tz('2003-10-26 04:00:00', 'MET', 'UTC')
|
||||
2003-10-26 03:00:00
|
||||
select convert_tz('2038-01-01 00:59:59', 'MET', 'UTC');
|
||||
convert_tz('2038-01-01 00:59:59', 'MET', 'UTC')
|
||||
2037-12-31 23:59:59
|
||||
select convert_tz('2038-01-01 01:00:00', 'MET', 'UTC');
|
||||
convert_tz('2038-01-01 01:00:00', 'MET', 'UTC')
|
||||
2038-01-01 01:00:00
|
||||
select convert_tz('2038-01-19 04:14:07', 'MET', 'UTC');
|
||||
convert_tz('2038-01-19 04:14:07', 'MET', 'UTC')
|
||||
2038-01-19 03:14:07
|
||||
select convert_tz('2038-01-19 04:14:08', 'MET', 'UTC');
|
||||
convert_tz('2038-01-19 04:14:08', 'MET', 'UTC')
|
||||
2038-01-19 04:14:08
|
||||
select convert_tz('2103-01-01 04:00:00', 'MET', 'UTC');
|
||||
convert_tz('2103-01-01 04:00:00', 'MET', 'UTC')
|
||||
2103-01-01 04:00:00
|
||||
|
6
mysql-test/r/timezone4.result
Normal file
6
mysql-test/r/timezone4.result
Normal file
@ -0,0 +1,6 @@
|
||||
select from_unixtime(0);
|
||||
from_unixtime(0)
|
||||
1969-12-31 14:00:00
|
||||
select unix_timestamp('1969-12-31 14:00:01');
|
||||
unix_timestamp('1969-12-31 14:00:01')
|
||||
1
|
@ -236,16 +236,56 @@ 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
|
||||
#
|
||||
|
@ -70,4 +70,8 @@ show tables;
|
||||
|
||||
drop table t2, t4;
|
||||
|
||||
# End of 4.1 tests
|
||||
disconnect con2;
|
||||
disconnect con1;
|
||||
connection default;
|
||||
|
||||
--echo End of 4.1 tests
|
||||
|
@ -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
|
||||
|
@ -107,21 +107,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;
|
||||
@ -171,8 +171,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
|
||||
|
1
mysql-test/t/timezone4-master.opt
Normal file
1
mysql-test/t/timezone4-master.opt
Normal file
@ -0,0 +1 @@
|
||||
--timezone=GMT+10
|
13
mysql-test/t/timezone4.test
Normal file
13
mysql-test/t/timezone4.test
Normal file
@ -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');
|
||||
|
Reference in New Issue
Block a user