diff options
author | Alexander Barkov <bar@mnogosearch.org> | 2013-09-13 12:06:17 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mnogosearch.org> | 2013-09-13 12:06:17 +0400 |
commit | 51dcf4dcff44e64b9a18951898ed29f2c576ae61 (patch) | |
tree | 95ff77f90a05056c22e291a1d7ea33965f553dc8 /mysql-test | |
parent | 33f807fd91826013499c996f9515838cf2c6d0c5 (diff) | |
parent | 499ddea5766d988adc858448c8eec549c7bedcc1 (diff) | |
download | mariadb-git-51dcf4dcff44e64b9a18951898ed29f2c576ae61.tar.gz |
Merge from 5.3.
pending merges:
Alexander Barkov 2013-09-12 MDEV-4724 Some temporal functions do not pre...
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/r/ctype_binary.result | 20 | ||||
-rw-r--r-- | mysql-test/r/ctype_cp1251.result | 20 | ||||
-rw-r--r-- | mysql-test/r/ctype_latin1.result | 20 | ||||
-rw-r--r-- | mysql-test/r/ctype_ucs.result | 20 | ||||
-rw-r--r-- | mysql-test/r/ctype_utf8.result | 20 | ||||
-rw-r--r-- | mysql-test/r/date_formats.result | 108 | ||||
-rw-r--r-- | mysql-test/r/func_sapdb.result | 6 | ||||
-rw-r--r-- | mysql-test/r/func_time.result | 175 | ||||
-rw-r--r-- | mysql-test/r/func_time_hires.result | 20 | ||||
-rw-r--r-- | mysql-test/r/ps_2myisam.result | 12 | ||||
-rw-r--r-- | mysql-test/r/ps_3innodb.result | 12 | ||||
-rw-r--r-- | mysql-test/r/ps_4heap.result | 12 | ||||
-rw-r--r-- | mysql-test/r/ps_5merge.result | 24 | ||||
-rw-r--r-- | mysql-test/r/timezone.result | 4 | ||||
-rw-r--r-- | mysql-test/r/timezone4.result | 2 | ||||
-rw-r--r-- | mysql-test/r/type_time.result | 4 | ||||
-rw-r--r-- | mysql-test/suite/maria/ps_maria.result | 12 | ||||
-rw-r--r-- | mysql-test/t/func_time.test | 66 |
18 files changed, 384 insertions, 173 deletions
diff --git a/mysql-test/r/ctype_binary.result b/mysql-test/r/ctype_binary.result index c897108f793..4c09fb97e64 100644 --- a/mysql-test/r/ctype_binary.result +++ b/mysql-test/r/ctype_binary.result @@ -1421,12 +1421,12 @@ t1 CREATE TABLE `t1` ( drop table t1; select hex(concat(time_to_sec('10:11:12'))); hex(concat(time_to_sec('10:11:12'))) -33363637322E303030303030 +3336363732 create table t1 as select concat(time_to_sec('10:11:12')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(24) DEFAULT NULL + `c1` varbinary(17) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(extract(year from 20090702))); @@ -1533,7 +1533,7 @@ create table t1 as select concat(timediff('2001-01-02 00:00:00', '2001-01-01 00: show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(17) DEFAULT NULL + `c1` varbinary(10) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(maketime(10,11,12))); @@ -1573,7 +1573,7 @@ create table t1 as select concat(convert_tz('2004-01-01 12:00:00','+10:00','-6:0 show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(26) DEFAULT NULL + `c1` varbinary(19) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(date_add('2004-01-01 12:00:00', interval 1 day))); @@ -1583,7 +1583,7 @@ create table t1 as select concat(date_add('2004-01-01 12:00:00', interval 1 day) show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(26) DEFAULT NULL + `c1` varbinary(19) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 select * from t1; c1 @@ -2786,8 +2786,8 @@ DATE_SUB(CAST('2007-08-03 17:33:00' AS DATETIME), INTERVAL 1 MINUTE) AS field_da SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `field_str1` varchar(26) DEFAULT NULL, - `field1_str2` varchar(26) DEFAULT NULL, + `field_str1` varchar(19) DEFAULT NULL, + `field1_str2` varchar(19) DEFAULT NULL, `field_date` date DEFAULT NULL, `field_datetime` datetime DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 @@ -2798,8 +2798,8 @@ DATE_SUB('2007-08-03 17:33:00', INTERVAL 1 MINUTE) AS field1_str2, DATE_SUB(DATE('2007-08-03'), INTERVAL 1 DAY) AS field_date, DATE_SUB(CAST('2007-08-03 17:33:00' AS DATETIME), INTERVAL 1 MINUTE) AS field_datetime; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def field_str1 254 26 10 Y 128 31 63 -def field1_str2 254 26 19 Y 128 31 63 +def field_str1 254 19 10 Y 128 0 63 +def field1_str2 254 19 19 Y 128 0 63 def field_date 10 10 10 Y 128 0 63 def field_datetime 12 19 19 Y 128 0 63 field_str1 field1_str2 field_date field_datetime @@ -2854,7 +2854,7 @@ CREATE TABLE t1(a char(215) CHARACTER SET utf8 NOT NULL DEFAULT '', KEY(a)); INSERT INTO t1 VALUES (); SELECT maketime(`a`,`a`,`a`) FROM t1 GROUP BY 1; maketime(`a`,`a`,`a`) -00:00:00 +00:00:00.000000 DROP TABLE t1; SET sql_mode=default; # diff --git a/mysql-test/r/ctype_cp1251.result b/mysql-test/r/ctype_cp1251.result index 5323469dff3..723f7534259 100644 --- a/mysql-test/r/ctype_cp1251.result +++ b/mysql-test/r/ctype_cp1251.result @@ -1813,12 +1813,12 @@ t1 CREATE TABLE `t1` ( drop table t1; select hex(concat(time_to_sec('10:11:12'))); hex(concat(time_to_sec('10:11:12'))) -33363637322E303030303030 +3336363732 create table t1 as select concat(time_to_sec('10:11:12')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(24) CHARACTER SET cp1251 DEFAULT NULL + `c1` varchar(17) CHARACTER SET cp1251 DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(extract(year from 20090702))); @@ -1925,7 +1925,7 @@ create table t1 as select concat(timediff('2001-01-02 00:00:00', '2001-01-01 00: show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(17) CHARACTER SET cp1251 DEFAULT NULL + `c1` varchar(10) CHARACTER SET cp1251 DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(maketime(10,11,12))); @@ -1965,7 +1965,7 @@ create table t1 as select concat(convert_tz('2004-01-01 12:00:00','+10:00','-6:0 show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(26) CHARACTER SET cp1251 DEFAULT NULL + `c1` varchar(19) CHARACTER SET cp1251 DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(date_add('2004-01-01 12:00:00', interval 1 day))); @@ -1975,7 +1975,7 @@ create table t1 as select concat(date_add('2004-01-01 12:00:00', interval 1 day) show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(26) CHARACTER SET cp1251 DEFAULT NULL + `c1` varchar(19) CHARACTER SET cp1251 DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 select * from t1; c1 @@ -3178,8 +3178,8 @@ DATE_SUB(CAST('2007-08-03 17:33:00' AS DATETIME), INTERVAL 1 MINUTE) AS field_da SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `field_str1` varchar(26) DEFAULT NULL, - `field1_str2` varchar(26) DEFAULT NULL, + `field_str1` varchar(19) DEFAULT NULL, + `field1_str2` varchar(19) DEFAULT NULL, `field_date` date DEFAULT NULL, `field_datetime` datetime DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 @@ -3190,8 +3190,8 @@ DATE_SUB('2007-08-03 17:33:00', INTERVAL 1 MINUTE) AS field1_str2, DATE_SUB(DATE('2007-08-03'), INTERVAL 1 DAY) AS field_date, DATE_SUB(CAST('2007-08-03 17:33:00' AS DATETIME), INTERVAL 1 MINUTE) AS field_datetime; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def field_str1 254 26 10 Y 128 31 63 -def field1_str2 254 26 19 Y 128 31 63 +def field_str1 254 19 10 Y 128 0 63 +def field1_str2 254 19 19 Y 128 0 63 def field_date 10 10 10 Y 128 0 63 def field_datetime 12 19 19 Y 128 0 63 field_str1 field1_str2 field_date field_datetime @@ -3246,7 +3246,7 @@ CREATE TABLE t1(a char(215) CHARACTER SET utf8 NOT NULL DEFAULT '', KEY(a)); INSERT INTO t1 VALUES (); SELECT maketime(`a`,`a`,`a`) FROM t1 GROUP BY 1; maketime(`a`,`a`,`a`) -00:00:00 +00:00:00.000000 DROP TABLE t1; SET sql_mode=default; # diff --git a/mysql-test/r/ctype_latin1.result b/mysql-test/r/ctype_latin1.result index ae459fce8eb..5ed8159aae3 100644 --- a/mysql-test/r/ctype_latin1.result +++ b/mysql-test/r/ctype_latin1.result @@ -1840,12 +1840,12 @@ t1 CREATE TABLE `t1` ( drop table t1; select hex(concat(time_to_sec('10:11:12'))); hex(concat(time_to_sec('10:11:12'))) -33363637322E303030303030 +3336363732 create table t1 as select concat(time_to_sec('10:11:12')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(24) DEFAULT NULL + `c1` varchar(17) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(extract(year from 20090702))); @@ -1952,7 +1952,7 @@ create table t1 as select concat(timediff('2001-01-02 00:00:00', '2001-01-01 00: show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(17) DEFAULT NULL + `c1` varchar(10) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(maketime(10,11,12))); @@ -1992,7 +1992,7 @@ create table t1 as select concat(convert_tz('2004-01-01 12:00:00','+10:00','-6:0 show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(26) DEFAULT NULL + `c1` varchar(19) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(date_add('2004-01-01 12:00:00', interval 1 day))); @@ -2002,7 +2002,7 @@ create table t1 as select concat(date_add('2004-01-01 12:00:00', interval 1 day) show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(26) DEFAULT NULL + `c1` varchar(19) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 select * from t1; c1 @@ -3205,8 +3205,8 @@ DATE_SUB(CAST('2007-08-03 17:33:00' AS DATETIME), INTERVAL 1 MINUTE) AS field_da SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `field_str1` varchar(26) DEFAULT NULL, - `field1_str2` varchar(26) DEFAULT NULL, + `field_str1` varchar(19) DEFAULT NULL, + `field1_str2` varchar(19) DEFAULT NULL, `field_date` date DEFAULT NULL, `field_datetime` datetime DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 @@ -3217,8 +3217,8 @@ DATE_SUB('2007-08-03 17:33:00', INTERVAL 1 MINUTE) AS field1_str2, DATE_SUB(DATE('2007-08-03'), INTERVAL 1 DAY) AS field_date, DATE_SUB(CAST('2007-08-03 17:33:00' AS DATETIME), INTERVAL 1 MINUTE) AS field_datetime; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def field_str1 254 26 10 Y 128 31 63 -def field1_str2 254 26 19 Y 128 31 63 +def field_str1 254 19 10 Y 128 0 63 +def field1_str2 254 19 19 Y 128 0 63 def field_date 10 10 10 Y 128 0 63 def field_datetime 12 19 19 Y 128 0 63 field_str1 field1_str2 field_date field_datetime @@ -3273,7 +3273,7 @@ CREATE TABLE t1(a char(215) CHARACTER SET utf8 NOT NULL DEFAULT '', KEY(a)); INSERT INTO t1 VALUES (); SELECT maketime(`a`,`a`,`a`) FROM t1 GROUP BY 1; maketime(`a`,`a`,`a`) -00:00:00 +00:00:00.000000 DROP TABLE t1; SET sql_mode=default; # diff --git a/mysql-test/r/ctype_ucs.result b/mysql-test/r/ctype_ucs.result index cc43dd2d7dc..f73ea4bdbee 100644 --- a/mysql-test/r/ctype_ucs.result +++ b/mysql-test/r/ctype_ucs.result @@ -2749,12 +2749,12 @@ t1 CREATE TABLE `t1` ( drop table t1; select hex(concat(time_to_sec('10:11:12'))); hex(concat(time_to_sec('10:11:12'))) -00330036003600370032002E003000300030003000300030 +00330036003600370032 create table t1 as select concat(time_to_sec('10:11:12')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(24) CHARACTER SET ucs2 DEFAULT NULL + `c1` varchar(17) CHARACTER SET ucs2 DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(extract(year from 20090702))); @@ -2861,7 +2861,7 @@ create table t1 as select concat(timediff('2001-01-02 00:00:00', '2001-01-01 00: show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(17) CHARACTER SET ucs2 DEFAULT NULL + `c1` varchar(10) CHARACTER SET ucs2 DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(maketime(10,11,12))); @@ -2901,7 +2901,7 @@ create table t1 as select concat(convert_tz('2004-01-01 12:00:00','+10:00','-6:0 show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(26) CHARACTER SET ucs2 DEFAULT NULL + `c1` varchar(19) CHARACTER SET ucs2 DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(date_add('2004-01-01 12:00:00', interval 1 day))); @@ -2911,7 +2911,7 @@ create table t1 as select concat(date_add('2004-01-01 12:00:00', interval 1 day) show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(26) CHARACTER SET ucs2 DEFAULT NULL + `c1` varchar(19) CHARACTER SET ucs2 DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 select * from t1; c1 @@ -4114,8 +4114,8 @@ DATE_SUB(CAST('2007-08-03 17:33:00' AS DATETIME), INTERVAL 1 MINUTE) AS field_da SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `field_str1` varchar(26) DEFAULT NULL, - `field1_str2` varchar(26) DEFAULT NULL, + `field_str1` varchar(19) DEFAULT NULL, + `field1_str2` varchar(19) DEFAULT NULL, `field_date` date DEFAULT NULL, `field_datetime` datetime DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 @@ -4126,8 +4126,8 @@ DATE_SUB('2007-08-03 17:33:00', INTERVAL 1 MINUTE) AS field1_str2, DATE_SUB(DATE('2007-08-03'), INTERVAL 1 DAY) AS field_date, DATE_SUB(CAST('2007-08-03 17:33:00' AS DATETIME), INTERVAL 1 MINUTE) AS field_datetime; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def field_str1 254 26 10 Y 128 31 63 -def field1_str2 254 26 19 Y 128 31 63 +def field_str1 254 19 10 Y 128 0 63 +def field1_str2 254 19 19 Y 128 0 63 def field_date 10 10 10 Y 128 0 63 def field_datetime 12 19 19 Y 128 0 63 field_str1 field1_str2 field_date field_datetime @@ -4182,7 +4182,7 @@ CREATE TABLE t1(a char(215) CHARACTER SET utf8 NOT NULL DEFAULT '', KEY(a)); INSERT INTO t1 VALUES (); SELECT maketime(`a`,`a`,`a`) FROM t1 GROUP BY 1; maketime(`a`,`a`,`a`) -00:00:00 +00:00:00.000000 DROP TABLE t1; SET sql_mode=default; SET NAMES latin1; diff --git a/mysql-test/r/ctype_utf8.result b/mysql-test/r/ctype_utf8.result index d25c454913d..ad8e852979b 100644 --- a/mysql-test/r/ctype_utf8.result +++ b/mysql-test/r/ctype_utf8.result @@ -3579,12 +3579,12 @@ t1 CREATE TABLE `t1` ( drop table t1; select hex(concat(time_to_sec('10:11:12'))); hex(concat(time_to_sec('10:11:12'))) -33363637322E303030303030 +3336363732 create table t1 as select concat(time_to_sec('10:11:12')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(24) CHARACTER SET utf8 DEFAULT NULL + `c1` varchar(17) CHARACTER SET utf8 DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(extract(year from 20090702))); @@ -3691,7 +3691,7 @@ create table t1 as select concat(timediff('2001-01-02 00:00:00', '2001-01-01 00: show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(17) CHARACTER SET utf8 DEFAULT NULL + `c1` varchar(10) CHARACTER SET utf8 DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(maketime(10,11,12))); @@ -3731,7 +3731,7 @@ create table t1 as select concat(convert_tz('2004-01-01 12:00:00','+10:00','-6:0 show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(26) CHARACTER SET utf8 DEFAULT NULL + `c1` varchar(19) CHARACTER SET utf8 DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(date_add('2004-01-01 12:00:00', interval 1 day))); @@ -3741,7 +3741,7 @@ create table t1 as select concat(date_add('2004-01-01 12:00:00', interval 1 day) show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(26) CHARACTER SET utf8 DEFAULT NULL + `c1` varchar(19) CHARACTER SET utf8 DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 select * from t1; c1 @@ -4944,8 +4944,8 @@ DATE_SUB(CAST('2007-08-03 17:33:00' AS DATETIME), INTERVAL 1 MINUTE) AS field_da SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `field_str1` varchar(26) DEFAULT NULL, - `field1_str2` varchar(26) DEFAULT NULL, + `field_str1` varchar(19) DEFAULT NULL, + `field1_str2` varchar(19) DEFAULT NULL, `field_date` date DEFAULT NULL, `field_datetime` datetime DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 @@ -4956,8 +4956,8 @@ DATE_SUB('2007-08-03 17:33:00', INTERVAL 1 MINUTE) AS field1_str2, DATE_SUB(DATE('2007-08-03'), INTERVAL 1 DAY) AS field_date, DATE_SUB(CAST('2007-08-03 17:33:00' AS DATETIME), INTERVAL 1 MINUTE) AS field_datetime; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def field_str1 254 26 10 Y 128 31 63 -def field1_str2 254 26 19 Y 128 31 63 +def field_str1 254 19 10 Y 128 0 63 +def field1_str2 254 19 19 Y 128 0 63 def field_date 10 10 10 Y 128 0 63 def field_datetime 12 19 19 Y 128 0 63 field_str1 field1_str2 field_date field_datetime @@ -5012,7 +5012,7 @@ CREATE TABLE t1(a char(215) CHARACTER SET utf8 NOT NULL DEFAULT '', KEY(a)); INSERT INTO t1 VALUES (); SELECT maketime(`a`,`a`,`a`) FROM t1 GROUP BY 1; maketime(`a`,`a`,`a`) -00:00:00 +00:00:00.000000 DROP TABLE t1; SET sql_mode=default; # diff --git a/mysql-test/r/date_formats.result b/mysql-test/r/date_formats.result index 7f69fd1a5a4..ff3f4038447 100644 --- a/mysql-test/r/date_formats.result +++ b/mysql-test/r/date_formats.result @@ -192,70 +192,70 @@ Tuesday 52 2001 %W %V %X 2002-01-01 15-2001-1 %d-%Y-%c 2001-01-15 select date,format,TIME(str_to_date(date, format)) as time from t1; date format time -2003-01-02 10:11:12 %Y-%m-%d %H:%i:%S 10:11:12 -03-01-02 8:11:2.123456 %y-%m-%d %H:%i:%S.%# 08:11:02 -0003-01-02 8:11:2.123456 %Y-%m-%d %H:%i:%S.%# 08:11:02 -03-01-02 8:11:2.123456 %Y-%m-%d %H:%i:%S.%# 08:11:02 -2003-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 22:11:12 +2003-01-02 10:11:12 %Y-%m-%d %H:%i:%S 10:11:12.000000 +03-01-02 8:11:2.123456 %y-%m-%d %H:%i:%S.%# 08:11:02.000000 +0003-01-02 8:11:2.123456 %Y-%m-%d %H:%i:%S.%# 08:11:02.000000 +03-01-02 8:11:2.123456 %Y-%m-%d %H:%i:%S.%# 08:11:02.000000 +2003-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 22:11:12.000000 2003-01-02 01:11:12.12345AM %Y-%m-%d %h:%i:%S.%f%p 01:11:12.123450 2003-01-02 02:11:12.12345AM %Y-%m-%d %h:%i:%S.%f %p 02:11:12.123450 2003-01-02 12:11:12.12345 am %Y-%m-%d %h:%i:%S.%f%p 00:11:12.123450 -2003-01-02 11:11:12Pm %Y-%m-%d %h:%i:%S%p 23:11:12 -10:20:10 %H:%i:%s 10:20:10 -10:20:10 %h:%i:%s.%f 10:20:10 -10:20:10 %T 10:20:10 -10:20:10AM %h:%i:%s%p 10:20:10 -10:20:10AM %r 10:20:10 +2003-01-02 11:11:12Pm %Y-%m-%d %h:%i:%S%p 23:11:12.000000 +10:20:10 %H:%i:%s 10:20:10.000000 +10:20:10 %h:%i:%s.%f 10:20:10.000000 +10:20:10 %T 10:20:10.000000 +10:20:10AM %h:%i:%s%p 10:20:10.000000 +10:20:10AM %r 10:20:10.000000 10:20:10.44AM %h:%i:%s.%f%p 10:20:10.440000 -15-01-2001 12:59:58 %d-%m-%Y %H:%i:%S 12:59:58 -15 September 2001 %d %M %Y 00:00:00 -15 SEPTEMB 2001 %d %M %Y 00:00:00 -15 MAY 2001 %d %b %Y 00:00:00 -15th May 2001 %D %b %Y 00:00:00 -Sunday 15 MAY 2001 %W %d %b %Y 00:00:00 -Sund 15 MAY 2001 %W %d %b %Y 00:00:00 -Tuesday 00 2002 %W %U %Y 00:00:00 -Thursday 53 1998 %W %u %Y 00:00:00 -Sunday 01 2001 %W %v %x 00:00:00 -Tuesday 52 2001 %W %V %X 00:00:00 -060 2004 %j %Y 00:00:00 -4 53 1998 %w %u %Y 00:00:00 -15-01-2001 %d-%m-%Y %H:%i:%S 00:00:00 -15-01-20 %d-%m-%y 00:00:00 -15-2001-1 %d-%Y-%c 00:00:00 +15-01-2001 12:59:58 %d-%m-%Y %H:%i:%S 12:59:58.000000 +15 September 2001 %d %M %Y 00:00:00.000000 +15 SEPTEMB 2001 %d %M %Y 00:00:00.000000 +15 MAY 2001 %d %b %Y 00:00:00.000000 +15th May 2001 %D %b %Y 00:00:00.000000 +Sunday 15 MAY 2001 %W %d %b %Y 00:00:00.000000 +Sund 15 MAY 2001 %W %d %b %Y 00:00:00.000000 +Tuesday 00 2002 %W %U %Y 00:00:00.000000 +Thursday 53 1998 %W %u %Y 00:00:00.000000 +Sunday 01 2001 %W %v %x 00:00:00.000000 +Tuesday 52 2001 %W %V %X 00:00:00.000000 +060 2004 %j %Y 00:00:00.000000 +4 53 1998 %w %u %Y 00:00:00.000000 +15-01-2001 %d-%m-%Y %H:%i:%S 00:00:00.000000 +15-01-20 %d-%m-%y 00:00:00.000000 +15-2001-1 %d-%Y-%c 00:00:00.000000 select date,format,concat(TIME(str_to_date(date, format))) as time2 from t1; date format time2 -2003-01-02 10:11:12 %Y-%m-%d %H:%i:%S 10:11:12 -03-01-02 8:11:2.123456 %y-%m-%d %H:%i:%S.%# 08:11:02 -0003-01-02 8:11:2.123456 %Y-%m-%d %H:%i:%S.%# 08:11:02 -03-01-02 8:11:2.123456 %Y-%m-%d %H:%i:%S.%# 08:11:02 -2003-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 22:11:12 +2003-01-02 10:11:12 %Y-%m-%d %H:%i:%S 10:11:12.000000 +03-01-02 8:11:2.123456 %y-%m-%d %H:%i:%S.%# 08:11:02.000000 +0003-01-02 8:11:2.123456 %Y-%m-%d %H:%i:%S.%# 08:11:02.000000 +03-01-02 8:11:2.123456 %Y-%m-%d %H:%i:%S.%# 08:11:02.000000 +2003-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 22:11:12.000000 2003-01-02 01:11:12.12345AM %Y-%m-%d %h:%i:%S.%f%p 01:11:12.123450 2003-01-02 02:11:12.12345AM %Y-%m-%d %h:%i:%S.%f %p 02:11:12.123450 2003-01-02 12:11:12.12345 am %Y-%m-%d %h:%i:%S.%f%p 00:11:12.123450 -2003-01-02 11:11:12Pm %Y-%m-%d %h:%i:%S%p 23:11:12 -10:20:10 %H:%i:%s 10:20:10 -10:20:10 %h:%i:%s.%f 10:20:10 -10:20:10 %T 10:20:10 -10:20:10AM %h:%i:%s%p 10:20:10 -10:20:10AM %r 10:20:10 +2003-01-02 11:11:12Pm %Y-%m-%d %h:%i:%S%p 23:11:12.000000 +10:20:10 %H:%i:%s 10:20:10.000000 +10:20:10 %h:%i:%s.%f 10:20:10.000000 +10:20:10 %T 10:20:10.000000 +10:20:10AM %h:%i:%s%p 10:20:10.000000 +10:20:10AM %r 10:20:10.000000 10:20:10.44AM %h:%i:%s.%f%p 10:20:10.440000 -15-01-2001 12:59:58 %d-%m-%Y %H:%i:%S 12:59:58 -15 September 2001 %d %M %Y 00:00:00 -15 SEPTEMB 2001 %d %M %Y 00:00:00 -15 MAY 2001 %d %b %Y 00:00:00 -15th May 2001 %D %b %Y 00:00:00 -Sunday 15 MAY 2001 %W %d %b %Y 00:00:00 -Sund 15 MAY 2001 %W %d %b %Y 00:00:00 -Tuesday 00 2002 %W %U %Y 00:00:00 -Thursday 53 1998 %W %u %Y 00:00:00 -Sunday 01 2001 %W %v %x 00:00:00 -Tuesday 52 2001 %W %V %X 00:00:00 -060 2004 %j %Y 00:00:00 -4 53 1998 %w %u %Y 00:00:00 -15-01-2001 %d-%m-%Y %H:%i:%S 00:00:00 -15-01-20 %d-%m-%y 00:00:00 -15-2001-1 %d-%Y-%c 00:00:00 +15-01-2001 12:59:58 %d-%m-%Y %H:%i:%S 12:59:58.000000 +15 September 2001 %d %M %Y 00:00:00.000000 +15 SEPTEMB 2001 %d %M %Y 00:00:00.000000 +15 MAY 2001 %d %b %Y 00:00:00.000000 +15th May 2001 %D %b %Y 00:00:00.000000 +Sunday 15 MAY 2001 %W %d %b %Y 00:00:00.000000 +Sund 15 MAY 2001 %W %d %b %Y 00:00:00.000000 +Tuesday 00 2002 %W %U %Y 00:00:00.000000 +Thursday 53 1998 %W %u %Y 00:00:00.000000 +Sunday 01 2001 %W %v %x 00:00:00.000000 +Tuesday 52 2001 %W %V %X 00:00:00.000000 +060 2004 %j %Y 00:00:00.000000 +4 53 1998 %w %u %Y 00:00:00.000000 +15-01-2001 %d-%m-%Y %H:%i:%S 00:00:00.000000 +15-01-20 %d-%m-%y 00:00:00.000000 +15-2001-1 %d-%Y-%c 00:00:00.000000 select concat('',str_to_date('8:11:2.123456 03-01-02','%H:%i:%S.%f %y-%m-%d')); concat('',str_to_date('8:11:2.123456 03-01-02','%H:%i:%S.%f %y-%m-%d')) 2003-01-02 08:11:02.123456 diff --git a/mysql-test/r/func_sapdb.result b/mysql-test/r/func_sapdb.result index 72c7a5a128f..66a8b99f7fd 100644 --- a/mysql-test/r/func_sapdb.result +++ b/mysql-test/r/func_sapdb.result @@ -156,7 +156,7 @@ timestamp("2001-12-01", "25:01:01") 2001-12-02 01:01:01 select timestamp("2001-12-01 01:01:01.000100"); timestamp("2001-12-01 01:01:01.000100") -2001-12-01 01:01:01.000100 +2001-12-01 01:01:01.0001 select timestamp("2001-12-01"); timestamp("2001-12-01") 2001-12-01 00:00:00 @@ -200,12 +200,12 @@ f3 time(6) YES NULL f4 time(6) YES NULL f5 time(6) YES NULL f6 time YES NULL -f7 datetime(6) YES NULL +f7 datetime YES NULL f8 date YES NULL f9 time(6) YES NULL select * from t1; f1 f2 f3 f4 f5 f6 f7 f8 f9 -1997-01-01 1998-01-02 01:01:00.000003 49:01:01.000001 46:58:57.999999 -24:00:00.000001 10:11:12 2001-12-01 01:01:01.000000 1997-12-31 23:59:59.000001 +1997-01-01 1998-01-02 01:01:00.000003 49:01:01.000001 46:58:57.999999 -24:00:00.000001 10:11:12 2001-12-01 01:01:01 1997-12-31 23:59:59.000001 create table test(t1 datetime, t2 time, t3 time, t4 datetime); insert into test values ('2001-01-01 01:01:01', '01:01:01', null, '2001-02-01 01:01:01'), diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result index 11ad18cd414..82bfa04fc2f 100644 --- a/mysql-test/r/func_time.result +++ b/mysql-test/r/func_time.result @@ -11,17 +11,17 @@ now()-now() weekday(curdate())-weekday(now()) unix_timestamp()-unix_timestamp(no 0 0 0 select from_unixtime(unix_timestamp("1994-03-02 10:11:12")),from_unixtime(unix_timestamp("1994-03-02 10:11:12"),"%Y-%m-%d %h:%i:%s"),from_unixtime(unix_timestamp("1994-03-02 10:11:12"))+0; from_unixtime(unix_timestamp("1994-03-02 10:11:12")) from_unixtime(unix_timestamp("1994-03-02 10:11:12"),"%Y-%m-%d %h:%i:%s") from_unixtime(unix_timestamp("1994-03-02 10:11:12"))+0 -1994-03-02 10:11:12.000000 1994-03-02 10:11:12 19940302101112.000000 +1994-03-02 10:11:12 1994-03-02 10:11:12 19940302101112 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); 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) -02:30:01 23001 54742.000000 00:04:57.423510 +02:30:01 23001 54742 00:04:57.4235 select sec_to_time(9001.1), time_to_sec('15:12:22.123456'), time_to_sec(15.5566778899); sec_to_time(9001.1) time_to_sec('15:12:22.123456') time_to_sec(15.5566778899) 02:30:01.1 54742.123456 15.556677 select sec_to_time(time_to_sec('-838:59:59')); sec_to_time(time_to_sec('-838:59:59')) --838:59:59.000000 +-838:59:59 select sec_to_time('9001.1'), sec_to_time('1234567890123.123'); sec_to_time('9001.1') sec_to_time('1234567890123.123') 02:30:01.100000 838:59:59.999999 @@ -77,7 +77,7 @@ HOUR("1997-03-03 23:03:22") MINUTE("23:03:22") SECOND(230322) 23 3 22 select TIME(230322), TIME(230322.33), TIME("230322.33"); TIME(230322) TIME(230322.33) TIME("230322.33") -23:03:22 23:03:22.33 23:03:22.330000 +23:03:22 23:03:22.33 23:03:22.33 select week(19980101),week(19970101),week(19980101,1),week(19970101,1); week(19980101) week(19970101) week(19980101,1) week(19970101,1) 0 0 1 1 @@ -569,7 +569,7 @@ select @a:=FROM_UNIXTIME(1); 1970-01-01 03:00:01 select unix_timestamp(@a); unix_timestamp(@a) -1.000000 +1 select unix_timestamp('1969-12-01 19:00:01'); unix_timestamp('1969-12-01 19:00:01') NULL @@ -611,10 +611,10 @@ unix_timestamp('1969-12-30 01:00:00') NULL select unix_timestamp('2038-01-17 12:00:00'); unix_timestamp('2038-01-17 12:00:00') -2147331600.000000 +2147331600 select unix_timestamp('1970-01-01 03:00:01'); unix_timestamp('1970-01-01 03:00:01') -1.000000 +1 select unix_timestamp('2038-01-19 07:14:07'); unix_timestamp('2038-01-19 07:14:07') NULL @@ -1974,7 +1974,7 @@ TIME(COALESCE(DATE('2001-01-01'),TIMESTAMP('2001-01-02 10:20:30'))) AS c5, DATE(COALESCE(DATE('2001-01-01'),TIMESTAMP('2001-01-02 10:20:30'))) AS c6, TIMESTAMP(COALESCE(DATE('2001-01-01'),TIMESTAMP('2001-01-02 10:20:30'))) AS c7; c1 c2 c3 c4 c5 c6 c7 -20010101000000 20010101000000.0000 20010101000000 2001-01-01 00:00:00.000000 00:00:00.000000 2001-01-01 2001-01-01 00:00:00.000000 +20010101000000 20010101000000.0000 20010101000000 2001-01-01 00:00:00 00:00:00 2001-01-01 2001-01-01 00:00:00 SELECT CAST(COALESCE(TIMESTAMP('2001-01-02 10:20:30'),DATE('2001-01-01')) AS SIGNED) AS c1, CAST(COALESCE(TIMESTAMP('2001-01-02 10:20:30'),DATE('2001-01-01')) AS DECIMAL(25,4)) AS c2, @@ -1984,7 +1984,7 @@ TIME(COALESCE(TIMESTAMP('2001-01-02 10:20:30'),DATE('2001-01-01'))) AS c5, DATE(COALESCE(TIMESTAMP('2001-01-02 10:20:30'),DATE('2001-01-01'))) AS c6, TIMESTAMP(COALESCE(TIMESTAMP('2001-01-02 10:20:30'),DATE('2001-01-01'))) AS c7; c1 c2 c3 c4 c5 c6 c7 -20010102102030 20010102102030.0000 20010102102030 2001-01-02 10:20:30.000000 10:20:30.000000 2001-01-02 2001-01-02 10:20:30.000000 +20010102102030 20010102102030.0000 20010102102030 2001-01-02 10:20:30 10:20:30 2001-01-02 2001-01-02 10:20:30 SELECT CAST(IFNULL(DATE('2001-01-01'),TIMESTAMP('2001-01-02 10:20:30')) AS SIGNED) AS c1, CAST(IFNULL(DATE('2001-01-01'),TIMESTAMP('2001-01-02 10:20:30')) AS DECIMAL(25,4)) AS c2, @@ -1994,7 +1994,7 @@ TIME(IFNULL(DATE('2001-01-01'),TIMESTAMP('2001-01-02 10:20:30'))) AS c5, DATE(IFNULL(DATE('2001-01-01'),TIMESTAMP('2001-01-02 10:20:30'))) AS c6, TIMESTAMP(IFNULL(DATE('2001-01-01'),TIMESTAMP('2001-01-02 10:20:30'))) AS c7; c1 c2 c3 c4 c5 c6 c7 -20010101000000 20010101000000.0000 20010101000000 2001-01-01 00:00:00.000000 00:00:00.000000 2001-01-01 2001-01-01 00:00:00.000000 +20010101000000 20010101000000.0000 20010101000000 2001-01-01 00:00:00 00:00:00 2001-01-01 2001-01-01 00:00:00 SELECT CAST(IFNULL(TIMESTAMP('2001-01-02 10:20:30'),DATE('2001-01-01')) AS SIGNED) AS c1, CAST(IFNULL(TIMESTAMP('2001-01-02 10:20:30'),DATE('2001-01-01')) AS DECIMAL(25,4)) AS c2, @@ -2004,7 +2004,7 @@ TIME(IFNULL(TIMESTAMP('2001-01-02 10:20:30'),DATE('2001-01-01'))) AS c5, DATE(IFNULL(TIMESTAMP('2001-01-02 10:20:30'),DATE('2001-01-01'))) AS c6, TIMESTAMP(IFNULL(TIMESTAMP('2001-01-02 10:20:30'),DATE('2001-01-01'))) AS c7; c1 c2 c3 c4 c5 c6 c7 -20010102102030 20010102102030.0000 20010102102030 2001-01-02 10:20:30.000000 10:20:30.000000 2001-01-02 2001-01-02 10:20:30.000000 +20010102102030 20010102102030.0000 20010102102030 2001-01-02 10:20:30 10:20:30 2001-01-02 2001-01-02 10:20:30 SELECT CAST(IF(1,DATE('2001-01-01'),TIMESTAMP('2001-01-02 10:20:30')) AS SIGNED) AS c1, CAST(IF(1,DATE('2001-01-01'),TIMESTAMP('2001-01-02 10:20:30')) AS DECIMAL(25,4)) AS c2, @@ -2014,7 +2014,7 @@ TIME(IF(1,DATE('2001-01-01'),TIMESTAMP('2001-01-02 10:20:30'))) AS c5, DATE(IF(1,DATE('2001-01-01'),TIMESTAMP('2001-01-02 10:20:30'))) AS c6, TIMESTAMP(IF(1,DATE('2001-01-01'),TIMESTAMP('2001-01-02 10:20:30'))) AS c7; c1 c2 c3 c4 c5 c6 c7 -20010101000000 20010101000000.0000 20010101000000 2001-01-01 00:00:00.000000 00:00:00.000000 2001-01-01 2001-01-01 00:00:00.000000 +20010101000000 20010101000000.0000 20010101000000 2001-01-01 00:00:00 00:00:00 2001-01-01 2001-01-01 00:00:00 SELECT CAST(IF(0,DATE('2001-01-01'),TIMESTAMP('2001-01-02 10:20:30')) AS SIGNED) AS c1, CAST(IF(0,DATE('2001-01-01'),TIMESTAMP('2001-01-02 10:20:30')) AS DECIMAL(25,4)) AS c2, @@ -2024,7 +2024,7 @@ TIME(IF(0,DATE('2001-01-01'),TIMESTAMP('2001-01-02 10:20:30'))) AS c5, DATE(IF(0,DATE('2001-01-01'),TIMESTAMP('2001-01-02 10:20:30'))) AS c6, TIMESTAMP(IF(0,DATE('2001-01-01'),TIMESTAMP('2001-01-02 10:20:30'))) AS c7; c1 c2 c3 c4 c5 c6 c7 -20010102102030 20010102102030.0000 20010102102030 2001-01-02 10:20:30.000000 10:20:30.000000 2001-01-02 2001-01-02 10:20:30.000000 +20010102102030 20010102102030.0000 20010102102030 2001-01-02 10:20:30 10:20:30 2001-01-02 2001-01-02 10:20:30 SELECT CAST(CASE WHEN 1 THEN DATE('2001-01-01') ELSE TIMESTAMP('2001-01-02 10:20:30') END AS SIGNED) AS c1, CAST(CASE WHEN 1 THEN DATE('2001-01-01') ELSE TIMESTAMP('2001-01-02 10:20:30') END AS DECIMAL(25,4)) AS c2, @@ -2034,7 +2034,7 @@ TIME(CASE WHEN 1 THEN DATE('2001-01-01') ELSE TIMESTAMP('2001-01-02 10:20:30') E DATE(CASE WHEN 1 THEN DATE('2001-01-01') ELSE TIMESTAMP('2001-01-02 10:20:30') END) AS c6, TIMESTAMP(CASE WHEN 1 THEN DATE('2001-01-01') ELSE TIMESTAMP('2001-01-02 10:20:30') END) AS c7; c1 c2 c3 c4 c5 c6 c7 -20010101000000 20010101000000.0000 20010101000000 2001-01-01 00:00:00.000000 00:00:00.000000 2001-01-01 2001-01-01 00:00:00.000000 +20010101000000 20010101000000.0000 20010101000000 2001-01-01 00:00:00 00:00:00 2001-01-01 2001-01-01 00:00:00 SELECT CAST(CASE WHEN 0 THEN DATE('2001-01-01') ELSE TIMESTAMP('2001-01-02 10:20:30') END AS SIGNED) AS c1, CAST(CASE WHEN 0 THEN DATE('2001-01-01') ELSE TIMESTAMP('2001-01-02 10:20:30') END AS DECIMAL(25,4)) AS c2, @@ -2044,7 +2044,7 @@ TIME(CASE WHEN 0 THEN DATE('2001-01-01') ELSE TIMESTAMP('2001-01-02 10:20:30') E DATE(CASE WHEN 0 THEN DATE('2001-01-01') ELSE TIMESTAMP('2001-01-02 10:20:30') END) AS c6, TIMESTAMP(CASE WHEN 0 THEN DATE('2001-01-01') ELSE TIMESTAMP('2001-01-02 10:20:30') END) AS c7; c1 c2 c3 c4 c5 c6 c7 -20010102102030 20010102102030.0000 20010102102030 2001-01-02 10:20:30.000000 10:20:30.000000 2001-01-02 2001-01-02 10:20:30.000000 +20010102102030 20010102102030.0000 20010102102030 2001-01-02 10:20:30 10:20:30 2001-01-02 2001-01-02 10:20:30 CREATE TABLE t1 AS SELECT CONCAT(COALESCE(TIME(101010),TIME(101010))) AS c1, CONCAT(IF(0,TIME(101010),TIME(101010))) AS c2, @@ -2059,3 +2059,148 @@ t1 CREATE TABLE `t1` ( `c4` varchar(10) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; +# +# MDEV-4724 Some temporal functions do not preserve microseconds +# +SELECT MAKETIME(10,10,10.231); +MAKETIME(10,10,10.231) +10:10:10.231 +SELECT MAKETIME(0, 0, 59.9); +MAKETIME(0, 0, 59.9) +00:00:59.9 +CREATE TABLE t1 AS SELECT +MAKETIME(10,00,00), +MAKETIME(10,00,00.1), +MAKETIME(10,00,00.12), +MAKETIME(10,00,00.123), +MAKETIME(10,00,00.1234), +MAKETIME(10,00,00.12345), +MAKETIME(10,00,00.123456); +SHOW COLUMNS FROM t1; +Field Type Null Key Default Extra +MAKETIME(10,00,00) time YES NULL +MAKETIME(10,00,00.1) time(1) YES NULL +MAKETIME(10,00,00.12) time(2) YES NULL +MAKETIME(10,00,00.123) time(3) YES NULL +MAKETIME(10,00,00.1234) time(4) YES NULL +MAKETIME(10,00,00.12345) time(5) YES NULL +MAKETIME(10,00,00.123456) time(6) YES NULL +DROP TABLE t1; +CREATE TABLE t1 AS SELECT +TIME('10:00:00'), +TIME('10:00:00.1'), +TIME('10:00:00.12'), +TIME('10:00:00.123'), +TIME('10:00:00.1234'), +TIME('10:00:00.12345'), +TIME('10:00:00.12346'); +SHOW COLUMNS FROM t1; +Field Type Null Key Default Extra +TIME('10:00:00') time YES NULL +TIME('10:00:00.1') time(1) YES NULL +TIME('10:00:00.12') time(2) YES NULL +TIME('10:00:00.123') time(3) YES NULL +TIME('10:00:00.1234') time(4) YES NULL +TIME('10:00:00.12345') time(5) YES NULL +TIME('10:00:00.12346') time(5) YES NULL +DROP TABLE t1; +SET TIME_ZONE='+00:00'; +SET TIMESTAMP=UNIX_TIMESTAMP('2012-10-16 22:46:17'); +SELECT NOW(), UNIX_TIMESTAMP(), UNIX_TIMESTAMP(NOW()),UNIX_TIMESTAMP('2012-10-16 22:46:17'); +NOW() UNIX_TIMESTAMP() UNIX_TIMESTAMP(NOW()) UNIX_TIMESTAMP('2012-10-16 22:46:17') +2012-10-16 22:46:17 1350427577 1350427577 1350427577 +SET TIMESTAMP=UNIX_TIMESTAMP('1970-01-02 03:04:05.123456'); +SELECT @@timestamp, FROM_UNIXTIME(@@timestamp); +@@timestamp FROM_UNIXTIME(@@timestamp) +97445.123456 1970-01-02 03:04:05.123456 +SET TIME_ZONE=DEFAULT; +SET TIMESTAMP=DEFAULT; +SELECT TIME('2012-10-16 15:54:16.12'); +TIME('2012-10-16 15:54:16.12') +15:54:16.12 +SELECT TIMESTAMP('2012-10-16 15:54:16.12'); +TIMESTAMP('2012-10-16 15:54:16.12') +2012-10-16 15:54:16.12 +SELECT TIMEDIFF('10:10:10.1','00:00:00'); +TIMEDIFF('10:10:10.1','00:00:00') +10:10:10.1 +SELECT TIME_TO_SEC('10:10:10'); +TIME_TO_SEC('10:10:10') +36610 +SELECT ADDTIME(TIME('10:10:10.1'),'10:10:10.12'); +ADDTIME(TIME('10:10:10.1'),'10:10:10.12') +20:20:20.22 +SELECT ADDTIME(TIMESTAMP('2001-01-01 10:10:10.1'),'10:10:10.12'); +ADDTIME(TIMESTAMP('2001-01-01 10:10:10.1'),'10:10:10.12') +2001-01-01 20:20:20.22 +SELECT DATE_ADD('2001-01-01 00:00:00', INTERVAL 1 SECOND); +DATE_ADD('2001-01-01 00:00:00', INTERVAL 1 SECOND) +2001-01-01 00:00:01 +SELECT DATE_ADD('2001-01-01 00:00:00.1', INTERVAL 1 SECOND); +DATE_ADD('2001-01-01 00:00:00.1', INTERVAL 1 SECOND) +2001-01-01 00:00:01.1 +SELECT DATE_ADD('2001-01-01 00:00:00.12', INTERVAL 1 SECOND); +DATE_ADD('2001-01-01 00:00:00.12', INTERVAL 1 SECOND) +2001-01-01 00:00:01.12 +SELECT DATE_ADD('2001-01-01 00:00:00.123', INTERVAL 1 SECOND); +DATE_ADD('2001-01-01 00:00:00.123', INTERVAL 1 SECOND) +2001-01-01 00:00:01.123 +SELECT DATE_ADD('2001-01-01 00:00:00.1234', INTERVAL 1 SECOND); +DATE_ADD('2001-01-01 00:00:00.1234', INTERVAL 1 SECOND) +2001-01-01 00:00:01.1234 +SELECT DATE_ADD('2001-01-01 00:00:00.12345', INTERVAL 1 SECOND); +DATE_ADD('2001-01-01 00:00:00.12345', INTERVAL 1 SECOND) +2001-01-01 00:00:01.12345 +SELECT DATE_ADD('2001-01-01 00:00:00.123456', INTERVAL 1 SECOND); +DATE_ADD('2001-01-01 00:00:00.123456', INTERVAL 1 SECOND) +2001-01-01 00:00:01.123456 +SELECT DATE_ADD('2001-01-01 00:00:00', INTERVAL 1 SECOND); +DATE_ADD('2001-01-01 00:00:00', INTERVAL 1 SECOND) +2001-01-01 00:00:01 +SELECT DATE_ADD('2001-01-01 00:00:00', INTERVAL 1.1 SECOND); +DATE_ADD('2001-01-01 00:00:00', INTERVAL 1.1 SECOND) +2001-01-01 00:00:01.1 +SELECT DATE_ADD('2001-01-01 00:00:00', INTERVAL 1.12 SECOND); +DATE_ADD('2001-01-01 00:00:00', INTERVAL 1.12 SECOND) +2001-01-01 00:00:01.12 +SELECT DATE_ADD('2001-01-01 00:00:00', INTERVAL 1.123 SECOND); +DATE_ADD('2001-01-01 00:00:00', INTERVAL 1.123 SECOND) +2001-01-01 00:00:01.123 +SELECT DATE_ADD('2001-01-01 00:00:00', INTERVAL 1.1234 SECOND); +DATE_ADD('2001-01-01 00:00:00', INTERVAL 1.1234 SECOND) +2001-01-01 00:00:01.1234 +SELECT DATE_ADD('2001-01-01 00:00:00', INTERVAL 1.12345 SECOND); +DATE_ADD('2001-01-01 00:00:00', INTERVAL 1.12345 SECOND) +2001-01-01 00:00:01.12345 +SELECT DATE_ADD('2001-01-01 00:00:00', INTERVAL 1.123456 SECOND); +DATE_ADD('2001-01-01 00:00:00', INTERVAL 1.123456 SECOND) +2001-01-01 00:00:01.123456 +SELECT DATE_ADD('2001-01-01 00:00:00', INTERVAL -1 SECOND); +DATE_ADD('2001-01-01 00:00:00', INTERVAL -1 SECOND) +2000-12-31 23:59:59 +SELECT DATE_ADD('2001-01-01 00:00:00', INTERVAL -1.1 SECOND); +DATE_ADD('2001-01-01 00:00:00', INTERVAL -1.1 SECOND) +2000-12-31 23:59:58.9 +SELECT DATE_ADD('2001-01-01 00:00:00', INTERVAL -1.12 SECOND); +DATE_ADD('2001-01-01 00:00:00', INTERVAL -1.12 SECOND) +2000-12-31 23:59:58.88 +SELECT DATE_ADD('2001-01-01 00:00:00', INTERVAL -1.123 SECOND); +DATE_ADD('2001-01-01 00:00:00', INTERVAL -1.123 SECOND) +2000-12-31 23:59:58.877 +SELECT DATE_ADD('2001-01-01 00:00:00', INTERVAL -1.1234 SECOND); +DATE_ADD('2001-01-01 00:00:00', INTERVAL -1.1234 SECOND) +2000-12-31 23:59:58.8766 +SELECT DATE_ADD('2001-01-01 00:00:00', INTERVAL -1.12345 SECOND); +DATE_ADD('2001-01-01 00:00:00', INTERVAL -1.12345 SECOND) +2000-12-31 23:59:58.87655 +SELECT DATE_ADD('2001-01-01 00:00:00', INTERVAL -1.123456 SECOND); +DATE_ADD('2001-01-01 00:00:00', INTERVAL -1.123456 SECOND) +2000-12-31 23:59:58.876544 +SELECT DATE_ADD('2001-01-01 00:00:00', INTERVAL 'xxx' SECOND); +DATE_ADD('2001-01-01 00:00:00', INTERVAL 'xxx' SECOND) +2001-01-01 00:00:00.000000 +Warnings: +Warning 1292 Truncated incorrect DECIMAL value: 'xxx' +SELECT CONVERT_TZ('2001-01-01 10:20:30.12','+00:00','+01:00'); +CONVERT_TZ('2001-01-01 10:20:30.12','+00:00','+01:00') +2001-01-01 11:20:30.12 diff --git a/mysql-test/r/func_time_hires.result b/mysql-test/r/func_time_hires.result index 4aa0333c4b4..1a736c89573 100644 --- a/mysql-test/r/func_time_hires.result +++ b/mysql-test/r/func_time_hires.result @@ -15,11 +15,11 @@ current_time(3) 01:01:01.123 current_timestamp(4) 2011-01-01 01:01:01.1234 localtime(5) 2011-01-01 01:01:01.12345 localtimestamp(6) 2011-01-01 01:01:01.123456 -time_to_sec('12:34:56') 45296.000000 -time_to_sec('12:34:56.789') 45296.789000 +time_to_sec('12:34:56') 45296 +time_to_sec('12:34:56.789') 45296.789 select sec_to_time(time_to_sec('1:2:3')), sec_to_time(time_to_sec('2:3:4.567890')); -sec_to_time(time_to_sec('1:2:3')) 01:02:03.000000 -sec_to_time(time_to_sec('2:3:4.567890')) 02:03:04.567890 +sec_to_time(time_to_sec('1:2:3')) 01:02:03 +sec_to_time(time_to_sec('2:3:4.567890')) 02:03:04.56789 select time_to_sec(sec_to_time(11111)), time_to_sec(sec_to_time(11111.22222)); time_to_sec(sec_to_time(11111)) 11111 time_to_sec(sec_to_time(11111.22222)) 11111.22222 @@ -48,7 +48,7 @@ t1 CREATE TABLE `t1` ( `localtime(5)` datetime(5) NOT NULL DEFAULT '0000-00-00 00:00:00.00000', `localtimestamp(6)` datetime(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000', `time_to_sec(123456)` bigint(17) DEFAULT NULL, - `time_to_sec('12:34:56.789')` decimal(22,6) DEFAULT NULL + `time_to_sec('12:34:56.789')` decimal(19,3) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 select * from t1; sec_to_time(12345) 03:25:45 @@ -63,15 +63,15 @@ current_timestamp(4) 2011-01-01 01:01:01.1234 localtime(5) 2011-01-01 01:01:01.12345 localtimestamp(6) 2011-01-01 01:01:01.123456 time_to_sec(123456) 45296 -time_to_sec('12:34:56.789') 45296.789000 +time_to_sec('12:34:56.789') 45296.789 drop table t1; select unix_timestamp('2011-01-01 01:01:01'), unix_timestamp('2011-01-01 01:01:01.123456'), unix_timestamp(cast('2011-01-01 01:01:01.123456' as datetime(0))), unix_timestamp(cast('2011-01-01 01:01:01.123456' as datetime(4)));; -unix_timestamp('2011-01-01 01:01:01') 1293832861.000000 +unix_timestamp('2011-01-01 01:01:01') 1293832861 unix_timestamp('2011-01-01 01:01:01.123456') 1293832861.123456 unix_timestamp(cast('2011-01-01 01:01:01.123456' as datetime(0))) 1293832861 unix_timestamp(cast('2011-01-01 01:01:01.123456' as datetime(4))) 1293832861.1234 select from_unixtime(unix_timestamp('2011/1/1 1:1:1')), from_unixtime(unix_timestamp('2011/1/1 1:1:1.123456')), from_unixtime(unix_timestamp(cast('2011/1/1 1:1:1.123456' as datetime(0)))), from_unixtime(unix_timestamp(cast('2011/1/1 1:1:1.123456' as datetime(4))));; -from_unixtime(unix_timestamp('2011/1/1 1:1:1')) 2011-01-01 01:01:01.000000 +from_unixtime(unix_timestamp('2011/1/1 1:1:1')) 2011-01-01 01:01:01 from_unixtime(unix_timestamp('2011/1/1 1:1:1.123456')) 2011-01-01 01:01:01.123456 from_unixtime(unix_timestamp(cast('2011/1/1 1:1:1.123456' as datetime(0)))) 2011-01-01 01:01:01 from_unixtime(unix_timestamp(cast('2011/1/1 1:1:1.123456' as datetime(4)))) 2011-01-01 01:01:01.1234 @@ -167,7 +167,7 @@ CONVERT_TZ('2011-01-02 12:00:00', '+00:00', '+03:00') 2011-01-02 15:00:00 SELECT CONVERT_TZ('2011-01-02 12:00:00.123', '+00:00', '+03:00'); CONVERT_TZ('2011-01-02 12:00:00.123', '+00:00', '+03:00') -2011-01-02 15:00:00.123000 +2011-01-02 15:00:00.123 SELECT CONVERT_TZ('2011-01-02 12:00:00.123456', '+00:00', '+03:00'); CONVERT_TZ('2011-01-02 12:00:00.123456', '+00:00', '+03:00') 2011-01-02 15:00:00.123456 @@ -200,7 +200,7 @@ time(f1) alter table t1 modify f1 varchar(100); select time(f1) from t1; time(f1) -21:00:00 +21:00:00.000000 select time(f1) from t1 union all select time(f1 + interval 1 second) from t1; time(f1) 21:00:00.000000 diff --git a/mysql-test/r/ps_2myisam.result b/mysql-test/r/ps_2myisam.result index d7bc193a15c..1c3c2de764b 100644 --- a/mysql-test/r/ps_2myisam.result +++ b/mysql-test/r/ps_2myisam.result @@ -1793,8 +1793,8 @@ t5 CREATE TABLE `t5` ( `param08` longtext, `const09` datetime DEFAULT NULL, `param09` longtext, - `const10` decimal(22,6) DEFAULT NULL, - `param10` decimal(65,30) DEFAULT NULL, + `const10` bigint(17) DEFAULT NULL, + `param10` bigint(20) DEFAULT NULL, `const11` int(4) DEFAULT NULL, `param11` bigint(20) DEFAULT NULL, `const12` binary(0) DEFAULT NULL, @@ -1823,8 +1823,8 @@ def test t5 t5 const08 const08 253 19 19 N 1 0 8 def test t5 t5 param08 param08 252 4294967295 19 Y 16 0 8 def test t5 t5 const09 const09 12 19 19 Y 128 0 63 def test t5 t5 param09 param09 252 4294967295 19 Y 16 0 8 -def test t5 t5 const10 const10 246 24 16 Y 32768 6 63 -def test t5 t5 param10 param10 246 67 40 Y 32768 30 63 +def test t5 t5 const10 const10 8 17 9 Y 32768 0 63 +def test t5 t5 param10 param10 8 20 9 Y 32768 0 63 def test t5 t5 const11 const11 3 4 4 Y 32768 0 63 def test t5 t5 param11 param11 8 20 4 Y 32768 0 63 def test t5 t5 const12 const12 254 0 0 Y 128 0 63 @@ -1850,8 +1850,8 @@ const08 1991-08-05 01:01:01 param08 1991-08-05 01:01:01 const09 1991-08-05 01:01:01 param09 1991-08-05 01:01:01 -const10 662680861.000000 -param10 662680861.000000000000000000000000000000 +const10 662680861 +param10 662680861 const11 1991 param11 1991 const12 NULL diff --git a/mysql-test/r/ps_3innodb.result b/mysql-test/r/ps_3innodb.result index ce9409762e5..8b4b6daa108 100644 --- a/mysql-test/r/ps_3innodb.result +++ b/mysql-test/r/ps_3innodb.result @@ -1776,8 +1776,8 @@ t5 CREATE TABLE `t5` ( `param08` longtext, `const09` datetime DEFAULT NULL, `param09` longtext, - `const10` decimal(22,6) DEFAULT NULL, - `param10` decimal(65,30) DEFAULT NULL, + `const10` bigint(17) DEFAULT NULL, + `param10` bigint(20) DEFAULT NULL, `const11` int(4) DEFAULT NULL, `param11` bigint(20) DEFAULT NULL, `const12` binary(0) DEFAULT NULL, @@ -1806,8 +1806,8 @@ def test t5 t5 const08 const08 253 19 19 N 1 0 8 def test t5 t5 param08 param08 252 4294967295 19 Y 16 0 8 def test t5 t5 const09 const09 12 19 19 Y 128 0 63 def test t5 t5 param09 param09 252 4294967295 19 Y 16 0 8 -def test t5 t5 const10 const10 246 24 16 Y 32768 6 63 -def test t5 t5 param10 param10 246 67 40 Y 32768 30 63 +def test t5 t5 const10 const10 8 17 9 Y 32768 0 63 +def test t5 t5 param10 param10 8 20 9 Y 32768 0 63 def test t5 t5 const11 const11 3 4 4 Y 32768 0 63 def test t5 t5 param11 param11 8 20 4 Y 32768 0 63 def test t5 t5 const12 const12 254 0 0 Y 128 0 63 @@ -1833,8 +1833,8 @@ const08 1991-08-05 01:01:01 param08 1991-08-05 01:01:01 const09 1991-08-05 01:01:01 param09 1991-08-05 01:01:01 -const10 662680861.000000 -param10 662680861.000000000000000000000000000000 +const10 662680861 +param10 662680861 const11 1991 param11 1991 const12 NULL diff --git a/mysql-test/r/ps_4heap.result b/mysql-test/r/ps_4heap.result index d5fc8f7e8da..0ea54a45afa 100644 --- a/mysql-test/r/ps_4heap.result +++ b/mysql-test/r/ps_4heap.result @@ -1777,8 +1777,8 @@ t5 CREATE TABLE `t5` ( `param08` longtext, `const09` datetime DEFAULT NULL, `param09` longtext, - `const10` decimal(22,6) DEFAULT NULL, - `param10` decimal(65,30) DEFAULT NULL, + `const10` bigint(17) DEFAULT NULL, + `param10` bigint(20) DEFAULT NULL, `const11` int(4) DEFAULT NULL, `param11` bigint(20) DEFAULT NULL, `const12` binary(0) DEFAULT NULL, @@ -1807,8 +1807,8 @@ def test t5 t5 const08 const08 253 19 19 N 1 0 8 def test t5 t5 param08 param08 252 4294967295 19 Y 16 0 8 def test t5 t5 const09 const09 12 19 19 Y 128 0 63 def test t5 t5 param09 param09 252 4294967295 19 Y 16 0 8 -def test t5 t5 const10 const10 246 24 16 Y 32768 6 63 -def test t5 t5 param10 param10 246 67 40 Y 32768 30 63 +def test t5 t5 const10 const10 8 17 9 Y 32768 0 63 +def test t5 t5 param10 param10 8 20 9 Y 32768 0 63 def test t5 t5 const11 const11 3 4 4 Y 32768 0 63 def test t5 t5 param11 param11 8 20 4 Y 32768 0 63 def test t5 t5 const12 const12 254 0 0 Y 128 0 63 @@ -1834,8 +1834,8 @@ const08 1991-08-05 01:01:01 param08 1991-08-05 01:01:01 const09 1991-08-05 01:01:01 param09 1991-08-05 01:01:01 -const10 662680861.000000 -param10 662680861.000000000000000000000000000000 +const10 662680861 +param10 662680861 const11 1991 param11 1991 const12 NULL diff --git a/mysql-test/r/ps_5merge.result b/mysql-test/r/ps_5merge.result index bb74363f68c..2fc9475e926 100644 --- a/mysql-test/r/ps_5merge.result +++ b/mysql-test/r/ps_5merge.result @@ -1713,8 +1713,8 @@ t5 CREATE TABLE `t5` ( `param08` longtext, `const09` datetime DEFAULT NULL, `param09` longtext, - `const10` decimal(22,6) DEFAULT NULL, - `param10` decimal(65,30) DEFAULT NULL, + `const10` bigint(17) DEFAULT NULL, + `param10` bigint(20) DEFAULT NULL, `const11` int(4) DEFAULT NULL, `param11` bigint(20) DEFAULT NULL, `const12` binary(0) DEFAULT NULL, @@ -1743,8 +1743,8 @@ def test t5 t5 const08 const08 253 19 19 N 1 0 8 def test t5 t5 param08 param08 252 4294967295 19 Y 16 0 8 def test t5 t5 const09 const09 12 19 19 Y 128 0 63 def test t5 t5 param09 param09 252 4294967295 19 Y 16 0 8 -def test t5 t5 const10 const10 246 24 16 Y 32768 6 63 -def test t5 t5 param10 param10 246 67 40 Y 32768 30 63 +def test t5 t5 const10 const10 8 17 9 Y 32768 0 63 +def test t5 t5 param10 param10 8 20 9 Y 32768 0 63 def test t5 t5 const11 const11 3 4 4 Y 32768 0 63 def test t5 t5 param11 param11 8 20 4 Y 32768 0 63 def test t5 t5 const12 const12 254 0 0 Y 128 0 63 @@ -1770,8 +1770,8 @@ const08 1991-08-05 01:01:01 param08 1991-08-05 01:01:01 const09 1991-08-05 01:01:01 param09 1991-08-05 01:01:01 -const10 662680861.000000 -param10 662680861.000000000000000000000000000000 +const10 662680861 +param10 662680861 const11 1991 param11 1991 const12 NULL @@ -5067,8 +5067,8 @@ t5 CREATE TABLE `t5` ( `param08` longtext, `const09` datetime DEFAULT NULL, `param09` longtext, - `const10` decimal(22,6) DEFAULT NULL, - `param10` decimal(65,30) DEFAULT NULL, + `const10` bigint(17) DEFAULT NULL, + `param10` bigint(20) DEFAULT NULL, `const11` int(4) DEFAULT NULL, `param11` bigint(20) DEFAULT NULL, `const12` binary(0) DEFAULT NULL, @@ -5097,8 +5097,8 @@ def test t5 t5 const08 const08 253 19 19 N 1 0 8 def test t5 t5 param08 param08 252 4294967295 19 Y 16 0 8 def test t5 t5 const09 const09 12 19 19 Y 128 0 63 def test t5 t5 param09 param09 252 4294967295 19 Y 16 0 8 -def test t5 t5 const10 const10 246 24 16 Y 32768 6 63 -def test t5 t5 param10 param10 246 67 40 Y 32768 30 63 +def test t5 t5 const10 const10 8 17 9 Y 32768 0 63 +def test t5 t5 param10 param10 8 20 9 Y 32768 0 63 def test t5 t5 const11 const11 3 4 4 Y 32768 0 63 def test t5 t5 param11 param11 8 20 4 Y 32768 0 63 def test t5 t5 const12 const12 254 0 0 Y 128 0 63 @@ -5124,8 +5124,8 @@ const08 1991-08-05 01:01:01 param08 1991-08-05 01:01:01 const09 1991-08-05 01:01:01 param09 1991-08-05 01:01:01 -const10 662680861.000000 -param10 662680861.000000000000000000000000000000 +const10 662680861 +param10 662680861 const11 1991 param11 1991 const12 NULL diff --git a/mysql-test/r/timezone.result b/mysql-test/r/timezone.result index 5ae7e6f8117..d84fe54ba8c 100644 --- a/mysql-test/r/timezone.result +++ b/mysql-test/r/timezone.result @@ -7,7 +7,7 @@ select @a:=FROM_UNIXTIME(1); 1970-01-01 01:00:01 select unix_timestamp(@a); unix_timestamp(@a) -1.000000 +1 CREATE TABLE t1 (ts int); INSERT INTO t1 (ts) VALUES (Unix_timestamp('2002-10-27 01:00')); INSERT INTO t1 (ts) VALUES (Unix_timestamp('2002-10-27 02:00')); @@ -44,7 +44,7 @@ unix_timestamp('1970-01-01 01:00:01'), 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.000000 1.000000 2147483647.000000 NULL +0 1 2147483647 NULL select unix_timestamp('1969-12-31 23:59:59'), unix_timestamp('1970-01-01 00:00:00'), unix_timestamp('1970-01-01 00:59:59'); unix_timestamp('1969-12-31 23:59:59') unix_timestamp('1970-01-01 00:00:00') unix_timestamp('1970-01-01 00:59:59') NULL NULL NULL diff --git a/mysql-test/r/timezone4.result b/mysql-test/r/timezone4.result index ad0672890a2..28028bea657 100644 --- a/mysql-test/r/timezone4.result +++ b/mysql-test/r/timezone4.result @@ -3,4 +3,4 @@ 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.000000 +1 diff --git a/mysql-test/r/type_time.result b/mysql-test/r/type_time.result index 5a04913553b..32bbb6baa0b 100644 --- a/mysql-test/r/type_time.result +++ b/mysql-test/r/type_time.result @@ -187,10 +187,10 @@ Warning 1292 Incorrect datetime value: '0000-00-00 00:00:00' # SELECT CONCAT(GREATEST(TIME('00:00:01'),TIME('00:00:00'))); CONCAT(GREATEST(TIME('00:00:01'),TIME('00:00:00'))) -00:00:01.000000 +00:00:01 SELECT CONCAT(GREATEST(TIME('32 00:00:01'),TIME('00:00:00'))); CONCAT(GREATEST(TIME('32 00:00:01'),TIME('00:00:00'))) -768:00:01.000000 +768:00:01 # # End of 5.3 tests # diff --git a/mysql-test/suite/maria/ps_maria.result b/mysql-test/suite/maria/ps_maria.result index 6c1b40302ec..e2669b568cf 100644 --- a/mysql-test/suite/maria/ps_maria.result +++ b/mysql-test/suite/maria/ps_maria.result @@ -1793,8 +1793,8 @@ t5 CREATE TABLE `t5` ( `param08` longtext, `const09` datetime DEFAULT NULL, `param09` longtext, - `const10` decimal(22,6) DEFAULT NULL, - `param10` decimal(65,30) DEFAULT NULL, + `const10` bigint(17) DEFAULT NULL, + `param10` bigint(20) DEFAULT NULL, `const11` int(4) DEFAULT NULL, `param11` bigint(20) DEFAULT NULL, `const12` binary(0) DEFAULT NULL, @@ -1823,8 +1823,8 @@ def test t5 t5 const08 const08 253 19 19 N 1 0 8 def test t5 t5 param08 param08 252 4294967295 19 Y 16 0 8 def test t5 t5 const09 const09 12 19 19 Y 128 0 63 def test t5 t5 param09 param09 252 4294967295 19 Y 16 0 8 -def test t5 t5 const10 const10 246 24 16 Y 32768 6 63 -def test t5 t5 param10 param10 246 67 40 Y 32768 30 63 +def test t5 t5 const10 const10 8 17 9 Y 32768 0 63 +def test t5 t5 param10 param10 8 20 9 Y 32768 0 63 def test t5 t5 const11 const11 3 4 4 Y 32768 0 63 def test t5 t5 param11 param11 8 20 4 Y 32768 0 63 def test t5 t5 const12 const12 254 0 0 Y 128 0 63 @@ -1850,8 +1850,8 @@ const08 1991-08-05 01:01:01 param08 1991-08-05 01:01:01 const09 1991-08-05 01:01:01 param09 1991-08-05 01:01:01 -const10 662680861.000000 -param10 662680861.000000000000000000000000000000 +const10 662680861 +param10 662680861 const11 1991 param11 1991 const12 NULL diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test index a7f3ba18e99..793eff55aed 100644 --- a/mysql-test/t/func_time.test +++ b/mysql-test/t/func_time.test @@ -1285,3 +1285,69 @@ CREATE TABLE t1 AS SELECT CONCAT(CASE WHEN 1 THEN TIME(101010) ELSE TIME(101010) END) AS c4; SHOW CREATE TABLE t1; DROP TABLE t1; + + +--echo # +--echo # MDEV-4724 Some temporal functions do not preserve microseconds +--echo # +SELECT MAKETIME(10,10,10.231); +SELECT MAKETIME(0, 0, 59.9); +CREATE TABLE t1 AS SELECT + MAKETIME(10,00,00), + MAKETIME(10,00,00.1), + MAKETIME(10,00,00.12), + MAKETIME(10,00,00.123), + MAKETIME(10,00,00.1234), + MAKETIME(10,00,00.12345), + MAKETIME(10,00,00.123456); +SHOW COLUMNS FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 AS SELECT + TIME('10:00:00'), + TIME('10:00:00.1'), + TIME('10:00:00.12'), + TIME('10:00:00.123'), + TIME('10:00:00.1234'), + TIME('10:00:00.12345'), + TIME('10:00:00.12346'); +SHOW COLUMNS FROM t1; +DROP TABLE t1; + +SET TIME_ZONE='+00:00'; +SET TIMESTAMP=UNIX_TIMESTAMP('2012-10-16 22:46:17'); +SELECT NOW(), UNIX_TIMESTAMP(), UNIX_TIMESTAMP(NOW()),UNIX_TIMESTAMP('2012-10-16 22:46:17'); +SET TIMESTAMP=UNIX_TIMESTAMP('1970-01-02 03:04:05.123456'); +SELECT @@timestamp, FROM_UNIXTIME(@@timestamp); +SET TIME_ZONE=DEFAULT; +SET TIMESTAMP=DEFAULT; + +SELECT TIME('2012-10-16 15:54:16.12'); +SELECT TIMESTAMP('2012-10-16 15:54:16.12'); +SELECT TIMEDIFF('10:10:10.1','00:00:00'); +SELECT TIME_TO_SEC('10:10:10'); +SELECT ADDTIME(TIME('10:10:10.1'),'10:10:10.12'); +SELECT ADDTIME(TIMESTAMP('2001-01-01 10:10:10.1'),'10:10:10.12'); +SELECT DATE_ADD('2001-01-01 00:00:00', INTERVAL 1 SECOND); +SELECT DATE_ADD('2001-01-01 00:00:00.1', INTERVAL 1 SECOND); +SELECT DATE_ADD('2001-01-01 00:00:00.12', INTERVAL 1 SECOND); +SELECT DATE_ADD('2001-01-01 00:00:00.123', INTERVAL 1 SECOND); +SELECT DATE_ADD('2001-01-01 00:00:00.1234', INTERVAL 1 SECOND); +SELECT DATE_ADD('2001-01-01 00:00:00.12345', INTERVAL 1 SECOND); +SELECT DATE_ADD('2001-01-01 00:00:00.123456', INTERVAL 1 SECOND); +SELECT DATE_ADD('2001-01-01 00:00:00', INTERVAL 1 SECOND); +SELECT DATE_ADD('2001-01-01 00:00:00', INTERVAL 1.1 SECOND); +SELECT DATE_ADD('2001-01-01 00:00:00', INTERVAL 1.12 SECOND); +SELECT DATE_ADD('2001-01-01 00:00:00', INTERVAL 1.123 SECOND); +SELECT DATE_ADD('2001-01-01 00:00:00', INTERVAL 1.1234 SECOND); +SELECT DATE_ADD('2001-01-01 00:00:00', INTERVAL 1.12345 SECOND); +SELECT DATE_ADD('2001-01-01 00:00:00', INTERVAL 1.123456 SECOND); +SELECT DATE_ADD('2001-01-01 00:00:00', INTERVAL -1 SECOND); +SELECT DATE_ADD('2001-01-01 00:00:00', INTERVAL -1.1 SECOND); +SELECT DATE_ADD('2001-01-01 00:00:00', INTERVAL -1.12 SECOND); +SELECT DATE_ADD('2001-01-01 00:00:00', INTERVAL -1.123 SECOND); +SELECT DATE_ADD('2001-01-01 00:00:00', INTERVAL -1.1234 SECOND); +SELECT DATE_ADD('2001-01-01 00:00:00', INTERVAL -1.12345 SECOND); +SELECT DATE_ADD('2001-01-01 00:00:00', INTERVAL -1.123456 SECOND); +SELECT DATE_ADD('2001-01-01 00:00:00', INTERVAL 'xxx' SECOND); +SELECT CONVERT_TZ('2001-01-01 10:20:30.12','+00:00','+01:00'); |