Commit 86b5be0e authored by Alexander Barkov's avatar Alexander Barkov

Adding tests for MDEV-9406 CREATE TABLE..SELECT creates different columns for...

Adding tests for MDEV-9406 CREATE TABLE..SELECT creates different columns for IFNULL() and equivalent COALESCE,CASE,IF

Recent changes in Type_handler fixed this problem as well.
Adding tests only.
parent 13c6b0d5
......@@ -3571,5 +3571,40 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
#
# MDEV-9406 CREATE TABLE..SELECT creates different columns for IFNULL() and equivalent COALESCE,CASE,IF
#
CREATE TABLE t1 (a SMALLINT);
INSERT INTO t1 VALUES (1),(2);
CREATE TABLE t2 AS SELECT
IFNULL(a,a) AS c1,
COALESCE(a,a) AS c2,
CASE WHEN a IS NOT NULL THEN a ELSE a END AS c3,
IF(a IS NULL,a,a) AS c4 FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`c1` smallint(6) DEFAULT NULL,
`c2` smallint(6) DEFAULT NULL,
`c3` smallint(6) DEFAULT NULL,
`c4` smallint(6) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2,t1;
CREATE TABLE t1 AS SELECT
connection_id() AS c0,
IFNULL(connection_id(),connection_id()) AS c1,
COALESCE(connection_id(), connection_id()) AS c2,
CASE WHEN 0 THEN connection_id() ELSE connection_id() END AS c3,
IF(0,connection_id(),connection_id()) AS c4;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c0` int(10) NOT NULL,
`c1` int(10) NOT NULL,
`c2` int(10) NOT NULL,
`c3` int(10) NOT NULL,
`c4` int(10) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
#
# End of 10.3 tests
#
......@@ -553,6 +553,28 @@ SELECT * FROM t1;
SHOW CREATE TABLE t1;
DROP TABLE t1;
--echo #
--echo # MDEV-9406 CREATE TABLE..SELECT creates different columns for IFNULL() and equivalent COALESCE,CASE,IF
--echo #
CREATE TABLE t1 (a SMALLINT);
INSERT INTO t1 VALUES (1),(2);
CREATE TABLE t2 AS SELECT
IFNULL(a,a) AS c1,
COALESCE(a,a) AS c2,
CASE WHEN a IS NOT NULL THEN a ELSE a END AS c3,
IF(a IS NULL,a,a) AS c4 FROM t1;
SHOW CREATE TABLE t2;
DROP TABLE t2,t1;
CREATE TABLE t1 AS SELECT
connection_id() AS c0,
IFNULL(connection_id(),connection_id()) AS c1,
COALESCE(connection_id(), connection_id()) AS c2,
CASE WHEN 0 THEN connection_id() ELSE connection_id() END AS c3,
IF(0,connection_id(),connection_id()) AS c4;
SHOW CREATE TABLE t1;
DROP TABLE t1;
--echo #
--echo # End of 10.3 tests
--echo #
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment