summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test')
-rw-r--r--[-rwxr-xr-x]mysql-test/collections/default.weekly0
-rw-r--r--mysql-test/include/install_semisync.inc4
-rw-r--r--mysql-test/include/stop_dump_threads.inc32
-rw-r--r--mysql-test/include/uninstall_semisync.inc5
-rw-r--r--mysql-test/r/func_str.result3
-rw-r--r--mysql-test/r/group_min_max.result56
-rw-r--r--mysql-test/r/group_min_max_innodb.result168
-rw-r--r--mysql-test/r/mysqld--help.result4
-rw-r--r--mysql-test/r/partition_pruning.result114
-rw-r--r--mysql-test/r/union.result34
-rw-r--r--mysql-test/r/variables.result4
-rw-r--r--mysql-test/r/view.result39
-rwxr-xr-x[-rw-r--r--]mysql-test/std_data/checkDBI_DBD-mysql.pl0
-rw-r--r--mysql-test/suite/archive/partition_archive.result26
-rw-r--r--mysql-test/suite/archive/partition_archive.test18
-rw-r--r--mysql-test/suite/binlog/t/binlog_killed.test4
-rw-r--r--mysql-test/suite/innodb/r/blob_unique2pk.result15
-rw-r--r--mysql-test/suite/innodb/r/innodb-fk.result35
-rw-r--r--mysql-test/suite/innodb/t/blob_unique2pk.test20
-rw-r--r--mysql-test/suite/innodb/t/innodb-fk.test86
-rw-r--r--mysql-test/suite/innodb/t/innodb_bug60196-master.opt2
-rw-r--r--mysql-test/suite/rpl/disabled.def1
-rw-r--r--mysql-test/suite/rpl/r/rpl_semi_sync.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_semi_sync_uninstall_plugin.result36
-rw-r--r--mysql-test/suite/rpl/r/rpl_stop_slave.result7
-rw-r--r--mysql-test/suite/rpl/t/rpl_semi_sync.test12
-rw-r--r--mysql-test/suite/rpl/t/rpl_semi_sync_uninstall_plugin.test145
-rw-r--r--mysql-test/suite/rpl/t/rpl_stop_slave.test27
-rw-r--r--mysql-test/suite/sys_vars/r/timed_mutexes_basic.result20
-rw-r--r--mysql-test/t/func_str.test5
-rw-r--r--mysql-test/t/group_min_max.test25
-rw-r--r--mysql-test/t/group_min_max_innodb.test93
-rwxr-xr-x[-rw-r--r--]mysql-test/t/long_tmpdir-master.sh0
-rwxr-xr-x[-rw-r--r--]mysql-test/t/lowercase_mixed_tmpdir-master.sh0
-rw-r--r--mysql-test/t/lowercase_table4-master.opt2
-rw-r--r--mysql-test/t/partition_pruning.test48
-rw-r--r--mysql-test/t/union.test30
-rw-r--r--mysql-test/t/view.test41
38 files changed, 1141 insertions, 24 deletions
diff --git a/mysql-test/collections/default.weekly b/mysql-test/collections/default.weekly
index a03e2593cfe..a03e2593cfe 100755..100644
--- a/mysql-test/collections/default.weekly
+++ b/mysql-test/collections/default.weekly
diff --git a/mysql-test/include/install_semisync.inc b/mysql-test/include/install_semisync.inc
index 368b7b7cb4a..9cc6df2072a 100644
--- a/mysql-test/include/install_semisync.inc
+++ b/mysql-test/include/install_semisync.inc
@@ -14,7 +14,7 @@
if ($value == No such row)
{
SET sql_log_bin = 0;
- eval INSTALL PLUGIN rpl_semi_sync_master SONAME '$SEMISYNC_MASTER_PLUGIN';
+ install plugin rpl_semi_sync_master soname 'semisync_master';
SET GLOBAL rpl_semi_sync_master_enabled = 1;
SET sql_log_bin = 1;
}
@@ -28,7 +28,7 @@ if ($value == No such row)
if ($value == No such row)
{
SET sql_log_bin = 0;
- eval INSTALL PLUGIN rpl_semi_sync_slave SONAME '$SEMISYNC_SLAVE_PLUGIN';
+ install plugin rpl_semi_sync_slave soname 'semisync_slave';
SET GLOBAL rpl_semi_sync_slave_enabled = 1;
SET sql_log_bin = 1;
}
diff --git a/mysql-test/include/stop_dump_threads.inc b/mysql-test/include/stop_dump_threads.inc
new file mode 100644
index 00000000000..ae33c963d9a
--- /dev/null
+++ b/mysql-test/include/stop_dump_threads.inc
@@ -0,0 +1,32 @@
+# ==== Purpose ====
+#
+# Stop all dump threads on the server of the current connection.
+#
+# ==== Usage ====
+#
+# --source include/stop_dump_threads.inc
+
+--let $include_filename= stop_dump_threads.inc
+--source include/begin_include_file.inc
+
+
+--let $_sdt_show_rpl_debug_info_old= $show_rpl_debug_info
+--let $show_rpl_debug_info= 1
+--disable_query_log
+--disable_result_log
+
+--let $_sdt_dump_thread_id= `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE COMMAND = 'Binlog dump'`
+
+while ($_sdt_dump_thread_id != '')
+{
+ eval KILL $_sdt_dump_thread_id;
+ --let $wait_condition= SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE ID = $_sdt_dump_thread_id
+ --source include/wait_condition.inc
+
+ --let $_sdt_dump_thread_id= `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE COMMAND = 'Binlog dump'`
+}
+
+--let $show_rpl_debug_info= $_sdt_show_rpl_debug_info_old
+
+--let $include_filename= stop_dump_threads.inc
+--source include/end_include_file.inc
diff --git a/mysql-test/include/uninstall_semisync.inc b/mysql-test/include/uninstall_semisync.inc
index 11668d1db97..0a4c55fa4f2 100644
--- a/mysql-test/include/uninstall_semisync.inc
+++ b/mysql-test/include/uninstall_semisync.inc
@@ -13,6 +13,11 @@
UNINSTALL PLUGIN rpl_semi_sync_slave;
--connection master
+# After BUG#17638477 fix, uninstallation of rpl_semi_sync_master
+# is not allowed when there are semi sync slaves. Hence kill
+# all dump threads before uninstalling it.
+SET GLOBAL rpl_semi_sync_master_enabled = OFF;
+--source include/stop_dump_threads.inc
UNINSTALL PLUGIN rpl_semi_sync_master;
--enable_warnings
diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result
index bff8d0f1504..05d975b548b 100644
--- a/mysql-test/r/func_str.result
+++ b/mysql-test/r/func_str.result
@@ -2950,6 +2950,9 @@ replace(var, '00000000', table_name)
(( t2 ++ t2 ))
drop procedure foo;
drop table t1,t2;
+select md5(_filename "a"), sha(_filename "a");
+md5(_filename "a") sha(_filename "a")
+0cc175b9c0f1b6a831c399e269772661 86f7e437faa5a7fce15d1ddcb9eaeaea377667b8
#
# End of 5.5 tests
#
diff --git a/mysql-test/r/group_min_max.result b/mysql-test/r/group_min_max.result
index d590039f322..f658898543d 100644
--- a/mysql-test/r/group_min_max.result
+++ b/mysql-test/r/group_min_max.result
@@ -3506,7 +3506,7 @@ COUNT(DISTINCT a, b) SUM(DISTINCT a)
0 NULL
EXPLAIN SELECT SUM(DISTINCT a), MAX(b) FROM t2 GROUP BY a;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 range NULL a 5 NULL 9 Using index for group-by
+1 SIMPLE t2 index NULL a 15 NULL 16 Using index
SELECT SUM(DISTINCT a), MAX(b) FROM t2 GROUP BY a;
SUM(DISTINCT a) MAX(b)
1 8
@@ -3534,7 +3534,7 @@ SELECT 42 * (a + c + COUNT(DISTINCT c, a, b)) FROM t2 GROUP BY a, b, c;
168
EXPLAIN SELECT (SUM(DISTINCT a) + MAX(b)) FROM t2 GROUP BY a;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 range NULL a 5 NULL 9 Using index for group-by
+1 SIMPLE t2 index NULL a 15 NULL 16 Using index
SELECT (SUM(DISTINCT a) + MAX(b)) FROM t2 GROUP BY a;
(SUM(DISTINCT a) + MAX(b))
9
@@ -3563,6 +3563,58 @@ id select_type table type possible_keys key key_len ref rows Extra
drop table t1;
# End of test#50539.
#
+# Bug#17217128 - BAD INTERACTION BETWEEN MIN/MAX AND
+# "HAVING SUM(DISTINCT)": WRONG RESULTS.
+#
+CREATE TABLE t (a INT, b INT, KEY(a,b));
+INSERT INTO t VALUES (1,1), (2,2), (3,3), (4,4), (1,0), (3,2), (4,5);
+ANALYZE TABLE t;
+Table Op Msg_type Msg_text
+test.t analyze status OK
+SELECT a, SUM(DISTINCT a), MIN(b) FROM t GROUP BY a;
+a SUM(DISTINCT a) MIN(b)
+1 1 0
+2 2 2
+3 3 2
+4 4 4
+EXPLAIN SELECT a, SUM(DISTINCT a), MIN(b) FROM t GROUP BY a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t index NULL a 10 NULL 7 Using index
+SELECT a, SUM(DISTINCT a), MAX(b) FROM t GROUP BY a;
+a SUM(DISTINCT a) MAX(b)
+1 1 1
+2 2 2
+3 3 3
+4 4 5
+EXPLAIN SELECT a, SUM(DISTINCT a), MAX(b) FROM t GROUP BY a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t index NULL a 10 NULL 7 Using index
+SELECT a, MAX(b) FROM t GROUP BY a HAVING SUM(DISTINCT a);
+a MAX(b)
+1 1
+2 2
+3 3
+4 5
+EXPLAIN SELECT a, MAX(b) FROM t GROUP BY a HAVING SUM(DISTINCT a);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t index NULL a 10 NULL 7 Using index
+SELECT SUM(DISTINCT a), MIN(b), MAX(b) FROM t;
+SUM(DISTINCT a) MIN(b) MAX(b)
+10 0 5
+EXPLAIN SELECT SUM(DISTINCT a), MIN(b), MAX(b) FROM t;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t index NULL a 10 NULL 7 Using index
+SELECT a, SUM(DISTINCT a), MIN(b), MAX(b) FROM t GROUP BY a;
+a SUM(DISTINCT a) MIN(b) MAX(b)
+1 1 0 1
+2 2 2 2
+3 3 2 3
+4 4 4 5
+EXPLAIN SELECT a, SUM(DISTINCT a), MIN(b), MAX(b) FROM t GROUP BY a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t index NULL a 10 NULL 7 Using index
+DROP TABLE t;
+#
# MDEV-4219 A simple select query returns random data (upstream bug#68473)
#
drop table if exists faulty;
diff --git a/mysql-test/r/group_min_max_innodb.result b/mysql-test/r/group_min_max_innodb.result
index 320c4b2b750..c4d2fb88784 100644
--- a/mysql-test/r/group_min_max_innodb.result
+++ b/mysql-test/r/group_min_max_innodb.result
@@ -118,3 +118,171 @@ COUNT(DISTINCT a)
1
DROP TABLE t1;
End of 5.5 tests
+#
+# Bug#17909656 - WRONG RESULTS FOR A SIMPLE QUERY WITH GROUP BY
+#
+CREATE TABLE t0 (
+i1 INTEGER NOT NULL
+);
+INSERT INTO t0 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),
+(11),(12),(13),(14),(15),(16),(17),(18),(19),(20),
+(21),(22),(23),(24),(25),(26),(27),(28),(29),(30);
+CREATE TABLE t1 (
+c1 CHAR(1) NOT NULL,
+i1 INTEGER NOT NULL,
+i2 INTEGER NOT NULL,
+UNIQUE KEY k1 (c1,i2)
+) ENGINE=InnoDB;
+INSERT INTO t1 SELECT 'A',i1,i1 FROM t0;
+INSERT INTO t1 SELECT 'B',i1,i1 FROM t0;
+INSERT INTO t1 SELECT 'C',i1,i1 FROM t0;
+INSERT INTO t1 SELECT 'D',i1,i1 FROM t0;
+INSERT INTO t1 SELECT 'E',i1,i1 FROM t0;
+INSERT INTO t1 SELECT 'F',i1,i1 FROM t0;
+CREATE TABLE t2 (
+c1 CHAR(1) NOT NULL,
+i1 INTEGER NOT NULL,
+i2 INTEGER NOT NULL,
+UNIQUE KEY k2 (c1,i1,i2)
+) ENGINE=InnoDB;
+INSERT INTO t2 SELECT 'A',i1,i1 FROM t0;
+INSERT INTO t2 SELECT 'B',i1,i1 FROM t0;
+INSERT INTO t2 SELECT 'C',i1,i1 FROM t0;
+INSERT INTO t2 SELECT 'D',i1,i1 FROM t0;
+INSERT INTO t2 SELECT 'E',i1,i1 FROM t0;
+INSERT INTO t2 SELECT 'F',i1,i1 FROM t0;
+ANALYZE TABLE t1;
+ANALYZE TABLE t2;
+EXPLAIN SELECT c1, max(i2) FROM t1 WHERE (c1 = 'C' AND i2 = 17) OR ( c1 = 'F')
+GROUP BY c1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range k1 k1 5 NULL 31 Using where; Using index
+SELECT c1, max(i2) FROM t1 WHERE (c1 = 'C' AND i2 = 17) OR ( c1 = 'F')
+GROUP BY c1;
+c1 max(i2)
+C 17
+F 30
+EXPLAIN SELECT c1, max(i2) FROM t1 WHERE (c1 = 'C' OR ( c1 = 'F' AND i2 = 17))
+GROUP BY c1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range k1 k1 5 NULL 31 Using where; Using index
+SELECT c1, max(i2) FROM t1 WHERE (c1 = 'C' OR ( c1 = 'F' AND i2 = 17))
+GROUP BY c1;
+c1 max(i2)
+C 30
+F 17
+EXPLAIN SELECT c1, max(i2) FROM t1 WHERE (c1 = 'C' OR c1 = 'F' ) AND ( i2 = 17 )
+GROUP BY c1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range k1 k1 5 NULL 1 Using where; Using index for group-by
+SELECT c1, max(i2) FROM t1 WHERE (c1 = 'C' OR c1 = 'F' ) AND ( i2 = 17 )
+GROUP BY c1;
+c1 max(i2)
+C 17
+F 17
+EXPLAIN SELECT c1, max(i2) FROM t1
+WHERE ((c1 = 'C' AND (i2 = 40 OR i2 = 30)) OR ( c1 = 'F' AND (i2 = 40 )))
+GROUP BY c1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range k1 k1 5 NULL 3 Using where; Using index
+SELECT c1, max(i2) FROM t1
+WHERE ((c1 = 'C' AND (i2 = 40 OR i2 = 30)) OR ( c1 = 'F' AND (i2 = 40 )))
+GROUP BY c1;
+c1 max(i2)
+C 30
+EXPLAIN SELECT c1, i1, max(i2) FROM t2
+WHERE (c1 = 'C' OR ( c1 = 'F' AND i1 < 35)) AND ( i2 = 17 )
+GROUP BY c1,i1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 range k2 k2 9 NULL 59 Using where; Using index for group-by
+SELECT c1, i1, max(i2) FROM t2
+WHERE (c1 = 'C' OR ( c1 = 'F' AND i1 < 35)) AND ( i2 = 17 )
+GROUP BY c1,i1;
+c1 i1 max(i2)
+C 17 17
+F 17 17
+EXPLAIN SELECT c1, i1, max(i2) FROM t2
+WHERE (((c1 = 'C' AND i1 < 40) OR ( c1 = 'F' AND i1 < 35)) AND ( i2 = 17 ))
+GROUP BY c1,i1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 range k2 k2 9 NULL 58 Using where; Using index for group-by
+SELECT c1, i1, max(i2) FROM t2
+WHERE (((c1 = 'C' AND i1 < 40) OR ( c1 = 'F' AND i1 < 35)) AND ( i2 = 17 ))
+GROUP BY c1,i1;
+c1 i1 max(i2)
+C 17 17
+F 17 17
+EXPLAIN SELECT c1, i1, max(i2) FROM t2
+WHERE ((c1 = 'C' AND i1 < 40) OR ( c1 = 'F' AND i1 < 35) OR ( i2 = 17 ))
+GROUP BY c1,i1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 index k2 k2 9 NULL 180 Using where; Using index
+SELECT c1, i1, max(i2) FROM t2
+WHERE ((c1 = 'C' AND i1 < 40) OR ( c1 = 'F' AND i1 < 35) OR ( i2 = 17 ))
+GROUP BY c1,i1;
+c1 i1 max(i2)
+A 17 17
+B 17 17
+C 1 1
+C 2 2
+C 3 3
+C 4 4
+C 5 5
+C 6 6
+C 7 7
+C 8 8
+C 9 9
+C 10 10
+C 11 11
+C 12 12
+C 13 13
+C 14 14
+C 15 15
+C 16 16
+C 17 17
+C 18 18
+C 19 19
+C 20 20
+C 21 21
+C 22 22
+C 23 23
+C 24 24
+C 25 25
+C 26 26
+C 27 27
+C 28 28
+C 29 29
+C 30 30
+D 17 17
+E 17 17
+F 1 1
+F 2 2
+F 3 3
+F 4 4
+F 5 5
+F 6 6
+F 7 7
+F 8 8
+F 9 9
+F 10 10
+F 11 11
+F 12 12
+F 13 13
+F 14 14
+F 15 15
+F 16 16
+F 17 17
+F 18 18
+F 19 19
+F 20 20
+F 21 21
+F 22 22
+F 23 23
+F 24 24
+F 25 25
+F 26 26
+F 27 27
+F 28 28
+F 29 29
+F 30 30
+DROP TABLE t0,t1,t2;
diff --git a/mysql-test/r/mysqld--help.result b/mysql-test/r/mysqld--help.result
index 10e297bafb6..8bcad2a3cf5 100644
--- a/mysql-test/r/mysqld--help.result
+++ b/mysql-test/r/mysqld--help.result
@@ -824,8 +824,8 @@ The following options may be given as the first argument:
How many threads we should keep in a cache for reuse
--thread-stack=# The stack size for each thread
--time-format=name The TIME format (ignored)
- --timed-mutexes Specify whether to time mutexes (only InnoDB mutexes are
- currently supported)
+ --timed-mutexes Specify whether to time mutexes. Deprecated, has no
+ effect.
--tmp-table-size=# If an internal in-memory temporary table exceeds this
size, MySQL will automatically convert it to an on-disk
MyISAM or Aria table
diff --git a/mysql-test/r/partition_pruning.result b/mysql-test/r/partition_pruning.result
index 0a4cf9932c0..e52c2c7d886 100644
--- a/mysql-test/r/partition_pruning.result
+++ b/mysql-test/r/partition_pruning.result
@@ -3302,6 +3302,120 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p0,p1,p2 ALL NULL NULL NULL NULL 100 Using where
drop table t0, t1;
#
+# Bug#71095: Wrong results with PARTITION BY LIST COLUMNS()
+#
+CREATE TABLE t1
+(c1 int,
+c2 int,
+c3 int,
+c4 int,
+PRIMARY KEY (c1,c2))
+PARTITION BY LIST COLUMNS (c2)
+(PARTITION p1 VALUES IN (1,2),
+PARTITION p2 VALUES IN (3,4));
+INSERT INTO t1 VALUES (1, 1, 1, 1), (2, 3, 1, 1);
+INSERT INTO t1 VALUES (1, 2, 1, 1), (2, 4, 1, 1);
+SELECT * FROM t1 WHERE c1 = 1 AND c2 < 1;
+c1 c2 c3 c4
+SELECT * FROM t1 WHERE c1 = 1 AND c2 <= 1;
+c1 c2 c3 c4
+1 1 1 1
+SELECT * FROM t1 WHERE c1 = 1 AND c2 = 1;
+c1 c2 c3 c4
+1 1 1 1
+SELECT * FROM t1 WHERE c1 = 1 AND c2 >= 1;
+c1 c2 c3 c4
+1 1 1 1
+1 2 1 1
+SELECT * FROM t1 WHERE c1 = 1 AND c2 > 1;
+c1 c2 c3 c4
+1 2 1 1
+SELECT * FROM t1 WHERE c1 = 1 AND c2 < 3;
+c1 c2 c3 c4
+1 1 1 1
+1 2 1 1
+SELECT * FROM t1 WHERE c1 = 1 AND c2 <= 3;
+c1 c2 c3 c4
+1 1 1 1
+1 2 1 1
+SELECT * FROM t1 WHERE c1 = 2 AND c2 <= 3;
+c1 c2 c3 c4
+2 3 1 1
+SELECT * FROM t1 WHERE c1 = 2 AND c2 = 3;
+c1 c2 c3 c4
+2 3 1 1
+SELECT * FROM t1 WHERE c1 = 2 AND c2 >= 3;
+c1 c2 c3 c4
+2 3 1 1
+2 4 1 1
+SELECT * FROM t1 WHERE c1 = 2 AND c2 > 3;
+c1 c2 c3 c4
+2 4 1 1
+SELECT * FROM t1 WHERE c1 = 2 AND c2 < 4;
+c1 c2 c3 c4
+2 3 1 1
+SELECT * FROM t1 WHERE c1 = 2 AND c2 <= 4;
+c1 c2 c3 c4
+2 3 1 1
+2 4 1 1
+SELECT * FROM t1 WHERE c1 = 2 AND c2 = 4;
+c1 c2 c3 c4
+2 4 1 1
+SELECT * FROM t1 WHERE c1 = 2 AND c2 >= 4;
+c1 c2 c3 c4
+2 4 1 1
+SELECT * FROM t1 WHERE c1 = 2 AND c2 > 4;
+c1 c2 c3 c4
+EXPLAIN PARTITIONS SELECT * FROM t1 WHERE c1 = 1 AND c2 < 1;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+EXPLAIN PARTITIONS SELECT * FROM t1 WHERE c1 = 1 AND c2 <= 1;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p1 range PRIMARY PRIMARY 8 NULL 1 Using where
+EXPLAIN PARTITIONS SELECT * FROM t1 WHERE c1 = 1 AND c2 = 1;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p1 const PRIMARY PRIMARY 8 const,const 1
+EXPLAIN PARTITIONS SELECT * FROM t1 WHERE c1 = 1 AND c2 >= 1;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p1,p2 range PRIMARY PRIMARY 8 NULL 2 Using where
+EXPLAIN PARTITIONS SELECT * FROM t1 WHERE c1 = 1 AND c2 > 1;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p1,p2 range PRIMARY PRIMARY 8 NULL 2 Using where
+EXPLAIN PARTITIONS SELECT * FROM t1 WHERE c1 = 1 AND c2 < 3;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p1 range PRIMARY PRIMARY 8 NULL 1 Using where
+EXPLAIN PARTITIONS SELECT * FROM t1 WHERE c1 = 1 AND c2 <= 3;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p1,p2 range PRIMARY PRIMARY 8 NULL 2 Using where
+EXPLAIN PARTITIONS SELECT * FROM t1 WHERE c1 = 2 AND c2 <= 3;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p1,p2 range PRIMARY PRIMARY 8 NULL 2 Using where
+EXPLAIN PARTITIONS SELECT * FROM t1 WHERE c1 = 2 AND c2 = 3;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p2 const PRIMARY PRIMARY 8 const,const 1
+EXPLAIN PARTITIONS SELECT * FROM t1 WHERE c1 = 2 AND c2 >= 3;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p2 range PRIMARY PRIMARY 8 NULL 1 Using where
+EXPLAIN PARTITIONS SELECT * FROM t1 WHERE c1 = 2 AND c2 > 3;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p2 range PRIMARY PRIMARY 8 NULL 1 Using where
+EXPLAIN PARTITIONS SELECT * FROM t1 WHERE c1 = 2 AND c2 < 4;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p1,p2 range PRIMARY PRIMARY 8 NULL 2 Using where
+EXPLAIN PARTITIONS SELECT * FROM t1 WHERE c1 = 2 AND c2 <= 4;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p1,p2 range PRIMARY PRIMARY 8 NULL 2 Using where
+EXPLAIN PARTITIONS SELECT * FROM t1 WHERE c1 = 2 AND c2 = 4;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p2 const PRIMARY PRIMARY 8 const,const 1
+EXPLAIN PARTITIONS SELECT * FROM t1 WHERE c1 = 2 AND c2 >= 4;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p2 range PRIMARY PRIMARY 8 NULL 1 Using where
+EXPLAIN PARTITIONS SELECT * FROM t1 WHERE c1 = 2 AND c2 > 4;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+DROP TABLE t1;
+#
# MDEV-6239: Partition pruning is not working as expected in an inner query
#
create table t1
diff --git a/mysql-test/r/union.result b/mysql-test/r/union.result
index 6d99cad30f0..4ecac34d9fa 100644
--- a/mysql-test/r/union.result
+++ b/mysql-test/r/union.result
@@ -1876,6 +1876,40 @@ SELECT(SELECT 1 AS a FROM dual ORDER BY a DESC LIMIT 1) AS dev;
dev
1
#
+# Bug #17059925 : UNIONS COMPUTES ROWS_EXAMINED INCORRECTLY
+#
+SET @old_slow_query_log= @@global.slow_query_log;
+SET @old_log_output= @@global.log_output;
+SET @old_long_query_time= @@long_query_time;
+SET GLOBAL log_output= "TABLE";
+SET GLOBAL slow_query_log= ON;
+SET SESSION long_query_time= 0;
+CREATE TABLE t17059925 (a INT);
+CREATE TABLE t2 (b INT);
+CREATE TABLE t3 (c INT);
+INSERT INTO t17059925 VALUES (1), (2), (3);
+INSERT INTO t2 VALUES (4), (5), (6);
+INSERT INTO t3 VALUES (7), (8), (9);
+TRUNCATE table mysql.slow_log;
+SELECT * FROM t17059925 UNION SELECT * FROM t2 UNION SELECT * FROM t3;
+a
+1
+2
+3
+4
+5
+6
+7
+8
+9
+SELECT sql_text, rows_examined FROM mysql.slow_log WHERE sql_text LIKE '%SELECT%t17059925%';
+sql_text rows_examined
+SELECT * FROM t17059925 UNION SELECT * FROM t2 UNION SELECT * FROM t3 18
+DROP TABLE t17059925, t2, t3;
+SET @@long_query_time= @old_long_query_time;
+SET @@global.log_output= @old_log_output;
+SET @@global.slow_query_log= @old_slow_query_log;
+#
# lp:1010729: Unexpected syntax error from UNION
# (bug #54382) with single-table join nest
#
diff --git a/mysql-test/r/variables.result b/mysql-test/r/variables.result
index dd74e02a26f..28b67732a77 100644
--- a/mysql-test/r/variables.result
+++ b/mysql-test/r/variables.result
@@ -189,6 +189,8 @@ select @@concurrent_insert;
@@concurrent_insert
AUTO
set global timed_mutexes=ON;
+Warnings:
+Warning 1287 '@@timed_mutexes' is deprecated and will be removed in a future release.
show variables like 'timed_mutexes';
Variable_name Value
timed_mutexes ON
@@ -196,6 +198,8 @@ select * from information_schema.session_variables where variable_name like 'tim
VARIABLE_NAME VARIABLE_VALUE
TIMED_MUTEXES ON
set global timed_mutexes=0;
+Warnings:
+Warning 1287 '@@timed_mutexes' is deprecated and will be removed in a future release.
show variables like 'timed_mutexes';
Variable_name Value
timed_mutexes OFF
diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result
index 4511c4502ea..2978fce3a98 100644
--- a/mysql-test/r/view.result
+++ b/mysql-test/r/view.result
@@ -4791,6 +4791,45 @@ DROP DATABASE IF EXISTS nodb;
CREATE VIEW nodb.a AS SELECT 1;
ERROR 42000: Unknown database 'nodb'
#
+# BUG#14117018 - MYSQL SERVER CREATES INVALID VIEW DEFINITION
+# BUG#18405221 - SHOW CREATE VIEW OUTPUT INCORRECT
+#
+CREATE VIEW v1 AS (SELECT '' FROM DUAL);
+CREATE VIEW v2 AS (SELECT 'BUG#14117018' AS col1 FROM DUAL) UNION ALL
+(SELECT '' FROM DUAL);
+CREATE VIEW v3 AS (SELECT 'BUG#14117018' AS col1 FROM DUAL) UNION ALL
+(SELECT '' FROM DUAL) UNION ALL
+(SELECT '' FROM DUAL);
+CREATE VIEW v4 AS (SELECT 'BUG#14117018' AS col1 FROM DUAL) UNION ALL
+(SELECT '' AS col2 FROM DUAL) UNION ALL
+(SELECT '' FROM DUAL);
+CREATE VIEW v5 AS (SELECT 'buggy' AS col1, 'fix' as col2 FROM DUAL) UNION ALL
+(SELECT 'buggy' as a, 'fix' as a FROM DUAL);
+# Name for the column in select1 is set properly with or
+# without this fix.
+SHOW CREATE VIEW v1;
+View Create View character_set_client collation_connection
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS (select '' AS `Name_exp_1`) latin1 latin1_swedish_ci
+# Name for the column in select2 is set with this fix.
+# Without this fix, name would not have set for the
+# columns in select2.
+SHOW CREATE VIEW v2;
+View Create View character_set_client collation_connection
+v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS (select 'BUG#14117018' AS `col1`) union all (select '' AS `Name_exp_1`) latin1 latin1_swedish_ci
+# Name for the field item in select2 & select3 is set with this fix.
+# Without this fix, name would not have set for the
+# columns in select2 & select3.
+SHOW CREATE VIEW v3;
+View Create View character_set_client collation_connection
+v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS (select 'BUG#14117018' AS `col1`) union all (select '' AS `Name_exp_1`) union all (select '' AS `Name_exp_1`) latin1 latin1_swedish_ci
+# Name for the field item in select3 is set with this fix.
+# Without this fix, name would not have set for the
+# columns in select3.
+SHOW CREATE VIEW v4;
+View Create View character_set_client collation_connection
+v4 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v4` AS (select 'BUG#14117018' AS `col1`) union all (select '' AS `col2`) union all (select '' AS `Name_exp_1`) latin1 latin1_swedish_ci
+DROP VIEW v1, v2, v3, v4, v5;
+#
# lp:833600 Wrong result with view + outer join + uncorrelated subquery (non-semijoin)
#
CREATE TABLE t1 ( a int, b int );
diff --git a/mysql-test/std_data/checkDBI_DBD-mysql.pl b/mysql-test/std_data/checkDBI_DBD-mysql.pl
index d62d2f8bfc0..d62d2f8bfc0 100644..100755
--- a/mysql-test/std_data/checkDBI_DBD-mysql.pl
+++ b/mysql-test/std_data/checkDBI_DBD-mysql.pl
diff --git a/mysql-test/suite/archive/partition_archive.result b/mysql-test/suite/archive/partition_archive.result
index 186a7930251..e666c1a8215 100644
--- a/mysql-test/suite/archive/partition_archive.result
+++ b/mysql-test/suite/archive/partition_archive.result
@@ -126,3 +126,29 @@ select count(*) from t1;
count(*)
100
drop table t1;
+#
+#BUG 18618561: FAILED ALTER TABLE ENGINE CHANGE WITH PARTITIONS
+# CORRUPTS FRM
+CREATE TABLE t1 (fld1 INT PRIMARY KEY) ENGINE= MYISAM PARTITION BY HASH(fld1)
+PARTITIONS 5;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `fld1` int(11) NOT NULL,
+ PRIMARY KEY (`fld1`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY HASH (fld1)
+PARTITIONS 5 */
+ALTER TABLE t1 ENGINE= ARCHIVE;
+ERROR HY000: Can't create table 'test.#sql-temporary' (errno: 1)
+#After the patch, the ENGINE is correctly displayed as MyISAM
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `fld1` int(11) NOT NULL,
+ PRIMARY KEY (`fld1`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY HASH (fld1)
+PARTITIONS 5 */
+#Cleanup.
+DROP TABLE t1;
diff --git a/mysql-test/suite/archive/partition_archive.test b/mysql-test/suite/archive/partition_archive.test
index 6f6a26c018a..c8dec726d1d 100644
--- a/mysql-test/suite/archive/partition_archive.test
+++ b/mysql-test/suite/archive/partition_archive.test
@@ -128,3 +128,21 @@ show create table t1;
select count(*) from t1;
drop table t1;
+
+--echo #
+--echo #BUG 18618561: FAILED ALTER TABLE ENGINE CHANGE WITH PARTITIONS
+--echo # CORRUPTS FRM
+
+CREATE TABLE t1 (fld1 INT PRIMARY KEY) ENGINE= MYISAM PARTITION BY HASH(fld1)
+PARTITIONS 5;
+SHOW CREATE TABLE t1;
+
+--replace_regex /#sql-[0-9a-f_]*/#sql-temporary/
+--error ER_CANT_CREATE_TABLE
+ALTER TABLE t1 ENGINE= ARCHIVE;
+
+--echo #After the patch, the ENGINE is correctly displayed as MyISAM
+SHOW CREATE TABLE t1;
+
+--echo #Cleanup.
+DROP TABLE t1;
diff --git a/mysql-test/suite/binlog/t/binlog_killed.test b/mysql-test/suite/binlog/t/binlog_killed.test
index 9b6420df4b4..6fd9924d44b 100644
--- a/mysql-test/suite/binlog/t/binlog_killed.test
+++ b/mysql-test/suite/binlog/t/binlog_killed.test
@@ -353,6 +353,10 @@ drop function bug27563;
# common cleanup
#
+connection default;
+disconnect con1;
+disconnect con2;
+
drop table t1,t2,t3;
--echo end of the tests
diff --git a/mysql-test/suite/innodb/r/blob_unique2pk.result b/mysql-test/suite/innodb/r/blob_unique2pk.result
new file mode 100644
index 00000000000..57953dc8624
--- /dev/null
+++ b/mysql-test/suite/innodb/r/blob_unique2pk.result
@@ -0,0 +1,15 @@
+create table t1 (f1 tinyblob not null) engine=innodb;
+alter table t1 add unique index (f1(255));
+drop table t1;
+create table t1 (f1 tinyblob not null) engine=innodb;
+alter table t1 add unique index (f1(356));
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` tinyblob NOT NULL,
+ UNIQUE KEY `f1` (`f1`(255))
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 (f1 point not null) engine=innodb;
+alter table t1 add unique index (f1);
+drop table t1;
diff --git a/mysql-test/suite/innodb/r/innodb-fk.result b/mysql-test/suite/innodb/r/innodb-fk.result
new file mode 100644
index 00000000000..cf883d83874
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb-fk.result
@@ -0,0 +1,35 @@
+#
+# Bug #18806829 OPENING INNODB TABLES WITH MANY FOREIGN KEY
+# REFERENCES IS SLOW/CRASHES SEMAPHORE
+#
+create table t1 (f1 int primary key) engine=innodb;
+insert into t1 values (5);
+insert into t1 values (2882);
+insert into t1 values (10);
+update t1 set f1 = 28 where f1 = 2882;
+select * from fk_120;
+f1
+5
+10
+28
+select * from fk_1;
+f1
+5
+10
+28
+select * from fk_50;
+f1
+5
+10
+28
+drop table t1;
+#
+# Check if restrict is working fine.
+#
+create table t1 (f1 int primary key) engine=innodb;
+delete from t1 where f1 = 29;
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`fk_29`, CONSTRAINT `pc29` FOREIGN KEY (`f1`) REFERENCES `t1` (`f1`))
+select * from fk_29;
+f1
+29
+drop table t1;
diff --git a/mysql-test/suite/innodb/t/blob_unique2pk.test b/mysql-test/suite/innodb/t/blob_unique2pk.test
new file mode 100644
index 00000000000..ff6720690dd
--- /dev/null
+++ b/mysql-test/suite/innodb/t/blob_unique2pk.test
@@ -0,0 +1,20 @@
+--source include/have_innodb.inc
+
+
+#
+# Bug#16368875 INNODB: FAILING ASSERTION: PRIMARY_KEY_NO == -1 || PRIMARY_KEY_NO == 0
+#
+create table t1 (f1 tinyblob not null) engine=innodb;
+alter table t1 add unique index (f1(255));
+drop table t1;
+
+create table t1 (f1 tinyblob not null) engine=innodb;
+alter table t1 add unique index (f1(356));
+show create table t1;
+drop table t1;
+
+create table t1 (f1 point not null) engine=innodb;
+alter table t1 add unique index (f1);
+drop table t1;
+
+
diff --git a/mysql-test/suite/innodb/t/innodb-fk.test b/mysql-test/suite/innodb/t/innodb-fk.test
new file mode 100644
index 00000000000..9839cd2d084
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb-fk.test
@@ -0,0 +1,86 @@
+--source include/have_innodb.inc
+--source include/not_embedded.inc
+
+--echo #
+--echo # Bug #18806829 OPENING INNODB TABLES WITH MANY FOREIGN KEY
+--echo # REFERENCES IS SLOW/CRASHES SEMAPHORE
+--echo #
+
+create table t1 (f1 int primary key) engine=innodb;
+insert into t1 values (5);
+insert into t1 values (2882);
+insert into t1 values (10);
+
+let $fk_tables = 120;
+
+--disable_query_log
+let $i = $fk_tables;
+while ($i)
+{
+ eval create table fk_$i (f1 int primary key,
+ constraint pc$i foreign key (f1) references t1(f1)
+ on delete cascade on update cascade) engine=innodb;
+ eval insert into fk_$i values (5);
+ eval insert into fk_$i values (2882);
+ eval insert into fk_$i values (10);
+ dec $i;
+}
+--enable_query_log
+
+--source include/restart_mysqld.inc
+
+update t1 set f1 = 28 where f1 = 2882;
+
+select * from fk_120;
+select * from fk_1;
+select * from fk_50;
+
+--disable_query_log
+let $i = $fk_tables;
+while ($i)
+{
+ eval drop table fk_$i;
+ dec $i;
+}
+--enable_query_log
+
+drop table t1;
+
+--echo #
+--echo # Check if restrict is working fine.
+--echo #
+
+create table t1 (f1 int primary key) engine=innodb;
+
+let $fk_tables = 30;
+
+--disable_query_log
+let $i = $fk_tables;
+while ($i)
+{
+ eval create table fk_$i (f1 int primary key,
+ constraint pc$i foreign key (f1) references t1(f1)
+ on delete restrict on update restrict) engine=innodb;
+ eval insert into t1 values ($i);
+ eval insert into fk_$i values ($i);
+ dec $i;
+}
+--enable_query_log
+
+--source include/restart_mysqld.inc
+
+--error ER_ROW_IS_REFERENCED_2
+delete from t1 where f1 = 29;
+select * from fk_29;
+
+--disable_query_log
+let $i = $fk_tables;
+while ($i)
+{
+ eval drop table fk_$i;
+ dec $i;
+}
+--enable_query_log
+
+drop table t1;
+
diff --git a/mysql-test/suite/innodb/t/innodb_bug60196-master.opt b/mysql-test/suite/innodb/t/innodb_bug60196-master.opt
index c0a1981fa7c..ac4d3211e89 100644
--- a/mysql-test/suite/innodb/t/innodb_bug60196-master.opt
+++ b/mysql-test/suite/innodb/t/innodb_bug60196-master.opt
@@ -1 +1 @@
---lower-case-table-names=2
+--lower-case-table-names=2
diff --git a/mysql-test/suite/rpl/disabled.def b/mysql-test/suite/rpl/disabled.def
index f9af9c30f5c..687930e1524 100644
--- a/mysql-test/suite/rpl/disabled.def
+++ b/mysql-test/suite/rpl/disabled.def
@@ -1,3 +1,4 @@
+rpl_semi_sync_uninstall_plugin: waiting for the fix
##############################################################################
#
# List the test cases that are to be disabled temporarily.
diff --git a/mysql-test/suite/rpl/r/rpl_semi_sync.result b/mysql-test/suite/rpl/r/rpl_semi_sync.result
index 51859b5b49b..196844255f6 100644
--- a/mysql-test/suite/rpl/r/rpl_semi_sync.result
+++ b/mysql-test/suite/rpl/r/rpl_semi_sync.result
@@ -386,6 +386,7 @@ Rpl_semi_sync_slave_status ON
include/stop_slave.inc
[ on master ]
set sql_log_bin=0;
+include/stop_dump_threads.inc
UNINSTALL PLUGIN rpl_semi_sync_master;
set sql_log_bin=1;
SHOW VARIABLES LIKE 'rpl_semi_sync_master_enabled';
@@ -439,9 +440,8 @@ Rpl_semi_sync_slave_status OFF
#
# Clean up
#
+include/uninstall_semisync.inc
include/stop_slave.inc
-UNINSTALL PLUGIN rpl_semi_sync_slave;
-UNINSTALL PLUGIN rpl_semi_sync_master;
change master to master_user='root',master_password='';
include/start_slave.inc
drop table t1;
diff --git a/mysql-test/suite/rpl/r/rpl_semi_sync_uninstall_plugin.result b/mysql-test/suite/rpl/r/rpl_semi_sync_uninstall_plugin.result
new file mode 100644
index 00000000000..bd659e71600
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_semi_sync_uninstall_plugin.result
@@ -0,0 +1,36 @@
+include/master-slave.inc
+[connection master]
+INSTALL PLUGIN rpl_semi_sync_master SONAME 'SEMISYNC_MASTER_PLUGIN';
+INSTALL PLUGIN rpl_semi_sync_slave SONAME 'SEMISYNC_SLAVE_PLUGIN';
+UNINSTALL PLUGIN rpl_semi_sync_slave;
+UNINSTALL PLUGIN rpl_semi_sync_master;
+CREATE TABLE t1(i int);
+INSERT INTO t1 values (1);
+DROP TABLE t1;
+include/install_semisync.inc
+call mtr.add_suppression("Plugin 'rpl_semi_sync_slave' cannot be uninstalled now");
+UNINSTALL PLUGIN rpl_semi_sync_slave;
+ERROR HY000: Unknown error
+call mtr.add_suppression("Plugin 'rpl_semi_sync_master' cannot be uninstalled now");
+UNINSTALL PLUGIN rpl_semi_sync_master;
+ERROR HY000: Unknown error
+CREATE TABLE t1(i int);
+INSERT INTO t1 values (2);
+DROP TABLE t1;
+include/assert.inc [semi sync slave status should be ON.]
+include/assert.inc [semi sync master status should be ON.]
+include/assert.inc [semi sync master clients should be 1.]
+SET GLOBAL rpl_semi_sync_master_enabled = OFF;
+include/assert.inc [semi sync master clients should be 1.]
+UNINSTALL PLUGIN rpl_semi_sync_master;
+ERROR HY000: Unknown error
+include/stop_slave.inc
+SET GLOBAL rpl_semi_sync_slave_enabled = OFF;
+include/start_slave.inc
+UNINSTALL PLUGIN rpl_semi_sync_slave;
+include/assert.inc [semi sync master clients should be 0.]
+UNINSTALL PLUGIN rpl_semi_sync_master;
+CREATE TABLE t1(i int);
+INSERT INTO t1 values (3);
+DROP TABLE t1;
+include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_stop_slave.result b/mysql-test/suite/rpl/r/rpl_stop_slave.result
index 5959ee09993..b93ecce3597 100644
--- a/mysql-test/suite/rpl/r/rpl_stop_slave.result
+++ b/mysql-test/suite/rpl/r/rpl_stop_slave.result
@@ -94,10 +94,12 @@ DROP TABLE t1, t2;
CREATE TABLE t1 (c1 INT KEY, c2 INT) ENGINE=InnoDB;
CREATE TABLE t2 (c1 INT) ENGINE=MyISAM;
INSERT INTO t1 VALUES(1, 1);
+include/stop_slave.inc
[connection master]
+include/stop_dump_threads.inc
SET GLOBAL debug_dbug= '+d,dump_thread_wait_before_send_xid,*';
[connection slave]
-include/restart_slave.inc
+include/start_slave.inc
BEGIN;
UPDATE t1 SET c2 = 2 WHERE c1 = 1;
[connection master]
@@ -116,6 +118,9 @@ SET DEBUG_SYNC= 'now WAIT_FOR signal.continued';
[connection slave]
include/wait_for_slave_to_stop.inc
[connection slave1]
+[connection master]
+include/stop_dump_threads.inc
+[connection slave1]
include/start_slave.inc
[connection master]
DROP TABLE t1, t2;
diff --git a/mysql-test/suite/rpl/t/rpl_semi_sync.test b/mysql-test/suite/rpl/t/rpl_semi_sync.test
index 664ea732cac..091bbc38a15 100644
--- a/mysql-test/suite/rpl/t/rpl_semi_sync.test
+++ b/mysql-test/suite/rpl/t/rpl_semi_sync.test
@@ -548,6 +548,7 @@ source include/stop_slave.inc;
connection master;
echo [ on master ];
set sql_log_bin=0;
+--source include/stop_dump_threads.inc
UNINSTALL PLUGIN rpl_semi_sync_master;
set sql_log_bin=1;
enable_query_log;
@@ -601,19 +602,10 @@ SHOW STATUS LIKE 'Rpl_semi_sync_slave_status';
--echo #
--echo # Clean up
--echo #
+--source include/uninstall_semisync.inc
connection slave;
source include/stop_slave.inc;
-UNINSTALL PLUGIN rpl_semi_sync_slave;
-
-connection master;
-# The dump thread may still be running on the master, and so the following
-# UNINSTALL could generate a warning about the plugin is busy.
-disable_warnings;
-UNINSTALL PLUGIN rpl_semi_sync_master;
-enable_warnings;
-
-connection slave;
change master to master_user='root',master_password='';
source include/start_slave.inc;
diff --git a/mysql-test/suite/rpl/t/rpl_semi_sync_uninstall_plugin.test b/mysql-test/suite/rpl/t/rpl_semi_sync_uninstall_plugin.test
new file mode 100644
index 00000000000..2badd4203cf
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_semi_sync_uninstall_plugin.test
@@ -0,0 +1,145 @@
+###############################################################################
+# Bug#17638477 UNINSTALL AND INSTALL SEMI-SYNC PLUGIN CAUSES SLAVES TO BREAK
+# Problem: Uninstallation of Semi sync plugin should be blocked when it is
+# in use.
+# Test case: Uninstallation of semi sync should be allowed
+# On Master:
+# 1) When there is no dump thread
+# 2) When there are no semi sync slaves (i.e., async replication).
+# On Slave:
+# 1) When there is no I/O thread
+# 2) When there are no semi sync enabled I/O thread (i.e.,async replication).
+###############################################################################
+
+--source include/have_semisync_plugin.inc
+--source include/not_embedded.inc
+--source include/have_binlog_format_statement.inc
+--source include/master-slave.inc
+
+###############################################################################
+# Case 1: Uninstallation of semi sync plugins should be allowed when it is
+# not in use i.e., when asynchronous replication is active.
+###############################################################################
+# Step 1.1: Install semi sync master plugin on master
+--replace_result $SEMISYNC_MASTER_PLUGIN SEMISYNC_MASTER_PLUGIN
+eval INSTALL PLUGIN rpl_semi_sync_master SONAME '$SEMISYNC_MASTER_PLUGIN';
+
+# Step 1.2: Install semi sync slave plugin on slave
+--connection slave
+--replace_result $SEMISYNC_SLAVE_PLUGIN SEMISYNC_SLAVE_PLUGIN
+eval INSTALL PLUGIN rpl_semi_sync_slave SONAME '$SEMISYNC_SLAVE_PLUGIN';
+
+# Step 1.3: Uninstallation of semisync plugin on master and slave should be
+# allowed at this state as there is no semi sync replication enabled between
+# master and slave.
+UNINSTALL PLUGIN rpl_semi_sync_slave;
+--connection master
+UNINSTALL PLUGIN rpl_semi_sync_master;
+
+# Step 1.4: Check that replication is working fine at the end of the test case.
+CREATE TABLE t1(i int);
+INSERT INTO t1 values (1);
+DROP TABLE t1;
+--sync_slave_with_master
+
+###############################################################################
+# Case 2: Uninstallation of semi sync plugins should be disallowed
+# when it is in use i.e., when semi sync replication is active
+###############################################################################
+# Step 2.1: Install and enable semi sync replication between master and slave
+--source include/install_semisync.inc
+
+# Step 2.2: Check that rpl_semi_sync_slave uninstallation on Slave is not
+# possible at this state
+--connection slave
+call mtr.add_suppression("Plugin 'rpl_semi_sync_slave' cannot be uninstalled now");
+--error ER_UNKNOWN_ERROR
+UNINSTALL PLUGIN rpl_semi_sync_slave;
+
+# Step 2.3: Check that rpl_semi_sync_master uninstallation on Master is not
+# possible at this state
+--connection master
+call mtr.add_suppression("Plugin 'rpl_semi_sync_master' cannot be uninstalled now");
+--error ER_UNKNOWN_ERROR
+UNINSTALL PLUGIN rpl_semi_sync_master;
+
+# Step 2.4: Check that replication is working fine at the end of the test case.
+CREATE TABLE t1(i int);
+INSERT INTO t1 values (2);
+DROP TABLE t1;
+--sync_slave_with_master
+
+# Step 2.5: Make sure rpl_semi_sync_master_status on Master and
+# rpl_semi_sync_slave_staus on Slave are ON
+--let $slave_status=[show status like "Rpl_semi_sync_slave_status", Value, 1]
+--let assert_cond= "$slave_status" = "ON"
+--let assert_text= semi sync slave status should be ON.
+--source include/assert.inc
+
+--connection master
+--let $master_status=[show status like "Rpl_semi_sync_master_status", Value, 1]
+--let assert_cond= "$master_status" = "ON"
+--let assert_text= semi sync master status should be ON.
+--source include/assert.inc
+
+--let $master_clients=[show status like "Rpl_semi_sync_master_clients", Value, 1]
+--let assert_cond= $master_clients = 1
+--let assert_text= semi sync master clients should be 1.
+--source include/assert.inc
+
+###############################################################################
+# Case 3: Uninstallation of semi sync plugin should be disallowed when there
+# are semi sync slaves even though rpl_semi_sync_master_enabled= OFF;.
+###############################################################################
+# Step 3.1: Disable semi sync on master
+--connection master
+SET GLOBAL rpl_semi_sync_master_enabled = OFF;
+
+# Step 3.2: Check that still Rpl_semi_sync_master_clients is 1
+--let $master_clients=[show status like "Rpl_semi_sync_master_clients", Value, 1]
+--let assert_cond= $master_clients = 1
+--let assert_text= semi sync master clients should be 1.
+--source include/assert.inc
+
+# Step 3.3: Since Rpl_semi_sync_master_clients is 1, uninstallation of
+# rpl_semi_sync_master should be disallowed.
+--error ER_UNKNOWN_ERROR
+UNINSTALL PLUGIN rpl_semi_sync_master;
+
+###############################################################################
+# Case 4: Uninstallation of semi sync plugin should be allowed when it is not
+# in use. Same as Case 1 but this case is to check the case after enabling and
+# disabling semi sync replication.
+###############################################################################
+
+# Step 4.1: Stop IO thread on slave.
+--connection slave
+--source include/stop_slave.inc
+
+# Step 4.2: Disable semi sync on slave.
+SET GLOBAL rpl_semi_sync_slave_enabled = OFF;
+
+# Step 4.3: Start IO thread on slave.
+--source include/start_slave.inc
+
+# Step 4.4: Uninstall semi sync plugin, it should be successful now.
+UNINSTALL PLUGIN rpl_semi_sync_slave;
+
+# Step 4.5: On Master, check that semi sync slaves are now '0'.
+--connection master
+--let $master_clients=[show status like "Rpl_semi_sync_master_clients", Value, 1]
+--let assert_cond= $master_clients = 0
+--let assert_text= semi sync master clients should be 0.
+--source include/assert.inc
+
+# Step 4.6: So uninstalling semi sync plugin should be allowed
+UNINSTALL PLUGIN rpl_semi_sync_master;
+
+# Step 4.7: Check that replication is working fine at the end of the test case
+CREATE TABLE t1(i int);
+INSERT INTO t1 values (3);
+DROP TABLE t1;
+--sync_slave_with_master
+
+# Cleanup
+source include/rpl_end.inc;
diff --git a/mysql-test/suite/rpl/t/rpl_stop_slave.test b/mysql-test/suite/rpl/t/rpl_stop_slave.test
index d9d7f39c321..340738f8cb2 100644
--- a/mysql-test/suite/rpl/t/rpl_stop_slave.test
+++ b/mysql-test/suite/rpl/t/rpl_stop_slave.test
@@ -74,14 +74,17 @@ CREATE TABLE t2 (c1 INT) ENGINE=MyISAM;
INSERT INTO t1 VALUES(1, 1);
sync_slave_with_master;
+--source include/stop_slave.inc
--source include/rpl_connection_master.inc
+# make sure that there are no zombie threads
+--source include/stop_dump_threads.inc
let $debug_save= `SELECT @@GLOBAL.debug`;
SET GLOBAL debug_dbug= '+d,dump_thread_wait_before_send_xid,*';
--source include/rpl_connection_slave.inc
-source include/restart_slave_sql.inc;
+--source include/start_slave.inc
BEGIN;
UPDATE t1 SET c2 = 2 WHERE c1 = 1;
@@ -93,6 +96,10 @@ INSERT INTO t2 VALUES(1);
UPDATE t1 SET c2 = 3 WHERE c1 = 1;
COMMIT;
+# wait for the dump thread reach the sync point
+--let $wait_condition= select count(*)=1 from information_schema.processlist where state LIKE '%debug sync point%' and command='Binlog Dump'
+--source include/wait_condition.inc
+
--source include/rpl_connection_slave1.inc
let $show_statement= SHOW PROCESSLIST;
let $field= Info;
@@ -105,6 +112,7 @@ send STOP SLAVE;
ROLLBACK;
--source include/rpl_connection_master.inc
+
SET DEBUG_SYNC= 'now SIGNAL signal.continue';
SET DEBUG_SYNC= 'now WAIT_FOR signal.continued';
@@ -113,12 +121,25 @@ source include/wait_for_slave_to_stop.inc;
--source include/rpl_connection_slave1.inc
reap;
-source include/start_slave.inc;
+# Slave has stopped, thence lets make sure that
+# we kill the zombie dump threads. Also, make
+# sure that we disable the DBUG_EXECUTE_IF
+# that would set the dump thread to wait
--source include/rpl_connection_master.inc
-DROP TABLE t1, t2;
--disable_query_log
eval SET GLOBAL debug_dbug= '$debug_save';
--enable_query_log
+# make sure that there are no zombie threads
+--source include/stop_dump_threads.inc
+
+--source include/rpl_connection_slave1.inc
+# now the dump thread on the master will start
+# from a clean slate, i.e. without the
+# DBUG_EXECUTE_IF set
+source include/start_slave.inc;
+
+--source include/rpl_connection_master.inc
+DROP TABLE t1, t2;
--source include/rpl_end.inc
SET DEBUG_SYNC= 'RESET';
diff --git a/mysql-test/suite/sys_vars/r/timed_mutexes_basic.result b/mysql-test/suite/sys_vars/r/timed_mutexes_basic.result
index 50a5285b0d7..8c295fe8063 100644
--- a/mysql-test/suite/sys_vars/r/timed_mutexes_basic.result
+++ b/mysql-test/suite/sys_vars/r/timed_mutexes_basic.result
@@ -4,7 +4,11 @@ SELECT @global_start_value;
0
'#--------------------FN_DYNVARS_177_01------------------------#'
SET @@global.timed_mutexes = 1;
+Warnings:
+Warning 1287 '@@timed_mutexes' is deprecated and will be removed in a future release.
SET @@global.timed_mutexes = DEFAULT;
+Warnings:
+Warning 1287 '@@timed_mutexes' is deprecated and will be removed in a future release.
SELECT @@global.timed_mutexes;
@@global.timed_mutexes
0
@@ -17,15 +21,21 @@ SELECT @@timed_mutexes;
SELECT global.timed_mutexes;
ERROR 42S02: Unknown table 'global' in field list
SET global timed_mutexes = 1;
+Warnings:
+Warning 1287 '@@timed_mutexes' is deprecated and will be removed in a future release.
SELECT @@global.timed_mutexes;
@@global.timed_mutexes
1
'#--------------------FN_DYNVARS_177_03------------------------#'
SET @@global.timed_mutexes = 0;
+Warnings:
+Warning 1287 '@@timed_mutexes' is deprecated and will be removed in a future release.
SELECT @@global.timed_mutexes;
@@global.timed_mutexes
0
SET @@global.timed_mutexes = 1;
+Warnings:
+Warning 1287 '@@timed_mutexes' is deprecated and will be removed in a future release.
SELECT @@global.timed_mutexes;
@@global.timed_mutexes
1
@@ -82,23 +92,33 @@ VARIABLE_VALUE
ON
'#---------------------FN_DYNVARS_177_08-------------------------#'
SET @@global.timed_mutexes = OFF;
+Warnings:
+Warning 1287 '@@timed_mutexes' is deprecated and will be removed in a future release.
SELECT @@global.timed_mutexes;
@@global.timed_mutexes
0
SET @@global.timed_mutexes = ON;
+Warnings:
+Warning 1287 '@@timed_mutexes' is deprecated and will be removed in a future release.
SELECT @@global.timed_mutexes;
@@global.timed_mutexes
1
'#---------------------FN_DYNVARS_177_09----------------------#'
SET @@global.timed_mutexes = TRUE;
+Warnings:
+Warning 1287 '@@timed_mutexes' is deprecated and will be removed in a future release.
SELECT @@global.timed_mutexes;
@@global.timed_mutexes
1
SET @@global.timed_mutexes = FALSE;
+Warnings:
+Warning 1287 '@@timed_mutexes' is deprecated and will be removed in a future release.
SELECT @@global.timed_mutexes;
@@global.timed_mutexes
0
SET @@global.timed_mutexes = @global_start_value;
+Warnings:
+Warning 1287 '@@timed_mutexes' is deprecated and will be removed in a future release.
SELECT @@global.timed_mutexes;
@@global.timed_mutexes
0
diff --git a/mysql-test/t/func_str.test b/mysql-test/t/func_str.test
index c61ebbfa4bd..3c3de4240ab 100644
--- a/mysql-test/t/func_str.test
+++ b/mysql-test/t/func_str.test
@@ -1583,6 +1583,11 @@ call foo('(( 00000000 ++ 00000000 ))');
drop procedure foo;
drop table t1,t2;
+#
+# Bug#18786138 SHA/MD5 HASHING FUNCTIONS DIE WITH "FILENAME" CHARACTER SET
+#
+select md5(_filename "a"), sha(_filename "a");
+
--echo #
--echo # End of 5.5 tests
--echo #
diff --git a/mysql-test/t/group_min_max.test b/mysql-test/t/group_min_max.test
index 85559afb7b3..8d5863db176 100644
--- a/mysql-test/t/group_min_max.test
+++ b/mysql-test/t/group_min_max.test
@@ -1404,6 +1404,31 @@ drop table t1;
--echo # End of test#50539.
--echo #
+--echo # Bug#17217128 - BAD INTERACTION BETWEEN MIN/MAX AND
+--echo # "HAVING SUM(DISTINCT)": WRONG RESULTS.
+--echo #
+
+CREATE TABLE t (a INT, b INT, KEY(a,b));
+INSERT INTO t VALUES (1,1), (2,2), (3,3), (4,4), (1,0), (3,2), (4,5);
+ANALYZE TABLE t;
+
+SELECT a, SUM(DISTINCT a), MIN(b) FROM t GROUP BY a;
+EXPLAIN SELECT a, SUM(DISTINCT a), MIN(b) FROM t GROUP BY a;
+
+SELECT a, SUM(DISTINCT a), MAX(b) FROM t GROUP BY a;
+EXPLAIN SELECT a, SUM(DISTINCT a), MAX(b) FROM t GROUP BY a;
+
+SELECT a, MAX(b) FROM t GROUP BY a HAVING SUM(DISTINCT a);
+EXPLAIN SELECT a, MAX(b) FROM t GROUP BY a HAVING SUM(DISTINCT a);
+
+SELECT SUM(DISTINCT a), MIN(b), MAX(b) FROM t;
+EXPLAIN SELECT SUM(DISTINCT a), MIN(b), MAX(b) FROM t;
+
+SELECT a, SUM(DISTINCT a), MIN(b), MAX(b) FROM t GROUP BY a;
+EXPLAIN SELECT a, SUM(DISTINCT a), MIN(b), MAX(b) FROM t GROUP BY a;
+DROP TABLE t;
+
+--echo #
--echo # MDEV-4219 A simple select query returns random data (upstream bug#68473)
--echo #
diff --git a/mysql-test/t/group_min_max_innodb.test b/mysql-test/t/group_min_max_innodb.test
index 7038eb2ff47..6967f847147 100644
--- a/mysql-test/t/group_min_max_innodb.test
+++ b/mysql-test/t/group_min_max_innodb.test
@@ -137,3 +137,96 @@ SELECT COUNT(DISTINCT a) FROM t1 WHERE b = 'b';
DROP TABLE t1;
--echo End of 5.5 tests
+
+--echo #
+--echo # Bug#17909656 - WRONG RESULTS FOR A SIMPLE QUERY WITH GROUP BY
+--echo #
+
+CREATE TABLE t0 (
+ i1 INTEGER NOT NULL
+);
+
+INSERT INTO t0 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),
+ (11),(12),(13),(14),(15),(16),(17),(18),(19),(20),
+ (21),(22),(23),(24),(25),(26),(27),(28),(29),(30);
+
+CREATE TABLE t1 (
+ c1 CHAR(1) NOT NULL,
+ i1 INTEGER NOT NULL,
+ i2 INTEGER NOT NULL,
+ UNIQUE KEY k1 (c1,i2)
+) ENGINE=InnoDB;
+
+INSERT INTO t1 SELECT 'A',i1,i1 FROM t0;
+INSERT INTO t1 SELECT 'B',i1,i1 FROM t0;
+INSERT INTO t1 SELECT 'C',i1,i1 FROM t0;
+INSERT INTO t1 SELECT 'D',i1,i1 FROM t0;
+INSERT INTO t1 SELECT 'E',i1,i1 FROM t0;
+INSERT INTO t1 SELECT 'F',i1,i1 FROM t0;
+
+CREATE TABLE t2 (
+ c1 CHAR(1) NOT NULL,
+ i1 INTEGER NOT NULL,
+ i2 INTEGER NOT NULL,
+ UNIQUE KEY k2 (c1,i1,i2)
+) ENGINE=InnoDB;
+
+INSERT INTO t2 SELECT 'A',i1,i1 FROM t0;
+INSERT INTO t2 SELECT 'B',i1,i1 FROM t0;
+INSERT INTO t2 SELECT 'C',i1,i1 FROM t0;
+INSERT INTO t2 SELECT 'D',i1,i1 FROM t0;
+INSERT INTO t2 SELECT 'E',i1,i1 FROM t0;
+INSERT INTO t2 SELECT 'F',i1,i1 FROM t0;
+
+-- disable_result_log
+ANALYZE TABLE t1;
+ANALYZE TABLE t2;
+-- enable_result_log
+
+let query=
+SELECT c1, max(i2) FROM t1 WHERE (c1 = 'C' AND i2 = 17) OR ( c1 = 'F')
+GROUP BY c1;
+eval EXPLAIN $query;
+eval $query;
+
+let query=
+SELECT c1, max(i2) FROM t1 WHERE (c1 = 'C' OR ( c1 = 'F' AND i2 = 17))
+GROUP BY c1;
+eval EXPLAIN $query;
+eval $query;
+
+let query=
+SELECT c1, max(i2) FROM t1 WHERE (c1 = 'C' OR c1 = 'F' ) AND ( i2 = 17 )
+GROUP BY c1;
+eval EXPLAIN $query;
+eval $query;
+
+let query=
+SELECT c1, max(i2) FROM t1
+WHERE ((c1 = 'C' AND (i2 = 40 OR i2 = 30)) OR ( c1 = 'F' AND (i2 = 40 )))
+GROUP BY c1;
+eval EXPLAIN $query;
+eval $query;
+
+let query=
+SELECT c1, i1, max(i2) FROM t2
+WHERE (c1 = 'C' OR ( c1 = 'F' AND i1 < 35)) AND ( i2 = 17 )
+GROUP BY c1,i1;
+eval EXPLAIN $query;
+eval $query;
+
+let query=
+SELECT c1, i1, max(i2) FROM t2
+WHERE (((c1 = 'C' AND i1 < 40) OR ( c1 = 'F' AND i1 < 35)) AND ( i2 = 17 ))
+GROUP BY c1,i1;
+eval EXPLAIN $query;
+eval $query;
+
+let query=
+SELECT c1, i1, max(i2) FROM t2
+WHERE ((c1 = 'C' AND i1 < 40) OR ( c1 = 'F' AND i1 < 35) OR ( i2 = 17 ))
+GROUP BY c1,i1;
+eval EXPLAIN $query;
+eval $query;
+
+DROP TABLE t0,t1,t2;
diff --git a/mysql-test/t/long_tmpdir-master.sh b/mysql-test/t/long_tmpdir-master.sh
index 7bcbee26105..7bcbee26105 100644..100755
--- a/mysql-test/t/long_tmpdir-master.sh
+++ b/mysql-test/t/long_tmpdir-master.sh
diff --git a/mysql-test/t/lowercase_mixed_tmpdir-master.sh b/mysql-test/t/lowercase_mixed_tmpdir-master.sh
index 9330d0581ee..9330d0581ee 100644..100755
--- a/mysql-test/t/lowercase_mixed_tmpdir-master.sh
+++ b/mysql-test/t/lowercase_mixed_tmpdir-master.sh
diff --git a/mysql-test/t/lowercase_table4-master.opt b/mysql-test/t/lowercase_table4-master.opt
index c0a1981fa7c..ac4d3211e89 100644
--- a/mysql-test/t/lowercase_table4-master.opt
+++ b/mysql-test/t/lowercase_table4-master.opt
@@ -1 +1 @@
---lower-case-table-names=2
+--lower-case-table-names=2
diff --git a/mysql-test/t/partition_pruning.test b/mysql-test/t/partition_pruning.test
index 69f159e8142..a34ffe7b365 100644
--- a/mysql-test/t/partition_pruning.test
+++ b/mysql-test/t/partition_pruning.test
@@ -1415,6 +1415,54 @@ explain partitions select * from t1 where a between 10 and 10+33;
drop table t0, t1;
--echo #
+--echo # Bug#71095: Wrong results with PARTITION BY LIST COLUMNS()
+--echo #
+CREATE TABLE t1
+(c1 int,
+ c2 int,
+ c3 int,
+ c4 int,
+ PRIMARY KEY (c1,c2))
+PARTITION BY LIST COLUMNS (c2)
+(PARTITION p1 VALUES IN (1,2),
+ PARTITION p2 VALUES IN (3,4));
+INSERT INTO t1 VALUES (1, 1, 1, 1), (2, 3, 1, 1);
+INSERT INTO t1 VALUES (1, 2, 1, 1), (2, 4, 1, 1);
+SELECT * FROM t1 WHERE c1 = 1 AND c2 < 1;
+SELECT * FROM t1 WHERE c1 = 1 AND c2 <= 1;
+SELECT * FROM t1 WHERE c1 = 1 AND c2 = 1;
+SELECT * FROM t1 WHERE c1 = 1 AND c2 >= 1;
+SELECT * FROM t1 WHERE c1 = 1 AND c2 > 1;
+SELECT * FROM t1 WHERE c1 = 1 AND c2 < 3;
+SELECT * FROM t1 WHERE c1 = 1 AND c2 <= 3;
+SELECT * FROM t1 WHERE c1 = 2 AND c2 <= 3;
+SELECT * FROM t1 WHERE c1 = 2 AND c2 = 3;
+SELECT * FROM t1 WHERE c1 = 2 AND c2 >= 3;
+SELECT * FROM t1 WHERE c1 = 2 AND c2 > 3;
+SELECT * FROM t1 WHERE c1 = 2 AND c2 < 4;
+SELECT * FROM t1 WHERE c1 = 2 AND c2 <= 4;
+SELECT * FROM t1 WHERE c1 = 2 AND c2 = 4;
+SELECT * FROM t1 WHERE c1 = 2 AND c2 >= 4;
+SELECT * FROM t1 WHERE c1 = 2 AND c2 > 4;
+EXPLAIN PARTITIONS SELECT * FROM t1 WHERE c1 = 1 AND c2 < 1;
+EXPLAIN PARTITIONS SELECT * FROM t1 WHERE c1 = 1 AND c2 <= 1;
+EXPLAIN PARTITIONS SELECT * FROM t1 WHERE c1 = 1 AND c2 = 1;
+EXPLAIN PARTITIONS SELECT * FROM t1 WHERE c1 = 1 AND c2 >= 1;
+EXPLAIN PARTITIONS SELECT * FROM t1 WHERE c1 = 1 AND c2 > 1;
+EXPLAIN PARTITIONS SELECT * FROM t1 WHERE c1 = 1 AND c2 < 3;
+EXPLAIN PARTITIONS SELECT * FROM t1 WHERE c1 = 1 AND c2 <= 3;
+EXPLAIN PARTITIONS SELECT * FROM t1 WHERE c1 = 2 AND c2 <= 3;
+EXPLAIN PARTITIONS SELECT * FROM t1 WHERE c1 = 2 AND c2 = 3;
+EXPLAIN PARTITIONS SELECT * FROM t1 WHERE c1 = 2 AND c2 >= 3;
+EXPLAIN PARTITIONS SELECT * FROM t1 WHERE c1 = 2 AND c2 > 3;
+EXPLAIN PARTITIONS SELECT * FROM t1 WHERE c1 = 2 AND c2 < 4;
+EXPLAIN PARTITIONS SELECT * FROM t1 WHERE c1 = 2 AND c2 <= 4;
+EXPLAIN PARTITIONS SELECT * FROM t1 WHERE c1 = 2 AND c2 = 4;
+EXPLAIN PARTITIONS SELECT * FROM t1 WHERE c1 = 2 AND c2 >= 4;
+EXPLAIN PARTITIONS SELECT * FROM t1 WHERE c1 = 2 AND c2 > 4;
+DROP TABLE t1;
+
+--echo #
--echo # MDEV-6239: Partition pruning is not working as expected in an inner query
--echo #
diff --git a/mysql-test/t/union.test b/mysql-test/t/union.test
index 877509a9fc0..a5d7dae606f 100644
--- a/mysql-test/t/union.test
+++ b/mysql-test/t/union.test
@@ -1273,6 +1273,36 @@ SELECT(SELECT 1 AS a ORDER BY a) AS dev;
SELECT(SELECT 1 AS a LIMIT 1) AS dev;
SELECT(SELECT 1 AS a FROM dual ORDER BY a DESC LIMIT 1) AS dev;
+
+--echo #
+--echo # Bug #17059925 : UNIONS COMPUTES ROWS_EXAMINED INCORRECTLY
+--echo #
+
+## Save current state of slow log variables
+SET @old_slow_query_log= @@global.slow_query_log;
+SET @old_log_output= @@global.log_output;
+SET @old_long_query_time= @@long_query_time;
+SET GLOBAL log_output= "TABLE";
+SET GLOBAL slow_query_log= ON;
+SET SESSION long_query_time= 0;
+
+CREATE TABLE t17059925 (a INT);
+CREATE TABLE t2 (b INT);
+CREATE TABLE t3 (c INT);
+INSERT INTO t17059925 VALUES (1), (2), (3);
+INSERT INTO t2 VALUES (4), (5), (6);
+INSERT INTO t3 VALUES (7), (8), (9);
+TRUNCATE table mysql.slow_log;
+--sorted_result
+SELECT * FROM t17059925 UNION SELECT * FROM t2 UNION SELECT * FROM t3;
+SELECT sql_text, rows_examined FROM mysql.slow_log WHERE sql_text LIKE '%SELECT%t17059925%';
+DROP TABLE t17059925, t2, t3;
+
+## Reset to initial values
+SET @@long_query_time= @old_long_query_time;
+SET @@global.log_output= @old_log_output;
+SET @@global.slow_query_log= @old_slow_query_log;
+
--echo #
--echo # lp:1010729: Unexpected syntax error from UNION
--echo # (bug #54382) with single-table join nest
diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test
index 5f3e69431ee..9cb9deff3f8 100644
--- a/mysql-test/t/view.test
+++ b/mysql-test/t/view.test
@@ -4700,6 +4700,47 @@ DROP DATABASE IF EXISTS nodb;
--error ER_BAD_DB_ERROR
CREATE VIEW nodb.a AS SELECT 1;
+
+--echo #
+--echo # BUG#14117018 - MYSQL SERVER CREATES INVALID VIEW DEFINITION
+--echo # BUG#18405221 - SHOW CREATE VIEW OUTPUT INCORRECT
+--echo #
+
+CREATE VIEW v1 AS (SELECT '' FROM DUAL);
+CREATE VIEW v2 AS (SELECT 'BUG#14117018' AS col1 FROM DUAL) UNION ALL
+ (SELECT '' FROM DUAL);
+CREATE VIEW v3 AS (SELECT 'BUG#14117018' AS col1 FROM DUAL) UNION ALL
+ (SELECT '' FROM DUAL) UNION ALL
+ (SELECT '' FROM DUAL);
+CREATE VIEW v4 AS (SELECT 'BUG#14117018' AS col1 FROM DUAL) UNION ALL
+ (SELECT '' AS col2 FROM DUAL) UNION ALL
+ (SELECT '' FROM DUAL);
+
+# In the second (and later) UNIONed queries, duplicate column names are allowed
+CREATE VIEW v5 AS (SELECT 'buggy' AS col1, 'fix' as col2 FROM DUAL) UNION ALL
+ (SELECT 'buggy' as a, 'fix' as a FROM DUAL);
+
+--echo # Name for the column in select1 is set properly with or
+--echo # without this fix.
+SHOW CREATE VIEW v1;
+
+--echo # Name for the column in select2 is set with this fix.
+--echo # Without this fix, name would not have set for the
+--echo # columns in select2.
+SHOW CREATE VIEW v2;
+
+--echo # Name for the field item in select2 & select3 is set with this fix.
+--echo # Without this fix, name would not have set for the
+--echo # columns in select2 & select3.
+SHOW CREATE VIEW v3;
+
+--echo # Name for the field item in select3 is set with this fix.
+--echo # Without this fix, name would not have set for the
+--echo # columns in select3.
+SHOW CREATE VIEW v4;
+
+DROP VIEW v1, v2, v3, v4, v5;
+
# Check that all connections opened by test cases in this file are really
# gone so execution of other tests won't be affected by their presence.
--source include/wait_until_count_sessions.inc