summaryrefslogtreecommitdiff
path: root/mysql-test/t
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/t')
-rw-r--r--mysql-test/t/cast.test13
-rw-r--r--mysql-test/t/ctype_cp932_binlog_stm.test17
-rw-r--r--mysql-test/t/ctype_ucs2_query_cache-master.opt1
-rw-r--r--mysql-test/t/ctype_ucs2_query_cache.test19
-rw-r--r--mysql-test/t/ctype_utf8mb4.test15
-rw-r--r--mysql-test/t/empty_user_table.test20
-rw-r--r--mysql-test/t/func_group.test25
-rw-r--r--mysql-test/t/func_str.test12
-rw-r--r--mysql-test/t/gis-rtree.test20
-rw-r--r--mysql-test/t/grant_4332.test108
-rw-r--r--mysql-test/t/init_connection_query_cache-master.opt1
-rw-r--r--mysql-test/t/init_connection_query_cache.test26
-rw-r--r--mysql-test/t/innodb_ext_key.test123
-rw-r--r--mysql-test/t/join_nested.test24
-rw-r--r--mysql-test/t/join_outer.test48
-rw-r--r--mysql-test/t/join_outer_innodb.test23
-rw-r--r--mysql-test/t/log_slow.test14
-rw-r--r--mysql-test/t/myisam-metadata.test7
-rw-r--r--mysql-test/t/mysql_plugin.test66
-rw-r--r--mysql-test/t/mysqlshow.test6
-rw-r--r--mysql-test/t/select.test39
-rw-r--r--mysql-test/t/sp.test63
-rw-r--r--mysql-test/t/subselect_sj.test44
-rw-r--r--mysql-test/t/subselect_sj_mat.test19
-rw-r--r--mysql-test/t/type_datetime.test15
-rw-r--r--mysql-test/t/varbinary.test27
-rw-r--r--mysql-test/t/variables.test12
27 files changed, 742 insertions, 65 deletions
diff --git a/mysql-test/t/cast.test b/mysql-test/t/cast.test
index c39b7267f83..64e8225530b 100644
--- a/mysql-test/t/cast.test
+++ b/mysql-test/t/cast.test
@@ -412,6 +412,19 @@ WHERE CAST(a as BINARY)=x'62736D697468'
DROP TABLE t1;
+--echo #
+--echo # Bug#13581962 HIGH MEMORY USAGE ATTEMPT, THEN CRASH WITH
+--echo # LONGTEXT, UNION, USER VARIABLE
+--echo # Bug#14096619 UNABLE TO RESTORE DATABASE DUMP
+--echo #
+
+CREATE TABLE t1 AS SELECT CONCAT(CAST(REPEAT('9', 1000) AS SIGNED)),
+ CONCAT(CAST(REPEAT('9', 1000) AS UNSIGNED));
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+--echo # End of test for Bug#13581962, Bug#14096619
+
--echo End of 5.1 tests
select cast("2101-00-01 02:03:04" as datetime);
diff --git a/mysql-test/t/ctype_cp932_binlog_stm.test b/mysql-test/t/ctype_cp932_binlog_stm.test
index 167840a649c..a83f48b1439 100644
--- a/mysql-test/t/ctype_cp932_binlog_stm.test
+++ b/mysql-test/t/ctype_cp932_binlog_stm.test
@@ -141,6 +141,23 @@ SELECT HEX(a), HEX(CONVERT(a using cp932)) as b FROM t1 HAVING b<>'3F' ORDER BY
DROP TABLE t1;
+--echo #
+--echo # Bug#MDEV-4489 Replication of big5, cp932, gbk, sjis strings makes wrong values on slave
+--echo #
+let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
+SET NAMES cp932;
+CREATE TABLE t1 (a INT);
+SHOW CREATE TABLE t1;
+INSERT INTO t1 VALUES (0x31);
+INSERT INTO t1 VALUES (X'31');
+PREPARE stmt FROM 'INSERT INTO t1 (a) VALUES (?)';
+SET @a='1';
+SELECT charset(@a);
+EXECUTE stmt USING @a;
+DROP PREPARE stmt;
+DROP TABLE t1;
+--source include/show_binlog_events.inc
+
--echo #
--echo # End of 5.5 tests
diff --git a/mysql-test/t/ctype_ucs2_query_cache-master.opt b/mysql-test/t/ctype_ucs2_query_cache-master.opt
new file mode 100644
index 00000000000..413ebb9f898
--- /dev/null
+++ b/mysql-test/t/ctype_ucs2_query_cache-master.opt
@@ -0,0 +1 @@
+--collation-server=ucs2_unicode_ci --character-set-server=ucs2,latin1 --query-cache-size=1048576
diff --git a/mysql-test/t/ctype_ucs2_query_cache.test b/mysql-test/t/ctype_ucs2_query_cache.test
new file mode 100644
index 00000000000..bdc1d079d5e
--- /dev/null
+++ b/mysql-test/t/ctype_ucs2_query_cache.test
@@ -0,0 +1,19 @@
+-- source include/have_query_cache.inc
+-- source include/have_ucs2.inc
+
+--echo #
+--echo # Start of 5.5 tests
+--echo #
+
+--echo #
+--echo # Bug#MDEV-4518 Server crashes in is_white_space when it's run
+--echo # with query cache, charset ucs2 and collation ucs2_unicode_ci
+--echo #
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1),(2),(3),(4);
+SELECT * FROM t1;
+DROP TABLE t1;
+
+--echo #
+--echo # End of 5.5 tests
+--echo #
diff --git a/mysql-test/t/ctype_utf8mb4.test b/mysql-test/t/ctype_utf8mb4.test
index 03696f385b5..fda20ca0ec5 100644
--- a/mysql-test/t/ctype_utf8mb4.test
+++ b/mysql-test/t/ctype_utf8mb4.test
@@ -1812,6 +1812,21 @@ SHOW CREATE TABLE t2;
DROP TABLE t1, t2;
--echo #
+--echo # Bug#13581962 HIGH MEMORY USAGE ATTEMPT, THEN CRASH WITH
+--echo # LONGTEXT, UNION, USER VARIABLE
+--echo # Bug#14096619 UNABLE TO RESTORE DATABASE DUMP
+--echo #
+
+CREATE TABLE t1(f1 LONGTEXT CHARACTER SET utf8mb4);
+INSERT INTO t1 VALUES ('a');
+SELECT @a:= CAST(f1 AS SIGNED) FROM t1
+UNION ALL
+SELECT CAST(f1 AS SIGNED) FROM t1;
+DROP TABLE t1;
+
+--echo # End of test for Bug#13581962,Bug#14096619
+
+--echo #
--echo # End of 5.5 tests
--echo #
diff --git a/mysql-test/t/empty_user_table.test b/mysql-test/t/empty_user_table.test
new file mode 100644
index 00000000000..b54f2109e30
--- /dev/null
+++ b/mysql-test/t/empty_user_table.test
@@ -0,0 +1,20 @@
+#
+# MDEV-4462 mysqld gets SIGFPE when mysql.user table is empty
+#
+
+source include/not_embedded.inc;
+
+create table t1 as select * from mysql.user;
+truncate table mysql.user;
+flush privileges;
+
+# connecting via unix socket gives ER_ACCESS_DENIED_ERROR
+# connecting via tcp/ip gives ER_HOST_NOT_PRIVILEGED
+--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
+--error ER_ACCESS_DENIED_ERROR,ER_HOST_NOT_PRIVILEGED
+connect (fail,localhost,u1);
+
+insert mysql.user select * from t1;
+drop table t1;
+flush privileges;
+
diff --git a/mysql-test/t/func_group.test b/mysql-test/t/func_group.test
index 97766fefa91..a5c35c0dff2 100644
--- a/mysql-test/t/func_group.test
+++ b/mysql-test/t/func_group.test
@@ -1380,7 +1380,30 @@ insert into t1 values (1, '2008-10-02'), (2, '2010-12-12');
select avg(export_set( 3, 'y', sha(i))), group_concat(d) from t1 group by d order by i;
drop table t1;
-#### End of 5.3 tests
+--echo #
+--echo # MDEV-4290: crash in st_select_lex::mark_as_dependent
+--echo #
+create table `t1`(`a` int);
+
+--error ER_INVALID_GROUP_FUNC_USE
+select 1 from t1 v1 right join t1 on count(*);
+--error ER_INVALID_GROUP_FUNC_USE
+select 1 from t1 order by
+(
+ select 1 from
+ (
+ select 1 from t1 v1 right join t1 on count(*)
+ ) v
+);
+insert into t1 values (1),(1),(2),(2);
+select count(*) from t1;
+select z from (select count(*) as z from t1) v;
+--echo # next is how it implemented now (may be changed in case of dependent
+--echo # derived tables)
+select z from (select count(*) as z from t1) v group by 1;
+drop table t1;
+
+--echo # end of 5.3 tests
--echo #
--echo # Bug#52123 Assertion failed: aggregator == aggr->Aggrtype(),
diff --git a/mysql-test/t/func_str.test b/mysql-test/t/func_str.test
index f245b4f9f78..1a60b0c222a 100644
--- a/mysql-test/t/func_str.test
+++ b/mysql-test/t/func_str.test
@@ -1538,6 +1538,18 @@ create table t1(a int) select null;
select 1 div convert(a using utf8) from t1;
drop table t1;
+#
+# BUG#11757250: REPLACE(...) INSIDE A STORED PROCEDURE.
+#
+create table t1 (a int);
+create table t2 (a int);
+create procedure foo (var char(100))
+ select replace(var, '00000000', table_name)
+ from information_schema.tables where table_schema='test';
+--sorted_result
+call foo('(( 00000000 ++ 00000000 ))');
+drop procedure foo;
+drop table t1,t2;
--echo #
--echo # End of 5.5 tests
diff --git a/mysql-test/t/gis-rtree.test b/mysql-test/t/gis-rtree.test
index 731efe5648e..404f0447f56 100644
--- a/mysql-test/t/gis-rtree.test
+++ b/mysql-test/t/gis-rtree.test
@@ -956,3 +956,23 @@ SELECT a, ASTEXT(b) FROM t1;
DROP TABLE t1;
--echo End of 5.1 tests
+
+#
+# MDEV-4521 MBRContains, MBRWithin no longer work with geometries of different type.
+#
+CREATE TABLE t1 (
+ l LINESTRING NOT NULL,
+ SPATIAL KEY(l)
+) ENGINE = myisam;
+
+INSERT INTO t1 VALUES(GeomFromText('LINESTRING(0 0, 1 1)'));
+INSERT INTO t1 VALUES(GeomFromText('LINESTRING(1 1, 2 2)'));
+INSERT INTO t1 VALUES(GeomFromText('LINESTRING(2 2, 3 3)'));
+
+SELECT COUNT(*) FROM t1 IGNORE INDEX(l) WHERE MBRContains(l, GEOMFROMTEXT('POINT(0 0)'));
+SELECT COUNT(*) FROM t1 IGNORE INDEX(l) WHERE MBRWithin(GEOMFROMTEXT('POINT(0 0)'), l);
+
+SELECT COUNT(*) FROM t1 FORCE INDEX(l) WHERE MBRContains(l, GEOMFROMTEXT('POINT(0 0)'));
+SELECT COUNT(*) FROM t1 FORCE INDEX(l) WHERE MBRWithin(GEOMFROMTEXT('POINT(0 0)'), l);
+
+DROP TABLE t1;
diff --git a/mysql-test/t/grant_4332.test b/mysql-test/t/grant_4332.test
new file mode 100644
index 00000000000..f77d3be350f
--- /dev/null
+++ b/mysql-test/t/grant_4332.test
@@ -0,0 +1,108 @@
+#
+# MDEV-4332 Increase username length from 16 characters
+#
+
+# user names here have the pattern
+# <letter><length><more letters>0
+# where '0' at the end is the end-of-name marker
+
+--source include/not_embedded.inc
+
+--enable_metadata
+select user();
+--disable_metadata
+
+--error ER_WRONG_STRING_LENGTH
+create user a17aaaaaaaaaaaaa0@localhost;
+
+alter table mysql.user modify User char(80) binary not null default '';
+alter table mysql.db modify User char(80) binary not null default '';
+alter table mysql.tables_priv modify User char(80) binary not null default '';
+alter table mysql.columns_priv modify User char(80) binary not null default '';
+alter table mysql.procs_priv modify User char(80) binary not null default '';
+alter table mysql.proc modify definer char(141) collate utf8_bin not null default '';
+alter table mysql.event modify definer char(141) collate utf8_bin not null default '';
+
+--source include/restart_mysqld.inc
+
+set global event_scheduler = on;
+
+--enable_metadata
+select user();
+--disable_metadata
+
+create user a17aaaaaaaaaaaaa0@localhost;
+grant usage on *.* to a17aaaaaaaaaaaaa0@localhost;
+grant select on mysql.user to b64bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb0@localhost;
+grant select(User) on mysql.tables_priv to c80cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc0@localhost;
+
+connect (a17,localhost,a17aaaaaaaaaaaaa0,,);
+connect (b64,localhost,b64bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb0,,);
+connect (c80,localhost,c80cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc0,,);
+
+connection a17;
+select user(), current_user();
+show grants;
+
+connection b64;
+select user(), current_user();
+show grants;
+select user,host from mysql.user where user like '%0';
+--error ER_TABLEACCESS_DENIED_ERROR
+select user,host from mysql.db;
+
+connection c80;
+select user(), current_user();
+show grants;
+select user from mysql.tables_priv;
+--error ER_COLUMNACCESS_DENIED_ERROR
+select user,host from mysql.tables_priv;
+
+create procedure test.p1() select user(), current_user(), user from mysql.tables_priv;
+
+show create procedure test.p1;
+
+create table test.t1 (a text);
+create event e1 on schedule every 1 second
+ do insert test.t1 values (concat(user(), ' ', current_user()));
+
+connection default;
+
+call test.p1();
+
+disconnect a17;
+disconnect b64;
+disconnect c80;
+
+let $wait_timeout= 10;
+let $wait_condition= SELECT 1 from t1;
+--source include/wait_condition.inc
+
+select * from t1 limit 1;
+--error ER_WRONG_STRING_LENGTH
+grant usage on *.* to d81ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd0@lodalhost;
+
+--error ER_WRONG_STRING_LENGTH
+drop user d81ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd0@lodalhost;
+drop user c80cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc0@localhost;
+drop user b64bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb0@localhost;
+drop user a17aaaaaaaaaaaaa0@localhost;
+
+set global event_scheduler = off;
+drop event e1;
+drop procedure test.p1;
+drop table t1;
+
+alter table mysql.user modify User char(16) binary not null default '';
+alter table mysql.db modify User char(16) binary not null default '';
+alter table mysql.tables_priv modify User char(16) binary not null default '';
+alter table mysql.columns_priv modify User char(16) binary not null default '';
+alter table mysql.procs_priv modify User char(16) binary not null default '';
+alter table mysql.proc modify definer char(77) collate utf8_bin not null default '';
+alter table mysql.event modify definer char(77) collate utf8_bin not null default '';
+flush privileges;
+
+--enable_metadata
+select user();
+--disable_metadata
+
diff --git a/mysql-test/t/init_connection_query_cache-master.opt b/mysql-test/t/init_connection_query_cache-master.opt
new file mode 100644
index 00000000000..7bef2af8d35
--- /dev/null
+++ b/mysql-test/t/init_connection_query_cache-master.opt
@@ -0,0 +1 @@
+--init_connect="select * from test.t1 where 0"
diff --git a/mysql-test/t/init_connection_query_cache.test b/mysql-test/t/init_connection_query_cache.test
new file mode 100644
index 00000000000..4d83304163e
--- /dev/null
+++ b/mysql-test/t/init_connection_query_cache.test
@@ -0,0 +1,26 @@
+-- source include/have_query_cache.inc
+
+--echo #
+--echo # MDEV-4520: Assertion `0' fails in Query_cache::end_of_result on
+--echo # concurrent drop event and event execution
+--echo #
+set GLOBAL query_cache_size=1355776;
+
+create user mysqltest1@localhost;
+grant SELECT on test.* to mysqltest1@localhost;
+
+create table t1 (a int);
+
+connect (con1,localhost,mysqltest1,,);
+connection con1;
+--echo # This explain put here to be sure that init connection query
+--echo # has 'Impossible WHERE'.
+explain extended select * from test.t1 where 0;
+connection default;
+disconnect con1;
+revoke all privileges, grant option from mysqltest1@localhost;
+drop user mysqltest1@localhost;
+
+drop table t1;
+
+set GLOBAL query_cache_size=default;
diff --git a/mysql-test/t/innodb_ext_key.test b/mysql-test/t/innodb_ext_key.test
index 31c6fca2b95..36414105917 100644
--- a/mysql-test/t/innodb_ext_key.test
+++ b/mysql-test/t/innodb_ext_key.test
@@ -539,6 +539,129 @@ select * from t1, t3 where t3.col1=t1.a and t3.col2=t1.a and t3.pk1=t1.a;
drop table t1,t2,t3;
+--echo #
+--echo # Bug mdev-4340: performance regression with extended_keys=on
+--echo #
+
+set @save_optimizer_switch=@@optimizer_switch;
+
+CREATE TABLE t1 (
+ page_id int(8) unsigned NOT NULL AUTO_INCREMENT,
+ page_namespace int(11) NOT NULL DEFAULT '0',
+ page_title varbinary(255) NOT NULL DEFAULT '',
+ page_restrictions tinyblob NOT NULL,
+ page_counter bigint(20) unsigned NOT NULL DEFAULT '0',
+ page_is_redirect tinyint(1) unsigned NOT NULL DEFAULT '0',
+ page_is_new tinyint(1) unsigned NOT NULL DEFAULT '0',
+ page_random double unsigned NOT NULL DEFAULT '0',
+ page_touched varbinary(14) NOT NULL DEFAULT '',
+ page_latest int(8) unsigned NOT NULL DEFAULT '0',
+ page_len int(8) unsigned NOT NULL DEFAULT '0',
+ PRIMARY KEY (page_id),
+ UNIQUE KEY name_title (page_namespace,page_title),
+ KEY page_random (page_random),
+ KEY page_len (page_len),
+ KEY page_redirect_namespace_len (page_is_redirect,page_namespace,page_len)
+) ENGINE=InnoDB AUTO_INCREMENT=38929100 DEFAULT CHARSET=binary;
+INSERT INTO t1 VALUES
+(38928077,0,'Sandbox','',0,0,0,0,'',0,0),(38928078,1,'Sandbox','',0,0,0,1,'',0,0),
+(38928079,2,'Sandbox','',0,0,0,2,'',0,0),(38928080,3,'Sandbox','',0,0,0,3,'',0,0),
+(38928081,4,'Sandbox','',0,0,0,4,'',0,0),(38928082,5,'Sandbox','',0,0,0,5,'',0,0);
+
+CREATE TABLE t2 (
+ rev_id int(8) unsigned NOT NULL AUTO_INCREMENT,
+ rev_page int(8) unsigned NOT NULL DEFAULT '0',
+ rev_text_id int(8) unsigned NOT NULL DEFAULT '0',
+ rev_comment varbinary(255) DEFAULT NULL,
+ rev_user int(5) unsigned NOT NULL DEFAULT '0',
+ rev_user_text varbinary(255) NOT NULL DEFAULT '',
+ rev_timestamp varbinary(14) NOT NULL DEFAULT '',
+ rev_minor_edit tinyint(1) unsigned NOT NULL DEFAULT '0',
+ rev_deleted tinyint(1) unsigned NOT NULL DEFAULT '0',
+ rev_len int(8) unsigned DEFAULT NULL,
+ rev_parent_id int(8) unsigned DEFAULT NULL,
+ rev_sha1 varbinary(32) NOT NULL DEFAULT '',
+ PRIMARY KEY (rev_page,rev_id),
+ UNIQUE KEY rev_id (rev_id),
+ KEY rev_timestamp (rev_timestamp),
+ KEY page_timestamp (rev_page,rev_timestamp),
+ KEY user_timestamp (rev_user,rev_timestamp),
+ KEY usertext_timestamp (rev_user_text,rev_timestamp,rev_user,rev_deleted,rev_minor_edit,rev_text_id,rev_comment)
+) ENGINE=InnoDB DEFAULT CHARSET=binary;
+INSERT INTO t2 VALUES
+(547116222,20,0,NULL,3,'','',0,0,NULL,NULL,''),(547117245,20,0,NULL,4,'','',0,0,NULL,NULL,''),
+(547118268,20,0,NULL,5,'','',0,0,NULL,NULL,''),(547114177,21,0,NULL,1,'','',0,0,NULL,NULL,''),
+(547115200,21,0,NULL,2,'','',0,0,NULL,NULL,''),(547116223,21,0,NULL,3,'','',0,0,NULL,NULL,''),
+(547117246,21,0,NULL,4,'','',0,0,NULL,NULL,''),(547118269,21,0,NULL,5,'','',0,0,NULL,NULL,''),
+(547114178,22,0,NULL,1,'','',0,0,NULL,NULL,''),(547115201,22,0,NULL,2,'','',0,0,NULL,NULL,''),
+(547116224,22,0,NULL,3,'','',0,0,NULL,NULL,''),(547117247,22,0,NULL,4,'','',0,0,NULL,NULL,''),
+(547116226,24,0,NULL,3,'','',0,0,NULL,NULL,''),(547117249,24,0,NULL,4,'','',0,0,NULL,NULL,''),
+(547118272,24,0,NULL,5,'','',0,0,NULL,NULL,''),(547114181,25,0,NULL,1,'','',0,0,NULL,NULL,''),
+(547115204,25,0,NULL,2,'','',0,0,NULL,NULL,''),(547116227,25,0,NULL,3,'','',0,0,NULL,NULL,''),
+(547116157,978,0,NULL,2,'','',0,0,NULL,NULL,''),(547117180,978,0,NULL,3,'','',0,0,NULL,NULL,''),
+(547118203,978,0,NULL,4,'','',0,0,NULL,NULL,''),(547119226,978,0,NULL,5,'','',0,0,NULL,NULL,''),
+(547115135,979,0,NULL,1,'','',0,0,NULL,NULL,''),(547116158,979,0,NULL,2,'','',0,0,NULL,NULL,''),
+(547116173,994,0,NULL,2,'','',0,0,NULL,NULL,''),(547117196,994,0,NULL,3,'','',0,0,NULL,NULL,''),
+(547118219,994,0,NULL,4,'','',0,0,NULL,NULL,''),(547119242,994,0,NULL,5,'','',0,0,NULL,NULL,''),
+(547115151,995,0,NULL,1,'','',0,0,NULL,NULL,''),(547116174,995,0,NULL,2,'','',0,0,NULL,NULL,''),
+(547117197,995,0,NULL,3,'','',0,0,NULL,NULL,''),(547118220,995,0,NULL,4,'','',0,0,NULL,NULL,''),
+(547118223,998,0,NULL,4,'','',0,0,NULL,NULL,''),(547119246,998,0,NULL,5,'','',0,0,NULL,NULL,''),
+(547115155,999,0,NULL,1,'','',0,0,NULL,NULL,''),(547116178,999,0,NULL,2,'','',0,0,NULL,NULL,''),
+(547117201,999,0,NULL,3,'','',0,0,NULL,NULL,''),(547118224,999,0,NULL,4,'','',0,0,NULL,NULL,''),
+(547119271,38928081,0,NULL,10,'','',0,0,NULL,NULL,''),(547119272,38928081,0,NULL,11,'','',0,0,NULL,NULL,''),
+(547119273,38928081,0,NULL,12,'','',0,0,NULL,NULL,''),(547119274,38928081,0,NULL,13,'','',0,0,NULL,NULL,''),
+(547119275,38928081,0,NULL,14,'','',0,0,NULL,NULL,''),(547119276,38928081,0,NULL,15,'','',0,0,NULL,NULL,''),
+(547119277,38928081,0,NULL,16,'','',0,0,NULL,NULL,''),(547119278,38928081,0,NULL,17,'','',0,0,NULL,NULL,''),
+(547119279,38928081,0,NULL,18,'','',0,0,NULL,NULL,''),(547119280,38928081,0,NULL,19,'','',0,0,NULL,NULL,'');
+
+CREATE TABLE t3 (
+ old_id int(10) unsigned NOT NULL AUTO_INCREMENT,
+ old_text mediumblob NOT NULL,
+ old_flags tinyblob NOT NULL,
+ PRIMARY KEY (old_id)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+INSERT INTO t3 VALUES
+(1,'text-0',''),(2,'text-1000',''),(3,'text-2000',''),(4,'text-3000',''),
+(5,'text-4000',''),(6,'text-5000',''),(7,'text-6000',''),(8,'text-7000',''),
+(9,'text-8000',''),(10,'text-9000',''),(11,'text-1',''),(12,'text-1001',''),
+(13,'text-2001',''),(14,'text-3001',''),(15,'text-4001',''),(16,'text-5001',''),
+(17,'text-6001',''),(18,'text-7001',''),(19,'text-8001',''),(20,'text-9001',''),
+(21,'text-2',''),(22,'text-1002',''),(23,'text-2002',''),(24,'text-3002',''),
+(25,'text-4002',''),(26,'text-5002',''),(27,'text-6002',''),(28,'text-7002',''),
+(29,'text-8002',''),(30,'text-9002',''),(31,'text-3',''),(32,'text-1003',''),
+(33,'text-2003',''),(34,'text-3003',''),(35,'text-4003',''),(36,'text-5003',''),
+(37,'text-6003',''),(38,'text-7003',''),(39,'text-8003',''),(40,'text-9003',''),
+(41,'text-4',''),(42,'text-1004',''),(43,'text-2004',''),(44,'text-3004',''),
+(45,'text-4004',''),(46,'text-5004',''),(47,'text-6004',''),(48,'text-7004',''),
+(49,'text-8004',''),(50,'text-9004',''),(51,'text-5',''),(52,'text-1005',''),
+(53,'text-2005',''),(54,'text-3005',''),(55,'text-4005',''),(56,'text-5005',''),
+(57,'text-6005',''),(58,'text-7005',''),(59,'text-8005',''),(60,'text-9005',''),
+(61,'text-6',''),(62,'text-1006',''),(63,'text-2006',''),(64,'text-3006',''),
+(65,'text-4006',''),(66,'text-5006',''),(67,'text-6006',''),(68,'text-7006',''),
+(69,'text-8006',''),(70,'text-9006',''),(71,'text-7',''),(72,'text-1007',''),
+(73,'text-2007',''),(74,'text-3007',''),(75,'text-4007',''),(76,'text-5007',''),
+(77,'text-6007',''),(78,'text-7007',''),(79,'text-8007',''),(80,'text-9007',''),
+(81,'text-8',''),(82,'text-1008',''),(83,'text-2008',''),(84,'text-3008',''),
+(85,'text-4008',''),(86,'text-5008',''),(87,'text-6008',''),(88,'text-7008',''),
+(89,'text-8008',''),(90,'text-9008',''),(91,'text-9',''),(92,'text-1009',''),
+(93,'text-2009',''),(94,'text-3009',''),(95,'text-4009',''),(96,'text-5009',''),
+(97,'text-6009',''),(98,'text-7009',''),(99,'text-8009',''),(100,'text-9009','');
+
+
+set optimizer_switch='extended_keys=off';
+EXPLAIN
+SELECT * FROM t1, t2 IGNORE INDEX (PRIMARY), t3
+ WHERE page_id=rev_page AND rev_text_id=old_id AND page_namespace=4 AND page_title='Sandbox'
+ORDER BY rev_timestamp ASC LIMIT 10;
+
+set optimizer_switch='extended_keys=on';
+EXPLAIN
+SELECT * FROM t1, t2 IGNORE INDEX (PRIMARY), t3
+ WHERE page_id=rev_page AND rev_text_id=old_id AND page_namespace=4 AND page_title='Sandbox'
+ORDER BY rev_timestamp ASC LIMIT 10;
+
+DROP TABLE t1,t2,t3;
+
set optimizer_switch=@save_optimizer_switch;
set optimizer_switch=@save_ext_key_optimizer_switch;
diff --git a/mysql-test/t/join_nested.test b/mysql-test/t/join_nested.test
index 3168e95f620..7b7d9236835 100644
--- a/mysql-test/t/join_nested.test
+++ b/mysql-test/t/join_nested.test
@@ -1287,3 +1287,27 @@ SET optimizer_switch=@save_optimizer_switch;
--echo End of 5.0 tests
+--echo #
+--echo # MDEV-621: LP:693329 - Assertion `!is_interleave_error' failed on low optimizer_search_depth
+--echo #
+set @tmp_mdev621= @@optimizer_search_depth;
+SET SESSION optimizer_search_depth = 4;
+
+CREATE TABLE t1 (f1 int,f2 int,f3 int,f4 int) ;
+INSERT IGNORE INTO t1 VALUES (0,0,2,0),(NULL,0,2,0);
+CREATE TABLE t2 (f1 int) ;
+CREATE TABLE t3 (f3 int,PRIMARY KEY (f3)) ;
+CREATE TABLE t4 (f5 int) ;
+CREATE TABLE t5 (f2 int) ;
+
+SELECT alias2.f4 FROM t1 AS alias1
+LEFT JOIN t1 AS alias2
+ LEFT JOIN t2 AS alias3
+ LEFT JOIN t3 AS alias4 ON alias3.f1 = alias4.f3
+ ON alias2.f1
+LEFT JOIN t4 AS alias5
+ JOIN t5 ON alias5.f5
+ON alias2.f3 ON alias1.f2;
+DROP TABLE t1,t2,t3,t4,t5;
+set optimizer_search_depth= @tmp_mdev621;
+
diff --git a/mysql-test/t/join_outer.test b/mysql-test/t/join_outer.test
index 44f4afd451b..24885c056b8 100644
--- a/mysql-test/t/join_outer.test
+++ b/mysql-test/t/join_outer.test
@@ -1439,6 +1439,37 @@ GROUP BY t2.f1, t2.f2;
DROP TABLE t1,t2;
+--echo #
+--echo # Bug#13068506 - QUERY WITH GROUP BY ON NON-AGGR COLUMN RETURNS
+--echo # WRONG RESULT
+--echo #
+
+CREATE TABLE t1 (i1 int);
+INSERT INTO t1 VALUES (100), (101);
+
+CREATE TABLE t2 (i2 int, i3 int);
+INSERT INTO t2 VALUES (20,1),(10,2);
+
+CREATE TABLE t3 (i4 int(11));
+INSERT INTO t3 VALUES (1),(2);
+
+let $query= SELECT (
+ SELECT MAX( t2.i2 )
+ FROM t3 RIGHT JOIN t2 ON ( t2.i3 = 2 )
+ WHERE t2.i3 <> t1.i1
+) AS field1
+FROM t1;
+
+--echo
+--eval $query;
+--echo
+--eval $query GROUP BY field1;
+
+--echo
+drop table t1,t2,t3;
+
+--echo # End of test for Bug#13068506
+
--echo End of 5.1 tests
--echo #
@@ -1622,4 +1653,21 @@ ORDER BY t1.b;
DROP TABLE t1,t2;
+--echo #
+--echo # Bug mdev-4336: LEFT JOIN with disjunctive
+--echo # <non-nullable datetime field> IS NULL in WHERE
+--echo # causes a hang and eventual crash
+--echo #
+
+CREATE TABLE t1 (
+ id int(11) NOT NULL,
+ modified datetime NOT NULL,
+ PRIMARY KEY (id)
+);
+
+SELECT a.* FROM t1 a LEFT JOIN t1 b ON a.id = b.id
+ WHERE a.modified > b.modified or b.modified IS NULL;
+
+DROP TABLE t1;
+
SET optimizer_switch=@save_optimizer_switch;
diff --git a/mysql-test/t/join_outer_innodb.test b/mysql-test/t/join_outer_innodb.test
index adb555d5f85..539d85a8b11 100644
--- a/mysql-test/t/join_outer_innodb.test
+++ b/mysql-test/t/join_outer_innodb.test
@@ -350,3 +350,26 @@ explain select * from v1;
drop view v1;
drop table t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16;
+
+
+--echo #
+--echo # MDEV-4270: crash in fix_semijoin_strategies_for_picked_join_order
+--echo #
+drop table if exists t1,t2,t3;
+create table t2(a int,unique key (a)) engine=innodb;
+create table t3(b int) engine=innodb;
+create table t1(a int,b int)engine=innodb;
+
+set @mdev4270_opl= @@optimizer_prune_level;
+set @mdev4270_osd= @@optimizer_search_depth;
+set optimizer_prune_level=0;
+set optimizer_search_depth=2;
+
+select 1 from t1 join t2 a
+natural left join t2 b
+natural right outer join t3;
+
+drop table t1,t2,t3;
+set optimizer_prune_level=@mdev4270_opl;
+set optimizer_search_depth=@mdev4270_osd;
+
diff --git a/mysql-test/t/log_slow.test b/mysql-test/t/log_slow.test
index af8a948d318..8d5a09d7a94 100644
--- a/mysql-test/t/log_slow.test
+++ b/mysql-test/t/log_slow.test
@@ -6,6 +6,7 @@ select @@log_slow_filter;
select @@log_slow_rate_limit;
select @@log_slow_verbosity;
show variables like "log_slow%";
+set @org_slow_query_log= @@global.slow_query_log;
# Some simple test to set log_slow_filter
set @@log_slow_filter= "filesort,filesort_on_disk,full_join,full_scan,query_cache,query_cache_miss,tmp_table,tmp_table_on_disk,admin";
@@ -42,7 +43,18 @@ show fields from mysql.slow_log;
flush slow logs;
-# Reset used variables
+# MDEV-4206 (empty filter should be no filter)
+set long_query_time=0.1;
+set log_slow_filter='';
+set global slow_query_log=1;
+set global log_output='TABLE';
+select sleep(0.5);
+select count(*) FROM mysql.slow_log;
+truncate mysql.slow_log;
+# Reset used variables
+set @@long_query_time=default;
+set global slow_query_log= @org_slow_query_log;
set @@log_slow_filter=default;
set @@log_slow_verbosity=default;
+set global log_output= default;
diff --git a/mysql-test/t/myisam-metadata.test b/mysql-test/t/myisam-metadata.test
index 2bbcc89a702..609cf5d8c5e 100644
--- a/mysql-test/t/myisam-metadata.test
+++ b/mysql-test/t/myisam-metadata.test
@@ -30,16 +30,11 @@ while ($1)
--enable_query_log
--connect(con1,localhost,root,,)
-SET debug_sync= 'myisam_after_repair_by_sort SIGNAL waiting WAIT_FOR go';
+SET debug_sync= 'myisam_before_repair_by_sort SIGNAL waiting WAIT_FOR go';
send
ALTER TABLE t1 ENABLE KEYS;
--connection default
---let $wait_timeout=60
---let $show_statement= SHOW PROCESSLIST
---let $field= State
---let $condition= = 'Repair by sorting'
---source include/wait_show_condition.inc
SET debug_sync= 'now WAIT_FOR waiting';
SET debug_sync= 'now SIGNAL go';
diff --git a/mysql-test/t/mysql_plugin.test b/mysql-test/t/mysql_plugin.test
index a05b5a624d9..10bc03e0f06 100644
--- a/mysql-test/t/mysql_plugin.test
+++ b/mysql-test/t/mysql_plugin.test
@@ -110,13 +110,8 @@ SELECT * FROM mysql.plugin WHERE dl like 'libdaemon%' ORDER BY name;
--echo #
--echo # Enable the plugin...
--echo #
-let $expect_file= $MYSQLTEST_VARDIR/tmp/mysqld.1.expect;
-# MTR will remove this file later, but this might be too late.
---error 0,1
---remove_file $expect_file
---write_file $expect_file
-wait
-EOF
+
+--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--shutdown_server 10
--source include/wait_until_disconnected.inc
@@ -132,9 +127,8 @@ EOF
#
# Restart the server
#
---append_file $expect_file
-restart
-EOF
+
+--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--enable_reconnect
--source include/wait_until_connected_again.inc
@@ -155,12 +149,7 @@ eval INSERT INTO mysql.plugin VALUES ('wonky', '$DAEMONEXAMPLE');
--replace_regex /\.dll/.so/
SELECT * FROM mysql.plugin WHERE dl like 'libdaemon%' ORDER BY name;
-# MTR will remove this file later, but this might be too late.
---error 0,1
---remove_file $expect_file
---write_file $expect_file
-wait
-EOF
+--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--shutdown_server 10
--source include/wait_until_disconnected.inc
@@ -177,9 +166,7 @@ EOF
#
# Restart the server
#
---append_file $expect_file
-restart
-EOF
+--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--enable_reconnect
--source include/wait_until_connected_again.inc
@@ -189,12 +176,7 @@ EOF
--replace_regex /\.dll/.so/
SELECT * FROM mysql.plugin WHERE dl like '%libdaemon%' ORDER BY name;
-# MTR will remove this file later, but this might be too late.
---error 0,1
---remove_file $expect_file
---write_file $expect_file
-wait
-EOF
+--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--shutdown_server 10
--source include/wait_until_disconnected.inc
@@ -211,9 +193,7 @@ let $DAEMON_RELOAD = lib$DAEMONEXAMPLE;
#
# Restart the server
#
---append_file $expect_file
-restart
-EOF
+--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--enable_reconnect
--source include/wait_until_connected_again.inc
@@ -226,12 +206,8 @@ SELECT * FROM mysql.plugin WHERE dl like '%libdaemon%' ORDER BY name;
--echo #
--echo # Disable the plugin...
--echo #
-# MTR will remove this file later, but this might be too late.
---error 0,1
---remove_file $expect_file
---write_file $expect_file
-wait
-EOF
+
+--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--shutdown_server 10
--source include/wait_until_disconnected.inc
@@ -248,9 +224,7 @@ EOF
#
# Restart the server
#
---append_file $expect_file
-restart
-EOF
+--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--enable_reconnect
--source include/wait_until_connected_again.inc
@@ -262,13 +236,8 @@ SELECT * FROM mysql.plugin WHERE dl like '%libdaemon%' ORDER BY name;
#
# Stop the server for error conditions
#
-let $expect_file= $MYSQLTEST_VARDIR/tmp/mysqld.1.expect;
-# MTR will remove this file later, but this might be too late.
---error 0,1
---remove_file $expect_file
---write_file $expect_file
-wait
-EOF
+
+--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--shutdown_server 10
--source include/wait_until_disconnected.inc
@@ -382,17 +351,14 @@ replace_result $MYSQL_PLUGIN mysql_plugin;
#
# Restart the server
#
---append_file $expect_file
-restart
-EOF
+--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--enable_reconnect
--source include/wait_until_connected_again.inc
#
# Cleanup
-# MTR will remove this file later, but this might be too late.
---error 0,1
---remove_file $expect_file
+
+--remove_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
# Cleanup the share folder in the binary path.
--remove_file $MYSQLD_BASEDIR/share/errmsg.sys
diff --git a/mysql-test/t/mysqlshow.test b/mysql-test/t/mysqlshow.test
index 045329fd2e0..8c60b64a5f1 100644
--- a/mysql-test/t/mysqlshow.test
+++ b/mysql-test/t/mysqlshow.test
@@ -36,7 +36,7 @@ DROP TABLE t1, t2;
#
# Bug #19147: mysqlshow INFORMATION_SCHEMA does not work
#
-# --exec $MYSQL_SHOW information_schema
-# --exec $MYSQL_SHOW INFORMATION_SCHEMA
-# --exec $MYSQL_SHOW inf_rmation_schema
+#--exec $MYSQL_SHOW information_schema
+#--exec $MYSQL_SHOW INFORMATION_SCHEMA
+#--exec $MYSQL_SHOW inf_rmation_schema
diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test
index af507b1f7ef..6a82a2901c5 100644
--- a/mysql-test/t/select.test
+++ b/mysql-test/t/select.test
@@ -2493,7 +2493,7 @@ DROP TABLE t1,t2;
# Bug #10650
#
-select x'10' + 0, X'10' + 0, b'10' + 0, B'10' + 0;
+select x'3136' + 0, X'3136' + 0, b'10' + 0, B'10' + 0;
#
# Bug #11398 Bug in field_conv() results in wrong result of join with index
@@ -4289,6 +4289,7 @@ SELECT f1 FROM t1 GROUP BY 1;
SELECT f1 FROM t1 GROUP BY '123' = 'abc';
SELECT 1 FROM t1 GROUP BY 1;
drop table t1;
+set sql_buffer_result= 0;
--echo #
@@ -4479,5 +4480,41 @@ WHERE ( NOT (Use_leap_seconds <= Use_leap_seconds AND Time_zone_id != 1)
OR Time_zone_id <> Time_zone_id )
AND Use_leap_seconds <> 'N';
+--echo #
+--echo # Bug mdev-4274: result of simplification of OR badly merged
+--echo # into embedding AND
+--echo #
+
+CREATE TABLE t1 (a int, b int, INDEX idx(b)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (8,8);
+
+CREATE TABLE t2 (c int, INDEX idx(c)) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (8), (9);
+
+EXPLAIN EXTENDED
+SELECT * FROM t1 INNER JOIN t2 ON ( c = a )
+ WHERE 1 IS NULL OR b < 33 AND b = c;
+SELECT * FROM t1 INNER JOIN t2 ON ( c = a )
+ WHERE 1 IS NULL OR b < 33 AND b = c;
+
+DROP TABLE t1,t2;
+
+--echo #
+--echo # Bug mdev-4413: another manifestations of bug mdev-2474
+--echo # (valgrind complains)
+--echo #
+
+CREATE TABLE t1 (a int, b int) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (7,1);
+
+CREATE TABLE t2 (c int) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (0), (8);
+
+SELECT * FROM t1, t2
+ WHERE c = a AND
+ ( 0 OR ( b BETWEEN 45 AND 300 OR a > 45 AND a < 100 ) AND b = c );
+
+DROP TABLE t1, t2;
+
--echo End of 5.3 tests
diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test
index 9db6709a8d2..0fb3474f877 100644
--- a/mysql-test/t/sp.test
+++ b/mysql-test/t/sp.test
@@ -9209,5 +9209,66 @@ DROP FUNCTION f2;
DROP FUNCTION f3;
DROP FUNCTION f4;
---echo # End of 5.5 test
+--echo
+--echo Stored procedures and a condition handler in a nested procedure call
+--echo doesn't suppress the condition from being passed on to the calling
+--echo procedure
+--echo
+
+--disable_warnings
+drop procedure if exists p1;
+drop procedure if exists p0;
+--enable_warnings
+
+create table t1 (id int);
+delimiter $$;
+create procedure p1 () begin
+declare i int default 0;
+declare continue handler for not found begin
+select "You should see this message and the warning that generated this" as "message";
+show warnings;
+end;
+select id into i from t1;
+end$$
+create procedure p0 () begin
+declare continue handler for not found begin
+select "You should NOT see this message" as "message";
+end;
+call p1();
+end$$
+delimiter ;$$
+call p0();
+drop procedure p1;
+drop procedure p0;
+drop table t1;
+
+--echo
+--echo Test if stored procedures propagates errors
+--echo
+
+create table t1 (id int primary key);
+delimiter $$;
+create procedure p1 () begin
+insert into t1 values(1);
+insert into t1 values(2);
+insert into t1 values(2);
+insert into t1 values(3);
+end$$
+create procedure p2 () begin
+ declare x int;
+ select id into x from t1 where id=5;
+end$$
+delimiter ;$$
+--error ER_DUP_ENTRY
+call p1();
+show warnings;
+select * from t1;
+call p2();
+
+drop procedure p1;
+drop procedure p2;
+
+drop table t1;
+
+--echo # End of 5.5 test
diff --git a/mysql-test/t/subselect_sj.test b/mysql-test/t/subselect_sj.test
index e2abb8040b3..bfdc6335f1d 100644
--- a/mysql-test/t/subselect_sj.test
+++ b/mysql-test/t/subselect_sj.test
@@ -2540,5 +2540,49 @@ WHERE (field1) IN ($query);
DROP TABLE t1, t2;
+--echo #
+--echo # MDEV-389: Wrong result (missing row) with semijoin, join_cache_level>4, LEFT JOIN...
+--echo # (testcase only)
+--echo #
+
+# Use another connection to get rid of this test's settings
+connect (con1,localhost,root,,);
+connection con1;
+
+SET join_cache_level = 5;
+SET optimizer_switch = 'semijoin=on';
+
+CREATE TABLE t1 (a INT NOT NULL, b CHAR(1), KEY(a)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (4,'p'),(1,'q'),(8,'e');
+
+CREATE TABLE t2 (c INT, d CHAR(1), KEY(c), KEY(d)) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (4,'f'),(2,'i'),(5,'h'),(3,'q'),(1,'g');
+
+SELECT a, COUNT(*) AS cnt
+FROM t1 LEFT JOIN t2 ON (d = b)
+WHERE a IN ( SELECT c FROM t2 WHERE b > 'k' )
+GROUP BY a ORDER BY a, cnt LIMIT 2;
+
+drop table t1, t2;
+connection default;
+disconnect con1;
+
+--echo #
+--echo # MDEV-4071: Valgrind warnings 'Invalid read' in subselect_engine::calc_const_tables with ...
+--echo #
+CREATE TABLE t1 (b INT, c VARCHAR(1)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (7,'v'),(0,'s');
+
+CREATE TABLE t2 (a INT) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (0),(8);
+
+SELECT c, SUM( DISTINCT b ) AS sm FROM t1
+WHERE ( 5, 108 ) IN ( SELECT MIN(a), MAX(a) FROM t2 )
+GROUP BY b
+HAVING c <> ( SELECT MAX( c ) FROM t1 )
+ORDER BY sm;
+
+DROP TABLE t1,t2;
+
# The following command must be the last one the file
set optimizer_switch=@subselect_sj_tmp;
diff --git a/mysql-test/t/subselect_sj_mat.test b/mysql-test/t/subselect_sj_mat.test
index 4c40b2b5487..711f2f4f9b6 100644
--- a/mysql-test/t/subselect_sj_mat.test
+++ b/mysql-test/t/subselect_sj_mat.test
@@ -1677,6 +1677,25 @@ SELECT * FROM t1, t2 WHERE b1 IN ( SELECT b2 FROM t2 WHERE b1 > 'o' ) AND ( b1 <
DROP TABLE t1,t2;
+--echo #
+--echo # MDEV-4465: Reproducible crash (mysqld got signal 11) in multi_delete::initialize_tables with semijoin+materialization
+--echo #
+CREATE TABLE t1 (
+ id int(11) NOT NULL
+);
+
+CREATE TABLE t2 (
+ id int(11) NOT NULL,
+ a_id int(11) DEFAULT NULL
+);
+
+insert into t1 values (1), (2), (3);
+insert into t2 values (1, 1), (2, 1), (3, 1), (4, 2), (5, 3), (6, 3), (7, 3);
+
+delete t2 from t2 where a_id in (select * from (select t1.id from t1 limit 2) as x);
+
+drop table t1,t2;
+
--echo # This must be at the end:
set optimizer_switch=@subselect_sj_mat_tmp;
set join_cache_level=@save_join_cache_level;
diff --git a/mysql-test/t/type_datetime.test b/mysql-test/t/type_datetime.test
index d1648254fb2..05bc72291cd 100644
--- a/mysql-test/t/type_datetime.test
+++ b/mysql-test/t/type_datetime.test
@@ -471,6 +471,21 @@ insert into t1 values ('2000-12-03','22:55:23'),('2008-05-03','10:19:31');
select case when d = '2012-12-12' then d else t end as cond, group_concat( d ) from t1 group by cond;
drop table t1;
+--echo #
+--echo # Semantics of the condition <non-nullable datetime field> IS NULL
+--echo # when the field belongs to an inner table of an outer join
+--echo #
+
+create table t1 (a int, b date not null);
+insert t1 values (1, 0), (2, '1999-01-02');
+create table t2 (c int);
+insert t2 values (1),(3);
+
+select * from t2 left join t1 on t1.a=t2.c where t1.a is null;
+select * from t2 left join t1 on t1.a=t2.c where t1.b is null;
+
+drop table t1,t2;
+
--echo End of 5.3 tests
--echo #
diff --git a/mysql-test/t/varbinary.test b/mysql-test/t/varbinary.test
index 1f9f7b5412d..f03f3fcf703 100644
--- a/mysql-test/t/varbinary.test
+++ b/mysql-test/t/varbinary.test
@@ -13,7 +13,30 @@ drop table if exists t1;
select 0x41,0x41+0,0x41 | 0x7fffffffffffffff | 0,0xffffffffffffffff | 0 ;
select 0x31+1,concat(0x31)+1,-0xf;
-select x'31',X'ffff'+0;
+select x'31',0xffff+0;
+select X'FFFF'+0;
+
+#
+# Hex string vs hex hybrid
+#
+SELECT x'31'+0, 0x31+0;
+SELECT x'31'+0.1e0, 0x31+0.1e0;
+SELECT x'312E39'+0e0, 0x312E39+0e0;
+SELECT CAST(x'31' AS SIGNED), CAST(0x31 AS SIGNED);
+SELECT CAST(x'31' AS DECIMAL(10,1)), CAST(0x31 AS DECIMAL(10,1));
+SELECT CAST(x'312E39' AS SIGNED), CAST(0x312E39 AS SIGNED);
+SELECT CAST(x'312E39' AS DECIMAL(10,1)), CAST(0x312E39 AS DECIMAL(10,1));
+EXPLAIN EXTENDED SELECT X'FFFF', 0xFFFF;
+CREATE TABLE t1 (a int);
+INSERT INTO t1 VALUES (X'31'),(0x31);
+INSERT INTO t1 VALUES (X'312E39'),(0x312E39);
+SELECT * FROM t1;
+DROP TABLE t1;
+CREATE TABLE t1 (a DECIMAL(10,1));
+INSERT INTO t1 VALUES (X'31'),(0x31);
+INSERT INTO t1 VALUES (X'312E39'),(0x312E39);
+SELECT * FROM t1;
+DROP TABLE t1;
#
# Test of hex constants in WHERE:
@@ -115,7 +138,7 @@ select 0x41;
select b'01000001';
-select x'41', 0+x'41';
+select x'41', 0+x'3635';
select N'abc', length(N'abc');
diff --git a/mysql-test/t/variables.test b/mysql-test/t/variables.test
index 08e7e68c225..244c5f039fa 100644
--- a/mysql-test/t/variables.test
+++ b/mysql-test/t/variables.test
@@ -1522,4 +1522,16 @@ set session collation_connection=2048;
--error ER_UNKNOWN_COLLATION
set session collation_database=2048;
+#
+# Bug #16044655 CRASH: SETTING DEFAULT VALUE FOR SOME VARIABLES
+#
+--error ER_NO_DEFAULT
+set session rand_seed1=DEFAULT;
+
+#
+# Bug #14211565 CRASH WHEN ATTEMPTING TO SET SYSTEM VARIABLE TO RESULT OF VALUES()
+#
+--error ER_BAD_FIELD_ERROR
+set autocommit = values(v);
+
--echo End of 5.5 tests