diff options
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/main/sp-row.result | 32 | ||||
-rw-r--r-- | mysql-test/main/type_int.result | 117 | ||||
-rw-r--r-- | mysql-test/main/type_int.test | 74 | ||||
-rw-r--r-- | mysql-test/suite/compat/oracle/r/sp-row.result | 32 |
4 files changed, 223 insertions, 32 deletions
diff --git a/mysql-test/main/sp-row.result b/mysql-test/main/sp-row.result index 295a881f9e4..ac09f7572c3 100644 --- a/mysql-test/main/sp-row.result +++ b/mysql-test/main/sp-row.result @@ -1286,8 +1286,8 @@ CALL p1(); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `var` mediumint(9) DEFAULT NULL, - `rec.var` mediumint(9) DEFAULT NULL + `var` mediumint(8) DEFAULT NULL, + `rec.var` mediumint(8) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; DROP PROCEDURE p1; @@ -1296,8 +1296,8 @@ CALL p1(); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `var` mediumint(9) DEFAULT NULL, - `rec.var` mediumint(9) DEFAULT NULL + `var` mediumint(8) DEFAULT NULL, + `rec.var` mediumint(8) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; DROP PROCEDURE p1; @@ -1306,8 +1306,8 @@ CALL p1(); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `var` mediumint(9) DEFAULT NULL, - `rec.var` mediumint(9) DEFAULT NULL + `var` mediumint(8) DEFAULT NULL, + `rec.var` mediumint(8) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; DROP PROCEDURE p1; @@ -1316,8 +1316,8 @@ CALL p1(); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `var` mediumint(9) DEFAULT NULL, - `rec.var` mediumint(9) DEFAULT NULL + `var` mediumint(8) DEFAULT NULL, + `rec.var` mediumint(8) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; DROP PROCEDURE p1; @@ -1326,8 +1326,8 @@ CALL p1(); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `var` mediumint(9) DEFAULT NULL, - `rec.var` mediumint(9) DEFAULT NULL + `var` mediumint(8) DEFAULT NULL, + `rec.var` mediumint(8) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; DROP PROCEDURE p1; @@ -1336,8 +1336,8 @@ CALL p1(); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `var` mediumint(9) DEFAULT NULL, - `rec.var` mediumint(9) DEFAULT NULL + `var` mediumint(8) DEFAULT NULL, + `rec.var` mediumint(8) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; DROP PROCEDURE p1; @@ -1346,8 +1346,8 @@ CALL p1(); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `var` mediumint(9) DEFAULT NULL, - `rec.var` mediumint(9) DEFAULT NULL + `var` mediumint(8) DEFAULT NULL, + `rec.var` mediumint(8) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; DROP PROCEDURE p1; @@ -1356,8 +1356,8 @@ CALL p1(); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `var` mediumint(9) DEFAULT NULL, - `rec.var` mediumint(9) DEFAULT NULL + `var` mediumint(8) DEFAULT NULL, + `rec.var` mediumint(8) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; DROP PROCEDURE p1; diff --git a/mysql-test/main/type_int.result b/mysql-test/main/type_int.result index bd24641fd65..47c859d3ffb 100644 --- a/mysql-test/main/type_int.result +++ b/mysql-test/main/type_int.result @@ -106,5 +106,122 @@ a 7 b 8 DROP TABLE t1; # +# MDEV-15946 MEDIUMINT(N<8) creates a wrong data type on conversion to string +# +CREATE TABLE t1 ( +uint8 TINYINT(2) UNSIGNED, sint8 TINYINT(2), +uint16 SMALLINT(2) UNSIGNED, sint16 SMALLINT(2), +uint24 MEDIUMINT(2) UNSIGNED, sint24 MEDIUMINT(2), +uint32 INT(2) UNSIGNED, sint32 INT(2), +uint64 BIGINT(2) UNSIGNED, sint64 BIGINT(2) +); +CREATE TABLE t2 AS SELECT +CONCAT(uint8),CONCAT(sint8), +CONCAT(uint16),CONCAT(sint16), +CONCAT(uint24),CONCAT(sint24), +CONCAT(uint32),CONCAT(sint32), +CONCAT(uint64),CONCAT(sint64) +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `CONCAT(uint8)` varchar(3) DEFAULT NULL, + `CONCAT(sint8)` varchar(4) DEFAULT NULL, + `CONCAT(uint16)` varchar(5) DEFAULT NULL, + `CONCAT(sint16)` varchar(6) DEFAULT NULL, + `CONCAT(uint24)` varchar(8) DEFAULT NULL, + `CONCAT(sint24)` varchar(8) DEFAULT NULL, + `CONCAT(uint32)` varchar(10) DEFAULT NULL, + `CONCAT(sint32)` varchar(11) DEFAULT NULL, + `CONCAT(uint64)` varchar(20) DEFAULT NULL, + `CONCAT(sint64)` varchar(20) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +CREATE TABLE t2 AS SELECT +CONCAT(COALESCE(uint8)),CONCAT(COALESCE(sint8)), +CONCAT(COALESCE(uint16)),CONCAT(COALESCE(sint16)), +CONCAT(COALESCE(uint24)),CONCAT(COALESCE(sint24)), +CONCAT(COALESCE(uint32)),CONCAT(COALESCE(sint32)), +CONCAT(COALESCE(uint64)),CONCAT(COALESCE(sint64)) +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `CONCAT(COALESCE(uint8))` varchar(3) DEFAULT NULL, + `CONCAT(COALESCE(sint8))` varchar(4) DEFAULT NULL, + `CONCAT(COALESCE(uint16))` varchar(5) DEFAULT NULL, + `CONCAT(COALESCE(sint16))` varchar(6) DEFAULT NULL, + `CONCAT(COALESCE(uint24))` varchar(8) DEFAULT NULL, + `CONCAT(COALESCE(sint24))` varchar(8) DEFAULT NULL, + `CONCAT(COALESCE(uint32))` varchar(10) DEFAULT NULL, + `CONCAT(COALESCE(sint32))` varchar(11) DEFAULT NULL, + `CONCAT(COALESCE(uint64))` varchar(20) DEFAULT NULL, + `CONCAT(COALESCE(sint64))` varchar(20) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +DROP TABLE t1; +CREATE FUNCTION uint8() RETURNS TINYINT(2) UNSIGNED RETURN 1; +CREATE FUNCTION sint8() RETURNS TINYINT(2) RETURN 1; +CREATE FUNCTION uint16() RETURNS SMALLINT(2) UNSIGNED RETURN 1; +CREATE FUNCTION sint16() RETURNS SMALLINT(2) RETURN 1; +CREATE FUNCTION uint24() RETURNS MEDIUMINT(2) UNSIGNED RETURN 1; +CREATE FUNCTION sint24() RETURNS MEDIUMINT(2) RETURN 1; +CREATE FUNCTION uint32() RETURNS INT(2) UNSIGNED RETURN 1; +CREATE FUNCTION sint32() RETURNS INT(2) RETURN 1; +CREATE FUNCTION uint64() RETURNS BIGINT(2) UNSIGNED RETURN 1; +CREATE FUNCTION sint64() RETURNS BIGINT(2) RETURN 1; +CREATE TABLE t1 AS SELECT +CONCAT(uint8()), CONCAT(sint8()), +CONCAT(uint16()),CONCAT(sint16()), +CONCAT(uint24()),CONCAT(sint24()), +CONCAT(uint32()),CONCAT(sint32()), +CONCAT(uint64()),CONCAT(sint64()); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `CONCAT(uint8())` varchar(3) DEFAULT NULL, + `CONCAT(sint8())` varchar(4) DEFAULT NULL, + `CONCAT(uint16())` varchar(5) DEFAULT NULL, + `CONCAT(sint16())` varchar(6) DEFAULT NULL, + `CONCAT(uint24())` varchar(8) DEFAULT NULL, + `CONCAT(sint24())` varchar(8) DEFAULT NULL, + `CONCAT(uint32())` varchar(10) DEFAULT NULL, + `CONCAT(sint32())` varchar(11) DEFAULT NULL, + `CONCAT(uint64())` varchar(20) DEFAULT NULL, + `CONCAT(sint64())` varchar(20) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 AS SELECT +CONCAT(COALESCE(uint8())),CONCAT(COALESCE(sint8())), +CONCAT(COALESCE(uint16())),CONCAT(COALESCE(sint16())), +CONCAT(COALESCE(uint24())),CONCAT(COALESCE(sint24())), +CONCAT(COALESCE(uint32())),CONCAT(COALESCE(sint32())), +CONCAT(COALESCE(uint64())),CONCAT(COALESCE(sint64())); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `CONCAT(COALESCE(uint8()))` varchar(3) DEFAULT NULL, + `CONCAT(COALESCE(sint8()))` varchar(4) DEFAULT NULL, + `CONCAT(COALESCE(uint16()))` varchar(5) DEFAULT NULL, + `CONCAT(COALESCE(sint16()))` varchar(6) DEFAULT NULL, + `CONCAT(COALESCE(uint24()))` varchar(8) DEFAULT NULL, + `CONCAT(COALESCE(sint24()))` varchar(8) DEFAULT NULL, + `CONCAT(COALESCE(uint32()))` varchar(10) DEFAULT NULL, + `CONCAT(COALESCE(sint32()))` varchar(11) DEFAULT NULL, + `CONCAT(COALESCE(uint64()))` varchar(20) DEFAULT NULL, + `CONCAT(COALESCE(sint64()))` varchar(20) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +DROP FUNCTION uint8; +DROP FUNCTION sint8; +DROP FUNCTION uint16; +DROP FUNCTION sint16; +DROP FUNCTION uint24; +DROP FUNCTION sint24; +DROP FUNCTION uint32; +DROP FUNCTION sint32; +DROP FUNCTION uint64; +DROP FUNCTION sint64; +# # End of 10.3 tests # diff --git a/mysql-test/main/type_int.test b/mysql-test/main/type_int.test index f0df08ffa2c..bcab2b20dc4 100644 --- a/mysql-test/main/type_int.test +++ b/mysql-test/main/type_int.test @@ -91,5 +91,79 @@ DROP TABLE t1; --echo # +--echo # MDEV-15946 MEDIUMINT(N<8) creates a wrong data type on conversion to string +--echo # + +CREATE TABLE t1 ( + uint8 TINYINT(2) UNSIGNED, sint8 TINYINT(2), + uint16 SMALLINT(2) UNSIGNED, sint16 SMALLINT(2), + uint24 MEDIUMINT(2) UNSIGNED, sint24 MEDIUMINT(2), + uint32 INT(2) UNSIGNED, sint32 INT(2), + uint64 BIGINT(2) UNSIGNED, sint64 BIGINT(2) +); + +CREATE TABLE t2 AS SELECT + CONCAT(uint8),CONCAT(sint8), + CONCAT(uint16),CONCAT(sint16), + CONCAT(uint24),CONCAT(sint24), + CONCAT(uint32),CONCAT(sint32), + CONCAT(uint64),CONCAT(sint64) +FROM t1; +SHOW CREATE TABLE t2; +DROP TABLE t2; + +CREATE TABLE t2 AS SELECT + CONCAT(COALESCE(uint8)),CONCAT(COALESCE(sint8)), + CONCAT(COALESCE(uint16)),CONCAT(COALESCE(sint16)), + CONCAT(COALESCE(uint24)),CONCAT(COALESCE(sint24)), + CONCAT(COALESCE(uint32)),CONCAT(COALESCE(sint32)), + CONCAT(COALESCE(uint64)),CONCAT(COALESCE(sint64)) +FROM t1; +SHOW CREATE TABLE t2; +DROP TABLE t2; + +DROP TABLE t1; + +CREATE FUNCTION uint8() RETURNS TINYINT(2) UNSIGNED RETURN 1; +CREATE FUNCTION sint8() RETURNS TINYINT(2) RETURN 1; +CREATE FUNCTION uint16() RETURNS SMALLINT(2) UNSIGNED RETURN 1; +CREATE FUNCTION sint16() RETURNS SMALLINT(2) RETURN 1; +CREATE FUNCTION uint24() RETURNS MEDIUMINT(2) UNSIGNED RETURN 1; +CREATE FUNCTION sint24() RETURNS MEDIUMINT(2) RETURN 1; +CREATE FUNCTION uint32() RETURNS INT(2) UNSIGNED RETURN 1; +CREATE FUNCTION sint32() RETURNS INT(2) RETURN 1; +CREATE FUNCTION uint64() RETURNS BIGINT(2) UNSIGNED RETURN 1; +CREATE FUNCTION sint64() RETURNS BIGINT(2) RETURN 1; + +CREATE TABLE t1 AS SELECT + CONCAT(uint8()), CONCAT(sint8()), + CONCAT(uint16()),CONCAT(sint16()), + CONCAT(uint24()),CONCAT(sint24()), + CONCAT(uint32()),CONCAT(sint32()), + CONCAT(uint64()),CONCAT(sint64()); +SHOW CREATE TABLE t1; +DROP TABLE t1; + +CREATE TABLE t1 AS SELECT + CONCAT(COALESCE(uint8())),CONCAT(COALESCE(sint8())), + CONCAT(COALESCE(uint16())),CONCAT(COALESCE(sint16())), + CONCAT(COALESCE(uint24())),CONCAT(COALESCE(sint24())), + CONCAT(COALESCE(uint32())),CONCAT(COALESCE(sint32())), + CONCAT(COALESCE(uint64())),CONCAT(COALESCE(sint64())); +SHOW CREATE TABLE t1; +DROP TABLE t1; + +DROP FUNCTION uint8; +DROP FUNCTION sint8; +DROP FUNCTION uint16; +DROP FUNCTION sint16; +DROP FUNCTION uint24; +DROP FUNCTION sint24; +DROP FUNCTION uint32; +DROP FUNCTION sint32; +DROP FUNCTION uint64; +DROP FUNCTION sint64; + +--echo # --echo # End of 10.3 tests --echo # diff --git a/mysql-test/suite/compat/oracle/r/sp-row.result b/mysql-test/suite/compat/oracle/r/sp-row.result index 4ca403431c3..72b33768864 100644 --- a/mysql-test/suite/compat/oracle/r/sp-row.result +++ b/mysql-test/suite/compat/oracle/r/sp-row.result @@ -1363,8 +1363,8 @@ CALL p1(); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE "t1" ( - "var" mediumint(9) DEFAULT NULL, - "rec.var" mediumint(9) DEFAULT NULL + "var" mediumint(8) DEFAULT NULL, + "rec.var" mediumint(8) DEFAULT NULL ) DROP TABLE t1; DROP PROCEDURE p1; @@ -1373,8 +1373,8 @@ CALL p1(); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE "t1" ( - "var" mediumint(9) DEFAULT NULL, - "rec.var" mediumint(9) DEFAULT NULL + "var" mediumint(8) DEFAULT NULL, + "rec.var" mediumint(8) DEFAULT NULL ) DROP TABLE t1; DROP PROCEDURE p1; @@ -1383,8 +1383,8 @@ CALL p1(); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE "t1" ( - "var" mediumint(9) DEFAULT NULL, - "rec.var" mediumint(9) DEFAULT NULL + "var" mediumint(8) DEFAULT NULL, + "rec.var" mediumint(8) DEFAULT NULL ) DROP TABLE t1; DROP PROCEDURE p1; @@ -1393,8 +1393,8 @@ CALL p1(); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE "t1" ( - "var" mediumint(9) DEFAULT NULL, - "rec.var" mediumint(9) DEFAULT NULL + "var" mediumint(8) DEFAULT NULL, + "rec.var" mediumint(8) DEFAULT NULL ) DROP TABLE t1; DROP PROCEDURE p1; @@ -1403,8 +1403,8 @@ CALL p1(); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE "t1" ( - "var" mediumint(9) DEFAULT NULL, - "rec.var" mediumint(9) DEFAULT NULL + "var" mediumint(8) DEFAULT NULL, + "rec.var" mediumint(8) DEFAULT NULL ) DROP TABLE t1; DROP PROCEDURE p1; @@ -1413,8 +1413,8 @@ CALL p1(); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE "t1" ( - "var" mediumint(9) DEFAULT NULL, - "rec.var" mediumint(9) DEFAULT NULL + "var" mediumint(8) DEFAULT NULL, + "rec.var" mediumint(8) DEFAULT NULL ) DROP TABLE t1; DROP PROCEDURE p1; @@ -1423,8 +1423,8 @@ CALL p1(); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE "t1" ( - "var" mediumint(9) DEFAULT NULL, - "rec.var" mediumint(9) DEFAULT NULL + "var" mediumint(8) DEFAULT NULL, + "rec.var" mediumint(8) DEFAULT NULL ) DROP TABLE t1; DROP PROCEDURE p1; @@ -1433,8 +1433,8 @@ CALL p1(); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE "t1" ( - "var" mediumint(9) DEFAULT NULL, - "rec.var" mediumint(9) DEFAULT NULL + "var" mediumint(8) DEFAULT NULL, + "rec.var" mediumint(8) DEFAULT NULL ) DROP TABLE t1; DROP PROCEDURE p1; |