summaryrefslogtreecommitdiff
path: root/mysql-test/t
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/t')
-rw-r--r--mysql-test/t/func_group.test3
-rw-r--r--mysql-test/t/func_sapdb.test4
-rw-r--r--mysql-test/t/func_time.test14
-rw-r--r--mysql-test/t/func_time_hires.test2
-rw-r--r--mysql-test/t/parser_precedence.test2
-rw-r--r--mysql-test/t/type_datetime.test14
-rw-r--r--mysql-test/t/type_datetime_hires.test68
-rw-r--r--mysql-test/t/type_time_hires.test9
8 files changed, 31 insertions, 85 deletions
diff --git a/mysql-test/t/func_group.test b/mysql-test/t/func_group.test
index 72a78f612a2..b00bd84a3a6 100644
--- a/mysql-test/t/func_group.test
+++ b/mysql-test/t/func_group.test
@@ -1063,7 +1063,8 @@ insert into t1 values
(02,2002,20020101,"2002-01-01 23:59:59"),
(60,2060,20600101,"2060-01-01 11:11:11"),
(70,1970,19700101,"1970-11-11 22:22:22"),
- (NULL,NULL,NULL,NULL);
+ (NULL,NULL,NULL,NULL),
+ (71,1971,19710101,"1971-11-11 22:22:22");
select min(f1),max(f1) from t1;
select min(f2),max(f2) from t1;
select min(f3),max(f3) from t1;
diff --git a/mysql-test/t/func_sapdb.test b/mysql-test/t/func_sapdb.test
index 1292c475732..5c31cee403a 100644
--- a/mysql-test/t/func_sapdb.test
+++ b/mysql-test/t/func_sapdb.test
@@ -91,8 +91,8 @@ select microsecond("1997-12-31 23:59:59.000001");
create table t1
select makedate(1997,1) as f1,
- addtime(cast("1997-12-31 23:59:59.000001" as datetime), "1 1:1:1.000002") as f2,
- addtime(cast("23:59:59.999999" as time) , "1 1:1:1.000002") as f3,
+ addtime(cast("1997-12-31 23:59:59.000001" as datetime(6)), "1 1:1:1.000002") as f2,
+ addtime(cast("23:59:59.999999" as time(6)) , "1 1:1:1.000002") as f3,
timediff("1997-12-31 23:59:59.000001","1997-12-30 01:01:01.000002") as f4,
timediff("1997-12-30 23:59:59.000001","1997-12-31 23:59:59.000002") as f5,
maketime(10,11,12) as f6,
diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test
index 6570cf031a1..fea3d77003e 100644
--- a/mysql-test/t/func_time.test
+++ b/mysql-test/t/func_time.test
@@ -17,6 +17,9 @@ select sec_to_time(9001),sec_to_time(9001)+0,time_to_sec("15:12:22"),
sec_to_time(time_to_sec("0:30:47")/6.21);
select sec_to_time(9001.1), time_to_sec('15:12:22.123456'), time_to_sec(15.5566778899);
select sec_to_time(time_to_sec('-838:59:59'));
+select sec_to_time('9001.1'), sec_to_time('1234567890123.123');
+select sec_to_time(90011e-1), sec_to_time(1234567890123e30);
+select sec_to_time(1234567890123), sec_to_time('99999999999999999999999999999');
select now()-curdate()*1000000-curtime();
select strcmp(current_timestamp(),concat(current_date()," ",current_time()));
select strcmp(localtime(),concat(current_date()," ",current_time()));
@@ -67,10 +70,10 @@ select date_format('1999-12-31','%x-%v'),date_format('2000-01-01','%x-%v');
select dayname("1962-03-03"),dayname("1962-03-03")+0;
select monthname("1972-03-04"),monthname("1972-03-04")+0;
-select time_format(19980131000000,'%H|%I|%k|%l|%i|%p|%r|%S|%T');
-select time_format(19980131010203,'%H|%I|%k|%l|%i|%p|%r|%S|%T');
-select time_format(19980131131415,'%H|%I|%k|%l|%i|%p|%r|%S|%T');
-select time_format(19980131010015,'%H|%I|%k|%l|%i|%p|%r|%S|%T');
+select time_format(000000,'%H|%I|%k|%l|%i|%p|%r|%S|%T'),date_format(19980131000000,'%H|%I|%k|%l|%i|%p|%r|%S|%T');
+select time_format(010203,'%H|%I|%k|%l|%i|%p|%r|%S|%T'),date_format(19980131010203,'%H|%I|%k|%l|%i|%p|%r|%S|%T');
+select time_format(131415,'%H|%I|%k|%l|%i|%p|%r|%S|%T'),date_format(19980131131415,'%H|%I|%k|%l|%i|%p|%r|%S|%T');
+select time_format(010015,'%H|%I|%k|%l|%i|%p|%r|%S|%T'),date_format(19980131010015,'%H|%I|%k|%l|%i|%p|%r|%S|%T');
select date_format(concat('19980131',131415),'%H|%I|%k|%l|%i|%p|%r|%S|%T| %M|%W|%D|%Y|%y|%a|%b|%j|%m|%d|%h|%s|%w');
select date_format(19980021000000,'%H|%I|%k|%l|%i|%p|%r|%S|%T| %M|%W|%D|%Y|%y|%a|%b|%j|%m|%d|%h|%s|%w');
select date_add("1997-12-31 23:59:59",INTERVAL 1 SECOND);
@@ -882,6 +885,9 @@ select time(' 1 02:03:04') - interval 2 day;
select time('-1 02:03:04') + interval 2 day;
select time('-1 02:03:04') - interval 2 day;
+select time('10 02:03:04') + interval 30 day;
+select time('10 02:03:04') + interval 1 year;
+
# specially constructed queries to reach obscure places in the code
# not touched by the more "normal" queries (and to increase the coverage)
select cast('131415.123e0' as time);
diff --git a/mysql-test/t/func_time_hires.test b/mysql-test/t/func_time_hires.test
index b9cb6a92e9e..9d2dbfbaeb5 100644
--- a/mysql-test/t/func_time_hires.test
+++ b/mysql-test/t/func_time_hires.test
@@ -65,6 +65,8 @@ create table t1 select CAST(@a AS DATETIME) as dauto,
show create table t1;
--query_vertical select * from t1
drop table t1;
+explain extended select cast(cast(@a as datetime(4)) as time(0));
+select cast(cast(@a as time(2)) as time(6));
--error ER_TOO_BIG_PRECISION
select CAST(@a AS DATETIME(7));
diff --git a/mysql-test/t/parser_precedence.test b/mysql-test/t/parser_precedence.test
index 484c8759779..7b69bc9c6da 100644
--- a/mysql-test/t/parser_precedence.test
+++ b/mysql-test/t/parser_precedence.test
@@ -3,6 +3,8 @@
drop table if exists t1_30237_bool;
--enable_warnings
+set sql_mode=NO_UNSIGNED_SUBTRACTION;
+
create table t1_30237_bool(A boolean, B boolean, C boolean);
insert into t1_30237_bool values
diff --git a/mysql-test/t/type_datetime.test b/mysql-test/t/type_datetime.test
index d4fa6bed186..1c0e34fad48 100644
--- a/mysql-test/t/type_datetime.test
+++ b/mysql-test/t/type_datetime.test
@@ -137,9 +137,9 @@ DROP TABLE t1;
# Bug 19491 (CAST DATE AS DECIMAL returns incorrect result
#
SELECT CAST(CAST('2006-08-10' AS DATE) AS DECIMAL(20,6));
-SELECT CAST(CAST('2006-08-10 10:11:12' AS DATETIME) AS DECIMAL(20,6));
-SELECT CAST(CAST('2006-08-10 10:11:12' AS DATETIME) + INTERVAL 14 MICROSECOND AS DECIMAL(20,6));
-SELECT CAST(CAST('10:11:12.098700' AS TIME) AS DECIMAL(20,6));
+SELECT CAST(CAST('2006-08-10 10:11:12' AS DATETIME(6)) AS DECIMAL(20,6));
+SELECT CAST(CAST('2006-08-10 10:11:12' AS DATETIME(6)) + INTERVAL 14 MICROSECOND AS DECIMAL(20,6));
+SELECT CAST(CAST('10:11:12.098700' AS TIME(6)) AS DECIMAL(20,6));
#
@@ -432,17 +432,17 @@ set @@sql_mode= @org_mode;
# Bug #42146 - DATETIME fractional seconds parse error
#
# show we trucate microseconds from the right -- special case: leftmost is 0
-SELECT CAST(CAST('2006-08-10 10:11:12.0123450' AS DATETIME) AS DECIMAL(30,7));
+SELECT CAST(CAST('2006-08-10 10:11:12.0123450' AS DATETIME(6)) AS DECIMAL(30,7));
# show that we ignore leading zeroes for all other fields
-SELECT CAST(CAST('00000002006-000008-0000010 000010:0000011:00000012.0123450' AS DATETIME) AS DECIMAL(30,7));
+SELECT CAST(CAST('00000002006-000008-0000010 000010:0000011:00000012.0123450' AS DATETIME(6)) AS DECIMAL(30,7));
# once more with feeling (but no warnings)
-SELECT CAST(CAST('00000002006-000008-0000010 000010:0000011:00000012.012345' AS DATETIME) AS DECIMAL(30,7));
+SELECT CAST(CAST('00000002006-000008-0000010 000010:0000011:00000012.012345' AS DATETIME(6)) AS DECIMAL(30,7));
#
# Bug #38435 - LONG Microseconds cause MySQL to fail a CAST to DATETIME or DATE
#
# show we truncate microseconds from the right
-SELECT CAST(CAST('2008-07-29T10:42:51.1234567' AS DateTime) AS DECIMAL(30,7));
+SELECT CAST(CAST('2008-07-29T10:42:51.1234567' AS DateTime(6)) AS DECIMAL(30,7));
--echo End of 5.1 tests
diff --git a/mysql-test/t/type_datetime_hires.test b/mysql-test/t/type_datetime_hires.test
index d4ed0e342e6..613f94d52f2 100644
--- a/mysql-test/t/type_datetime_hires.test
+++ b/mysql-test/t/type_datetime_hires.test
@@ -61,74 +61,6 @@ select table_name,partition_name,partition_method,partition_expression,partition
drop table t1, t2;
-#
-# insert ... select with conversion
-#
-create table t1 (
- q_date date,
- q_time time,
- q_time5 time(5),
- q_datetime datetime,
- q_datetime1 datetime(1),
- q_datetime3 datetime(3),
- q_datetime5 datetime(5),
- q_timestamp timestamp,
- q_timestamp2 timestamp(2),
- q_timestamp4 timestamp(4),
- q_timestamp6 timestamp(6),
- q_varchar50 varchar(50),
- q_varchar60 varchar(60),
- q_varchar70 varchar(70),
- q_varchar80 varchar(80));
-
-create table t2 (
- date_datetime datetime,
- time_datetime datetime,
- time5_varchar100 varchar(100),
- datetime_time time,
- datetime1_date date,
- datetime3_timestamp timestamp,
- datetime5_varchar100 varchar(100),
- timestamp_datetime datetime,
- timestamp2_date date,
- timestamp4_time time,
- timestamp6_varchar100 varchar(100),
- varchar50_date date,
- varchar60_datetime datetime,
- varchar70_time time,
- varchar80_timestamp timestamp);
-
-insert t1 values ('2010-11-12 11:14:17.765432',
- '2010-11-12 11:14:17.765432', '2010-11-12 11:14:17.765432',
- '2010-11-12 11:14:17.765432', '2010-11-12 11:14:17.765432',
- '2010-11-12 11:14:17.765432', '2010-11-12 11:14:17.765432',
- '2010-11-12 11:14:17.765432', '2010-11-12 11:14:17.765432',
- '2010-11-12 11:14:17.765432', '2010-11-12 11:14:17.765432',
- '2010-11-12 11:14:17.765432', '2010-11-12 11:14:17.765432',
- '2010-11-12 11:14:17.765432', '2010-11-12 11:14:17.765432');
---query_vertical select * from t1;
-insert t2 select * from t1;
---query_vertical select * from t2;
-alter table t1
- change q_date date_datetime datetime,
- change q_time time_datetime datetime,
- change q_time5 time5_varchar100 varchar(100),
- change q_datetime datetime_time time,
- change q_datetime1 datetime1_date date,
- change q_datetime3 datetime3_timestamp timestamp,
- change q_datetime5 datetime5_varchar100 varchar(100),
- change q_timestamp timestamp_datetime datetime,
- change q_timestamp2 timestamp2_date date,
- change q_timestamp4 timestamp4_time time,
- change q_timestamp6 timestamp6_varchar100 varchar(100),
- change q_varchar50 varchar50_date date,
- change q_varchar60 varchar60_datetime datetime,
- change q_varchar70 varchar70_time time,
- change q_varchar80 varchar80_timestamp timestamp;
---query_vertical select * from t1;
-
-drop table t1, t2;
-
create table t1 (a datetime, b datetime(6));
insert t1 values ('2010-01-02 03:04:05.678912', '2010-01-02 03:04:05.678912');
update t1 set b=a;
diff --git a/mysql-test/t/type_time_hires.test b/mysql-test/t/type_time_hires.test
index c9939289e43..92ad79523c3 100644
--- a/mysql-test/t/type_time_hires.test
+++ b/mysql-test/t/type_time_hires.test
@@ -2,7 +2,10 @@
let type=time;
--source include/type_hrtime.inc
-create table t1 (a time(4) not null);
-insert into t1 values ('-00:00:00.6'),('-00:00:00.7'),('-00:00:00.8'),('-00:00:00.9'),('-00:00:01.0'),('-00:00:01.1'),('-00:00:01.000000'),('-00:00:01.100001'),('-00:00:01.000002'),('-00:00:01.090000');
-select * from t1;
+create table t1 (a time(4) not null, key(a));
+insert into t1 values ('1:2:3.001'),('1:2:3'), ('-00:00:00.6'),('-00:00:00.7'),('-00:00:00.8'),('-00:00:00.9'),('-00:00:01.0'),('-00:00:01.1'),('-00:00:01.000000'),('-00:00:01.100001'),('-00:00:01.000002'),('-00:00:01.090000');
+select * from t1 order by a;
+select * from t1 order by a desc;
drop table t1;
+
+select cast(1e-6 as time(6));