diff options
author | Alexander Barkov <bar@mariadb.com> | 2019-09-24 11:16:36 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mariadb.com> | 2019-09-24 11:18:39 +0400 |
commit | 5f118b26c83960c8fa98bfd544f57ffd76b55304 (patch) | |
tree | 762e9475ea3b0e402ebd0571a55958b377a3fab4 /mysql-test | |
parent | 896974fc3d721aabe1afbf637a566cab856a731d (diff) | |
parent | 67b0faa29e59387b74ae8547c96cf0f31fc3d9d1 (diff) | |
download | mariadb-git-5f118b26c83960c8fa98bfd544f57ffd76b55304.tar.gz |
Merge remote-tracking branch 'origin/5.5' into 10.1
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/r/ctype_binary.result | 2 | ||||
-rw-r--r-- | mysql-test/r/ctype_cp1251.result | 2 | ||||
-rw-r--r-- | mysql-test/r/ctype_latin1.result | 2 | ||||
-rw-r--r-- | mysql-test/r/ctype_ucs.result | 2 | ||||
-rw-r--r-- | mysql-test/r/ctype_utf8.result | 2 | ||||
-rw-r--r-- | mysql-test/r/func_math.result | 58 | ||||
-rw-r--r-- | mysql-test/r/func_time.result | 2 | ||||
-rw-r--r-- | mysql-test/r/type_newdecimal.result | 64 | ||||
-rw-r--r-- | mysql-test/t/func_math.test | 38 | ||||
-rw-r--r-- | mysql-test/t/type_newdecimal.test | 43 |
10 files changed, 209 insertions, 6 deletions
diff --git a/mysql-test/r/ctype_binary.result b/mysql-test/r/ctype_binary.result index 627ba8a35a5..15b44d07ddf 100644 --- a/mysql-test/r/ctype_binary.result +++ b/mysql-test/r/ctype_binary.result @@ -102,7 +102,7 @@ create table t1 as select concat(1 % 2) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(1) DEFAULT NULL + `c1` varbinary(2) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(-1)); diff --git a/mysql-test/r/ctype_cp1251.result b/mysql-test/r/ctype_cp1251.result index 09344a50ee9..5c35956b5f0 100644 --- a/mysql-test/r/ctype_cp1251.result +++ b/mysql-test/r/ctype_cp1251.result @@ -496,7 +496,7 @@ create table t1 as select concat(1 % 2) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET cp1251 DEFAULT NULL + `c1` varchar(2) CHARACTER SET cp1251 DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(-1)); diff --git a/mysql-test/r/ctype_latin1.result b/mysql-test/r/ctype_latin1.result index db9ce63fb78..4bb3515bbb1 100644 --- a/mysql-test/r/ctype_latin1.result +++ b/mysql-test/r/ctype_latin1.result @@ -790,7 +790,7 @@ create table t1 as select concat(1 % 2) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) DEFAULT NULL + `c1` varchar(2) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(-1)); diff --git a/mysql-test/r/ctype_ucs.result b/mysql-test/r/ctype_ucs.result index c8354a96a87..1c61638432b 100644 --- a/mysql-test/r/ctype_ucs.result +++ b/mysql-test/r/ctype_ucs.result @@ -1723,7 +1723,7 @@ create table t1 as select concat(1 % 2) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL + `c1` varchar(2) CHARACTER SET ucs2 DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(-1)); diff --git a/mysql-test/r/ctype_utf8.result b/mysql-test/r/ctype_utf8.result index dbed2d7473f..9ff12870d75 100644 --- a/mysql-test/r/ctype_utf8.result +++ b/mysql-test/r/ctype_utf8.result @@ -2565,7 +2565,7 @@ create table t1 as select concat(1 % 2) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL + `c1` varchar(2) CHARACTER SET utf8 DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(-1)); diff --git a/mysql-test/r/func_math.result b/mysql-test/r/func_math.result index 4215a82e3f0..639ba54d308 100644 --- a/mysql-test/r/func_math.result +++ b/mysql-test/r/func_math.result @@ -796,6 +796,64 @@ STDDEV_SAMP(ROUND('0', 309)) 0 DROP TABLE t1; # +# MDEV-20495 Assertion `precision > 0' failed in decimal_bin_size upon CREATE .. SELECT with zerofilled decimal +# +# Testing that dyadic arithmetic operations are symmetric +# for (+1) and (-1) and produce the same length in CONCAT(), +# because (+1) and (-1) have the same data type: signed int. +CREATE TABLE t1 AS SELECT +CONCAT(+1%2.0), +CONCAT(-1%2.0), +CONCAT(+1/2.0), +CONCAT(-1/2.0), +CONCAT(+1*2.0), +CONCAT(-1*2.0), +CONCAT(+1+2.0), +CONCAT(-1+2.0), +CONCAT(+1-2.0), +CONCAT(-1-2.0); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `CONCAT(+1%2.0)` varchar(4) DEFAULT NULL, + `CONCAT(-1%2.0)` varchar(4) DEFAULT NULL, + `CONCAT(+1/2.0)` varchar(8) DEFAULT NULL, + `CONCAT(-1/2.0)` varchar(8) DEFAULT NULL, + `CONCAT(+1*2.0)` varchar(5) NOT NULL, + `CONCAT(-1*2.0)` varchar(5) NOT NULL, + `CONCAT(+1+2.0)` varchar(5) NOT NULL, + `CONCAT(-1+2.0)` varchar(5) NOT NULL, + `CONCAT(+1-2.0)` varchar(5) NOT NULL, + `CONCAT(-1-2.0)` varchar(5) NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 AS SELECT +CONCAT(+1%2), +CONCAT(-1%2), +CONCAT(+1/2), +CONCAT(-1/2), +CONCAT(+1*2), +CONCAT(-1*2), +CONCAT(+1+2), +CONCAT(-1+2), +CONCAT(+1-2), +CONCAT(-1-2); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `CONCAT(+1%2)` varchar(2) DEFAULT NULL, + `CONCAT(-1%2)` varchar(2) DEFAULT NULL, + `CONCAT(+1/2)` varchar(7) DEFAULT NULL, + `CONCAT(-1/2)` varchar(7) DEFAULT NULL, + `CONCAT(+1*2)` varchar(3) NOT NULL, + `CONCAT(-1*2)` varchar(3) NOT NULL, + `CONCAT(+1+2)` varchar(3) NOT NULL, + `CONCAT(-1+2)` varchar(3) NOT NULL, + `CONCAT(+1-2)` varchar(3) NOT NULL, + `CONCAT(-1-2)` varchar(3) NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +# # End of 5.5 tests # # diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result index 25f3484b718..c6e6884a7e2 100644 --- a/mysql-test/r/func_time.result +++ b/mysql-test/r/func_time.result @@ -2152,7 +2152,7 @@ Warning 1292 Truncated incorrect DECIMAL value: '2005-05-0410' SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `f2` varchar(26) DEFAULT NULL + `f2` varchar(28) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT * FROM t2; f2 diff --git a/mysql-test/r/type_newdecimal.result b/mysql-test/r/type_newdecimal.result index 2246784df42..dc6ef3c59e2 100644 --- a/mysql-test/r/type_newdecimal.result +++ b/mysql-test/r/type_newdecimal.result @@ -2040,6 +2040,70 @@ t1 CREATE TABLE `t1` ( ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; # +# MDEV-20495 Assertion `precision > 0' failed in decimal_bin_size upon CREATE .. SELECT with zerofilled decimal +# +CREATE TABLE t1 (d DECIMAL(1,0) ZEROFILL); +CREATE TABLE t2 AS SELECT 0 MOD d AS f FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `f` decimal(1,0) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1, t2; +CREATE TABLE t1 (d DECIMAL(1,0) UNSIGNED); +CREATE TABLE t2 AS SELECT 0 MOD d AS f FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `f` decimal(1,0) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE IF EXISTS t1,t2; +CREATE TABLE t1 (d DECIMAL(1,0) ZEROFILL); +CREATE TABLE t2 AS SELECT CAST(0 AS UNSIGNED) MOD d AS f FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `f` decimal(1,0) unsigned DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1, t2; +CREATE TABLE t1 (d DECIMAL(1,0) UNSIGNED); +CREATE TABLE t2 AS SELECT CAST(0 AS UNSIGNED) MOD d AS f FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `f` decimal(1,0) unsigned DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1,t2; +# +# MDEV-20560 Assertion `precision > 0' failed in decimal_bin_size upon SELECT with MOD short unsigned decimal +# +CREATE TABLE t1 (a DECIMAL(1,0) UNSIGNED); +INSERT INTO t1 VALUES (1.0),(2.0); +SELECT DISTINCT 1 MOD a FROM t1; +1 MOD a +0 +1 +CREATE TABLE t2 AS SELECT DISTINCT 1 MOD a AS f FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `f` decimal(1,0) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1, t2; +CREATE TABLE t1 (a DECIMAL(1,0) UNSIGNED); +INSERT INTO t1 VALUES (1.0),(2.0); +SELECT DISTINCT 1 MOD a FROM t1; +1 MOD a +0 +1 +CREATE TABLE t2 AS SELECT DISTINCT CAST(1 AS UNSIGNED) MOD a AS f FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `f` decimal(1,0) unsigned DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1, t2; +# # End of 5.5 tests # # diff --git a/mysql-test/t/func_math.test b/mysql-test/t/func_math.test index 4c2d7921593..bb9e46c4378 100644 --- a/mysql-test/t/func_math.test +++ b/mysql-test/t/func_math.test @@ -587,6 +587,44 @@ INSERT INTO t1 VALUES (1),(2); SELECT STDDEV_SAMP(ROUND('0', 309)) FROM t1; DROP TABLE t1; + +--echo # +--echo # MDEV-20495 Assertion `precision > 0' failed in decimal_bin_size upon CREATE .. SELECT with zerofilled decimal +--echo # + +--echo # Testing that dyadic arithmetic operations are symmetric +--echo # for (+1) and (-1) and produce the same length in CONCAT(), +--echo # because (+1) and (-1) have the same data type: signed int. + +CREATE TABLE t1 AS SELECT + CONCAT(+1%2.0), + CONCAT(-1%2.0), + CONCAT(+1/2.0), + CONCAT(-1/2.0), + CONCAT(+1*2.0), + CONCAT(-1*2.0), + CONCAT(+1+2.0), + CONCAT(-1+2.0), + CONCAT(+1-2.0), + CONCAT(-1-2.0); +SHOW CREATE TABLE t1; +DROP TABLE t1; + +CREATE TABLE t1 AS SELECT + CONCAT(+1%2), + CONCAT(-1%2), + CONCAT(+1/2), + CONCAT(-1/2), + CONCAT(+1*2), + CONCAT(-1*2), + CONCAT(+1+2), + CONCAT(-1+2), + CONCAT(+1-2), + CONCAT(-1-2); +SHOW CREATE TABLE t1; +DROP TABLE t1; + + --echo # --echo # End of 5.5 tests --echo # diff --git a/mysql-test/t/type_newdecimal.test b/mysql-test/t/type_newdecimal.test index 03e55831972..9b1beeb3f51 100644 --- a/mysql-test/t/type_newdecimal.test +++ b/mysql-test/t/type_newdecimal.test @@ -1625,6 +1625,49 @@ SHOW CREATE TABLE t1; DROP TABLE t1; --echo # +--echo # MDEV-20495 Assertion `precision > 0' failed in decimal_bin_size upon CREATE .. SELECT with zerofilled decimal +--echo # + +CREATE TABLE t1 (d DECIMAL(1,0) ZEROFILL); +CREATE TABLE t2 AS SELECT 0 MOD d AS f FROM t1; +SHOW CREATE TABLE t2; +DROP TABLE t1, t2; + +CREATE TABLE t1 (d DECIMAL(1,0) UNSIGNED); +CREATE TABLE t2 AS SELECT 0 MOD d AS f FROM t1; +SHOW CREATE TABLE t2; +DROP TABLE IF EXISTS t1,t2; + +CREATE TABLE t1 (d DECIMAL(1,0) ZEROFILL); +CREATE TABLE t2 AS SELECT CAST(0 AS UNSIGNED) MOD d AS f FROM t1; +SHOW CREATE TABLE t2; +DROP TABLE t1, t2; + +CREATE TABLE t1 (d DECIMAL(1,0) UNSIGNED); +CREATE TABLE t2 AS SELECT CAST(0 AS UNSIGNED) MOD d AS f FROM t1; +SHOW CREATE TABLE t2; +DROP TABLE t1,t2; + +--echo # +--echo # MDEV-20560 Assertion `precision > 0' failed in decimal_bin_size upon SELECT with MOD short unsigned decimal +--echo # + +CREATE TABLE t1 (a DECIMAL(1,0) UNSIGNED); +INSERT INTO t1 VALUES (1.0),(2.0); +SELECT DISTINCT 1 MOD a FROM t1; +CREATE TABLE t2 AS SELECT DISTINCT 1 MOD a AS f FROM t1; +SHOW CREATE TABLE t2; +DROP TABLE t1, t2; + +CREATE TABLE t1 (a DECIMAL(1,0) UNSIGNED); +INSERT INTO t1 VALUES (1.0),(2.0); +SELECT DISTINCT 1 MOD a FROM t1; +CREATE TABLE t2 AS SELECT DISTINCT CAST(1 AS UNSIGNED) MOD a AS f FROM t1; +SHOW CREATE TABLE t2; +DROP TABLE t1, t2; + + +--echo # --echo # End of 5.5 tests --echo # |