summaryrefslogtreecommitdiff
path: root/mysql-test/t
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/t')
-rw-r--r--mysql-test/t/alias.test11
-rw-r--r--mysql-test/t/change_user_notembedded.test24
-rw-r--r--mysql-test/t/create_delayed.test34
-rw-r--r--mysql-test/t/ctype_ucs.test32
-rw-r--r--mysql-test/t/ctype_utf16.test4
-rw-r--r--mysql-test/t/ctype_utf8.test5
-rw-r--r--mysql-test/t/derived_view.test61
-rw-r--r--mysql-test/t/distinct.test25
-rw-r--r--mysql-test/t/failed_auth_3909.test37
-rw-r--r--mysql-test/t/func_gconcat.test10
-rw-r--r--mysql-test/t/func_misc.test19
-rw-r--r--mysql-test/t/gis2.test17
-rw-r--r--mysql-test/t/grant_lowercase.opt1
-rw-r--r--mysql-test/t/grant_lowercase.test31
-rw-r--r--mysql-test/t/group_by.test78
-rw-r--r--mysql-test/t/group_by_innodb.test38
-rw-r--r--mysql-test/t/group_min_max.test9
-rw-r--r--mysql-test/t/information_schema2.test9
-rw-r--r--mysql-test/t/innodb_mrr_cpk.test26
-rw-r--r--mysql-test/t/loaddata.test62
-rw-r--r--[-rwxr-xr-x]mysql-test/t/lowercase_table4-master.opt0
-rw-r--r--[-rwxr-xr-x]mysql-test/t/lowercase_table4.test0
-rw-r--r--mysql-test/t/mysql.test12
-rw-r--r--mysql-test/t/mysqlbinlog-cp932-master.opt1
-rw-r--r--mysql-test/t/mysqlbinlog-cp932.test26
-rw-r--r--mysql-test/t/mysqlbinlog2-master.opt1
-rw-r--r--mysql-test/t/mysqlbinlog2.test187
-rw-r--r--mysql-test/t/mysqlbinlog_base64.test102
-rw-r--r--mysql-test/t/mysqlbinlog_row-master.opt1
-rw-r--r--mysql-test/t/mysqlbinlog_row.test446
-rw-r--r--mysql-test/t/mysqlbinlog_row_innodb-master.opt1
-rw-r--r--mysql-test/t/mysqlbinlog_row_innodb.test24
-rw-r--r--mysql-test/t/mysqlbinlog_row_myisam-master.opt1
-rw-r--r--mysql-test/t/mysqlbinlog_row_myisam.test23
-rw-r--r--mysql-test/t/mysqlbinlog_row_trans-master.opt1
-rw-r--r--mysql-test/t/mysqlbinlog_row_trans.test161
-rw-r--r--mysql-test/t/mysqlshow.test2
-rw-r--r--mysql-test/t/partition_innodb.test15
-rw-r--r--mysql-test/t/plugin.test18
-rw-r--r--mysql-test/t/plugin_auth.test26
-rw-r--r--mysql-test/t/range.test55
-rw-r--r--[-rwxr-xr-x]mysql-test/t/range_vs_index_merge.test0
-rw-r--r--[-rwxr-xr-x]mysql-test/t/range_vs_index_merge_innodb.test0
-rw-r--r--mysql-test/t/show_check.test14
-rw-r--r--mysql-test/t/sp.test20
-rw-r--r--mysql-test/t/sp_notembedded.test21
-rw-r--r--mysql-test/t/subselect4.test51
-rw-r--r--mysql-test/t/subselect_innodb.test14
-rw-r--r--mysql-test/t/subselect_sj.test69
-rw-r--r--mysql-test/t/sum_distinct-big.test17
-rw-r--r--mysql-test/t/update.test41
-rw-r--r--mysql-test/t/view.test47
52 files changed, 904 insertions, 1026 deletions
diff --git a/mysql-test/t/alias.test b/mysql-test/t/alias.test
index 0e2d57598e2..c02ebe2f5ff 100644
--- a/mysql-test/t/alias.test
+++ b/mysql-test/t/alias.test
@@ -215,3 +215,14 @@ drop table t4;
drop table t1,t2,t3;
# End of 5.2 tests
+
+#
+# MDEV-3908 crash in multi-table delete and mdl
+#
+connect (c1,localhost,root,,);
+connection c1;
+# this used to crash on disconnect
+--error ER_PARSE_ERROR
+DELETE ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ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ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZROM t1 WHERE 1=1;
+connection default;
+disconnect c1;
diff --git a/mysql-test/t/change_user_notembedded.test b/mysql-test/t/change_user_notembedded.test
new file mode 100644
index 00000000000..bf5d1956cd5
--- /dev/null
+++ b/mysql-test/t/change_user_notembedded.test
@@ -0,0 +1,24 @@
+source include/not_embedded.inc;
+
+#
+# MDEV-3915 COM_CHANGE_USER allows fast password brute-forcing
+#
+# only three failed change_user per connection.
+# successful change_user do NOT reset the counter
+#
+connect (test,localhost,root,,);
+connection test;
+--error 1045
+change_user foo,bar;
+--error 1045
+change_user foo;
+change_user;
+--error 1045
+change_user foo,bar;
+--error 1047
+change_user foo,bar;
+--error 1047
+change_user;
+disconnect test;
+connection default;
+
diff --git a/mysql-test/t/create_delayed.test b/mysql-test/t/create_delayed.test
new file mode 100644
index 00000000000..e99886d97d1
--- /dev/null
+++ b/mysql-test/t/create_delayed.test
@@ -0,0 +1,34 @@
+#
+# Ensure that INSERT DELAYED works with CREATE TABLE on existing table
+#
+
+-- source include/big_test.inc
+
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+--disable_query_log
+--disable_result_log
+
+--let $run=1000
+
+--echo Starting test
+
+while ($run)
+{
+# --echo # $run attempts left...
+ CREATE TABLE t1 ( f1 INTEGER AUTO_INCREMENT, PRIMARY KEY (f1)) ENGINE=MyISAM;
+ INSERT DELAYED t1 VALUES (4);
+--error ER_TABLE_EXISTS_ERROR
+ CREATE TABLE t1 AS SELECT 1 AS f1;
+
+ REPLACE DELAYED t1 VALUES (5);
+ DROP TABLE t1;
+--dec $run
+}
+
+--enable_query_log
+--enable_result_log
+
+--echo # All done
diff --git a/mysql-test/t/ctype_ucs.test b/mysql-test/t/ctype_ucs.test
index f3557e36a58..9f5b4153bce 100644
--- a/mysql-test/t/ctype_ucs.test
+++ b/mysql-test/t/ctype_ucs.test
@@ -68,6 +68,38 @@ RPAD(_ucs2 X'0420',10,_ucs2 X'0421') r;
SHOW CREATE TABLE t1;
DROP TABLE t1;
+--echo #
+--echo # Bug #51876 : crash/memory underrun when loading data with ucs2
+--echo # and reverse() function
+--echo #
+
+--echo # Problem # 1 (original report): wrong parsing of ucs2 data
+SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp.txt';
+CREATE TABLE t1(a INT);
+LOAD DATA INFILE 'tmpp.txt' INTO TABLE t1 CHARACTER SET ucs2
+(@b) SET a=REVERSE(@b);
+--echo # should return 2 zeroes (as the value is truncated)
+SELECT * FROM t1;
+
+DROP TABLE t1;
+let $MYSQLD_DATADIR= `select @@datadir`;
+remove_file $MYSQLD_DATADIR/test/tmpp.txt;
+
+
+--echo # Problem # 2 : if you write and read ucs2 data to a file they're lost
+SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp2.txt' CHARACTER SET ucs2;
+CREATE TABLE t1(a INT);
+LOAD DATA INFILE 'tmpp2.txt' INTO TABLE t1 CHARACTER SET ucs2
+(@b) SET a=REVERSE(@b);
+--echo # should return 0 and 1 (10 reversed)
+SELECT * FROM t1;
+
+DROP TABLE t1;
+let $MYSQLD_DATADIR= `select @@datadir`;
+remove_file $MYSQLD_DATADIR/test/tmpp2.txt;
+
+
+
#
# BUG3946
#
diff --git a/mysql-test/t/ctype_utf16.test b/mysql-test/t/ctype_utf16.test
index 847e302e615..f42d30e1f00 100644
--- a/mysql-test/t/ctype_utf16.test
+++ b/mysql-test/t/ctype_utf16.test
@@ -777,6 +777,10 @@ SELECT 'a' AS id, REPEAT('bla bla', 100) AS body) t1
GROUP BY id
ORDER BY l DESC;
+SELECT id, CHAR_LENGTH(GROUP_CONCAT(body)) AS l
+FROM (SELECT 'a' AS id, REPEAT('foo bar', 100) AS body
+UNION ALL
+SELECT 'a' AS id, REPEAT('bla bla', 100) AS body) t1;
#
## TODO: add tests for all engines
diff --git a/mysql-test/t/ctype_utf8.test b/mysql-test/t/ctype_utf8.test
index 210589adc81..0b90f222593 100644
--- a/mysql-test/t/ctype_utf8.test
+++ b/mysql-test/t/ctype_utf8.test
@@ -1590,6 +1590,11 @@ SELECT 'a' AS id, REPEAT('bla bla', 100) AS body) t1
GROUP BY id
ORDER BY l DESC;
+SELECT id, CHAR_LENGTH(GROUP_CONCAT(body)) AS l
+FROM (SELECT 'a' AS id, REPEAT('foo bar', 100) AS body
+UNION ALL
+SELECT 'a' AS id, REPEAT('bla bla', 100) AS body) t1;
+
--echo #
--echo # End of 5.5 tests
--echo #
diff --git a/mysql-test/t/derived_view.test b/mysql-test/t/derived_view.test
index 30811be2934..c7705294ef2 100644
--- a/mysql-test/t/derived_view.test
+++ b/mysql-test/t/derived_view.test
@@ -1451,6 +1451,67 @@ select * from t1;
drop table t1,t2;
--echo #
+--echo # MDEV-3873: Wrong result (extra rows) with NOT IN and
+--echo # a subquery from a MERGE view
+--echo #
+
+CREATE TABLE t1 (a INT NOT NULL) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (4),(7),(0);
+
+CREATE TABLE t2 (b INT NOT NULL) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (1),(2);
+
+CREATE TABLE t3 (c INT NOT NULL) ENGINE=MyISAM;
+INSERT INTO t3 VALUES (4),(6),(3);
+
+CREATE TABLE t4 (d INT NOT NULL) ENGINE=MyISAM;
+INSERT INTO t4 VALUES (4),(5),(3);
+
+CREATE TABLE tv (e INT NOT NULL) ENGINE=MyISAM;
+INSERT INTO tv VALUES (1),(3);
+
+CREATE ALGORITHM=TEMPTABLE VIEW v_temptable AS SELECT * FROM tv;
+CREATE ALGORITHM=MERGE VIEW v_merge AS SELECT * FROM tv;
+
+SELECT * FROM t1, t2
+WHERE a NOT IN ( SELECT e FROM t3 LEFT JOIN v_temptable ON (c = e) WHERE c <> b ) AND a < b;
+
+SELECT * FROM t1, t2
+WHERE a NOT IN ( SELECT e FROM t3 LEFT JOIN v_merge ON (c = e) WHERE c <> b ) AND a < b;
+
+SELECT * FROM t1, t2
+WHERE a NOT IN ( SELECT e FROM t3 LEFT JOIN (SELECT * FROM tv) as derived ON (c = e) WHERE c <> b ) AND a < b;
+
+drop view v_temptable, v_merge;
+drop table t1,t2,t3,t4,tv;
+
+--echo #
+--echo # MDEV-3912: Wrong result (extra rows) with FROM subquery inside
+--echo # ALL subquery, LEFT JOIN, derived_merge.
+--echo # (duplicate of MDEV-3873 (above))
+--echo #
+
+SET @save3912_optimizer_switch=@@optimizer_switch;
+SET optimizer_switch = 'derived_merge=on,in_to_exists=on';
+
+CREATE TABLE t1 (a INT) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (4),(8);
+
+CREATE TABLE t2 (b INT) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (7),(0);
+
+CREATE TABLE t3 (c INT, d INT NOT NULL) ENGINE=MyISAM;
+INSERT INTO t3 VALUES (0,4),(8,6);
+
+SELECT * FROM t1
+WHERE a >= ALL (
+SELECT d FROM t2 LEFT JOIN ( SELECT * FROM t3 ) AS alias ON ( c = b )
+WHERE b >= a
+);
+set optimizer_switch=@save3912_optimizer_switch;
+drop table t1, t2, t3;
+
+--echo #
--echo # end of 5.3 tests
--echo #
diff --git a/mysql-test/t/distinct.test b/mysql-test/t/distinct.test
index 051499f465b..f1c120a313d 100644
--- a/mysql-test/t/distinct.test
+++ b/mysql-test/t/distinct.test
@@ -658,6 +658,31 @@ select time(f1) from t1 ;
select distinct time(f1) from t1 ;
drop table t1;
+#
+# MDEV-3875 Wrong result (missing row) on a DISTINCT query with the same subquery in the SELECT list and GROUP BY
+# MySQL Bug#66896 Distinct not distinguishing 0 from NULL when GROUP BY is used
+#
+create table t1(i int, g int); # remove_dup_with_hash_index
+insert into t1 values (null, 1), (0, 2);
+select distinct i from t1 group by g;
+drop table t1;
+
+create table t1(i int, g blob); # remove_dup_with_compare
+insert into t1 values (null, 1), (0, 2);
+select distinct i from t1 group by g;
+drop table t1;
+
+create table t1 (a int) engine=myisam;
+insert into t1 values (0),(7);
+create table t2 (b int) engine=myisam;
+insert into t2 values (7),(0),(3);
+create algorithm=temptable view v as
+select distinct (select max(a) from t1 where alias.b = a) as field1 from t2 as alias group by field1;
+select * from v;
+select distinct (select max(a) from t1 where alias.b = a) as field1 from t2 as alias group by field1;
+drop view v;
+drop table t1, t2;
+
--echo #
--echo # Bug #11744875: 4082: integer lengths cause truncation with distinct concat and innodb
--echo #
diff --git a/mysql-test/t/failed_auth_3909.test b/mysql-test/t/failed_auth_3909.test
new file mode 100644
index 00000000000..3179794d155
--- /dev/null
+++ b/mysql-test/t/failed_auth_3909.test
@@ -0,0 +1,37 @@
+source include/not_embedded.inc;
+
+#
+# MDEV-3909 remote user enumeration
+#
+# verify that for some failed login attemps (with wrong user names)
+# the server requests a plugin
+#
+optimize table mysql.user;
+insert mysql.user (user,plugin) values ('foo','bar'),('bar','bar'),('baz','bar');
+flush privileges;
+
+--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
+--error ER_PLUGIN_IS_NOT_LOADED
+connect (fail,localhost,u1);
+
+--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
+--error ER_ACCESS_DENIED_ERROR
+connect (fail,localhost,u2);
+
+--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
+--error ER_ACCESS_DENIED_ERROR
+connect (fail,localhost,u2,password);
+
+--error ER_PLUGIN_IS_NOT_LOADED
+change_user u1;
+
+--error ER_ACCESS_DENIED_ERROR
+change_user u2;
+
+--error ER_ACCESS_DENIED_ERROR
+change_user u2,password;
+
+delete from mysql.user where plugin = 'bar';
+flush privileges;
+
+
diff --git a/mysql-test/t/func_gconcat.test b/mysql-test/t/func_gconcat.test
index e4a1206fa9c..936b93b49c9 100644
--- a/mysql-test/t/func_gconcat.test
+++ b/mysql-test/t/func_gconcat.test
@@ -375,7 +375,7 @@ select group_concat('x') UNION ALL select 1;
drop table t1;
#
-# Bug #12863 : missing separators after first empty cancatanated elements
+# Bug #12863 : missing separators after first empty concatenated elements
#
CREATE TABLE t1 (id int, a varchar(9));
@@ -795,3 +795,11 @@ INSERT INTO t2 SELECT GROUP_CONCAT(a), b FROM t1 GROUP BY b;
SET group_concat_max_len = DEFAULT;
SET @@sql_mode = @old_sql_mode;
DROP TABLE t1, t2;
+
+#
+# MDEV-3987 uninitialized read in Item_cond::fix_fields leads to crash: select .. where .. in ( select ... )
+#
+create table t1 (a char(1) character set utf8);
+insert into t1 values ('a'),('b');
+select 1 from t1 where a in (select group_concat(a) from t1);
+drop table t1;
diff --git a/mysql-test/t/func_misc.test b/mysql-test/t/func_misc.test
index 1f221ce9878..292db69a6e3 100644
--- a/mysql-test/t/func_misc.test
+++ b/mysql-test/t/func_misc.test
@@ -348,6 +348,25 @@ SELECT 1 from t1 HAVING NAME_CONST('', a);
DROP TABLE t1;
+--echo #
+--echo # Test or correct maybe_null of last_value
+--echo #
+CREATE TABLE t1 (a char(2) not null );
+INSERT INTO t1 VALUES (4),(7),(1);
+set @optimizer_switch_save= @@optimizer_switch;
+set optimizer_switch='materialization=off';
+CREATE TABLE tv (e char(2) not null ) engine=mysql;
+INSERT INTO tv VALUES (1);
+CREATE ALGORITHM=MERGE VIEW v_merge AS SELECT * FROM tv;
+CREATE ALGORITHM=MERGE VIEW vm AS SELECT * FROM tv;
+explain extended
+select a from t1 left join v_merge on (a=e) where last_value(NULL,e) not in (select last_value(NULL,e) from vm);
+explain extended
+select a from t1 left join v_merge on (a=e) where e not in (select last_value(NULL,e) from vm);
+set optimizer_switch=@optimizer_switch_save;
+drop view v_merge, vm;
+drop table t1,tv;
+
--echo #
--echo # End of 5.5 tests
diff --git a/mysql-test/t/gis2.test b/mysql-test/t/gis2.test
new file mode 100644
index 00000000000..b734ab19ecd
--- /dev/null
+++ b/mysql-test/t/gis2.test
@@ -0,0 +1,17 @@
+#
+# MDEV-3934 Assertion `((keypart_map+1) & keypart_map) == 0' failed in _mi_pack_key with an index on a POINT column
+#
+
+CREATE TABLE t1 (
+ id INT UNSIGNED NOT NULL AUTO_INCREMENT,
+ point_data POINT NOT NULL,
+ PRIMARY KEY (id),
+ KEY idx_point_data(point_data)
+) ENGINE=MyISAM;
+INSERT t1 (point_data) VALUES
+ (GeomFromText('Point(37.0248492 23.8512726)')),
+ (GeomFromText('Point(38.0248492 23.8512726)'));
+SELECT id FROM t1
+WHERE ST_Contains(point_data, GeomFromText('Point(38.0248492 23.8512726)'));
+DROP TABLE t1;
+
diff --git a/mysql-test/t/grant_lowercase.opt b/mysql-test/t/grant_lowercase.opt
new file mode 100644
index 00000000000..5b0a3d41b41
--- /dev/null
+++ b/mysql-test/t/grant_lowercase.opt
@@ -0,0 +1 @@
+--lower-case-table-names=1
diff --git a/mysql-test/t/grant_lowercase.test b/mysql-test/t/grant_lowercase.test
new file mode 100644
index 00000000000..b07cb88afd6
--- /dev/null
+++ b/mysql-test/t/grant_lowercase.test
@@ -0,0 +1,31 @@
+# test cases for strmov(tmp_db, db) -> strnmov replacement in sql_acl.cc
+--source include/not_embedded.inc
+
+#
+# http://seclists.org/fulldisclosure/2012/Dec/4
+#
+
+# in acl_get(), check_grant_db(), mysql_grant()
+grant file on *.* to user1@localhost with grant option;
+grant select on `a%`.* to user1@localhost with grant option;
+connect (conn1,localhost,user1,,);
+connection conn1;
+--error ER_WRONG_DB_NAME
+grant file on aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.* to 'user'@'%' identified by 'secret';
+connection default;
+disconnect conn1;
+drop user user1@localhost;
+
+# in acl_load()
+call mtr.add_suppression("Incorrect database name");
+alter table mysql.host modify Db varchar(200);
+alter table mysql.db modify Db varchar(200);
+insert mysql.host set db=concat('=>', repeat(_utf8 'й', 200));
+insert mysql.db set db=concat('=>', repeat(_utf8 'й', 200));
+flush privileges; # shouldn't crash here
+delete from mysql.host where db like '=>%';
+delete from mysql.db where db like '=>%';
+alter table mysql.host modify Db char(64);
+alter table mysql.db modify Db char(64);
+flush privileges;
+
diff --git a/mysql-test/t/group_by.test b/mysql-test/t/group_by.test
index 6a2d0a1c030..3c6f997f28e 100644
--- a/mysql-test/t/group_by.test
+++ b/mysql-test/t/group_by.test
@@ -1,3 +1,4 @@
+--source include/have_innodb.inc
# Initialise
--disable_warnings
@@ -1483,6 +1484,41 @@ DROP TABLE t1;
--echo the value below *must* be 1
show status like 'Created_tmp_disk_tables';
+--echo #
+--echo # Bug #1002146: Unneeded filesort if usage of join buffer is not allowed
+--echo # (bug mdev-645)
+--echo #
+
+CREATE TABLE t1 (pk int PRIMARY KEY, a int, INDEX idx(a));
+INSERT INTO t1 VALUES (3,2), (2,3), (5,3), (6,4);
+
+CREATE TABLE t2 (pk int PRIMARY KEY, a int, INDEX idx(a));
+INSERT INTO t2 VALUES (9,0), (10,3), (6,4), (1,6), (3,100), (5,200);
+
+set join_cache_level=0;
+
+EXPLAIN
+SELECT t2.a FROM t2 STRAIGHT_JOIN t1 ON t2.a <> 0 WHERE t2.a <> 6
+ GROUP BY t2.a;
+SELECT t2.a FROM t2 STRAIGHT_JOIN t1 ON t2.a <> 0 WHERE t2.a <> 6
+ GROUP BY t2.a;
+
+set join_cache_level=default;
+
+set @save_optimizer_switch=@@optimizer_switch;
+set optimizer_switch='outer_join_with_cache=off';
+
+EXPLAIN
+SELECT t2.a FROM t2 LEFT JOIN t1 ON t2.a <> 0 WHERE t2.a <> 6
+ GROUP BY t2.a;
+SELECT t2.a FROM t2 LEFT JOIN t1 ON t2.a <> 0 WHERE t2.a <> 6
+ GROUP BY t2.a;
+
+set optimizer_switch=@save_optimizer_switch;
+
+
+DROP TABLE t1,t2;
+
--echo # End of 5.3 tests
--echo #
@@ -1509,6 +1545,48 @@ DROP TABLE t1;
--echo #End of test#49771
--echo #
+--echo # Test of bug in GROUP_CONCAT with ROLLUP
+--echo #
+
+CREATE TABLE t1 ( b VARCHAR(8) NOT NULL, a INT NOT NULL ) ENGINE=MyISAM;
+INSERT INTO t1 (a,b) VALUES (1,'c'),(2,'v');
+
+CREATE TABLE t2 ( c VARCHAR(8), d INT, KEY (c, d) ) ENGINE=MyISAM;
+INSERT INTO t2 VALUES ('v',6),('c',4),('v',3);
+
+SELECT b, GROUP_CONCAT( a, b ORDER BY a, b )
+FROM t1 JOIN t2 ON c = b GROUP BY b;
+
+SELECT b, GROUP_CONCAT( a, b ORDER BY a, b )
+FROM t1 JOIN t2 ON c = b GROUP BY b WITH ROLLUP;
+
+DROP TABLE t1,t2;
+
+--echo #
+--echo # Test of MDEV-4002
+--echo #
+
+CREATE TABLE t1 (
+ pk INT NOT NULL PRIMARY KEY,
+ d1 DOUBLE,
+ d2 DOUBLE,
+ i INT NOT NULL DEFAULT '0',
+ KEY (i)
+) ENGINE=InnoDB;
+
+INSERT INTO t1 VALUES (1,1.0,1.1,1),(2,2.0,2.2,2);
+
+PREPARE stmt FROM "
+SELECT DISTINCT i, GROUP_CONCAT( d1, d2 ORDER BY d1, d2 )
+FROM t1 a1 NATURAL JOIN t1 a2 GROUP BY i WITH ROLLUP
+";
+
+EXECUTE stmt;
+EXECUTE stmt;
+
+DROP TABLE t1;
+
+--echo #
--echo # Bug #58782
--echo # Missing rows with SELECT .. WHERE .. IN subquery
--echo # with full GROUP BY and no aggr
diff --git a/mysql-test/t/group_by_innodb.test b/mysql-test/t/group_by_innodb.test
new file mode 100644
index 00000000000..0d5e5e9ae30
--- /dev/null
+++ b/mysql-test/t/group_by_innodb.test
@@ -0,0 +1,38 @@
+#
+# Test GROUP BY queries that utilize InnoDB extended keys
+#
+
+--source include/have_innodb.inc
+
+--echo #
+--echo # MDEV-3992 Server crash or valgrind errors in test_if_skip_sort_order/test_if_cheaper_ordering
+--echo # on GROUP BY with indexes on InnoDB table
+--echo #
+
+CREATE TABLE t1 (
+ pk INT PRIMARY KEY,
+ a VARCHAR(1) NOT NULL,
+ KEY (pk)
+) ENGINE=InnoDB;
+
+INSERT INTO t1 VALUES (1,'a'),(2,'b');
+
+EXPLAIN
+SELECT COUNT(*), pk field1, pk AS field2
+FROM t1 WHERE a = 'r' OR pk = 183
+GROUP BY field1, field2;
+
+SELECT COUNT(*), pk field1, pk AS field2
+FROM t1 WHERE a = 'r' OR pk = 183
+GROUP BY field1, field2;
+
+EXPLAIN
+SELECT COUNT(*), pk field1 FROM t1
+WHERE a = 'r' OR pk = 183 GROUP BY field1, field1;
+
+SELECT COUNT(*), pk field1 FROM t1
+WHERE a = 'r' OR pk = 183 GROUP BY field1, field1;
+
+drop table t1;
+
+--echo End of 5.5 tests
diff --git a/mysql-test/t/group_min_max.test b/mysql-test/t/group_min_max.test
index b984acc78ea..19f7cbe40a1 100644
--- a/mysql-test/t/group_min_max.test
+++ b/mysql-test/t/group_min_max.test
@@ -1155,6 +1155,15 @@ ORDER BY min_a;
DROP TABLE t1;
+#
+# MDEV-729 lp:998028 - Server crashes on normal shutdown in closefrm after executing a query from MyISAM table
+#
+create table t1 (a int, b varchar(1), key(b,a)) engine=myisam;
+insert t1 values (1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e'),(6,'f'),(7,'g'),(8,'h'),(null,'i');
+select min(a), b from t1 where a=7 or b='z' group by b;
+flush tables;
+drop table t1;
+
--echo #
--echo # LP BUG#888456 Wrong result with DISTINCT , ANY , subquery_cache=off , NOT NULL
--echo #
diff --git a/mysql-test/t/information_schema2.test b/mysql-test/t/information_schema2.test
new file mode 100644
index 00000000000..c2479087f47
--- /dev/null
+++ b/mysql-test/t/information_schema2.test
@@ -0,0 +1,9 @@
+
+#
+# MDEV-4029 SELECT on information_schema using a subquery locks up the information_schema table due to incorrect mutexes handling
+#
+select variable_name from information_schema.session_status where variable_name =
+(select variable_name from information_schema.session_status where variable_name = 'uptime');
+select variable_name from information_schema.session_variables where variable_name =
+(select variable_name from information_schema.session_variables where variable_name = 'basedir');
+
diff --git a/mysql-test/t/innodb_mrr_cpk.test b/mysql-test/t/innodb_mrr_cpk.test
index a157ddd792f..a7b2d9c0ddd 100644
--- a/mysql-test/t/innodb_mrr_cpk.test
+++ b/mysql-test/t/innodb_mrr_cpk.test
@@ -139,3 +139,29 @@ set storage_engine=@save_storage_engine;
set optimizer_switch=@innodb_mrr_cpk_tmp;
drop table t0;
+--echo #
+--echo # MDEV-3817: Wrong result with index_merge+index_merge_intersection, InnoDB table, join, AND and OR conditions
+--echo #
+
+set @tmp_mdev3817=@@optimizer_switch;
+SET optimizer_switch='index_merge=on,index_merge_intersection=on';
+
+CREATE TABLE t1 (
+ a INT PRIMARY KEY,
+ b INT,
+ c VARCHAR(1024) CHARACTER SET utf8,
+ d INT,
+ KEY (b)
+) ENGINE=InnoDB;
+
+INSERT INTO t1 VALUES
+(1, 9, 'one', 11), (2, 6, 'two', 12), (3, 2, 'three', 13), (4, 5, 'four', 14);
+
+CREATE TABLE t2 (e INT, g INT) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (1,9), (2,6) ;
+
+SELECT * FROM t1, t2 WHERE g = b AND ( a < 7 OR a > e );
+
+DROP TABLE t1, t2;
+set optimizer_switch=@tmp_mdev3817;
+
diff --git a/mysql-test/t/loaddata.test b/mysql-test/t/loaddata.test
index f9181f91a89..bf84bdf9194 100644
--- a/mysql-test/t/loaddata.test
+++ b/mysql-test/t/loaddata.test
@@ -572,36 +572,40 @@ DROP TABLE t1;
connection default;
disconnect con1;
+#############################################################################
+# The below protion is moved to ctype_ucs.test #
+#############################################################################
+#--echo #
+#--echo # Bug #51876 : crash/memory underrun when loading data with ucs2
+#--echo # and reverse() function
+#--echo #
+
+#--echo # Problem # 1 (original report): wrong parsing of ucs2 data
+#SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp.txt';
+#CREATE TABLE t1(a INT);
+#LOAD DATA INFILE 'tmpp.txt' INTO TABLE t1 CHARACTER SET ucs2
+#(@b) SET a=REVERSE(@b);
+#--echo # should return 2 zeroes (as the value is truncated)
+#SELECT * FROM t1;
+
+#DROP TABLE t1;
+#let $MYSQLD_DATADIR= `select @@datadir`;
+#remove_file $MYSQLD_DATADIR/test/tmpp.txt;
+
+
+#--echo # Problem # 2 : if you write and read ucs2 data to a file they're lost
+#SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp2.txt' CHARACTER SET ucs2;
+#CREATE TABLE t1(a INT);
+#LOAD DATA INFILE 'tmpp2.txt' INTO TABLE t1 CHARACTER SET ucs2
+#(@b) SET a=REVERSE(@b);
+#--echo # should return 0 and 1 (10 reversed)
+#SELECT * FROM t1;
+
+#DROP TABLE t1;
+#let $MYSQLD_DATADIR= `select @@datadir`;
+#remove_file $MYSQLD_DATADIR/test/tmpp2.txt;
+######################################################################################
---echo #
---echo # Bug #51876 : crash/memory underrun when loading data with ucs2
---echo # and reverse() function
---echo #
-
---echo # Problem # 1 (original report): wrong parsing of ucs2 data
-SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp.txt';
-CREATE TABLE t1(a INT);
-LOAD DATA INFILE 'tmpp.txt' INTO TABLE t1 CHARACTER SET ucs2
-(@b) SET a=REVERSE(@b);
---echo # should return 2 zeroes (as the value is truncated)
-SELECT * FROM t1;
-
-DROP TABLE t1;
-let $MYSQLD_DATADIR= `select @@datadir`;
-remove_file $MYSQLD_DATADIR/test/tmpp.txt;
-
-
---echo # Problem # 2 : if you write and read ucs2 data to a file they're lost
-SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp2.txt' CHARACTER SET ucs2;
-CREATE TABLE t1(a INT);
-LOAD DATA INFILE 'tmpp2.txt' INTO TABLE t1 CHARACTER SET ucs2
-(@b) SET a=REVERSE(@b);
---echo # should return 0 and 1 (10 reversed)
-SELECT * FROM t1;
-
-DROP TABLE t1;
-let $MYSQLD_DATADIR= `select @@datadir`;
-remove_file $MYSQLD_DATADIR/test/tmpp2.txt;
--echo #
--echo # Bug#11765139 58069: LOAD DATA INFILE: VALGRIND REPORTS INVALID MEMORY READS AND WRITES WITH U
diff --git a/mysql-test/t/lowercase_table4-master.opt b/mysql-test/t/lowercase_table4-master.opt
index c0a1981fa7c..c0a1981fa7c 100755..100644
--- a/mysql-test/t/lowercase_table4-master.opt
+++ b/mysql-test/t/lowercase_table4-master.opt
diff --git a/mysql-test/t/lowercase_table4.test b/mysql-test/t/lowercase_table4.test
index 783a4fcae51..783a4fcae51 100755..100644
--- a/mysql-test/t/lowercase_table4.test
+++ b/mysql-test/t/lowercase_table4.test
diff --git a/mysql-test/t/mysql.test b/mysql-test/t/mysql.test
index 3269b88ca04..71a985654ef 100644
--- a/mysql-test/t/mysql.test
+++ b/mysql-test/t/mysql.test
@@ -582,5 +582,17 @@ DROP DATABASE connected_db;
--remove_file $MYSQLTEST_VARDIR/tmp/one_db_1.sql
--remove_file $MYSQLTEST_VARDIR/tmp/one_db_2.sql
+#
+# USE and names with backticks
+#
+--write_file $MYSQLTEST_VARDIR/tmp/backticks.sql
+USE aa`bb``cc
+SELECT DATABASE();
+EOF
+create database `aa``bb````cc`;
+--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/backticks.sql
+drop database `aa``bb````cc`;
+
+
--echo
--echo End of tests
diff --git a/mysql-test/t/mysqlbinlog-cp932-master.opt b/mysql-test/t/mysqlbinlog-cp932-master.opt
deleted file mode 100644
index bb0cda4519a..00000000000
--- a/mysql-test/t/mysqlbinlog-cp932-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---max-binlog-size=8192
diff --git a/mysql-test/t/mysqlbinlog-cp932.test b/mysql-test/t/mysqlbinlog-cp932.test
deleted file mode 100644
index 2a210bea0e0..00000000000
--- a/mysql-test/t/mysqlbinlog-cp932.test
+++ /dev/null
@@ -1,26 +0,0 @@
-# disabled in embedded until tools running is fixed with embedded
---source include/not_embedded.inc
-
--- source include/have_binlog_format_mixed_or_statement.inc
--- source include/have_cp932.inc
--- source include/have_log_bin.inc
-
-RESET MASTER;
-
-# Bug#16217 (mysql client did not know how not switch its internal charset)
-create table t3 (f text character set utf8);
-create table t4 (f text character set cp932);
---exec $MYSQL --default-character-set=utf8 test -e "insert into t3 values(_utf8'ソ')"
---exec $MYSQL --default-character-set=cp932 test -e "insert into t4 values(_cp932'ƒ\');"
-flush logs;
-rename table t3 to t03, t4 to t04;
-let $MYSQLD_DATADIR= `select @@datadir`;
---exec $MYSQL_BINLOG --short-form $MYSQLD_DATADIR/master-bin.000001 | $MYSQL --default-character-set=utf8
-# original and recovered data must be equal
-select HEX(f) from t03;
-select HEX(f) from t3;
-select HEX(f) from t04;
-select HEX(f) from t4;
-
-drop table t3, t4, t03, t04;
---echo End of 5.0 tests
diff --git a/mysql-test/t/mysqlbinlog2-master.opt b/mysql-test/t/mysqlbinlog2-master.opt
deleted file mode 100644
index 4d69f3359db..00000000000
--- a/mysql-test/t/mysqlbinlog2-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---timezone=GMT-3
diff --git a/mysql-test/t/mysqlbinlog2.test b/mysql-test/t/mysqlbinlog2.test
deleted file mode 100644
index 986e180db13..00000000000
--- a/mysql-test/t/mysqlbinlog2.test
+++ /dev/null
@@ -1,187 +0,0 @@
-# Test for the new options --start-datetime, stop-datetime,
-# and a few others.
-
-# TODO: Need to look at making row based version once new binlog client is complete.
--- source include/have_binlog_format_mixed_or_statement.inc
--- source include/binlog_start_pos.inc
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-reset master;
-
-# We need this for getting fixed timestamps inside of this test.
-# I use a date in the future to keep a growing timestamp along the
-# binlog (including the Start_log_event). This test will work
-# unchanged everywhere, because mysql-test-run has fixed TZ, which it
-# exports (so mysqlbinlog has same fixed TZ).
-set @a=UNIX_TIMESTAMP("2020-01-21 15:32:22");
-set timestamp=@a;
-create table t1 (a int auto_increment not null primary key, b char(3));
-insert into t1 values(null, "a");
-insert into t1 values(null, "b");
-set timestamp=@a+2;
---let $binlog_pos_760=query_get_value(SHOW MASTER STATUS, Position, 1)
-insert into t1 values(null, "c");
---let $binlog_pos_951=query_get_value(SHOW BINLOG EVENTS in 'master-bin.000001' from $binlog_pos_760, Pos, 5)
-set timestamp=@a+4;
-insert into t1 values(null, "d");
-insert into t1 values(null, "e");
-
-flush logs;
-set timestamp=@a+1; # this could happen on a slave
-insert into t1 values(null, "f");
---let $binlog_pos_135=query_get_value(SHOW BINLOG EVENTS in 'master-bin.000002', Pos, 4)
---let $binlog_pos_203=query_get_value(SHOW BINLOG EVENTS in 'master-bin.000002', Pos, 5)
-
-# delimiters are for easier debugging in future
-
---disable_query_log
-select "--- Local --" as "";
---enable_query_log
-
-#
-# We should use --short-form everywhere because in other case output will
-# be time dependent (the Start events). Better than nothing.
-#
-let $MYSQLD_DATADIR= `select @@datadir`;
---exec $MYSQL_BINLOG --short-form --base64-output=never $MYSQLD_DATADIR/master-bin.000001
-
---disable_query_log
-select "--- offset --" as "";
---enable_query_log
---exec $MYSQL_BINLOG --short-form --offset=3 $MYSQLD_DATADIR/master-bin.000001
---disable_query_log
-select "--- start-position --" as "";
---enable_query_log
-let $start_pos= `select @binlog_start_pos + 693`;
---exec $MYSQL_BINLOG --short-form --start-position=$start_pos $MYSQLD_DATADIR/master-bin.000001
---disable_query_log
-select "--- stop-position --" as "";
---enable_query_log
-let $stop_pos= `select @binlog_start_pos + 693`;
---exec $MYSQL_BINLOG --short-form --stop-position=$stop_pos $MYSQLD_DATADIR/master-bin.000001
---disable_query_log
-select "--- start and stop positions ---" as "";
---enable_query_log
-let $start_pos= `select @binlog_start_pos + 693`;
-let $stop_pos= `select @binlog_start_pos + 810`;
---exec $MYSQL_BINLOG --short-form --start-position=$start_pos --stop-position=$stop_pos $MYSQLD_DATADIR/master-bin.000001
---disable_query_log
-select "--- start-datetime --" as "";
---enable_query_log
---exec $MYSQL_BINLOG --short-form "--start-datetime=2020-01-21 15:32:24" $MYSQLD_DATADIR/master-bin.000001
---disable_query_log
-select "--- stop-datetime --" as "";
---enable_query_log
---exec $MYSQL_BINLOG --short-form "--stop-datetime=2020-01-21 15:32:24" $MYSQLD_DATADIR/master-bin.000001
-
---disable_query_log
-select "--- Local with 2 binlogs on command line --" as "";
---enable_query_log
-
-# This is to verify that some options apply only to first, or last binlog
-
-flush logs;
---exec $MYSQL_BINLOG --short-form $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002
-
---disable_query_log
-select "--- offset --" as "";
---enable_query_log
---exec $MYSQL_BINLOG --short-form --offset=3 $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002
---disable_query_log
-select "--- start-position --" as "";
---enable_query_log
-let $start_pos= `select @binlog_start_pos + 693`;
---exec $MYSQL_BINLOG --short-form --start-position=$start_pos $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002
---disable_query_log
-select "--- stop-position --" as "";
---enable_query_log
-let $stop_pos= `select @binlog_start_pos + 109`;
---exec $MYSQL_BINLOG --short-form --stop-position=$stop_pos $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002
---disable_query_log
-select "--- start-datetime --" as "";
---enable_query_log
---exec $MYSQL_BINLOG --short-form "--start-datetime=2020-01-21 15:32:24" $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002
---disable_query_log
-select "--- stop-datetime --" as "";
---enable_query_log
---exec $MYSQL_BINLOG --short-form "--stop-datetime=2020-01-21 15:32:24" $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002
-
---disable_query_log
-select "--- Remote --" as "";
---enable_query_log
-
---exec $MYSQL_BINLOG --short-form --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
-
---disable_query_log
-select "--- offset --" as "";
---enable_query_log
---exec $MYSQL_BINLOG --short-form --offset=3 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
---disable_query_log
-select "--- start-position --" as "";
---enable_query_log
-let $start_pos= `select @binlog_start_pos + 693`;
---exec $MYSQL_BINLOG --short-form --start-position=$start_pos --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
---disable_query_log
-select "--- stop-position --" as "";
---enable_query_log
-let $stop_pos= `select @binlog_start_pos + 693`;
---exec $MYSQL_BINLOG --short-form --stop-position=$stop_pos --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
---disable_query_log
-select "--- start and stop positions ---" as "";
---enable_query_log
-let $start_pos= `select @binlog_start_pos + 693`;
-let $stop_pos= `select @binlog_start_pos + 810`;
---exec $MYSQL_BINLOG --short-form --start-position=$start_pos --stop-position $stop_pos --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
---disable_query_log
-select "--- start-datetime --" as "";
---enable_query_log
---exec $MYSQL_BINLOG --short-form "--start-datetime=2020-01-21 15:32:24" --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
---disable_query_log
-select "--- stop-datetime --" as "";
---enable_query_log
---exec $MYSQL_BINLOG --short-form "--stop-datetime=2020-01-21 15:32:24" --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
-
---disable_query_log
-select "--- Remote with 2 binlogs on command line --" as "";
---enable_query_log
-
---exec $MYSQL_BINLOG --short-form --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002
-
---disable_query_log
-select "--- offset --" as "";
---enable_query_log
---exec $MYSQL_BINLOG --short-form --offset=3 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002
---disable_query_log
-select "--- start-position --" as "";
---enable_query_log
-let $start_pos= `select @binlog_start_pos + 693`;
---exec $MYSQL_BINLOG --short-form --start-position=$start_pos --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002
---disable_query_log
-select "--- stop-position --" as "";
---enable_query_log
-let $stop_pos= `select @binlog_start_pos + 68`;
---exec $MYSQL_BINLOG --short-form --stop-position=$stop_pos --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002
---disable_query_log
-select "--- start-datetime --" as "";
---enable_query_log
---exec $MYSQL_BINLOG --short-form "--start-datetime=20200121153224" --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002
---disable_query_log
-select "--- stop-datetime --" as "";
---enable_query_log
---exec $MYSQL_BINLOG --short-form "--stop-datetime=2020/01/21 15@32@24" --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002
-
---disable_query_log
-select "--- to-last-log --" as "";
---enable_query_log
-
---exec $MYSQL_BINLOG --short-form --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT --to-last-log master-bin.000001
-
-# clean up
---disable_query_log
-select "--- end of test --" as "";
---enable_query_log
-drop table t1;
-
-# End of 4.1 tests
diff --git a/mysql-test/t/mysqlbinlog_base64.test b/mysql-test/t/mysqlbinlog_base64.test
deleted file mode 100644
index 3d3444cea1c..00000000000
--- a/mysql-test/t/mysqlbinlog_base64.test
+++ /dev/null
@@ -1,102 +0,0 @@
--- source include/have_binlog_format_row.inc
-#
-# Reset master to cleanup binlog
-#
-reset master;
-
-#
-# Write different events to binlog
-#
-create table t1 (a int);
-insert into t1 values (1);
-insert into t1 values (2);
-insert into t1 values (3);
-update t1 set a=a+2 where a=2;
-update t1 set a=a+2 where a=3;
-
-create table t2 (word varchar(20));
-load data infile '../../std_data/words.dat' into table t2;
-
-#
-# Save binlog
-#
-let $MYSQLD_DATADIR=`select @@datadir`;
-flush logs;
---exec $MYSQL_BINLOG --hexdump $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_base64.sql
-
-#
-# Clear database and restore from binlog
-#
-drop table t1;
-drop table t2;
---exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/mysqlbinlog_base64.sql
-
-#
-# Verify that all binlog events have been executed
-#
-select * from t1;
-select * from t2;
-
-#
-# Verify that events larger than the default IO_CACHE buffer
-# are handled correctly (BUG#25628).
-#
-flush logs;
-drop table t2;
-create table t2 (word varchar(20));
-load data infile '../../std_data/words.dat' into table t2;
-insert into t2 select * from t2;
-insert into t2 select * from t2;
-insert into t2 select * from t2;
-insert into t2 select * from t2;
-insert into t2 select * from t2;
-insert into t2 select * from t2;
-insert into t2 select * from t2;
-insert into t2 select * from t2;
-insert into t2 select * from t2;
-select count(*) from t2;
-
-flush logs;
---exec $MYSQL_BINLOG --hexdump $MYSQLD_DATADIR/master-bin.000003 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_base64.sql
---exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/mysqlbinlog_base64.sql
-
-#
-# Verify that all binlog events have been executed
-#
-select count(*) from t2;
-
-#
-# Test cleanup
-#
---remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog_base64.sql
-drop table t1;
-drop table t2;
-
-#
-# BUG#12354268
-#
-# This test verifies that using --start-position with DECODE-ROWS
-# does not make mysqlbinlog to output an error stating that it
-# does not contain any FD event.
-#
-
-RESET MASTER;
-USE test;
-SET @old_binlog_format= @@binlog_format;
-SET SESSION binlog_format=ROW;
-CREATE TABLE t1(c1 INT);
---let $master_binlog= query_get_value(SHOW MASTER STATUS, File, 1)
---let $master_pos= query_get_value(SHOW MASTER STATUS, Position, 1)
---let $MYSQLD_DATADIR= `SELECT @@datadir`
-
-INSERT INTO t1 VALUES (1);
-
-FLUSH LOGS;
-
---disable_result_log
---exec $MYSQL_BINLOG --base64-output=DECODE-ROWS --start-position=$master_pos -v $MYSQLD_DATADIR/$master_binlog
---enable_result_log
-
-DROP TABLE t1;
-SET SESSION binlog_format= @old_binlog_format;
-RESET MASTER;
diff --git a/mysql-test/t/mysqlbinlog_row-master.opt b/mysql-test/t/mysqlbinlog_row-master.opt
deleted file mode 100644
index 4d69f3359db..00000000000
--- a/mysql-test/t/mysqlbinlog_row-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---timezone=GMT-3
diff --git a/mysql-test/t/mysqlbinlog_row.test b/mysql-test/t/mysqlbinlog_row.test
deleted file mode 100644
index 9b41c63d195..00000000000
--- a/mysql-test/t/mysqlbinlog_row.test
+++ /dev/null
@@ -1,446 +0,0 @@
---source include/have_log_bin.inc
---source include/have_binlog_format_row.inc
---source include/have_ucs2.inc
-
---echo #
---echo # Preparatory cleanup.
---echo #
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
---echo #
---echo # We need a fixed timestamp to avoid varying results.
---echo #
-SET timestamp=1000000000;
-
---echo #
---echo # Delete all existing binary logs.
---echo #
-RESET MASTER;
-
-
-CREATE TABLE t1 (c01 BIT);
-INSERT INTO t1 VALUES (0);
-INSERT INTO t1 VALUES (1);
-DROP TABLE t1;
-
-CREATE TABLE t1 (c01 BIT(7));
-INSERT INTO t1 VALUES (1);
-INSERT INTO t1 VALUES (2);
-INSERT INTO t1 VALUES (4);
-INSERT INTO t1 VALUES (8);
-INSERT INTO t1 VALUES (16);
-INSERT INTO t1 VALUES (32);
-INSERT INTO t1 VALUES (64);
-INSERT INTO t1 VALUES (127);
-DELETE FROM t1 WHERE c01=127;
-UPDATE t1 SET c01=15 WHERE c01=16;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a BIT(20), b CHAR(2));
-INSERT INTO t1 VALUES (b'00010010010010001001', 'ab');
-DROP TABLE t1;
-
-CREATE TABLE t1 (c02 BIT(64));
-INSERT INTO t1 VALUES (1);
-INSERT INTO t1 VALUES (2);
-INSERT INTO t1 VALUES (128);
-INSERT INTO t1 VALUES (b'1111111111111111111111111111111111111111111111111111111111111111');
-DROP TABLE t1;
-
-
-CREATE TABLE t1 (c03 TINYINT);
-INSERT INTO t1 VALUES (1),(2),(3);
-INSERT INTO t1 VALUES (-128);
-UPDATE t1 SET c03=2 WHERE c03=1;
-DELETE FROM t1 WHERE c03=-128;
-DROP TABLE t1;
-
-CREATE TABLE t1 (c04 TINYINT UNSIGNED);
-INSERT INTO t1 VALUES (128), (255);
-UPDATE t1 SET c04=2 WHERE c04=1;
-DELETE FROM t1 WHERE c04=255;
-DROP TABLE t1;
-
-CREATE TABLE t1 (c06 BOOL);
-INSERT INTO t1 VALUES (TRUE);
-DELETE FROM t1 WHERE c06=TRUE;
-DROP TABLE t1;
-
-CREATE TABLE t1 (c07 SMALLINT);
-INSERT INTO t1 VALUES (1234);
-DELETE FROM t1 WHERE c07=1234;
-DROP TABLE t1;
-
-CREATE TABLE t1 (c08 SMALLINT UNSIGNED);
-INSERT INTO t1 VALUES (32768), (65535);
-UPDATE t1 SET c08=2 WHERE c08=32768;
-DELETE FROM t1 WHERE c08=65535;
-DROP TABLE t1;
-
-CREATE TABLE t1 (c10 MEDIUMINT);
-INSERT INTO t1 VALUES (12345);
-DELETE FROM t1 WHERE c10=12345;
-DROP TABLE t1;
-
-CREATE TABLE t1 (c11 MEDIUMINT UNSIGNED);
-INSERT INTO t1 VALUES (8388608), (16777215);
-UPDATE t1 SET c11=2 WHERE c11=8388608;
-DELETE FROM t1 WHERE c11=16777215;
-DROP TABLE t1;
-
-CREATE TABLE t1 (c13 INT);
-INSERT INTO t1 VALUES (123456);
-DELETE FROM t1 WHERE c13=123456;
-DROP TABLE t1;
-
-CREATE TABLE t1 (c14 INT UNSIGNED);
-INSERT INTO t1 VALUES (2147483648), (4294967295);
-UPDATE t1 SET c14=2 WHERE c14=2147483648;
-DELETE FROM t1 WHERE c14=4294967295;
-DROP TABLE t1;
-
-CREATE TABLE t1 (c16 BIGINT);
-INSERT INTO t1 VALUES (1234567890);
-DELETE FROM t1 WHERE c16=1234567890;
-DROP TABLE t1;
-
-CREATE TABLE t1 (c17 BIGINT UNSIGNED);
-INSERT INTO t1 VALUES (9223372036854775808), (18446744073709551615);
-UPDATE t1 SET c17=2 WHERE c17=9223372036854775808;
-DELETE FROM t1 WHERE c17=18446744073709551615;
-DROP TABLE t1;
-
-CREATE TABLE t1 (c19 FLOAT);
-INSERT INTO t1 VALUES (123.2234);
-DELETE FROM t1 WHERE c19>123;
-DROP TABLE t1;
-
-CREATE TABLE t1 (c22 DOUBLE);
-INSERT INTO t1 VALUES (123434.22344545);
-DELETE FROM t1 WHERE c22>123434;
-DROP TABLE t1;
-
-#
-
-CREATE TABLE t1 (c25 DECIMAL(10,5));
-INSERT INTO t1 VALUES (124.45);
-INSERT INTO t1 VALUES (-543.21);
-DELETE FROM t1 WHERE c25=124.45;
-DROP TABLE t1;
-
-#
-
-CREATE TABLE t1 (c28 DATE);
-INSERT INTO t1 VALUES ('2001-02-03');
-DELETE FROM t1 WHERE c28='2001-02-03';
-DROP TABLE t1;
-
-CREATE TABLE t1 (c29 DATETIME);
-INSERT INTO t1 VALUES ('2001-02-03 10:20:30');
-DELETE FROM t1 WHERE c29='2001-02-03 10:20:30';
-DROP TABLE t1;
-
-CREATE TABLE t1 (c30 TIMESTAMP);
-INSERT INTO t1 VALUES ('2001-02-03 10:20:30');
-DELETE FROM t1 WHERE c30='2001-02-03 10:20:30';
-DROP TABLE t1;
-
-CREATE TABLE t1 (c31 TIME);
-INSERT INTO t1 VALUES ('11:22:33');
-DELETE FROM t1 WHERE c31='11:22:33';
-DROP TABLE t1;
-
-CREATE TABLE t1 (c32 YEAR);
-INSERT INTO t1 VALUES ('2001');
-DELETE FROM t1 WHERE c32=2001;
-DROP TABLE t1;
-
-#
-
-CREATE TABLE t1 (c33 CHAR);
-INSERT INTO t1 VALUES ('a');
-DELETE FROM t1 WHERE c33='a';
-DROP TABLE t1;
-
-CREATE TABLE t1 (c34 CHAR(0));
-INSERT INTO t1 VALUES ('');
-DELETE FROM t1 WHERE c34='';
-DROP TABLE t1;
-
-CREATE TABLE t1 (c35 CHAR(1));
-INSERT INTO t1 VALUES ('b');
-DELETE FROM t1 WHERE c35='b';
-DROP TABLE t1;
-
-CREATE TABLE t1 (c36 CHAR(255));
-INSERT INTO t1 VALUES (repeat('c',255));
-DELETE FROM t1 WHERE c36>'c';
-DROP TABLE t1;
-
-#
-
-CREATE TABLE t1 (c37 NATIONAL CHAR);
-INSERT INTO t1 VALUES ('a');
-DELETE FROM t1 WHERE c37='a';
-DROP TABLE t1;
-
-CREATE TABLE t1 (c38 NATIONAL CHAR(0));
-INSERT INTO t1 VALUES ('');
-DELETE FROM t1 WHERE c38='';
-DROP TABLE t1;
-
-CREATE TABLE t1 (c39 NATIONAL CHAR(1));
-INSERT INTO t1 VALUES ('a');
-DELETE FROM t1 WHERE c39='a';
-DROP TABLE t1;
-
-CREATE TABLE t1 (c40 NATIONAL CHAR(255));
-INSERT INTO t1 VALUES (repeat('a', 255));
-INSERT INTO t1 VALUES (repeat(_latin1 0xDF, 255));
-DELETE FROM t1 WHERE c40>'a';
-DROP TABLE t1;
-
-#
-
-CREATE TABLE t1 (c41 CHAR CHARACTER SET UCS2);
-INSERT INTO t1 VALUES ('a');
-DELETE FROM t1 WHERE c41='a';
-DROP TABLE t1;
-
-CREATE TABLE t1 (c42 CHAR(0) CHARACTER SET UCS2);
-INSERT INTO t1 VALUES ('');
-DELETE FROM t1 WHERE c42='';
-DROP TABLE t1;
-
-CREATE TABLE t1 (c43 CHAR(1) CHARACTER SET UCS2);
-INSERT INTO t1 VALUES ('a');
-DELETE FROM t1 WHERE c43='a';
-DROP TABLE t1;
-
-CREATE TABLE t1 (c44 CHAR(255) CHARACTER SET UCS2);
-INSERT INTO t1 VALUES (repeat('a', 255));
-INSERT INTO t1 VALUES (repeat(_latin1 0xDF, 255));
-DELETE FROM t1 WHERE c44>'a';
-DROP TABLE t1;
-
-#
-
-CREATE TABLE t1 (c45 VARCHAR(0));
-INSERT INTO t1 VALUES ('');
-DELETE FROM t1 WHERE c45='';
-DROP TABLE t1;
-
-CREATE TABLE t1 (c46 VARCHAR(1));
-INSERT INTO t1 VALUES ('a');
-DELETE FROM t1 WHERE c46='a';
-DROP TABLE t1;
-
-CREATE TABLE t1 (c47 VARCHAR(255));
-INSERT INTO t1 VALUES (repeat('a',255));
-DELETE FROM t1 WHERE c47>'a';
-DROP TABLE t1;
-
-CREATE TABLE t1 (c48 VARCHAR(261));
-INSERT INTO t1 VALUES (repeat('a',261));
-DELETE FROM t1 WHERE c48>'a';
-DROP TABLE t1;
-
-#
-
-CREATE TABLE t1 (c49 NATIONAL VARCHAR(0));
-INSERT INTO t1 VALUES ('');
-DELETE FROM t1 WHERE c49='';
-DROP TABLE t1;
-
-CREATE TABLE t1 (c50 NATIONAL VARCHAR(1));
-INSERT INTO t1 VALUES ('a');
-DELETE FROM t1 WHERE c50='a';
-DROP TABLE t1;
-
-CREATE TABLE t1 (c51 NATIONAL VARCHAR(255));
-INSERT INTO t1 VALUES (repeat('a',255));
-INSERT INTO t1 VALUES (repeat(_latin1 0xDF, 255));
-DELETE FROM t1 WHERE c51>'a';
-DROP TABLE t1;
-
-CREATE TABLE t1 (c52 NATIONAL VARCHAR(261));
-INSERT INTO t1 VALUES (repeat('a',261));
-INSERT INTO t1 VALUES (repeat(_latin1 0xDF, 261));
-DELETE FROM t1 WHERE c52>'a';
-DROP TABLE t1;
-
-#
-
-CREATE TABLE t1 (c53 VARCHAR(0) CHARACTER SET ucs2);
-INSERT INTO t1 VALUES ('');
-DELETE FROM t1 WHERE c53='';
-DROP TABLE t1;
-
-CREATE TABLE t1 (c54 VARCHAR(1) CHARACTER SET ucs2);
-INSERT INTO t1 VALUES ('a');
-DELETE FROM t1 WHERE c54='a';
-DROP TABLE t1;
-
-CREATE TABLE t1 (c55 VARCHAR(255) CHARACTER SET ucs2);
-INSERT INTO t1 VALUES (repeat('ab', 127));
-DELETE FROM t1 WHERE c55>'a';
-DROP TABLE t1;
-
-CREATE TABLE t1 (c56 VARCHAR(261) CHARACTER SET ucs2);
-INSERT INTO t1 VALUES (repeat('ab', 130));
-DELETE FROM t1 WHERE c56>'a';
-DROP TABLE t1;
-
-#
-
-CREATE TABLE t1 (c57 BINARY);
-INSERT INTO t1 VALUES (0x00);
-INSERT INTO t1 VALUES (0x02);
-INSERT INTO t1 VALUES ('a');
-DELETE FROM t1 WHERE c57='a';
-DROP TABLE t1;
-
-CREATE TABLE t1 (c58 BINARY(0));
-INSERT INTO t1 VALUES ('');
-DELETE FROM t1 WHERE c58='';
-DROP TABLE t1;
-
-CREATE TABLE t1 (c59 BINARY(1));
-INSERT INTO t1 VALUES (0x00);
-INSERT INTO t1 VALUES (0x02);
-INSERT INTO t1 VALUES ('a');
-DELETE FROM t1 WHERE c59='a';
-DROP TABLE t1;
-
-CREATE TABLE t1 (c60 BINARY(255));
-INSERT INTO t1 VALUES (0x00);
-INSERT INTO t1 VALUES (0x02);
-INSERT INTO t1 VALUES (repeat('a\0',120));
-DELETE FROM t1 WHERE c60<0x02;
-DROP TABLE t1;
-
-#
-
-CREATE TABLE t1 (c61 VARBINARY(0));
-INSERT INTO t1 VALUES ('');
-DELETE FROM t1 WHERE c61='';
-DROP TABLE t1;
-
-CREATE TABLE t1 (c62 VARBINARY(1));
-INSERT INTO t1 VALUES (0x00);
-INSERT INTO t1 VALUES (0x02);
-INSERT INTO t1 VALUES ('a');
-DELETE FROM t1 WHERE c62=0x02;
-DROP TABLE t1;
-
-CREATE TABLE t1 (c63 VARBINARY(255));
-INSERT INTO t1 VALUES (0x00);
-INSERT INTO t1 VALUES (0x02);
-INSERT INTO t1 VALUES (repeat('a\0',120));
-DELETE FROM t1 WHERE c63=0x02;
-DROP TABLE t1;
-
-#
-
-CREATE TABLE t1 (c65 TINYBLOB);
-INSERT INTO t1 VALUES ('tinyblob1');
-DELETE FROM t1 WHERE c65='tinyblob1';
-DROP TABLE t1;
-
-CREATE TABLE t1 (c68 BLOB);
-INSERT INTO t1 VALUES ('blob1');
-DELETE FROM t1 WHERE c68='blob1';
-DROP TABLE t1;
-
-CREATE TABLE t1 (c71 MEDIUMBLOB);
-INSERT INTO t1 VALUES ('mediumblob1');
-DELETE FROM t1 WHERE c71='mediumblob1';
-DROP TABLE t1;
-
-CREATE TABLE t1 (c74 LONGBLOB);
-INSERT INTO t1 VALUES ('longblob1');
-DELETE FROM t1 WHERE c74='longblob1';
-DROP TABLE t1;
-
-CREATE TABLE t1 (c66 TINYTEXT);
-INSERT INTO t1 VALUES ('tinytext1');
-DELETE FROM t1 WHERE c66='tinytext1';
-DROP TABLE t1;
-
-CREATE TABLE t1 (c69 TEXT);
-INSERT INTO t1 VALUES ('text1');
-DELETE FROM t1 WHERE c69='text1';
-DROP TABLE t1;
-
-CREATE TABLE t1 (c72 MEDIUMTEXT);
-INSERT INTO t1 VALUES ('mediumtext1');
-DELETE FROM t1 WHERE c72='mediumtext1';
-DROP TABLE t1;
-
-CREATE TABLE t1 (c75 LONGTEXT);
-INSERT INTO t1 VALUES ('longtext1');
-DELETE FROM t1 WHERE c75='longtext1';
-DROP TABLE t1;
-
-#
-
-CREATE TABLE t1 (c67 TINYTEXT CHARACTER SET UCS2);
-INSERT INTO t1 VALUES ('tinytext1');
-DELETE FROM t1 WHERE c67='tinytext1';
-DROP TABLE t1;
-
-CREATE TABLE t1 (c70 TEXT CHARACTER SET UCS2);
-INSERT INTO t1 VALUES ('text1');
-DELETE FROM t1 WHERE c70='text1';
-DROP TABLE t1;
-
-CREATE TABLE t1 (c73 MEDIUMTEXT CHARACTER SET UCS2);
-INSERT INTO t1 VALUES ('mediumtext1');
-DELETE FROM t1 WHERE c73='mediumtext1';
-DROP TABLE t1;
-
-CREATE TABLE t1 (c76 LONGTEXT CHARACTER SET UCS2);
-INSERT INTO t1 VALUES ('longtext1');
-DELETE FROM t1 WHERE c76='longtext1';
-DROP TABLE t1;
-
-#
-
-CREATE TABLE t1 (c77 ENUM('a','b','c'));
-INSERT INTO t1 VALUES ('b');
-DELETE FROM t1 WHERE c77='b';
-DROP TABLE t1;
-
-#
-
-CREATE TABLE t1 (c78 SET('a','b','c','d','e','f'));
-INSERT INTO t1 VALUES ('a,b');
-INSERT INTO t1 VALUES ('a,c');
-INSERT INTO t1 VALUES ('b,c');
-INSERT INTO t1 VALUES ('a,b,c');
-INSERT INTO t1 VALUES ('a,b,c,d');
-INSERT INTO t1 VALUES ('a,b,c,d,e');
-INSERT INTO t1 VALUES ('a,b,c,d,e,f');
-DELETE FROM t1 WHERE c78='a,b';
-DROP TABLE t1;
-
-#
-# Check multi-table update
-#
-CREATE TABLE t1 (a int NOT NULL DEFAULT 0, b int NOT NULL DEFAULT 0);
-CREATE TABLE t2 (a int NOT NULL DEFAULT 0, b int NOT NULL DEFAULT 0);
-INSERT INTO t1 SET a=1;
-INSERT INTO t1 SET b=1;
-INSERT INTO t2 SET a=1;
-INSERT INTO t2 SET b=1;
-UPDATE t1, t2 SET t1.a=10, t2.a=20;
-DROP TABLE t1,t2;
-
-flush logs;
-
-let $MYSQLD_DATADIR= `select @@datadir`;
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ /exec_time=[0-9]*/exec_time=#/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /server v [^ ]*/server v #.##.##/ /(@[0-9]*=[0-9]*[.][0-9]{1,3})[0-9e+-]*[^ ]*(.*(FLOAT|DOUBLE).*[*].)/\1...\2/
---exec $MYSQL_BINLOG --base64-output=decode-rows -v -v $MYSQLD_DATADIR/master-bin.000001
diff --git a/mysql-test/t/mysqlbinlog_row_innodb-master.opt b/mysql-test/t/mysqlbinlog_row_innodb-master.opt
deleted file mode 100644
index 4d69f3359db..00000000000
--- a/mysql-test/t/mysqlbinlog_row_innodb-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---timezone=GMT-3
diff --git a/mysql-test/t/mysqlbinlog_row_innodb.test b/mysql-test/t/mysqlbinlog_row_innodb.test
deleted file mode 100644
index cef1a712f7d..00000000000
--- a/mysql-test/t/mysqlbinlog_row_innodb.test
+++ /dev/null
@@ -1,24 +0,0 @@
-# mysqlbinlog_row_innodb.test
-#
-# Show that mysqlbinlog displays human readable comments to
-# row-based log events.
-#
-# Main module for the InnoDB storage engine.
-#
-# Calls include/mysqlbinlog_row.inc
-# See there for more informaton.
-#
-
---source include/have_innodb.inc
-let $engine_type=InnoDB;
-
-#
-# The test case would also work with statement based or mixed mode logging.
-# But this would require different result files. To handle this with the
-# current test suite, new main test cases are required.
-#
---source include/have_binlog_format_row.inc
---source include/have_ucs2.inc
-
---source include/mysqlbinlog_row_engine.inc
-
diff --git a/mysql-test/t/mysqlbinlog_row_myisam-master.opt b/mysql-test/t/mysqlbinlog_row_myisam-master.opt
deleted file mode 100644
index 4d69f3359db..00000000000
--- a/mysql-test/t/mysqlbinlog_row_myisam-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---timezone=GMT-3
diff --git a/mysql-test/t/mysqlbinlog_row_myisam.test b/mysql-test/t/mysqlbinlog_row_myisam.test
deleted file mode 100644
index e7b0335812a..00000000000
--- a/mysql-test/t/mysqlbinlog_row_myisam.test
+++ /dev/null
@@ -1,23 +0,0 @@
-# mysqlbinlog_row.test
-#
-# Show that mysqlbinlog displays human readable comments to
-# row-based log events.
-#
-# Main module for the MyISAM storage engine.
-#
-# Calls include/mysqlbinlog_row.inc
-# See there for more informaton.
-#
-
-#--source include/have_myisam.inc
-let $engine_type=MyISAM;
-
-#
-# The test case would also work with statement based or mixed mode logging.
-# But this would require different result files. To handle this with the
-# current test suite, new main test cases are required.
-#
---source include/have_binlog_format_row.inc
---source include/have_ucs2.inc
-
---source include/mysqlbinlog_row_engine.inc
diff --git a/mysql-test/t/mysqlbinlog_row_trans-master.opt b/mysql-test/t/mysqlbinlog_row_trans-master.opt
deleted file mode 100644
index 4d69f3359db..00000000000
--- a/mysql-test/t/mysqlbinlog_row_trans-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---timezone=GMT-3
diff --git a/mysql-test/t/mysqlbinlog_row_trans.test b/mysql-test/t/mysqlbinlog_row_trans.test
deleted file mode 100644
index 24abc441c4c..00000000000
--- a/mysql-test/t/mysqlbinlog_row_trans.test
+++ /dev/null
@@ -1,161 +0,0 @@
-# mysqlbinlog_trans.test
-#
-# Show that mysqlbinlog work correctly with transactions.
-#
-
-#--source include/have_myisam.inc
---let $engine_type_nontrans= MyISAM
---source include/have_innodb.inc
---let $engine_type= InnoDB
-
-#
-# The test case would also work with statement based or mixed mode logging.
-# But this would require different result files. To handle this with the
-# current test suite, new main test cases are required.
-#
---source include/have_binlog_format_row.inc
-
---source include/have_log_bin.inc
-
---echo #
---echo # Preparatory cleanup.
---echo #
---disable_warnings
-DROP TABLE IF EXISTS t1, t2;
---enable_warnings
-
---echo #
---echo # We need a fixed timestamp to avoid varying results.
---echo #
-SET timestamp=1000000000;
-
---echo #
---echo # Delete all existing binary logs.
---echo #
-RESET MASTER;
-
---echo #
---echo # Create test tables.
---echo #
-eval CREATE TABLE t1 (
- c1 INT,
- c2 VARCHAR(20)
- ) ENGINE=$engine_type DEFAULT CHARSET latin1;
-eval CREATE TABLE t2 (
- c1 INT,
- c2 VARCHAR(20)
- ) ENGINE=$engine_type_nontrans DEFAULT CHARSET latin1;
-
---echo #
---echo # Start transaction #1, transactional table only, commit.
---echo #
-START TRANSACTION;
-
---echo #
---echo # Do some statements.
---echo #
-INSERT INTO t1 VALUES (1,'varchar-1'), (2,'varchar-2'), (3,'varchar-3');
-UPDATE t1 SET c1 = c1 + 10;
-DELETE FROM t1 WHERE c1 = 12;
-
---echo #
---echo # Commit transaction.
---echo #
-COMMIT;
-SELECT * FROM t1;
-TRUNCATE TABLE t1;
-
---echo #
---echo # Start transaction #2, transactional table only, rollback.
---echo #
-START TRANSACTION;
-
---echo #
---echo # Do some statements.
---echo #
-INSERT INTO t1 VALUES (1,'varchar-1'), (2,'varchar-2'), (3,'varchar-3');
-UPDATE t1 SET c1 = c1 + 10;
-DELETE FROM t1 WHERE c1 = 12;
-
---echo #
---echo # Rollback transaction.
---echo #
-ROLLBACK;
-SELECT * FROM t1;
-TRUNCATE TABLE t1;
-
---echo #
---echo # Start transaction #3, both tables, commit.
---echo #
-START TRANSACTION;
-
---echo #
---echo # Do some statements on the transactional table.
---echo #
-INSERT INTO t1 VALUES (1,'varchar-1'), (2,'varchar-2'), (3,'varchar-3');
-UPDATE t1 SET c1 = c1 + 10;
-DELETE FROM t1 WHERE c1 = 12;
-
---echo #
---echo # Do some statements on the non-transactional table.
---echo #
-INSERT INTO t2 VALUES (1,'varchar-1'), (2,'varchar-2'), (3,'varchar-3');
-UPDATE t2 SET c1 = c1 + 10;
-DELETE FROM t2 WHERE c1 = 12;
-
---echo #
---echo # Commit transaction.
---echo #
-COMMIT;
-SELECT * FROM t1;
-SELECT * FROM t2;
-TRUNCATE TABLE t1;
-TRUNCATE TABLE t2;
-
---echo #
---echo # Start transaction #4, both tables, rollback.
---echo #
-START TRANSACTION;
-
---echo #
---echo # Do some statements on the transactional table.
---echo #
-INSERT INTO t1 VALUES (1,'varchar-1'), (2,'varchar-2'), (3,'varchar-3');
-UPDATE t1 SET c1 = c1 + 10;
-DELETE FROM t1 WHERE c1 = 12;
-
---echo #
---echo # Do some statements on the non-transactional table.
---echo #
-INSERT INTO t2 VALUES (1,'varchar-1'), (2,'varchar-2'), (3,'varchar-3');
-UPDATE t2 SET c1 = c1 + 10;
-DELETE FROM t2 WHERE c1 = 12;
-
---echo #
---echo # Rollback transaction.
---echo #
-ROLLBACK;
-SELECT * FROM t1;
-SELECT * FROM t2;
-TRUNCATE TABLE t1;
-TRUNCATE TABLE t2;
-
---echo #
---echo # Flush all log buffers to the log file.
---echo #
-FLUSH LOGS;
-
---echo #
---echo # Call mysqlbinlog to display the log file contents.
---echo #
-let $MYSQLD_DATADIR= `select @@datadir`;
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ /exec_time=[0-9]*/exec_time=#/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /Xid = [0-9]*/Xid = #/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /server v [^ ]*/server v #.##.##/
---exec $MYSQL_BINLOG --base64-output=decode-rows -v -v $MYSQLD_DATADIR/master-bin.000001
-
---echo #
---echo # Cleanup.
---echo #
-DROP TABLE t1, t2;
-
-
diff --git a/mysql-test/t/mysqlshow.test b/mysql-test/t/mysqlshow.test
index 5dba7fa5b85..fc5d4d982e5 100644
--- a/mysql-test/t/mysqlshow.test
+++ b/mysql-test/t/mysqlshow.test
@@ -29,7 +29,7 @@ select "---- -v -v -t ------" as "";
DROP TABLE t1, t2;
-if (`select count(*) from information_schema.plugins where plugin_name='innodb' and plugin_auth_version > "1.1.8-29.1"`)
+if (`select count(*) from information_schema.plugins where plugin_name='innodb' and plugin_auth_version > "1.1.8-29.3"`)
{
# because of lp:1066512 this test shows xtradb I_S plugins, even when
# xtradb is supposed to be disabled
diff --git a/mysql-test/t/partition_innodb.test b/mysql-test/t/partition_innodb.test
index 2756f7d1ebb..3aa78e74828 100644
--- a/mysql-test/t/partition_innodb.test
+++ b/mysql-test/t/partition_innodb.test
@@ -663,4 +663,19 @@ SHOW CREATE TABLE t1;
SELECT * FROM t1;
DROP TABLE t1;
+--echo #
+--echo # BUG#12912171 - ASSERTION FAILED: QUICK->HEAD->READ_SET ==
+--echo # SAVE_READ_SET
+--echo #
+CREATE TABLE t1 (
+ a INT,
+ b INT,
+ c INT,
+ PRIMARY KEY (c,a), KEY (a),KEY (a)
+) ENGINE=INNODB PARTITION BY KEY () PARTITIONS 2;
+INSERT INTO t1 VALUES (1,5,1),(2,4,1),(3,3,1),(4,2,1),(5,1,1);
+UPDATE t1 SET b = 0, c=1 WHERE a <=>0;
+SELECT * FROM t1;
+DROP TABLE t1;
+
set global default_storage_engine=default;
diff --git a/mysql-test/t/plugin.test b/mysql-test/t/plugin.test
index 2b234b64047..4412383f837 100644
--- a/mysql-test/t/plugin.test
+++ b/mysql-test/t/plugin.test
@@ -4,14 +4,14 @@
CREATE TABLE t1(a int) ENGINE=EXAMPLE;
DROP TABLE t1;
-eval INSTALL PLUGIN example SONAME 'ha_example';
+INSTALL PLUGIN example SONAME 'ha_example';
--replace_regex /\.dll/.so/
--error 1125
-eval INSTALL PLUGIN EXAMPLE SONAME 'ha_example';
+INSTALL PLUGIN EXAMPLE SONAME 'ha_example';
UNINSTALL PLUGIN example;
-eval INSTALL SONAME 'ha_example';
+INSTALL SONAME 'ha_example';
--replace_column 5 #
--replace_regex /\.dll/.so/
--query_vertical select * from information_schema.plugins where plugin_library like 'ha_example%'
@@ -28,7 +28,7 @@ set global example_enum_var= e1;
show status like 'example%';
show variables like 'example%';
-eval UNINSTALL SONAME 'ha_example';
+UNINSTALL SONAME 'ha_example';
--replace_column 5 #
--replace_regex /\.dll/.so/
--query_vertical select * from information_schema.plugins where plugin_library like 'ha_example%'
@@ -41,12 +41,18 @@ UNINSTALL PLUGIN EXAMPLE;
--error 1305
UNINSTALL PLUGIN non_exist;
+#
+# MDEV-3985 crash: uninstall soname 'a'
+#
+--replace_regex /\.dll/.so/
+--error 1305
+UNINSTALL SONAME 'non_exist';
--echo #
--echo # Bug#32034: check_func_enum() does not check correct values but set it
--echo # to impossible int val
--echo #
-eval INSTALL PLUGIN example SONAME 'ha_example';
+INSTALL PLUGIN example SONAME 'ha_example';
SET GLOBAL example_enum_var= e1;
SET GLOBAL example_enum_var= e2;
@@ -60,7 +66,7 @@ UNINSTALL PLUGIN example;
#
# Bug #32757 hang with sql_mode set when setting some global variables
#
-eval INSTALL PLUGIN example SONAME 'ha_example';
+INSTALL PLUGIN example SONAME 'ha_example';
select @@session.sql_mode into @old_sql_mode;
diff --git a/mysql-test/t/plugin_auth.test b/mysql-test/t/plugin_auth.test
index e1de1cc8153..4a3187a33eb 100644
--- a/mysql-test/t/plugin_auth.test
+++ b/mysql-test/t/plugin_auth.test
@@ -174,21 +174,35 @@ GRANT PROXY ON ''@'' TO grant_plug;
--error ER_ACCESS_DENIED_NO_PASSWORD_ERROR
GRANT PROXY ON grant_plug TO grant_plug_dest;
---echo this should fail : same user, but on a different host
---error ER_ACCESS_DENIED_NO_PASSWORD_ERROR
+# Security context in THD contains two pairs of (user,host)
+# 1. (user,host) pair referring to inbound connection
+# 2. (priv_user,priv_host) pair obtained from mysql.user table after doing
+# authnetication of incoming connection.
+# Granting/revoking proxy privileges, privileges should be checked wrt
+# (priv_user, priv_host) tuple that is obtained from mysql.user table
+# Following is a valid grant because effective user of connection is
+# grant_plug_dest@% and statement is trying to grant proxy on the same
+# user.
+--echo This is a valid grant
GRANT PROXY ON grant_plug_dest TO grant_plug;
+REVOKE PROXY ON grant_plug_dest FROM grant_plug;
--echo this should work : same user
-GRANT PROXY ON grant_plug_dest@localhost TO grant_plug_dest2;
-REVOKE PROXY ON grant_plug_dest@localhost FROM grant_plug_dest2;
+GRANT PROXY ON grant_plug_dest TO grant_plug_dest2;
+REVOKE PROXY ON grant_plug_dest FROM grant_plug_dest2;
---echo this should work : same user
+# grant_plug_dest@localhost is not the same as grant_plug_dest@%
+# so following grant/revoke should fail
+--echo this should fail : not the same user
+--error ER_ACCESS_DENIED_NO_PASSWORD_ERROR
GRANT PROXY ON grant_plug_dest@localhost TO grant_plug WITH GRANT OPTION;
+--echo this should fail : not the same user
+--error ER_ACCESS_DENIED_NO_PASSWORD_ERROR
REVOKE PROXY ON grant_plug_dest@localhost FROM grant_plug;
--echo this should fail : can't create users
--error ER_CANT_CREATE_USER_WITH_GRANT
-GRANT PROXY ON grant_plug_dest@localhost TO grant_plug@localhost;
+GRANT PROXY ON grant_plug_dest TO grant_plug@localhost;
connection default;
--echo in default connection
diff --git a/mysql-test/t/range.test b/mysql-test/t/range.test
index 6ac883ffcc1..a5ff9cc0096 100644
--- a/mysql-test/t/range.test
+++ b/mysql-test/t/range.test
@@ -1,6 +1,7 @@
#
# Problem with range optimizer
#
+--source include/have_innodb.inc
--disable_warnings
drop table if exists t1, t2, t3, t10, t100;
@@ -1549,3 +1550,57 @@ SELECT * FROM t1 ignore index(d) WHERE d = 'q' OR d >= 'q' OR (d IN ( 'j' , 's'
SELECT * FROM t1 force index(d) WHERE d = 'q' OR d >= 'q' OR (d IN ( 'j' , 's' , 'i' ) AND ( b = 102 ));
DROP TABLE t1;
+
+--disable_parsing
+# MariaDB: Moved the following to partition.test
+--echo #
+--echo # BUG#12912171 - ASSERTION FAILED: QUICK->HEAD->READ_SET ==
+--echo # SAVE_READ_SET
+--echo #
+CREATE TABLE t1 (
+ a INT,
+ b INT,
+ c INT,
+ PRIMARY KEY (c,a), KEY (a),KEY (a)
+) ENGINE=INNODB PARTITION BY KEY () PARTITIONS 2;
+INSERT INTO t1 VALUES (1,5,1),(2,4,1),(3,3,1),(4,2,1),(5,1,1);
+UPDATE t1 SET b = 0, c=1 WHERE a <=>0;
+SELECT * FROM t1;
+DROP TABLE t1;
+--enable_parsing
+
+--echo #
+--echo # BUG#13256446 - ASSERTION QUICK->HEAD->READ_SET ==
+--echo # SAVE_READ_SET' FAILED IN OPT_RANGE.CC:1606
+--echo #
+CREATE TABLE t1 (
+ f1 INT AUTO_INCREMENT,
+ f2 INT,
+ f3 INT,
+ f4 INT,
+ PRIMARY KEY (f1),KEY(f2)
+) ENGINE=INNODB;
+CREATE ALGORITHM=MERGE VIEW v2 AS SELECT f1,f2,f3,f4 FROM t1 WHERE f2=103;
+INSERT INTO t1 VALUES (154,0,NULL,0),(0,NULL,9,0),
+ (NULL,102,NULL,3),(0,3,NULL,0), (9,0,NULL,0),(0,9,NULL,157);
+SELECT * FROM v2;
+UPDATE v2 SET f4=0, f2=NULL, f1=NULL WHERE f1 > 16 ORDER BY f1;
+SELECT * FROM v2;
+DROP TABLE t1;
+DROP VIEW v2;
+
+CREATE TABLE t1 (
+ f1 INT AUTO_INCREMENT,
+ f2 INT,
+ f3 INT,
+ f4 INT,
+ PRIMARY KEY (f1),KEY(f2)
+) ENGINE=INNODB;
+INSERT INTO t1 VALUES(1,NULL,NULL,0), (2,2,0,3), (9,0,107,18),
+ (10,0,0,0), (231,0,0,0), (232,0,8,0), (234,0,0,NULL), (235,8,0,3);
+CREATE ALGORITHM=MERGE VIEW v3 AS SELECT f1,f2,f3,f4 FROM t1 WHERE f1<=85 ;
+SELECT * FROM v3;
+UPDATE v3 SET f3=0, f4=4 WHERE f2=68 ORDER BY f1;
+SELECT * FROM v3;
+DROP TABLE t1;
+DROP VIEW v3;
diff --git a/mysql-test/t/range_vs_index_merge.test b/mysql-test/t/range_vs_index_merge.test
index fb8fd778559..fb8fd778559 100755..100644
--- a/mysql-test/t/range_vs_index_merge.test
+++ b/mysql-test/t/range_vs_index_merge.test
diff --git a/mysql-test/t/range_vs_index_merge_innodb.test b/mysql-test/t/range_vs_index_merge_innodb.test
index e85cd044ece..e85cd044ece 100755..100644
--- a/mysql-test/t/range_vs_index_merge_innodb.test
+++ b/mysql-test/t/range_vs_index_merge_innodb.test
diff --git a/mysql-test/t/show_check.test b/mysql-test/t/show_check.test
index 3a38b85f1ae..c2edef87d41 100644
--- a/mysql-test/t/show_check.test
+++ b/mysql-test/t/show_check.test
@@ -1371,3 +1371,17 @@ SELECT RELEASE_LOCK('t');
--connection default
SET NAMES latin1;
+
+--echo #
+--echo # WL#6454: Deprecate SHOW AUTHORS and SHOW CONTRIBUTORS
+--echo #
+
+--disable_result_log
+SHOW AUTHORS;
+--enable_result_log
+SHOW WARNINGS;
+
+--disable_result_log
+SHOW CONTRIBUTORS;
+--enable_result_log
+SHOW WARNINGS;
diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test
index 7fc8dad3bb9..9db6709a8d2 100644
--- a/mysql-test/t/sp.test
+++ b/mysql-test/t/sp.test
@@ -9151,6 +9151,26 @@ CALL p1(1);
DROP PROCEDURE p1;
+--echo
+--echo MDEV-3900 Optimizer difference between MySQL and MariaDB with stored functions in WHERE clause of UPDATE or DELETE statements
+--echo
+
+CREATE FUNCTION tdn() RETURNS int(7) DETERMINISTIC RETURN to_days(now());
+
+CREATE TABLE t1 (pk INT NOT NULL AUTO_INCREMENT PRIMARY KEY, daynum INT, a CHAR(1), INDEX(daynum), INDEX(a)) ENGINE=MyISAM;
+INSERT INTO t1 (daynum) VALUES (1),(2),(3),(4),(5),(TO_DAYS(NOW())),(7),(8);
+INSERT INTO t1 (daynum) SELECT a1.daynum FROM t1 a1, t1 a2, t1 a3, t1 a4, t1 a5;
+
+FLUSH TABLES;
+FLUSH STATUS;
+
+SHOW STATUS LIKE '%Handler_read%';
+UPDATE t1 SET a = '+' WHERE daynum=tdn();
+SHOW STATUS LIKE '%Handler_read%';
+
+drop function tdn;
+drop table t1;
+
--echo #
--echo # lp:1002157 : testing stored function
--echo # bug#62125 result for null incorrectly yields 1292 warning.
diff --git a/mysql-test/t/sp_notembedded.test b/mysql-test/t/sp_notembedded.test
index 39e7102079c..447a1db762e 100644
--- a/mysql-test/t/sp_notembedded.test
+++ b/mysql-test/t/sp_notembedded.test
@@ -429,14 +429,6 @@ disconnect addcon;
DROP DATABASE `my.db`;
USE test;
-#
-# Restore global concurrent_insert value. Keep in the end of the test file.
-#
-
-set @@global.concurrent_insert= @old_concurrent_insert;
-
-# Wait till all disconnects are completed
---source include/wait_until_count_sessions.inc
--echo #
--echo # Bug#11763507 - 56224: FUNCTION NAME IS CASE-SENSITIVE
@@ -461,3 +453,16 @@ SHOW CREATE EVENT TESTE_bug11763507;
DROP EVENT teste_bug11763507;
--echo #END OF BUG#11763507 test.
+
+--echo # ------------------------------------------------------------------
+--echo # -- End of 5.1 tests
+--echo # ------------------------------------------------------------------
+
+#
+# Restore global concurrent_insert value. Keep in the end of the test file.
+#
+
+set @@global.concurrent_insert= @old_concurrent_insert;
+
+# Wait till all disconnects are completed
+--source include/wait_until_count_sessions.inc
diff --git a/mysql-test/t/subselect4.test b/mysql-test/t/subselect4.test
index 14b62bfd2f7..37f660d6682 100644
--- a/mysql-test/t/subselect4.test
+++ b/mysql-test/t/subselect4.test
@@ -1778,6 +1778,57 @@ drop table t1, t2;
set optimizer_switch=@subselect4_tmp;
--echo #
+--echo # MDEV-3928 Assertion `example' failed in Item_cache::is_expensive_processor with a 2-level IN subquery
+--echo #
+
+CREATE TABLE t1 (a1 INT, b1 TIME) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (4,'21:22:34'),(6,'10:50:38');
+
+CREATE TABLE t2 (a2 INT, b2 TIME) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (8, '06:17:39');
+
+CREATE TABLE t3 (a3 INT, b3 TIME) ENGINE=MyISAM;
+INSERT INTO t3 VALUES (1,'00:00:01'),(7,'00:00:02');
+
+EXPLAIN
+SELECT * FROM t1 WHERE a1 IN (
+ SELECT a2 FROM t2 WHERE a2 IN (
+ SELECT a3 FROM t3 WHERE b2 = b1 AND b2 <= b1 ORDER BY b3
+ )
+);
+
+SELECT * FROM t1 WHERE a1 IN (
+ SELECT a2 FROM t2 WHERE a2 IN (
+ SELECT a3 FROM t3 WHERE b2 = b1 AND b2 <= b1 ORDER BY b3
+ )
+);
+drop table t1, t2, t3;
+
+--echo #
+--echo # MDEV-4056:Server crashes in Item_func_trig_cond::val_int
+--echo # with FROM and NOT IN subqueries, LEFT JOIN, derived_merge+in_to_exists
+--echo #
+
+set @optimizer_switch_MDEV4056 = @@optimizer_switch;
+SET optimizer_switch = 'derived_merge=on,in_to_exists=on';
+
+CREATE TABLE t1 (a VARCHAR(1)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES ('x'),('d');
+
+CREATE TABLE t2 (pk INT PRIMARY KEY, b INT, c VARCHAR(1)) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (1,2,'v'),(2,150,'v');
+
+SELECT * FROM t1 LEFT JOIN (
+ SELECT * FROM t2 WHERE ( pk, pk ) NOT IN (
+ SELECT MIN(b), SUM(pk) FROM t1
+ )
+) AS alias1 ON (a = c)
+WHERE b IS NULL OR a < 'u';
+
+drop table t1,t2;
+set @@optimizer_switch = @optimizer_switch_MDEV4056;
+
+--echo #
--echo # MDEV-3899 Valgrind warnings (blocks are definitely lost) in filesort on IN subquery with SUM and DISTINCT
--echo #
diff --git a/mysql-test/t/subselect_innodb.test b/mysql-test/t/subselect_innodb.test
index 523e1774a9c..fc07a088a15 100644
--- a/mysql-test/t/subselect_innodb.test
+++ b/mysql-test/t/subselect_innodb.test
@@ -425,4 +425,18 @@ select 1 from t1 where 1 like (select 1 from t1 where 1 <=> (select 1 from t1 gr
drop table t1;
+--echo #
+--echo # MDEV-3988 crash in create_tmp_table
+--echo #
+
+drop table if exists `t1`,`t2`;
+create table `t1`(`a` char(1) character set utf8)engine=innodb;
+create table `t2`(`b` char(1) character set utf8)engine=memory;
+select distinct (select 1 from `t2` where `a`) `d2` from `t1`;
+select distinct (select 1 from `t2` where `a`) `d2`, a from `t1`;
+select distinct a, (select 1 from `t2` where `a`) `d2` from `t1`;
+select distinct (1 + (select 1 from `t2` where `a`)) `d2` from `t1`;
+
+drop table t1,t2;
+
set optimizer_switch=@subselect_innodb_tmp;
diff --git a/mysql-test/t/subselect_sj.test b/mysql-test/t/subselect_sj.test
index 2facb089718..efbd2b00f24 100644
--- a/mysql-test/t/subselect_sj.test
+++ b/mysql-test/t/subselect_sj.test
@@ -2462,5 +2462,74 @@ HAVING t1sum <> 1;
DROP TABLE t1, t2;
+--echo #
+--echo # MDEV-3911: Assertion `fixed == 0' failed in Item_field::fix_fields
+--echo # on 2nd execution of PS with semijoin=on and IN subquery
+--echo #
+
+CREATE TABLE t1 (a INT, b INT) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (0,4),(8,6);
+
+CREATE TABLE t2 (c INT, d INT) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (7,1),(0,7);
+
+eval PREPARE stmt FROM ' SELECT * FROM t1 WHERE ( a, b ) IN ( SELECT c, d FROM t2 ) ';
+
+execute stmt;
+execute stmt;
+
+deallocate prepare stmt;
+drop table t1,t2;
+
+--echo #
+--echo # MySQL Bug#13340270: assertion table->sort.record_pointers == __null
+--echo #
+
+CREATE TABLE t1 (
+ pk int NOT NULL,
+ col_int_key int DEFAULT NULL,
+ col_varchar_key varchar(1) DEFAULT NULL,
+ col_varchar_nokey varchar(1) DEFAULT NULL,
+ PRIMARY KEY (pk),
+ KEY col_int_key (col_int_key),
+ KEY col_varchar_key (col_varchar_key, col_int_key)
+) ENGINE=InnoDB;
+
+INSERT INTO t1 VALUES
+(10,8,'x','x'),
+(11,7,'d','d'),
+(12,1,'r','r'),
+(13,7,'f','f'),
+(14,9,'y','y'),
+(15,NULL,'u','u'),
+(16,1,'m','m'),
+(17,9,NULL,NULL),
+(18,2,'o','o'),
+(19,9,'w','w'),
+(20,2,'m','m'),
+(21,4,'q','q');
+
+let $query=
+ SELECT alias1.col_varchar_nokey AS field1
+ FROM t1 AS alias1 JOIN t1 AS alias2
+ ON alias2.col_int_key = alias1.pk OR
+ alias2.col_int_key = alias1.col_int_key
+ WHERE alias1.pk = 58 OR alias1.col_varchar_key = 'o'
+;
+
+eval CREATE TABLE t2
+ $query
+;
+
+eval EXPLAIN SELECT *
+FROM t2
+WHERE (field1) IN ($query);
+
+eval SELECT *
+FROM t2
+WHERE (field1) IN ($query);
+
+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/sum_distinct-big.test b/mysql-test/t/sum_distinct-big.test
index 0859f4b3d89..d3710056c9a 100644
--- a/mysql-test/t/sum_distinct-big.test
+++ b/mysql-test/t/sum_distinct-big.test
@@ -63,5 +63,22 @@ SELECT SUM(DISTINCT id) sm FROM t1;
SELECT SUM(DISTINCT id) sm FROM t2;
SELECT SUM(DISTINCT id) sm FROM t1 GROUP BY id % 13;
+--echo #
+--echo # Bug mdev-4063: SUM(DISTINCT...) with small'max_heap_table_size
+--echo # (bug #56927)
+--echo #
+
+SET max_heap_table_size=default;
+
+INSERT INTO t1 SELECT id+16384 FROM t1;
+DELETE FROM t2;
+INSERT INTO t2 SELECT id FROM t1 ORDER BY id*rand();
+
+SELECT SUM(DISTINCT id) sm FROM t2;
+
+SET max_heap_table_size=16384;
+
+SELECT SUM(DISTINCT id) sm FROM t2;
+
DROP TABLE t1;
DROP TABLE t2;
diff --git a/mysql-test/t/update.test b/mysql-test/t/update.test
index c515f8873d8..daa20509ab6 100644
--- a/mysql-test/t/update.test
+++ b/mysql-test/t/update.test
@@ -2,6 +2,8 @@
# test of updating of keys
#
+-- source include/have_innodb.inc
+
--disable_warnings
drop table if exists t1,t2;
--enable_warnings
@@ -503,3 +505,42 @@ UPDATE v1 SET pk = 7 WHERE pk > 0;
DROP VIEW v1;
DROP FUNCTION f1;
DROP TABLE t1;
+
+--echo #
+--echo # Verify that UPDATE does the same number of handler_update
+--echo # operations, no matter if there is ORDER BY or not.
+--echo #
+
+CREATE TABLE t1 (i INT) ENGINE=INNODB;
+INSERT INTO t1 VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19),
+ (20),(21),(22),(23),(24),(25),(26),(27),(28),(29),
+ (30),(31),(32),(33),(34),(35);
+CREATE TABLE t2 (a CHAR(2), b CHAR(2), c CHAR(2), d CHAR(2),
+ INDEX idx (a,b(1),c)) ENGINE=INNODB;
+INSERT INTO t2 SELECT i, i, i, i FROM t1;
+FLUSH STATUS; # FLUSH is autocommit, so we put it outside of transaction
+START TRANSACTION;
+UPDATE t2 SET d = 10 WHERE b = 10 LIMIT 5;
+SHOW STATUS LIKE 'HANDLER_UPDATE';
+ROLLBACK;
+FLUSH STATUS;
+START TRANSACTION;
+UPDATE t2 SET d = 10 WHERE b = 10 ORDER BY a, c LIMIT 5;
+SHOW STATUS LIKE 'HANDLER_UPDATE';
+ROLLBACK;
+
+--echo Same test with a different UPDATE.
+
+ALTER TABLE t2 DROP INDEX idx, ADD INDEX idx2 (a, b);
+FLUSH STATUS;
+START TRANSACTION;
+UPDATE t2 SET c = 10 LIMIT 5;
+SHOW STATUS LIKE 'HANDLER_UPDATE';
+ROLLBACK;
+FLUSH STATUS;
+START TRANSACTION;
+UPDATE t2 SET c = 10 ORDER BY a, b DESC LIMIT 5;
+SHOW STATUS LIKE 'HANDLER_UPDATE';
+ROLLBACK;
+DROP TABLE t1, t2;
+
diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test
index d299718b54a..8b10e53f06d 100644
--- a/mysql-test/t/view.test
+++ b/mysql-test/t/view.test
@@ -4703,6 +4703,32 @@ drop view v2;
drop table t1,t2;
--echo #
+--echo # MDEV-3914: Wrong result (NULLs instead of real values)
+--echo # with INNER and RIGHT JOIN in a FROM subquery, derived_merge=on
+--echo # (fix of above MDEV-486 fix)
+--echo #
+SET @save_optimizer_switch_MDEV_3914=@@optimizer_switch;
+SET optimizer_switch = 'derived_merge=on';
+
+CREATE TABLE t1 (a INT) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1),(2);
+
+CREATE TABLE t2 (b INT) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (3),(4);
+
+CREATE TABLE t3 (c INT) ENGINE=MyISAM;
+INSERT INTO t3 VALUES (5),(6);
+
+SELECT * FROM ( SELECT c FROM ( t1 INNER JOIN t2 ) RIGHT JOIN t3 ON a = c ) AS alias;
+
+SET optimizer_switch = 'derived_merge=off';
+
+SELECT * FROM ( SELECT c FROM ( t1 INNER JOIN t2 ) RIGHT JOIN t3 ON a = c ) AS alias;
+
+SET optimizer_switch=@save_optimizer_switch_MDEV_3914;
+drop table t1,t2,t3;
+
+--echo #
--echo # MDEV-589 (LP BUG#1007647) :
--echo # Assertion `vcol_table == 0 || vcol_table == table' failed in
--echo # fill_record(THD*, List<Item>&, List<Item>&, bool)
@@ -4747,6 +4773,27 @@ SELECT * FROM (
drop tables t1,t2;
+--echo #
+--echo # MDEV-3876 Wrong result (extra rows) with ALL subquery
+--echo # from a MERGE view (duplicate of MDEV-3873)
+--echo #
+
+CREATE TABLE t1 (a INT NOT NULL) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1),(2);
+
+CREATE TABLE t2 (b INT NOT NULL) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (1),(3);
+
+CREATE OR REPLACE ALGORITHM=MERGE VIEW v1 AS SELECT * FROM t2;
+
+SELECT a FROM t1 AS alias
+WHERE a >= ALL (
+SELECT b FROM t1 LEFT JOIN v1 ON (a = b)
+WHERE a = alias.a );
+
+drop view v1;
+drop table t1,t2;
+
--echo # -----------------------------------------------------------------
--echo # -- End of 5.3 tests.
--echo # -----------------------------------------------------------------