Commit 241d5edc authored by Alexander Barkov's avatar Alexander Barkov

Adding tests for MDEV-9408 CREATE TABLE SELECT MAX(int_column) creates...

Adding tests for MDEV-9408 CREATE TABLE SELECT MAX(int_column) creates different columns for table vs view

Recent fixes in Type_handler fixed this problem. Adding tests only.
parent 86b5be0e
......@@ -2447,3 +2447,36 @@ DROP TABLE t1;
#
# End of 10.1 tests
#
#
# Start of 10.3 tests
#
#
# MDEV-9408 CREATE TABLE SELECT MAX(int_column) creates different columns for table vs view
#
CREATE TABLE t1 (
id int(11) NOT NULL PRIMARY KEY,
country varchar(32),
code int(11) default NULL
);
INSERT INTO t1 VALUES (1,'ITALY',100),(2,'ITALY',200),(3,'FRANCE',100), (4,'ITALY',100);
CREATE VIEW v1 AS SELECT * FROM t1;
CREATE TABLE t2 AS SELECT code, COUNT(DISTINCT country), MAX(id) FROM t1 GROUP BY code ORDER BY MAX(id);
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`code` int(11) DEFAULT NULL,
`COUNT(DISTINCT country)` bigint(21) NOT NULL,
`MAX(id)` int(11)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
CREATE TABLE t2 AS SELECT code, COUNT(DISTINCT country), MAX(id) FROM v1 GROUP BY code ORDER BY MAX(id);
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`code` int(11) DEFAULT NULL,
`COUNT(DISTINCT country)` bigint(21) NOT NULL,
`MAX(id)` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
DROP VIEW v1;
DROP TABLE t1;
......@@ -1691,3 +1691,30 @@ DROP TABLE t1;
--echo #
--echo # End of 10.1 tests
--echo #
--echo #
--echo # Start of 10.3 tests
--echo #
--echo #
--echo # MDEV-9408 CREATE TABLE SELECT MAX(int_column) creates different columns for table vs view
--echo #
CREATE TABLE t1 (
id int(11) NOT NULL PRIMARY KEY,
country varchar(32),
code int(11) default NULL
);
INSERT INTO t1 VALUES (1,'ITALY',100),(2,'ITALY',200),(3,'FRANCE',100), (4,'ITALY',100);
CREATE VIEW v1 AS SELECT * FROM t1;
CREATE TABLE t2 AS SELECT code, COUNT(DISTINCT country), MAX(id) FROM t1 GROUP BY code ORDER BY MAX(id);
SHOW CREATE TABLE t2;
DROP TABLE t2;
CREATE TABLE t2 AS SELECT code, COUNT(DISTINCT country), MAX(id) FROM v1 GROUP BY code ORDER BY MAX(id);
SHOW CREATE TABLE t2;
DROP TABLE t2;
DROP VIEW v1;
DROP TABLE t1;
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