diff options
author | Alexander Barkov <bar@mariadb.com> | 2019-09-24 23:05:09 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mariadb.com> | 2019-09-24 23:05:09 +0400 |
commit | b6bb64e54a3e34a20cda34e25b6ec62a097955ef (patch) | |
tree | 70fc710317991ae4892c57f179759ed3147d3d47 /mysql-test/main | |
parent | 0e50ee6f28ca709c3ab8d143360faca182e74db4 (diff) | |
parent | 102bc7beb080e936ba70c0524a8759799f42458e (diff) | |
download | mariadb-git-b6bb64e54a3e34a20cda34e25b6ec62a097955ef.tar.gz |
Merge remote-tracking branch 'origin/10.2' into 10.3
Diffstat (limited to 'mysql-test/main')
-rw-r--r-- | mysql-test/main/ctype_binary.result | 2 | ||||
-rw-r--r-- | mysql-test/main/ctype_cp1251.result | 2 | ||||
-rw-r--r-- | mysql-test/main/ctype_latin1.result | 2 | ||||
-rw-r--r-- | mysql-test/main/ctype_ucs.result | 2 | ||||
-rw-r--r-- | mysql-test/main/ctype_utf8.result | 2 | ||||
-rw-r--r-- | mysql-test/main/func_math.result | 58 | ||||
-rw-r--r-- | mysql-test/main/func_math.test | 38 | ||||
-rw-r--r-- | mysql-test/main/func_time.result | 2 | ||||
-rw-r--r-- | mysql-test/main/metadata.result | 22 | ||||
-rw-r--r-- | mysql-test/main/type_newdecimal.result | 64 | ||||
-rw-r--r-- | mysql-test/main/type_newdecimal.test | 43 |
11 files changed, 220 insertions, 17 deletions
diff --git a/mysql-test/main/ctype_binary.result b/mysql-test/main/ctype_binary.result index 8059e02611e..cd9da9486d4 100644 --- a/mysql-test/main/ctype_binary.result +++ b/mysql-test/main/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/main/ctype_cp1251.result b/mysql-test/main/ctype_cp1251.result index 2da53740619..643fefef02b 100644 --- a/mysql-test/main/ctype_cp1251.result +++ b/mysql-test/main/ctype_cp1251.result @@ -511,7 +511,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/main/ctype_latin1.result b/mysql-test/main/ctype_latin1.result index efee1006abf..eee7b4c866a 100644 --- a/mysql-test/main/ctype_latin1.result +++ b/mysql-test/main/ctype_latin1.result @@ -820,7 +820,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/main/ctype_ucs.result b/mysql-test/main/ctype_ucs.result index 9d88ba93153..419bb7ae9e0 100644 --- a/mysql-test/main/ctype_ucs.result +++ b/mysql-test/main/ctype_ucs.result @@ -1700,7 +1700,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/main/ctype_utf8.result b/mysql-test/main/ctype_utf8.result index 45d9d1d7e5a..f6fa2697241 100644 --- a/mysql-test/main/ctype_utf8.result +++ b/mysql-test/main/ctype_utf8.result @@ -2571,7 +2571,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/main/func_math.result b/mysql-test/main/func_math.result index 44c8622b522..968d394117a 100644 --- a/mysql-test/main/func_math.result +++ b/mysql-test/main/func_math.result @@ -817,6 +817,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) DEFAULT NULL, + `CONCAT(-1*2.0)` varchar(5) DEFAULT NULL, + `CONCAT(+1+2.0)` varchar(5) DEFAULT NULL, + `CONCAT(-1+2.0)` varchar(5) DEFAULT NULL, + `CONCAT(+1-2.0)` varchar(5) DEFAULT NULL, + `CONCAT(-1-2.0)` varchar(5) DEFAULT 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) DEFAULT NULL, + `CONCAT(-1*2)` varchar(3) DEFAULT NULL, + `CONCAT(+1+2)` varchar(3) DEFAULT NULL, + `CONCAT(-1+2)` varchar(3) DEFAULT NULL, + `CONCAT(+1-2)` varchar(3) DEFAULT NULL, + `CONCAT(-1-2)` varchar(3) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +# # End of 5.5 tests # # diff --git a/mysql-test/main/func_math.test b/mysql-test/main/func_math.test index 6d28d99006a..4d65f5e00b0 100644 --- a/mysql-test/main/func_math.test +++ b/mysql-test/main/func_math.test @@ -589,6 +589,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/main/func_time.result b/mysql-test/main/func_time.result index 51f882aeafc..408183af47b 100644 --- a/mysql-test/main/func_time.result +++ b/mysql-test/main/func_time.result @@ -2153,7 +2153,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(22) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT * FROM t2; f2 diff --git a/mysql-test/main/metadata.result b/mysql-test/main/metadata.result index 7848390b62e..1f917bfe5ab 100644 --- a/mysql-test/main/metadata.result +++ b/mysql-test/main/metadata.result @@ -647,17 +647,17 @@ SELECT 1111111111 MOD 1, 11111111111 MOD 1 LIMIT 0; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def 1 MOD 1 3 1 0 Y 32896 0 63 -def 11 MOD 1 3 2 0 Y 32896 0 63 -def 111 MOD 1 3 3 0 Y 32896 0 63 -def 1111 MOD 1 3 4 0 Y 32896 0 63 -def 11111 MOD 1 3 5 0 Y 32896 0 63 -def 111111 MOD 1 3 6 0 Y 32896 0 63 -def 1111111 MOD 1 3 7 0 Y 32896 0 63 -def 11111111 MOD 1 3 8 0 Y 32896 0 63 -def 111111111 MOD 1 3 9 0 Y 32896 0 63 -def 1111111111 MOD 1 8 10 0 Y 32896 0 63 -def 11111111111 MOD 1 8 11 0 Y 32896 0 63 +def 1 MOD 1 3 2 0 Y 32896 0 63 +def 11 MOD 1 3 3 0 Y 32896 0 63 +def 111 MOD 1 3 4 0 Y 32896 0 63 +def 1111 MOD 1 3 5 0 Y 32896 0 63 +def 11111 MOD 1 3 6 0 Y 32896 0 63 +def 111111 MOD 1 3 7 0 Y 32896 0 63 +def 1111111 MOD 1 3 8 0 Y 32896 0 63 +def 11111111 MOD 1 3 9 0 Y 32896 0 63 +def 111111111 MOD 1 8 10 0 Y 32896 0 63 +def 1111111111 MOD 1 8 11 0 Y 32896 0 63 +def 11111111111 MOD 1 8 12 0 Y 32896 0 63 1 MOD 1 11 MOD 1 111 MOD 1 1111 MOD 1 11111 MOD 1 111111 MOD 1 1111111 MOD 1 11111111 MOD 1 111111111 MOD 1 1111111111 MOD 1 11111111111 MOD 1 SELECT -(1), diff --git a/mysql-test/main/type_newdecimal.result b/mysql-test/main/type_newdecimal.result index 44f200c229b..d5fc6db107b 100644 --- a/mysql-test/main/type_newdecimal.result +++ b/mysql-test/main/type_newdecimal.result @@ -2038,6 +2038,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/main/type_newdecimal.test b/mysql-test/main/type_newdecimal.test index 56273a47b44..2f3409f56e9 100644 --- a/mysql-test/main/type_newdecimal.test +++ b/mysql-test/main/type_newdecimal.test @@ -1628,6 +1628,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 # |