diff options
author | Sergei Golubchik <serg@mariadb.org> | 2019-01-03 13:09:41 +0100 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2019-01-03 13:09:41 +0100 |
commit | 6bb11efa4a7ba813eb4aa2548f95b7297d70f3d7 (patch) | |
tree | 3c2dfb2dfbbb0a2471bdcfb0f0c122f823cc80ab /mysql-test | |
parent | ab4bc8442094a2be8cdb74bfcddfccede81ac03d (diff) | |
parent | 842402e4df35c230e7a416ce3ef8df3055f03d60 (diff) | |
download | mariadb-git-6bb11efa4a7ba813eb4aa2548f95b7297d70f3d7.tar.gz |
Merge branch '10.2' into 10.3
Diffstat (limited to 'mysql-test')
60 files changed, 896 insertions, 31 deletions
diff --git a/mysql-test/main/alter_table_errors.result b/mysql-test/main/alter_table_errors.result index 020a30304d0..b26409e3d05 100644 --- a/mysql-test/main/alter_table_errors.result +++ b/mysql-test/main/alter_table_errors.result @@ -8,3 +8,22 @@ t CREATE TABLE `t` ( `v` int(11) GENERATED ALWAYS AS (`a`) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 drop table t; +create temporary table t1 (a int, v int as (a)); +alter table t1 change column a b int, algorithm=inplace; +ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY +show create table t1; +Table Create Table +t1 CREATE TEMPORARY TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `v` int(11) GENERATED ALWAYS AS (`a`) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +create temporary table t2 (a int, v int as (a)); +lock table t2 write; +alter table t2 change column a b int, algorithm=inplace; +ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY +show create table t2; +Table Create Table +t2 CREATE TEMPORARY TABLE `t2` ( + `a` int(11) DEFAULT NULL, + `v` int(11) GENERATED ALWAYS AS (`a`) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 diff --git a/mysql-test/main/alter_table_errors.test b/mysql-test/main/alter_table_errors.test index d9982ac26f4..8fa65b0f330 100644 --- a/mysql-test/main/alter_table_errors.test +++ b/mysql-test/main/alter_table_errors.test @@ -8,3 +8,14 @@ create table t (a int, v int as (a)) engine=innodb; alter table t change column a b tinyint, algorithm=inplace; show create table t; drop table t; + +create temporary table t1 (a int, v int as (a)); +--error ER_ALTER_OPERATION_NOT_SUPPORTED +alter table t1 change column a b int, algorithm=inplace; +show create table t1; + +create temporary table t2 (a int, v int as (a)); +lock table t2 write; +--error ER_ALTER_OPERATION_NOT_SUPPORTED +alter table t2 change column a b int, algorithm=inplace; +show create table t2; diff --git a/mysql-test/main/check.result b/mysql-test/main/check.result index e3dcda773f4..e882a4cdbe6 100644 --- a/mysql-test/main/check.result +++ b/mysql-test/main/check.result @@ -85,3 +85,13 @@ t1 CREATE TABLE `t1` ( `c` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; +create temporary table t1 ( +id int not null auto_increment primary key, +f int not null default 0 +); +insert into t1 () values (); +alter ignore table t1 add constraint check (f > 0); +Warnings: +Warning 4025 CONSTRAINT `CONSTRAINT_1` failed for `test`.`t1` +alter table t1; +drop table t1; diff --git a/mysql-test/main/check.test b/mysql-test/main/check.test index cce8fd34c9c..475a7996a09 100644 --- a/mysql-test/main/check.test +++ b/mysql-test/main/check.test @@ -103,3 +103,15 @@ CREATE OR REPLACE TABLE t1 (a INT, b INT, c INT, CHECK (a+b>0)) ENGINE=MyISAM; ALTER TABLE t1 DROP COLUMN b, DROP CONSTRAINT `CONSTRAINT_1`; SHOW CREATE TABLE t1; DROP TABLE t1; + +# +# MDEV-16903 Assertion `!auto_increment_field_not_null' failed in TABLE::init after unsuccessful attempt to add CHECK constraint on temporary table +# +create temporary table t1 ( + id int not null auto_increment primary key, + f int not null default 0 +); +insert into t1 () values (); +alter ignore table t1 add constraint check (f > 0); +alter table t1; +drop table t1; diff --git a/mysql-test/main/func_group_innodb.result b/mysql-test/main/func_group_innodb.result index 27493ae710b..e149997af4f 100644 --- a/mysql-test/main/func_group_innodb.result +++ b/mysql-test/main/func_group_innodb.result @@ -246,4 +246,28 @@ EXPLAIN SELECT MIN(c) FROM t1 GROUP BY b; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 range NULL b 263 NULL 3 Using index for group-by DROP TABLE t1; +# +# MDEV-17589: Stack-buffer-overflow with indexed varchar (utf8) field +# +CREATE TABLE t1 (v1 varchar(1020), v2 varchar(2), v3 varchar(2), +KEY k1 (v3,v2,v1)) ENGINE=InnoDB CHARACTER SET=utf8 ROW_FORMAT=DYNAMIC; +INSERT INTO t1 VALUES ('king', 'qu','qu'), ('bad','go','go'); +explain +SELECT MIN(t1.v1) FROM t1 where t1.v2='qu' and t1.v3='qu'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +SELECT MIN(t1.v1) FROM t1 where t1.v2='qu' and t1.v3='qu'; +MIN(t1.v1) +king +drop table t1; +CREATE TABLE t1 (v1 varchar(1024) CHARACTER SET utf8, KEY v1 (v1)) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +INSERT INTO t1 VALUES ('king'), ('bad'); +explain +SELECT MIN(x.v1) FROM (SELECT t1.* FROM t1 WHERE t1.v1 >= 'p') x; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No matching min/max row +SELECT MIN(x.v1) FROM (SELECT t1.* FROM t1 WHERE t1.v1 >= 'p') x; +MIN(x.v1) +NULL +drop table t1; End of 5.5 tests diff --git a/mysql-test/main/func_group_innodb.test b/mysql-test/main/func_group_innodb.test index 1d175f85ed9..c4914b97641 100644 --- a/mysql-test/main/func_group_innodb.test +++ b/mysql-test/main/func_group_innodb.test @@ -192,4 +192,23 @@ EXPLAIN SELECT MIN(c) FROM t1 GROUP BY b; DROP TABLE t1; +--echo # +--echo # MDEV-17589: Stack-buffer-overflow with indexed varchar (utf8) field +--echo # + +CREATE TABLE t1 (v1 varchar(1020), v2 varchar(2), v3 varchar(2), + KEY k1 (v3,v2,v1)) ENGINE=InnoDB CHARACTER SET=utf8 ROW_FORMAT=DYNAMIC; +INSERT INTO t1 VALUES ('king', 'qu','qu'), ('bad','go','go'); +explain +SELECT MIN(t1.v1) FROM t1 where t1.v2='qu' and t1.v3='qu'; +SELECT MIN(t1.v1) FROM t1 where t1.v2='qu' and t1.v3='qu'; +drop table t1; + +CREATE TABLE t1 (v1 varchar(1024) CHARACTER SET utf8, KEY v1 (v1)) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +INSERT INTO t1 VALUES ('king'), ('bad'); +explain +SELECT MIN(x.v1) FROM (SELECT t1.* FROM t1 WHERE t1.v1 >= 'p') x; +SELECT MIN(x.v1) FROM (SELECT t1.* FROM t1 WHERE t1.v1 >= 'p') x; +drop table t1; + --echo End of 5.5 tests diff --git a/mysql-test/main/grant5.result b/mysql-test/main/grant5.result index 24abc61a348..c0fecf0c369 100644 --- a/mysql-test/main/grant5.result +++ b/mysql-test/main/grant5.result @@ -18,3 +18,10 @@ ERROR 42000: Access denied for user 'test'@'%' to database 'mysql' connection default; drop user test, foo; drop role foo; +CREATE TABLE t1 (a INT); +LOCK TABLE t1 WRITE; +REVOKE EXECUTE ON PROCEDURE sp FROM u; +ERROR HY000: Table 'user' was not locked with LOCK TABLES +REVOKE PROCESS ON *.* FROM u; +ERROR HY000: Table 'user' was not locked with LOCK TABLES +DROP TABLE t1; diff --git a/mysql-test/main/grant5.test b/mysql-test/main/grant5.test index 14f2fd65020..649bba7d1ca 100644 --- a/mysql-test/main/grant5.test +++ b/mysql-test/main/grant5.test @@ -23,3 +23,13 @@ show grants for foo@'%'; # user drop user test, foo; drop role foo; +# +# MDEV-17975 Assertion `! is_set()' or `!is_set() || (m_status == DA_OK_BULK && is_bulk_op())' failed upon REVOKE under LOCK TABLE +# +CREATE TABLE t1 (a INT); +LOCK TABLE t1 WRITE; +--error ER_TABLE_NOT_LOCKED +REVOKE EXECUTE ON PROCEDURE sp FROM u; +--error ER_TABLE_NOT_LOCKED +REVOKE PROCESS ON *.* FROM u; +DROP TABLE t1; diff --git a/mysql-test/main/innodb_ext_key.result b/mysql-test/main/innodb_ext_key.result index c55e8d138f8..7a994730738 100644 --- a/mysql-test/main/innodb_ext_key.result +++ b/mysql-test/main/innodb_ext_key.result @@ -1089,6 +1089,7 @@ from t0 A, t0 B, t0 C; drop table t0,t1; # +# # MDEV-10360: Extended keys: index properties depend on index order # create table t0 (a int); diff --git a/mysql-test/main/innodb_ext_key.test b/mysql-test/main/innodb_ext_key.test index a721943e8bc..4104ac5f787 100644 --- a/mysql-test/main/innodb_ext_key.test +++ b/mysql-test/main/innodb_ext_key.test @@ -726,6 +726,7 @@ if ($rows < 2) drop table t0,t1; --echo # +--echo # --echo # MDEV-10360: Extended keys: index properties depend on index order --echo # create table t0 (a int); diff --git a/mysql-test/main/mysqldump.result b/mysql-test/main/mysqldump.result index 1366f9bdd12..556245df9cd 100644 --- a/mysql-test/main/mysqldump.result +++ b/mysql-test/main/mysqldump.result @@ -4333,12 +4333,12 @@ second ee1 root@localhost UTC ONE TIME 2035-12-31 20:01:23 NULL NULL NULL NULL E show create event ee1; Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation ee1 UTC CREATE DEFINER=`root`@`localhost` EVENT `ee1` ON SCHEDULE AT '2035-12-31 20:01:23' ON COMPLETION NOT PRESERVE ENABLE DO set @a=5 latin1 latin1_swedish_ci latin1_swedish_ci -create event ee2 on schedule at '2018-12-31 21:01:23' do set @a=5; +create event ee2 on schedule at '2030-12-31 21:01:22' do set @a=5; create event ee3 on schedule at '2030-12-31 22:01:23' do set @a=5; show events; Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation second ee1 root@localhost UTC ONE TIME 2035-12-31 20:01:23 NULL NULL NULL NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci -second ee2 root@localhost UTC ONE TIME 2018-12-31 21:01:23 NULL NULL NULL NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci +second ee2 root@localhost UTC ONE TIME 2030-12-31 21:01:22 NULL NULL NULL NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci second ee3 root@localhost UTC ONE TIME 2030-12-31 22:01:23 NULL NULL NULL NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci drop database second; create database third; @@ -4346,7 +4346,7 @@ use third; show events; Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation third ee1 root@localhost UTC ONE TIME 2035-12-31 20:01:23 NULL NULL NULL NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci -third ee2 root@localhost UTC ONE TIME 2018-12-31 21:01:23 NULL NULL NULL NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci +third ee2 root@localhost UTC ONE TIME 2030-12-31 21:01:22 NULL NULL NULL NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci third ee3 root@localhost UTC ONE TIME 2030-12-31 22:01:23 NULL NULL NULL NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci drop database third; set time_zone = 'SYSTEM'; diff --git a/mysql-test/main/mysqldump.test b/mysql-test/main/mysqldump.test index 6567596c35c..dbd32f3e74a 100644 --- a/mysql-test/main/mysqldump.test +++ b/mysql-test/main/mysqldump.test @@ -1810,7 +1810,7 @@ show create event ee1; ## prove three works (with spaces and tabs on the end) # start with one from the previous restore -create event ee2 on schedule at '2018-12-31 21:01:23' do set @a=5; +create event ee2 on schedule at '2030-12-31 21:01:22' do set @a=5; create event ee3 on schedule at '2030-12-31 22:01:23' do set @a=5; show events; --exec $MYSQL_DUMP --events second > $MYSQLTEST_VARDIR/tmp/bug16853-2.sql diff --git a/mysql-test/main/partition_alter.test b/mysql-test/main/partition_alter.test index 62a3e1c0777..91ae67e2f7b 100644 --- a/mysql-test/main/partition_alter.test +++ b/mysql-test/main/partition_alter.test @@ -79,7 +79,6 @@ partition p1 values less than ('2016-10-18'), partition p2 values less than ('2020-10-19')); insert t1 values (0, '2000-01-02', 0); insert t1 values (1, '2020-01-02', 10); ---replace_regex /#sql-[0-9a-f_]*/#sql-temporary/ --error ER_CONSTRAINT_FAILED alter table t1 add check (b in (0, 1)); alter table t1 add check (b in (0, 10)); @@ -96,7 +95,6 @@ partition p1 values less than ('2016-10-18'), partition p2 values less than ('2020-10-19')); insert t1 values (0, '2000-01-02', 0); insert t1 values (1, '2020-01-02', 10); ---replace_regex /#sql-[0-9a-f_]*/#sql-temporary/ --error ER_CONSTRAINT_FAILED alter table t1 add check (b in (0, 1)); alter table t1 add check (b in (0, 10)); diff --git a/mysql-test/main/partition_innodb.result b/mysql-test/main/partition_innodb.result index 3d8d2040a48..cdfe619cb29 100644 --- a/mysql-test/main/partition_innodb.result +++ b/mysql-test/main/partition_innodb.result @@ -954,6 +954,26 @@ test_jfg test_jfg11 test_jfg test_jfg12#P#p1000 test_jfg test_jfg12#P#pmax DROP DATABASE test_jfg; +create table t1 (a int) engine=innodb; +create table t2 ( +b int, +c int, +d bit not null default 0, +v bit as (d) virtual, +key (b,v) +) engine=innodb partition by hash (b); +insert into t1 values (1),(2); +insert into t2 (b,c,d) values (1,1,0),(2,2,0); +explain select t1.* from t1 join t2 on (v = a); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 +1 SIMPLE t2 index NULL b 7 NULL 2 Using where; Using index; Using join buffer (flat, BNL join) +select t1.* from t1 join t2 on (v = a); +a +drop table t1, t2; +# +# End of 10.2 tests +# # # MDEV-16241 Assertion `inited==RND' failed in handler::ha_rnd_end() # @@ -965,3 +985,6 @@ SELECT COUNT(*) FROM t1 WHERE x IS NULL AND y IS NULL AND z IS NULL; COUNT(*) 2 DROP TABLE t1; +# +# End of 10.3 tests +# diff --git a/mysql-test/main/partition_innodb.test b/mysql-test/main/partition_innodb.test index 4b4662da47b..57d644d293d 100644 --- a/mysql-test/main/partition_innodb.test +++ b/mysql-test/main/partition_innodb.test @@ -1048,6 +1048,27 @@ database_name = 'test_jfg'; DROP DATABASE test_jfg; +# +# MDEV-17755 Assertion `!table || (!table->read_set || bitmap_is_set(table->read_set, field_index) || (!(ptr >= table->record[0] && ptr < table->record[0] + table->s->reclength)))' failed in Field_bit::val_int upon SELECT with JOIN, partitions, indexed virtual column +# +create table t1 (a int) engine=innodb; +create table t2 ( + b int, + c int, + d bit not null default 0, + v bit as (d) virtual, + key (b,v) +) engine=innodb partition by hash (b); +insert into t1 values (1),(2); +insert into t2 (b,c,d) values (1,1,0),(2,2,0); +explain select t1.* from t1 join t2 on (v = a); +select t1.* from t1 join t2 on (v = a); +drop table t1, t2; + +--echo # +--echo # End of 10.2 tests +--echo # + --echo # --echo # MDEV-16241 Assertion `inited==RND' failed in handler::ha_rnd_end() --echo # @@ -1057,3 +1078,7 @@ PARTITION BY SYSTEM_TIME (PARTITION p1 HISTORY, PARTITION pn CURRENT); INSERT INTO t1 VALUES (1, 7, 8, 9), (2, NULL, NULL, NULL), (3, NULL, NULL, NULL); SELECT COUNT(*) FROM t1 WHERE x IS NULL AND y IS NULL AND z IS NULL; DROP TABLE t1; + +--echo # +--echo # End of 10.3 tests +--echo # diff --git a/mysql-test/main/range_innodb.result b/mysql-test/main/range_innodb.result index 794e6c7b3cc..8bb1c833a56 100644 --- a/mysql-test/main/range_innodb.result +++ b/mysql-test/main/range_innodb.result @@ -37,3 +37,21 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t0 ALL NULL NULL NULL NULL 10 1 SIMPLE t2 range a,b b 5 NULL 201 Using where; Using join buffer (flat, BNL join) drop table t0,t1,t2; +CREATE TABLE t1 ( +pk INT PRIMARY KEY, f1 INT, f2 CHAR(1), f3 CHAR(1), +KEY(f1), KEY(f2) +) ENGINE=InnoDB; +INSERT INTO t1 VALUES +(1,4,'v',NULL),(2,6,'v',NULL),(3,7,'c',NULL),(4,1,'e',NULL),(5,0,'x',NULL), +(6,7,'i',NULL),(7,7,'e',NULL),(8,1,'p',NULL),(9,7,'s',NULL),(10,1,'j',NULL), +(11,5,'z',NULL),(12,2,'c',NULL),(13,0,'a',NULL),(14,1,'q',NULL),(15,8,'y',NULL), +(16,1,'m',NULL),(17,1,'r',NULL),(18,9,'v',NULL),(19,1,'n',NULL); +CREATE TABLE t2 (f4 INT, f5 CHAR(1)) ENGINE=InnoDB; +INSERT INTO t2 VALUES (4,'q'),(NULL,'j'); +SELECT * FROM t1 AS t1_1, t1 AS t1_2, t2 +WHERE f5 = t1_2.f2 AND ( t1_1.f1 = 103 AND t1_1.f2 = 'o' OR t1_1.pk < f4 ); +pk f1 f2 f3 pk f1 f2 f3 f4 f5 +1 4 v NULL 14 1 q NULL 4 q +2 6 v NULL 14 1 q NULL 4 q +3 7 c NULL 14 1 q NULL 4 q +drop table t1,t2; diff --git a/mysql-test/main/range_innodb.test b/mysql-test/main/range_innodb.test index f76794814ef..605006587cc 100644 --- a/mysql-test/main/range_innodb.test +++ b/mysql-test/main/range_innodb.test @@ -45,3 +45,20 @@ explain select * from t0 left join t2 on t2.a <t0.a and t2.b between 50 and 250; drop table t0,t1,t2; +CREATE TABLE t1 ( + pk INT PRIMARY KEY, f1 INT, f2 CHAR(1), f3 CHAR(1), + KEY(f1), KEY(f2) +) ENGINE=InnoDB; + +INSERT INTO t1 VALUES +(1,4,'v',NULL),(2,6,'v',NULL),(3,7,'c',NULL),(4,1,'e',NULL),(5,0,'x',NULL), +(6,7,'i',NULL),(7,7,'e',NULL),(8,1,'p',NULL),(9,7,'s',NULL),(10,1,'j',NULL), +(11,5,'z',NULL),(12,2,'c',NULL),(13,0,'a',NULL),(14,1,'q',NULL),(15,8,'y',NULL), +(16,1,'m',NULL),(17,1,'r',NULL),(18,9,'v',NULL),(19,1,'n',NULL); + +CREATE TABLE t2 (f4 INT, f5 CHAR(1)) ENGINE=InnoDB; +INSERT INTO t2 VALUES (4,'q'),(NULL,'j'); + +SELECT * FROM t1 AS t1_1, t1 AS t1_2, t2 +WHERE f5 = t1_2.f2 AND ( t1_1.f1 = 103 AND t1_1.f2 = 'o' OR t1_1.pk < f4 ); +drop table t1,t2; diff --git a/mysql-test/main/read_only.result b/mysql-test/main/read_only.result index 2029413c0f0..83dfada5f29 100644 --- a/mysql-test/main/read_only.result +++ b/mysql-test/main/read_only.result @@ -170,11 +170,24 @@ flush privileges; drop database mysqltest_db1; set global read_only= @start_read_only; # +# MDEV-16987 - ALTER DATABASE possible in read-only mode +# +CREATE USER user1@localhost; +GRANT ALTER ON test1.* TO user1@localhost; +CREATE DATABASE test1; +SET GLOBAL read_only=1; +ALTER DATABASE test1 CHARACTER SET utf8; +ERROR HY000: The MariaDB server is running with the --read-only option so it cannot execute this statement +SET GLOBAL read_only=0; +DROP DATABASE test1; +DROP USER user1@localhost; +USE test; +# End of 5.5 tests +# # WL#5968 Implement START TRANSACTION READ (WRITE|ONLY); # # # Test interaction with read_only system variable. -DROP TABLE IF EXISTS t1; CREATE TABLE t1(a INT); INSERT INTO t1 VALUES (1), (2); CREATE USER user1; @@ -211,3 +224,4 @@ connection default; DROP USER user1; SET GLOBAL read_only= 0; DROP TABLE t1; +# End of 10.0 tests diff --git a/mysql-test/main/read_only.test b/mysql-test/main/read_only.test index a05f813346e..5314b11154f 100644 --- a/mysql-test/main/read_only.test +++ b/mysql-test/main/read_only.test @@ -283,6 +283,23 @@ flush privileges; drop database mysqltest_db1; set global read_only= @start_read_only; +--echo # +--echo # MDEV-16987 - ALTER DATABASE possible in read-only mode +--echo # +CREATE USER user1@localhost; +GRANT ALTER ON test1.* TO user1@localhost; +CREATE DATABASE test1; +SET GLOBAL read_only=1; +change_user user1; +--error ER_OPTION_PREVENTS_STATEMENT +ALTER DATABASE test1 CHARACTER SET utf8; +change_user root; +SET GLOBAL read_only=0; +DROP DATABASE test1; +DROP USER user1@localhost; +USE test; + +--echo # End of 5.5 tests --echo # --echo # WL#5968 Implement START TRANSACTION READ (WRITE|ONLY); @@ -291,10 +308,6 @@ set global read_only= @start_read_only; --echo # --echo # Test interaction with read_only system variable. ---disable_warnings -DROP TABLE IF EXISTS t1; ---enable_warnings - CREATE TABLE t1(a INT); INSERT INTO t1 VALUES (1), (2); @@ -344,3 +357,5 @@ DROP TABLE t1; # Wait till all disconnects are completed --source include/wait_until_count_sessions.inc + +--echo # End of 10.0 tests diff --git a/mysql-test/main/udf.result b/mysql-test/main/udf.result index 6af6b167511..edbae7e046f 100644 --- a/mysql-test/main/udf.result +++ b/mysql-test/main/udf.result @@ -465,3 +465,17 @@ a b Hello HL DROP FUNCTION METAPHON; DROP TABLE t1; +# +# MDEV-15424: Unreasonal SQL Error (1356) on select from view +# +CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME "UDF_EXAMPLE_LIB"; +create table t1(a int , b int); +insert into t1 values(100, 54), (200, 199); +create view v1 as select myfunc_int(max(a) over (order by b) , b) from t1; +select * from v1; +myfunc_int(max(a) over (order by b) , b) +154 +399 +drop view v1; +drop function myfunc_int; +drop table t1; diff --git a/mysql-test/main/udf.test b/mysql-test/main/udf.test index c3a25c6bcce..d2c0dad8398 100644 --- a/mysql-test/main/udf.test +++ b/mysql-test/main/udf.test @@ -528,3 +528,16 @@ DROP FUNCTION METAPHON; #INSERT INTO t1 (a) VALUES ('Hello'); #SELECT * FROM t1; DROP TABLE t1; + +--echo # +--echo # MDEV-15424: Unreasonal SQL Error (1356) on select from view +--echo # +--replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB +eval CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME "$UDF_EXAMPLE_SO"; +create table t1(a int , b int); +insert into t1 values(100, 54), (200, 199); +create view v1 as select myfunc_int(max(a) over (order by b) , b) from t1; +select * from v1; +drop view v1; +drop function myfunc_int; +drop table t1; diff --git a/mysql-test/main/win.result b/mysql-test/main/win.result index 6ee6f01ba8d..73f9c65b41f 100644 --- a/mysql-test/main/win.result +++ b/mysql-test/main/win.result @@ -3471,7 +3471,25 @@ MIN(b1) OVER () 1 drop table t1; # -# Start of 10.3 tests +# MDEV-15424: Unreasonal SQL Error (1356) on select from view +# +create table t1 (id int, n1 int); +insert into t1 values (1,1), (2,1), (3,2), (4,4); +create view v1 as SELECT ifnull(max(n1) over (partition by n1),'aaa') FROM t1; +explain select * from v1; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> ALL NULL NULL NULL NULL 4 +2 DERIVED t1 ALL NULL NULL NULL NULL 4 Using temporary +select * from v1; +ifnull(max(n1) over (partition by n1),'aaa') +1 +1 +2 +4 +drop table t1; +drop view v1; +# +# End of 10.2 tests # # # MDEV-16489 when lead() returns null on a datetime field, the result is treated as the literal string '[NULL]' @@ -3490,3 +3508,6 @@ d x 00:00:01 00:00:02 00:00:02 NULL DROP TABLE t1; +# +# End of 10.3 tests +# diff --git a/mysql-test/main/win.test b/mysql-test/main/win.test index 1b49ac681f4..15e96ec7e8e 100644 --- a/mysql-test/main/win.test +++ b/mysql-test/main/win.test @@ -2229,7 +2229,20 @@ SELECT DISTINCT MIN(b1) OVER () FROM t1; drop table t1; --echo # ---echo # Start of 10.3 tests +--echo # MDEV-15424: Unreasonal SQL Error (1356) on select from view +--echo # + +create table t1 (id int, n1 int); +insert into t1 values (1,1), (2,1), (3,2), (4,4); + +create view v1 as SELECT ifnull(max(n1) over (partition by n1),'aaa') FROM t1; +explain select * from v1; +select * from v1; +drop table t1; +drop view v1; + +--echo # +--echo # End of 10.2 tests --echo # --echo # @@ -2245,3 +2258,7 @@ CREATE TABLE t1 (d time); INSERT INTO t1 VALUES ('00:00:01'),('00:00:02'); SELECT *, LEAD(d) OVER (ORDER BY d) AS x FROM t1; DROP TABLE t1; + +--echo # +--echo # End of 10.3 tests +--echo # diff --git a/mysql-test/r/ps_error.result b/mysql-test/r/ps_error.result new file mode 100644 index 00000000000..c3c312e82f5 --- /dev/null +++ b/mysql-test/r/ps_error.result @@ -0,0 +1,73 @@ +# +# MDEV-17741 Assertion `thd->Item_change_list::is_empty()' failed in mysql_parse after unsuccessful PS +# +SET SQL_MODE= 'STRICT_ALL_TABLES'; +CREATE TABLE t1 (a INT); +PREPARE stmt FROM "CREATE TABLE tmp AS SELECT * FROM t1 WHERE 'foo' && 0"; +Warnings: +Warning 1292 Truncated incorrect INTEGER value: 'foo' +EXECUTE stmt; +ERROR 22007: Truncated incorrect INTEGER value: 'foo' +SELECT a FROM t1 GROUP BY NULL WITH ROLLUP; +a +DROP TABLE t1; +SET sql_mode=DEFAULT; +SET SQL_MODE= 'STRICT_ALL_TABLES'; +CREATE TABLE t1 (a INT); +PREPARE stmt FROM "CREATE TABLE tmp AS SELECT * FROM t1 WHERE 'foo' && 0"; +Warnings: +Warning 1292 Truncated incorrect INTEGER value: 'foo' +EXECUTE stmt; +ERROR 22007: Truncated incorrect INTEGER value: 'foo' +SET @a = REPLACE( @@global.optimizer_switch, '=on', '=off' ) ; +DROP TABLE t1; +SET sql_mode=DEFAULT; +# +# MDEV-17738 Server crashes in Item::delete_self on closing connection after unsuccessful PS +# +SET SQL_MODE='STRICT_ALL_TABLES'; +PREPARE stmt FROM "CREATE TABLE ps AS SELECT 1 FROM DUAL WHERE 'foo' && 0"; +Warnings: +Warning 1292 Truncated incorrect INTEGER value: 'foo' +EXECUTE stmt; +ERROR 22007: Truncated incorrect INTEGER value: 'foo' +SELECT 'All done'; +All done +All done +SET SQL_MODE=DEFAULT; +SET SQL_MODE='STRICT_ALL_TABLES'; +PREPARE stmt FROM "CREATE TABLE ps AS SELECT 1 FROM DUAL WHERE 'foo' && 0"; +Warnings: +Warning 1292 Truncated incorrect INTEGER value: 'foo' +EXECUTE stmt; +ERROR 22007: Truncated incorrect INTEGER value: 'foo' +DEALLOCATE PREPARE stmt; +SELECT 'All done'; +All done +All done +SET SQL_MODE=DEFAULT; +SET SQL_MODE= 'STRICT_ALL_TABLES'; +CREATE TABLE t1 (a INT); +PREPARE stmt FROM "CREATE TABLE tmp AS SELECT * FROM t1 WHERE 'foo' && 0"; +Warnings: +Warning 1292 Truncated incorrect INTEGER value: 'foo' +EXECUTE stmt; +ERROR 22007: Truncated incorrect INTEGER value: 'foo' +SELECT a FROM t1 GROUP BY a; +a +SELECT * FROM t1; +a +DROP TABLE t1; +SET SQL_MODE=DEFAULT; +SET SQL_MODE= 'STRICT_ALL_TABLES'; +CREATE TABLE t1 (a INT); +PREPARE stmt FROM "CREATE TABLE tmp AS SELECT * FROM t1 WHERE 'foo' && 0"; +Warnings: +Warning 1292 Truncated incorrect INTEGER value: 'foo' +EXECUTE stmt; +ERROR 22007: Truncated incorrect INTEGER value: 'foo' +SELECT a FROM t1 GROUP BY a; +a +INSERT t1 SELECT * FROM ( SELECT * FROM t1 ) sq; +DROP TABLE t1; +SET SQL_MODE=DEFAULT; diff --git a/mysql-test/std_data/mdev17909#P#p20181029.MYD b/mysql-test/std_data/mdev17909#P#p20181029.MYD new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/mysql-test/std_data/mdev17909#P#p20181029.MYD diff --git a/mysql-test/std_data/mdev17909#P#p20181029.MYI b/mysql-test/std_data/mdev17909#P#p20181029.MYI Binary files differnew file mode 100644 index 00000000000..dcdd088b4dc --- /dev/null +++ b/mysql-test/std_data/mdev17909#P#p20181029.MYI diff --git a/mysql-test/std_data/mdev17909#P#p20181128.MYD b/mysql-test/std_data/mdev17909#P#p20181128.MYD new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/mysql-test/std_data/mdev17909#P#p20181128.MYD diff --git a/mysql-test/std_data/mdev17909#P#p20181128.MYI b/mysql-test/std_data/mdev17909#P#p20181128.MYI Binary files differnew file mode 100644 index 00000000000..dcdd088b4dc --- /dev/null +++ b/mysql-test/std_data/mdev17909#P#p20181128.MYI diff --git a/mysql-test/std_data/mdev17909.frm b/mysql-test/std_data/mdev17909.frm Binary files differnew file mode 100644 index 00000000000..575ecd2c70f --- /dev/null +++ b/mysql-test/std_data/mdev17909.frm diff --git a/mysql-test/std_data/mdev17909.par b/mysql-test/std_data/mdev17909.par Binary files differnew file mode 100644 index 00000000000..d9141dd0dee --- /dev/null +++ b/mysql-test/std_data/mdev17909.par diff --git a/mysql-test/suite/encryption/r/innodb-bad-key-change.result b/mysql-test/suite/encryption/r/innodb-bad-key-change.result index 179be43cc41..5812ff6dce9 100644 --- a/mysql-test/suite/encryption/r/innodb-bad-key-change.result +++ b/mysql-test/suite/encryption/r/innodb-bad-key-change.result @@ -3,6 +3,7 @@ call mtr.add_suppression("Plugin 'file_key_management' registration.*failed"); call mtr.add_suppression("InnoDB: Table `test`\\.`t[12]` (has an unreadable root page|is corrupted)"); call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file '.*test.t[12]\\.ibd' cannot be decrypted\\."); call mtr.add_suppression("failed to read or decrypt \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\]"); +call mtr.add_suppression("InnoDB: Encrypted page \\[page id: space=[1-9][0-9]*, page number=3\\] in file .*test.t1.ibd looks corrupted; key_version=1"); call mtr.add_suppression("File '.*mysql-test.std_data.keysbad3\\.txt' not found"); # Start server with keys2.txt SET GLOBAL innodb_file_per_table = ON; diff --git a/mysql-test/suite/encryption/r/innodb-encryption-disable.result b/mysql-test/suite/encryption/r/innodb-encryption-disable.result index d8d37ba7493..94b47103dd0 100644 --- a/mysql-test/suite/encryption/r/innodb-encryption-disable.result +++ b/mysql-test/suite/encryption/r/innodb-encryption-disable.result @@ -1,6 +1,7 @@ call mtr.add_suppression("InnoDB: Table `test`\\.`t[15]` (has an unreadable root page|is corrupted)"); call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file '.*test.t[15]\\.ibd' cannot be decrypted\\."); call mtr.add_suppression("failed to read or decrypt \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\]"); +call mtr.add_suppression("InnoDB: Encrypted page \\[page id: space=[1-9][0-9]*, page number=3\\] in file .*test.t[15].ibd looks corrupted; key_version=1"); call mtr.add_suppression("Couldn't load plugins from 'file_key_management"); create table t5 ( `intcol1` int(32) DEFAULT NULL, diff --git a/mysql-test/suite/encryption/r/innodb-missing-key.result b/mysql-test/suite/encryption/r/innodb-missing-key.result index 32ae29ca76b..6f4a45d817a 100644 --- a/mysql-test/suite/encryption/r/innodb-missing-key.result +++ b/mysql-test/suite/encryption/r/innodb-missing-key.result @@ -1,6 +1,7 @@ call mtr.add_suppression("InnoDB: Table `test`\\.`t1` (has an unreadable root page|is corrupted)"); call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file '.*test.t[123]\\.ibd' cannot be decrypted\\."); call mtr.add_suppression("failed to read or decrypt \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\]"); +call mtr.add_suppression("InnoDB: Encrypted page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file .*test.t[12].ibd looks corrupted; key_version=1"); # Start server with keys2.txt CREATE TABLE t1(a int not null primary key auto_increment, b varchar(128)) engine=innodb ENCRYPTED=YES ENCRYPTION_KEY_ID=19; CREATE TABLE t2(a int not null primary key auto_increment, b varchar(128)) engine=innodb ENCRYPTED=YES ENCRYPTION_KEY_ID=1; diff --git a/mysql-test/suite/encryption/t/innodb-bad-key-change.test b/mysql-test/suite/encryption/t/innodb-bad-key-change.test index 5c424d8752b..a832880c494 100644 --- a/mysql-test/suite/encryption/t/innodb-bad-key-change.test +++ b/mysql-test/suite/encryption/t/innodb-bad-key-change.test @@ -13,6 +13,7 @@ call mtr.add_suppression("Plugin 'file_key_management' registration.*failed"); call mtr.add_suppression("InnoDB: Table `test`\\.`t[12]` (has an unreadable root page|is corrupted)"); call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file '.*test.t[12]\\.ibd' cannot be decrypted\\."); call mtr.add_suppression("failed to read or decrypt \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\]"); +call mtr.add_suppression("InnoDB: Encrypted page \\[page id: space=[1-9][0-9]*, page number=3\\] in file .*test.t1.ibd looks corrupted; key_version=1"); call mtr.add_suppression("File '.*mysql-test.std_data.keysbad3\\.txt' not found"); --echo # Start server with keys2.txt diff --git a/mysql-test/suite/encryption/t/innodb-encryption-disable.test b/mysql-test/suite/encryption/t/innodb-encryption-disable.test index 0994078788e..6d6f1c40d4c 100644 --- a/mysql-test/suite/encryption/t/innodb-encryption-disable.test +++ b/mysql-test/suite/encryption/t/innodb-encryption-disable.test @@ -10,6 +10,7 @@ call mtr.add_suppression("InnoDB: Table `test`\\.`t[15]` (has an unreadable root page|is corrupted)"); call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file '.*test.t[15]\\.ibd' cannot be decrypted\\."); call mtr.add_suppression("failed to read or decrypt \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\]"); +call mtr.add_suppression("InnoDB: Encrypted page \\[page id: space=[1-9][0-9]*, page number=3\\] in file .*test.t[15].ibd looks corrupted; key_version=1"); # Suppression for builds where file_key_management plugin is linked statically call mtr.add_suppression("Couldn't load plugins from 'file_key_management"); diff --git a/mysql-test/suite/encryption/t/innodb-missing-key.test b/mysql-test/suite/encryption/t/innodb-missing-key.test index cf851a54def..c2a73d594b4 100644 --- a/mysql-test/suite/encryption/t/innodb-missing-key.test +++ b/mysql-test/suite/encryption/t/innodb-missing-key.test @@ -10,6 +10,7 @@ call mtr.add_suppression("InnoDB: Table `test`\\.`t1` (has an unreadable root page|is corrupted)"); call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file '.*test.t[123]\\.ibd' cannot be decrypted\\."); call mtr.add_suppression("failed to read or decrypt \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\]"); +call mtr.add_suppression("InnoDB: Encrypted page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file .*test.t[12].ibd looks corrupted; key_version=1"); --echo # Start server with keys2.txt -- let $restart_parameters=--file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys2.txt diff --git a/mysql-test/suite/innodb/include/crc32.pl b/mysql-test/suite/innodb/include/crc32.pl new file mode 100644 index 00000000000..c2bce09dd36 --- /dev/null +++ b/mysql-test/suite/innodb/include/crc32.pl @@ -0,0 +1,33 @@ +# The following is Public Domain / Creative Commons CC0 from +# http://billauer.co.il/blog/2011/05/perl-crc32-crc-xs-module/ + +sub mycrc32 { + my ($input, $init_value, $polynomial) = @_; + + $init_value = 0 unless (defined $init_value); + $polynomial = 0xedb88320 unless (defined $polynomial); + + my @lookup_table; + + for (my $i=0; $i<256; $i++) { + my $x = $i; + for (my $j=0; $j<8; $j++) { + if ($x & 1) { + $x = ($x >> 1) ^ $polynomial; + } else { + $x = $x >> 1; + } + } + push @lookup_table, $x; + } + + my $crc = $init_value ^ 0xffffffff; + + foreach my $x (unpack ('C*', $input)) { + $crc = (($crc >> 8) & 0xffffff) ^ $lookup_table[ ($crc ^ $x) & 0xff ]; + } + + $crc = $crc ^ 0xffffffff; + + return $crc; +} diff --git a/mysql-test/suite/innodb/r/data_types.result b/mysql-test/suite/innodb/r/data_types.result index 4e919e37cee..1394431b09d 100644 --- a/mysql-test/suite/innodb/r/data_types.result +++ b/mysql-test/suite/innodb/r/data_types.result @@ -77,7 +77,9 @@ t1_VARCHAR_500_BINARY VARCHAR(500) BINARY, t1_YEAR_2 YEAR(2), t1_YEAR_4 YEAR(4), t1_CHAR_0 CHAR(0), -t1_MYSQL_0 CHAR(0) CHARACTER SET utf8 +t1_MYSQL_0 CHAR(0) CHARACTER SET utf8, +t1_VARCHAR_0 VARCHAR(0), +t1_VARMYSQL_0 VARCHAR(0) CHARACTER SET utf8 ) ENGINE=InnoDB; Warnings: Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead @@ -151,10 +153,12 @@ t1_TINYINT DATA_INT t1_TINYINT_UNSIGNED DATA_INT UNSIGNED t1_TINYTEXT DATA_BLOB t1_VARBINARY_100 DATA_BINARY +t1_VARCHAR_0 DATA_VARCHAR t1_VARCHAR_10 DATA_VARCHAR t1_VARCHAR_10_BINARY DATA_VARMYSQL t1_VARCHAR_500 DATA_VARCHAR t1_VARCHAR_500_BINARY DATA_VARMYSQL +t1_VARMYSQL_0 DATA_VARMYSQL t1_YEAR_2 DATA_INT UNSIGNED t1_YEAR_4 DATA_INT UNSIGNED DROP TABLE t1; @@ -164,3 +168,9 @@ DROP TABLE t1; CREATE TABLE t1 (c CHAR(0), KEY(c)) ENGINE=InnoDB; INSERT INTO t1 VALUES (''); DROP TABLE t1; +# +# MDEV-18039 Assertion failed in btr_node_ptr_max_size for VARCHAR(0) +# +CREATE TABLE t1 (c VARCHAR(0), KEY(c)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (''); +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/innodb-alter-debug.result b/mysql-test/suite/innodb/r/innodb-alter-debug.result index 73037247272..51ba58aa1ef 100644 --- a/mysql-test/suite/innodb/r/innodb-alter-debug.result +++ b/mysql-test/suite/innodb/r/innodb-alter-debug.result @@ -75,3 +75,26 @@ connection default; ERROR 23000: Duplicate entry '1' for key 'a' SET DEBUG_SYNC='RESET'; DROP TABLE t1; +# +# MDEV-17470 Orphan temporary files after interrupted ALTER +# cause InnoDB: Operating system error number 17 and eventual +# fatal error 71 +# +CREATE TABLE t1 (pk INT AUTO_INCREMENT PRIMARY KEY, i INT) ENGINE=InnoDB; +INSERT INTO t1 VALUES (NULL,1),(NULL,2),(NULL,3),(NULL,4),(NULL,5),(NULL,6),(NULL,7),(NULL,8); +INSERT INTO t1 SELECT NULL, i FROM t1; +INSERT INTO t1 SELECT NULL, i FROM t1; +INSERT INTO t1 SELECT NULL, i FROM t1; +INSERT INTO t1 SELECT NULL, i FROM t1; +INSERT INTO t1 SELECT NULL, i FROM t1; +LOCK TABLE t1 READ; +connect con1,localhost,root,,test; +ALTER TABLE t1 FORCE, ALGORITHM=COPY; +connection default; +kill query @id; +connection con1; +ERROR 70100: Query execution was interrupted +disconnect con1; +connection default; +UNLOCK TABLES; +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/innodb-alter.result b/mysql-test/suite/innodb/r/innodb-alter.result index e9f827c004e..528cd07770b 100644 --- a/mysql-test/suite/innodb/r/innodb-alter.result +++ b/mysql-test/suite/innodb/r/innodb-alter.result @@ -879,6 +879,27 @@ NAME a b DROP TABLE t1; +# and an MDEV-18041 regression related to indexes prefixes +create table `test` ( +`test_old` varchar(255) NOT NULL, +`other` varchar(255) NOT NULL, +PRIMARY KEY (`test_old`,`other`), +UNIQUE KEY uk (`test_old`(100), `other`) +) ENGINE=InnoDB; +select name, pos from information_schema.innodb_SYS_FIELDS where name in ('test_old', 'other', 'test_new'); +name pos +test_old 0 +other 1 +test_old 0 +other 1 +alter table `test` CHANGE COLUMN `test_old` `test_new` varchar(255) NOT NULL; +select name, pos from information_schema.innodb_SYS_FIELDS where name in ('test_old', 'other', 'test_new'); +name pos +test_new 0 +other 1 +test_new 0 +other 1 +drop table `test`; # # BUG 20029625 - HANDLE_FATAL_SIGNAL (SIG=11) IN # DICT_MEM_TABLE_COL_RENAME_LOW diff --git a/mysql-test/suite/innodb/t/data_types.test b/mysql-test/suite/innodb/t/data_types.test index c8e80c9db27..cfdd5201af2 100644 --- a/mysql-test/suite/innodb/t/data_types.test +++ b/mysql-test/suite/innodb/t/data_types.test @@ -90,7 +90,9 @@ CREATE TABLE t1 t1_YEAR_2 YEAR(2), t1_YEAR_4 YEAR(4), t1_CHAR_0 CHAR(0), - t1_MYSQL_0 CHAR(0) CHARACTER SET utf8 + t1_MYSQL_0 CHAR(0) CHARACTER SET utf8, + t1_VARCHAR_0 VARCHAR(0), + t1_VARMYSQL_0 VARCHAR(0) CHARACTER SET utf8 ) ENGINE=InnoDB; INSERT INTO t1 () VALUES (); @@ -127,3 +129,10 @@ DROP TABLE t1; CREATE TABLE t1 (c CHAR(0), KEY(c)) ENGINE=InnoDB; INSERT INTO t1 VALUES (''); DROP TABLE t1; + +--echo # +--echo # MDEV-18039 Assertion failed in btr_node_ptr_max_size for VARCHAR(0) +--echo # +CREATE TABLE t1 (c VARCHAR(0), KEY(c)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (''); +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/t/innodb-alter-debug.test b/mysql-test/suite/innodb/t/innodb-alter-debug.test index 5c8025265e5..00300bfdccc 100644 --- a/mysql-test/suite/innodb/t/innodb-alter-debug.test +++ b/mysql-test/suite/innodb/t/innodb-alter-debug.test @@ -98,5 +98,37 @@ SET DEBUG_SYNC='RESET'; DROP TABLE t1; +--echo # +--echo # MDEV-17470 Orphan temporary files after interrupted ALTER +--echo # cause InnoDB: Operating system error number 17 and eventual +--echo # fatal error 71 +--echo # +CREATE TABLE t1 (pk INT AUTO_INCREMENT PRIMARY KEY, i INT) ENGINE=InnoDB; +INSERT INTO t1 VALUES (NULL,1),(NULL,2),(NULL,3),(NULL,4),(NULL,5),(NULL,6),(NULL,7),(NULL,8); +INSERT INTO t1 SELECT NULL, i FROM t1; +INSERT INTO t1 SELECT NULL, i FROM t1; +INSERT INTO t1 SELECT NULL, i FROM t1; +INSERT INTO t1 SELECT NULL, i FROM t1; +INSERT INTO t1 SELECT NULL, i FROM t1; + +LOCK TABLE t1 READ; + +--connect (con1,localhost,root,,test) +let $ID= `SELECT @id := CONNECTION_ID()`; +send ALTER TABLE t1 FORCE, ALGORITHM=COPY; + +--connection default +let $wait_condition= select 1 from information_schema.processlist where state='Waiting for table metadata lock'; +source include/wait_condition.inc; +let $ignore= `SELECT @id := $ID`; +kill query @id; +--connection con1 +--error ER_QUERY_INTERRUPTED +reap; +--disconnect con1 +--connection default +UNLOCK TABLES; +DROP TABLE t1; + # Wait till all disconnects are completed --source include/wait_until_count_sessions.inc diff --git a/mysql-test/suite/innodb/t/innodb-alter.test b/mysql-test/suite/innodb/t/innodb-alter.test index 7c9eb47252d..28ff110fc01 100644 --- a/mysql-test/suite/innodb/t/innodb-alter.test +++ b/mysql-test/suite/innodb/t/innodb-alter.test @@ -545,6 +545,19 @@ SELECT C.NAME FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS C INNER JOIN WHERE T.NAME='test/t1'; DROP TABLE t1; +--echo # and an MDEV-18041 regression related to indexes prefixes +create table `test` ( + `test_old` varchar(255) NOT NULL, + `other` varchar(255) NOT NULL, + PRIMARY KEY (`test_old`,`other`), + UNIQUE KEY uk (`test_old`(100), `other`) +) ENGINE=InnoDB; + +select name, pos from information_schema.innodb_SYS_FIELDS where name in ('test_old', 'other', 'test_new'); +alter table `test` CHANGE COLUMN `test_old` `test_new` varchar(255) NOT NULL; +select name, pos from information_schema.innodb_SYS_FIELDS where name in ('test_old', 'other', 'test_new'); +drop table `test`; + --echo # --echo # BUG 20029625 - HANDLE_FATAL_SIGNAL (SIG=11) IN diff --git a/mysql-test/suite/mariabackup/encrypted_page_compressed.opt b/mysql-test/suite/mariabackup/encrypted_page_compressed.opt new file mode 100644 index 00000000000..e5a02a1a1c9 --- /dev/null +++ b/mysql-test/suite/mariabackup/encrypted_page_compressed.opt @@ -0,0 +1,6 @@ +--innodb-encryption-rotate-key-age=2 +--innodb-encryption-threads=4 +--innodb-tablespaces-encryption +--plugin-load-add=$FILE_KEY_MANAGEMENT_SO +--loose-file-key-management +--loose-file-key-management-filename=$MYSQL_TEST_DIR/std_data/logkey.txt diff --git a/mysql-test/suite/mariabackup/encrypted_page_compressed.result b/mysql-test/suite/mariabackup/encrypted_page_compressed.result new file mode 100644 index 00000000000..293addd2b03 --- /dev/null +++ b/mysql-test/suite/mariabackup/encrypted_page_compressed.result @@ -0,0 +1,7 @@ +call mtr.add_suppression("InnoDB: Table `test`.`t1` has an unreadable root page"); +CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT, c char(200)) ENGINE=InnoDB page_compressed=yes encrypted=yes; +insert into t1(b, c) values("mariadb", "mariabackup"); +# Corrupt the table +# xtrabackup backup +FOUND 1 /Database page corruption detected.*/ in backup.log +drop table t1; diff --git a/mysql-test/suite/mariabackup/encrypted_page_compressed.test b/mysql-test/suite/mariabackup/encrypted_page_compressed.test new file mode 100644 index 00000000000..b4ca7eded14 --- /dev/null +++ b/mysql-test/suite/mariabackup/encrypted_page_compressed.test @@ -0,0 +1,48 @@ +source include/have_file_key_management.inc; +call mtr.add_suppression("InnoDB: Table `test`.`t1` has an unreadable root page"); +CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT, c char(200)) ENGINE=InnoDB page_compressed=yes encrypted=yes; +insert into t1(b, c) values("mariadb", "mariabackup"); + +let $MYSQLD_DATADIR=`select @@datadir`; +let t1_IBD = $MYSQLD_DATADIR/test/t1.ibd; +let INNODB_PAGE_SIZE=`select @@innodb_page_size`; + +--source include/shutdown_mysqld.inc + +--echo # Corrupt the table + +perl; +use strict; +use warnings; +use Fcntl qw(:DEFAULT :seek); + +my $ibd_file = $ENV{'t1_IBD'}; + +my $chunk; +my $page_size = $ENV{'INNODB_PAGE_SIZE'}; + +sysopen IBD_FILE, $ibd_file, O_RDWR || die "Unable to open $ibd_file"; +sysseek IBD_FILE, $page_size * 3 + 75, SEEK_CUR; +$chunk = '\xAA\xAA\xAA\xAA'; +syswrite IBD_FILE, $chunk, 4; + +close IBD_FILE; +EOF + +--source include/start_mysqld.inc + +echo # xtrabackup backup; +--disable_result_log +let $targetdir=$MYSQLTEST_VARDIR/tmp/backup; +let $backuplog=$MYSQLTEST_VARDIR/tmp/backup.log; +--error 1 +exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir > $backuplog; +--enable_result_log + +--let SEARCH_PATTERN=Database page corruption detected.* +--let SEARCH_FILE=$backuplog +--source include/search_pattern_in_file.inc +remove_file $backuplog; + +drop table t1; +rmdir $targetdir; diff --git a/mysql-test/suite/mariabackup/encrypted_page_corruption.result b/mysql-test/suite/mariabackup/encrypted_page_corruption.result index 8ae34b2a6f0..9a6202a5ea1 100644 --- a/mysql-test/suite/mariabackup/encrypted_page_corruption.result +++ b/mysql-test/suite/mariabackup/encrypted_page_corruption.result @@ -1,8 +1,8 @@ -call mtr.add_suppression("\\[ERROR\\] InnoDB: The page .* in file .* cannot be decrypted."); +call mtr.add_suppression("\\[ERROR\\] InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=3\\] in file '.*test.t1\\.ibd' cannot be decrypted."); call mtr.add_suppression("\\[ERROR\\] InnoDB: Table `test`\\.`t1` has an unreadable root page"); CREATE TABLE t1(c VARCHAR(128)) ENGINE INNODB, encrypted=yes; insert into t1 select repeat('a',100); # Corrupt the table # xtrabackup backup -FOUND 1 /Database page corruption detected/ in backup.log +FOUND 1 /Database page corruption detected.*/ in backup.log drop table t1; diff --git a/mysql-test/suite/mariabackup/encrypted_page_corruption.test b/mysql-test/suite/mariabackup/encrypted_page_corruption.test index 923875275e6..4491c235ac4 100644 --- a/mysql-test/suite/mariabackup/encrypted_page_corruption.test +++ b/mysql-test/suite/mariabackup/encrypted_page_corruption.test @@ -1,12 +1,13 @@ --source include/have_file_key_management.inc +--source include/innodb_page_size.inc -call mtr.add_suppression("\\[ERROR\\] InnoDB: The page .* in file .* cannot be decrypted."); +call mtr.add_suppression("\\[ERROR\\] InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=3\\] in file '.*test.t1\\.ibd' cannot be decrypted."); call mtr.add_suppression("\\[ERROR\\] InnoDB: Table `test`\\.`t1` has an unreadable root page"); CREATE TABLE t1(c VARCHAR(128)) ENGINE INNODB, encrypted=yes; insert into t1 select repeat('a',100); -let $MYSQLD_DATADIR=`select @@datadir`; -let t1_IBD = $MYSQLD_DATADIR/test/t1.ibd; +let MYSQLD_DATADIR=`select @@datadir`; +let INNODB_PAGE_SIZE=`select @@innodb_page_size`; --source include/shutdown_mysqld.inc @@ -16,17 +17,29 @@ perl; use strict; use warnings; use Fcntl qw(:DEFAULT :seek); +do "$ENV{MTR_SUITE_DIR}/../innodb/include/crc32.pl"; -my $ibd_file = $ENV{'t1_IBD'}; +my $page_size = $ENV{INNODB_PAGE_SIZE}; -my $chunk; -my $len; +sysopen IBD_FILE, "$ENV{MYSQLD_DATADIR}/test/t1.ibd", O_RDWR +|| die "Cannot open t1.ibd\n"; +sysread(IBD_FILE, $_, 38) || die "Cannot read t1.ibd\n"; +my $space = unpack("x[34]N", $_); +sysseek(IBD_FILE, $page_size * 3, SEEK_SET) || die "Cannot seek t1.ibd\n"; -sysopen IBD_FILE, $ibd_file, O_RDWR || die "Unable to open $ibd_file"; -sysseek IBD_FILE, 16384 * 3, SEEK_CUR; -$chunk = '\xAA\xAA\xAA\xAA'; -syswrite IBD_FILE, $chunk, 4; +my $head = pack("Nx[18]", 3); # better to have a valid page number +my $body = chr(0) x ($page_size - 38 - 8); +# Calculate innodb_checksum_algorithm=crc32 for the unencrypted page. +# The following bytes are excluded: +# bytes 0..3 (the checksum is stored there) +# bytes 26..37 (encryption key version, post-encryption checksum, tablespace id) +# bytes $page_size-8..$page_size-1 (checksum, LSB of FIL_PAGE_LSN) +my $polynomial = 0x82f63b78; # CRC-32C +my $ck = mycrc32($head, 0, $polynomial) ^ mycrc32($body, 0, $polynomial); + +my $page= pack("N",$ck).$head.pack("NNN",1,$ck,$space).$body.pack("Nx[4]",$ck); +die unless syswrite(IBD_FILE, $page, $page_size) == $page_size; close IBD_FILE; EOF @@ -38,14 +51,20 @@ let $backuplog=$MYSQLTEST_VARDIR/tmp/backup.log; --disable_result_log --error 1 -exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir > $backuplog; +exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --extended-validation --target-dir=$targetdir > $backuplog; --enable_result_log ---let SEARCH_PATTERN=Database page corruption detected +--let SEARCH_PATTERN=Database page corruption detected.* --let SEARCH_FILE=$backuplog --source include/search_pattern_in_file.inc remove_file $backuplog; +rmdir $targetdir; + +# Due to very constructed nature of the "corruption" (faking checksums), the "corruption" won't be found without --extended-validation +--disable_result_log +exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir; +--enable_result_log drop table t1; rmdir $targetdir; diff --git a/mysql-test/suite/mariabackup/huge_lsn.opt b/mysql-test/suite/mariabackup/huge_lsn.opt index 74a6450a1ef..c65b76fb7d2 100644 --- a/mysql-test/suite/mariabackup/huge_lsn.opt +++ b/mysql-test/suite/mariabackup/huge_lsn.opt @@ -1,4 +1,8 @@ --innodb-encrypt-log=ON +--innodb-tablespaces-encryption +--innodb-encrypt-tables=ON +--innodb-encryption-rotate-key-age=1 +--innodb-encryption-threads=4 --plugin-load-add=$FILE_KEY_MANAGEMENT_SO --loose-file-key-management --loose-file-key-management-filekey=FILE:$MTR_SUITE_DIR/filekeys-data.key diff --git a/mysql-test/suite/mariabackup/partition_partial.opt b/mysql-test/suite/mariabackup/partition_partial.opt new file mode 100644 index 00000000000..508cf185695 --- /dev/null +++ b/mysql-test/suite/mariabackup/partition_partial.opt @@ -0,0 +1 @@ +--innodb --loose-partition diff --git a/mysql-test/suite/mariabackup/partition_partial.result b/mysql-test/suite/mariabackup/partition_partial.result new file mode 100644 index 00000000000..62b7adf75f8 --- /dev/null +++ b/mysql-test/suite/mariabackup/partition_partial.result @@ -0,0 +1,31 @@ +CREATE TABLE t1(i INT) ENGINE INNODB +PARTITION BY RANGE (i) +(PARTITION p1 VALUES LESS THAN (100), +PARTITION p2 VALUES LESS THAN (200), +PARTITION p3 VALUES LESS THAN (300), +PARTITION p4 VALUES LESS THAN (400)); +INSERT INTO t1 VALUES (1), (101), (201), (301); +# xtrabackup backup +INSERT INTO t1 VALUES (1), (101), (201), (301); +# xtrabackup prepare +CREATE TABLE t1_placeholder (i INT) ENGINE INNODB; +ALTER TABLE t1_placeholder DISCARD TABLESPACE; +ALTER TABLE t1_placeholder IMPORT TABLESPACE; +ALTER TABLE t1 EXCHANGE PARTITION p4 WITH TABLE t1_placeholder; +ALTER TABLE t1_placeholder DISCARD TABLESPACE; +ALTER TABLE t1_placeholder IMPORT TABLESPACE; +ALTER TABLE t1 EXCHANGE PARTITION p3 WITH TABLE t1_placeholder; +ALTER TABLE t1_placeholder DISCARD TABLESPACE; +ALTER TABLE t1_placeholder IMPORT TABLESPACE; +ALTER TABLE t1 EXCHANGE PARTITION p2 WITH TABLE t1_placeholder; +ALTER TABLE t1_placeholder DISCARD TABLESPACE; +ALTER TABLE t1_placeholder IMPORT TABLESPACE; +ALTER TABLE t1 EXCHANGE PARTITION p1 WITH TABLE t1_placeholder; +SELECT * FROM t1; +i +1 +101 +201 +301 +DROP TABLE t1; +DROP TABLE t1_placeholder; diff --git a/mysql-test/suite/mariabackup/partition_partial.test b/mysql-test/suite/mariabackup/partition_partial.test new file mode 100644 index 00000000000..8e288ec997f --- /dev/null +++ b/mysql-test/suite/mariabackup/partition_partial.test @@ -0,0 +1,44 @@ +#--source include/innodb_page_size.inc + +# import partitioned table from table from partial backup + +CREATE TABLE t1(i INT) ENGINE INNODB +PARTITION BY RANGE (i) +(PARTITION p1 VALUES LESS THAN (100), + PARTITION p2 VALUES LESS THAN (200), + PARTITION p3 VALUES LESS THAN (300), + PARTITION p4 VALUES LESS THAN (400)); + +INSERT INTO t1 VALUES (1), (101), (201), (301); + +echo # xtrabackup backup; + +let $targetdir=$MYSQLTEST_VARDIR/tmp/backup; +--disable_result_log +exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup "--tables=test.t1" --target-dir=$targetdir; +--enable_result_log +INSERT INTO t1 VALUES (1), (101), (201), (301); + + +echo # xtrabackup prepare; +--disable_result_log +exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --defaults-group-suffix=.1 --prepare --export --target-dir=$targetdir; +--enable_result_log + + +let $MYSQLD_DATADIR= `select @@datadir`; +CREATE TABLE t1_placeholder (i INT) ENGINE INNODB; +let $i=4; +while($i) +{ + eval ALTER TABLE t1_placeholder DISCARD TABLESPACE; + copy_file $targetdir/test/t1#P#p$i.cfg $MYSQLD_DATADIR/test/t1_placeholder.cfg; + copy_file $targetdir/test/t1#P#p$i.ibd $MYSQLD_DATADIR/test/t1_placeholder.ibd; + eval ALTER TABLE t1_placeholder IMPORT TABLESPACE; + eval ALTER TABLE t1 EXCHANGE PARTITION p$i WITH TABLE t1_placeholder; + dec $i; +} +SELECT * FROM t1; +DROP TABLE t1; +DROP TABLE t1_placeholder; +rmdir $targetdir; diff --git a/mysql-test/suite/mariabackup/unencrypted_page_compressed.result b/mysql-test/suite/mariabackup/unencrypted_page_compressed.result new file mode 100644 index 00000000000..71eac085769 --- /dev/null +++ b/mysql-test/suite/mariabackup/unencrypted_page_compressed.result @@ -0,0 +1,11 @@ +call mtr.add_suppression("InnoDB: Table `test`.`t1` has an unreadable root page"); +SET GLOBAL innodb_purge_rseg_truncate_frequency = 1; +CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT, c char(200)) ENGINE=InnoDB page_compressed=yes; +insert into t1(b, c) values("mariadb", "mariabackup"); +InnoDB 0 transactions not purged +# Corrupt the table +# xtrabackup backup +FOUND 1 /Database page corruption detected.*/ in backup.log +drop table t1; +Warnings: +Warning 192 Table test/t1 in file ./test/t1.ibd is encrypted but encryption service or used key_id is not available. Can't continue reading table. diff --git a/mysql-test/suite/mariabackup/unencrypted_page_compressed.test b/mysql-test/suite/mariabackup/unencrypted_page_compressed.test new file mode 100644 index 00000000000..b41d177e572 --- /dev/null +++ b/mysql-test/suite/mariabackup/unencrypted_page_compressed.test @@ -0,0 +1,50 @@ +call mtr.add_suppression("InnoDB: Table `test`.`t1` has an unreadable root page"); +SET GLOBAL innodb_purge_rseg_truncate_frequency = 1; +CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT, c char(200)) ENGINE=InnoDB page_compressed=yes; +insert into t1(b, c) values("mariadb", "mariabackup"); +--source ../innodb/include/wait_all_purged.inc + +let $MYSQLD_DATADIR=`select @@datadir`; +let t1_IBD = $MYSQLD_DATADIR/test/t1.ibd; +let INNODB_PAGE_SIZE=`select @@innodb_page_size`; + +--source include/shutdown_mysqld.inc + +--echo # Corrupt the table + +perl; +use strict; +use warnings; +use Fcntl qw(:DEFAULT :seek); + +my $ibd_file = $ENV{'t1_IBD'}; + +my $chunk; +my $page_size = $ENV{'INNODB_PAGE_SIZE'}; + +sysopen IBD_FILE, $ibd_file, O_RDWR || die "Unable to open $ibd_file"; +sysseek IBD_FILE, 16384 * 3 + 75, SEEK_CUR; +$chunk = '\xAA\xAA\xAA\xAA'; +syswrite IBD_FILE, $chunk, 4; + +close IBD_FILE; +EOF + +--let $restart_parameters= --skip-innodb-buffer-pool-load-at-startup +--source include/start_mysqld.inc + +echo # xtrabackup backup; +--disable_result_log +let $targetdir=$MYSQLTEST_VARDIR/tmp/backup; +let $backuplog=$MYSQLTEST_VARDIR/tmp/backup.log; +--error 1 +exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir > $backuplog; +--enable_result_log + +--let SEARCH_PATTERN=Database page corruption detected.* +--let SEARCH_FILE=$backuplog +--source include/search_pattern_in_file.inc +remove_file $backuplog; + +drop table t1; +rmdir $targetdir; diff --git a/mysql-test/suite/rpl/r/rpl_idempotency.result b/mysql-test/suite/rpl/r/rpl_idempotency.result index a9485ca8933..09e084ce448 100644 --- a/mysql-test/suite/rpl/r/rpl_idempotency.result +++ b/mysql-test/suite/rpl/r/rpl_idempotency.result @@ -79,8 +79,25 @@ a -3 1 include/check_slave_no_error.inc +connection slave; +drop table t1, t2; connection master; DROP TABLE t1, t2; connection slave; +include/check_slave_no_error.inc +create database d; +create database e; +connection master; +create database d; +create database if not exists e; +connection slave; +include/check_slave_no_error.inc +drop database d; +drop database e; +connection master; +drop database d; +drop database if exists e; +connection slave; +include/check_slave_no_error.inc SET @@global.slave_exec_mode= @old_slave_exec_mode; include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_idempotency.test b/mysql-test/suite/rpl/t/rpl_idempotency.test index fcfe6f65e6d..12dec236d45 100644 --- a/mysql-test/suite/rpl/t/rpl_idempotency.test +++ b/mysql-test/suite/rpl/t/rpl_idempotency.test @@ -77,9 +77,30 @@ SELECT * FROM t1 ORDER BY a; SELECT * FROM t2 ORDER BY a; --source include/check_slave_no_error.inc +connection slave; +drop table t1, t2; + connection master; DROP TABLE t1, t2; sync_slave_with_master; +--source include/check_slave_no_error.inc +create database d; +create database e; + +connection master; +create database d; +create database if not exists e; + +sync_slave_with_master; +--source include/check_slave_no_error.inc +drop database d; +drop database e; + +connection master; +drop database d; +drop database if exists e; +sync_slave_with_master; +--source include/check_slave_no_error.inc SET @@global.slave_exec_mode= @old_slave_exec_mode; diff --git a/mysql-test/suite/storage_engine/type_bool.result b/mysql-test/suite/storage_engine/type_bool.result index 87308ed63fc..10cfc08102f 100644 --- a/mysql-test/suite/storage_engine/type_bool.result +++ b/mysql-test/suite/storage_engine/type_bool.result @@ -42,8 +42,8 @@ b1 b2 0 0 INSERT INTO t1 (b1,b2) VALUES ('a','b'); Warnings: -Warning 1366 Incorrect integer value: 'a' for column 'b1' at row 1 -Warning 1366 Incorrect integer value: 'b' for column 'b2' at row 1 +Warning 1366 Incorrect integer value: 'a' for column `test`.`t1`.`b1` at row 1 +Warning 1366 Incorrect integer value: 'b' for column `test`.`t1`.`b2` at row 1 SELECT b1,b2 FROM t1; b1 b2 -1 -2 diff --git a/mysql-test/suite/vcol/r/upgrade.result b/mysql-test/suite/vcol/r/upgrade.result index 75684bf0e41..527bc5f3abf 100644 --- a/mysql-test/suite/vcol/r/upgrade.result +++ b/mysql-test/suite/vcol/r/upgrade.result @@ -16,3 +16,19 @@ select * from vcol_autoinc; pk v3 1 1 drop table vcol_autoinc; +check table t1 for upgrade; +Table Op Msg_type Msg_text +test.t1 check status OK +flush tables; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `Date` datetime(6) NOT NULL, + `Data` varbinary(2000) NOT NULL, + `a` varchar(100) GENERATED ALWAYS AS (column_get(`Data`,1 as char(100) charset latin1)) VIRTUAL, + PRIMARY KEY (`Date`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 + PARTITION BY RANGE (to_days(`Date`)) +(PARTITION `p20181029` VALUES LESS THAN (737361) ENGINE = MyISAM, + PARTITION `p20181128` VALUES LESS THAN (737391) ENGINE = MyISAM) +drop table t1; diff --git a/mysql-test/suite/vcol/t/upgrade.test b/mysql-test/suite/vcol/t/upgrade.test index 3e221747dfa..146495d8ed0 100644 --- a/mysql-test/suite/vcol/t/upgrade.test +++ b/mysql-test/suite/vcol/t/upgrade.test @@ -11,3 +11,18 @@ select * from vcol_autoinc; insert vcol_autoinc (pk) values (1); select * from vcol_autoinc; drop table vcol_autoinc; + +# +# MDEV-17909 Problem by MariaDB Update 10.1.32 -> 10.2.19 (Incorrect information in file: .frm) +# +source include/have_partition.inc; +copy_file std_data/mdev17909#P#p20181029.MYD $datadir/test/t1#P#p20181029.MYD; +copy_file std_data/mdev17909#P#p20181029.MYI $datadir/test/t1#P#p20181029.MYI; +copy_file std_data/mdev17909#P#p20181128.MYD $datadir/test/t1#P#p20181128.MYD; +copy_file std_data/mdev17909#P#p20181128.MYI $datadir/test/t1#P#p20181128.MYI; +copy_file std_data/mdev17909.frm $datadir/test/t1.frm; +copy_file std_data/mdev17909.par $datadir/test/t1.par; +check table t1 for upgrade; +flush tables; +show create table t1; +drop table t1; diff --git a/mysql-test/t/ps_error.test b/mysql-test/t/ps_error.test new file mode 100644 index 00000000000..5efb5d36137 --- /dev/null +++ b/mysql-test/t/ps_error.test @@ -0,0 +1,66 @@ +# +# Tests related to PS returning errors rather than doing successfull execution +# + +--echo # +--echo # MDEV-17741 Assertion `thd->Item_change_list::is_empty()' failed in mysql_parse after unsuccessful PS +--echo # + +SET SQL_MODE= 'STRICT_ALL_TABLES'; +CREATE TABLE t1 (a INT); +PREPARE stmt FROM "CREATE TABLE tmp AS SELECT * FROM t1 WHERE 'foo' && 0"; +--error ER_TRUNCATED_WRONG_VALUE +EXECUTE stmt; +SELECT a FROM t1 GROUP BY NULL WITH ROLLUP; +DROP TABLE t1; +SET sql_mode=DEFAULT; + +SET SQL_MODE= 'STRICT_ALL_TABLES'; +CREATE TABLE t1 (a INT); +PREPARE stmt FROM "CREATE TABLE tmp AS SELECT * FROM t1 WHERE 'foo' && 0"; +--error ER_TRUNCATED_WRONG_VALUE +EXECUTE stmt; +SET @a = REPLACE( @@global.optimizer_switch, '=on', '=off' ) ; +DROP TABLE t1; +SET sql_mode=DEFAULT; + + +--echo # +--echo # MDEV-17738 Server crashes in Item::delete_self on closing connection after unsuccessful PS +--echo # + +SET SQL_MODE='STRICT_ALL_TABLES'; +PREPARE stmt FROM "CREATE TABLE ps AS SELECT 1 FROM DUAL WHERE 'foo' && 0"; +--error ER_TRUNCATED_WRONG_VALUE +EXECUTE stmt; +--source include/restart_mysqld.inc +SELECT 'All done'; +SET SQL_MODE=DEFAULT; + +SET SQL_MODE='STRICT_ALL_TABLES'; +PREPARE stmt FROM "CREATE TABLE ps AS SELECT 1 FROM DUAL WHERE 'foo' && 0"; +--error ER_TRUNCATED_WRONG_VALUE +EXECUTE stmt; +DEALLOCATE PREPARE stmt; +SELECT 'All done'; +SET SQL_MODE=DEFAULT; + +SET SQL_MODE= 'STRICT_ALL_TABLES'; +CREATE TABLE t1 (a INT); +PREPARE stmt FROM "CREATE TABLE tmp AS SELECT * FROM t1 WHERE 'foo' && 0"; +--error ER_TRUNCATED_WRONG_VALUE +EXECUTE stmt; +SELECT a FROM t1 GROUP BY a; +SELECT * FROM t1; +DROP TABLE t1; +SET SQL_MODE=DEFAULT; + +SET SQL_MODE= 'STRICT_ALL_TABLES'; +CREATE TABLE t1 (a INT); +PREPARE stmt FROM "CREATE TABLE tmp AS SELECT * FROM t1 WHERE 'foo' && 0"; +--error ER_TRUNCATED_WRONG_VALUE +EXECUTE stmt; +SELECT a FROM t1 GROUP BY a; +INSERT t1 SELECT * FROM ( SELECT * FROM t1 ) sq; +DROP TABLE t1; +SET SQL_MODE=DEFAULT; |