summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorNirbhay Choubey <nirbhay@mariadb.com>2015-10-31 18:07:02 -0400
committerNirbhay Choubey <nirbhay@mariadb.com>2015-10-31 18:07:02 -0400
commit4d1511296288782df0e3d9373396724e250b24c1 (patch)
tree9fa47d141b71933859d6c2da585e5bb5e52db212 /mysql-test
parent17b0b45b1de41a1b188c5de6c3e9d8e6ecc48a72 (diff)
parentd775ecdd010daad4dc6147fba58acd006bf2c60c (diff)
downloadmariadb-git-4d1511296288782df0e3d9373396724e250b24c1.tar.gz
Merge tag 'mariadb-10.0.22' into 10.0-galera
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/disabled.def3
-rw-r--r--mysql-test/include/restart_mysqld.inc20
-rwxr-xr-xmysql-test/mysql-test-run.pl5
-rw-r--r--mysql-test/r/alter_table.result9
-rw-r--r--mysql-test/r/derived.result27
-rw-r--r--mysql-test/r/dyncol.result15
-rw-r--r--mysql-test/r/empty_server_name-8224.result1
-rw-r--r--mysql-test/r/events_1.result3
-rw-r--r--mysql-test/r/events_restart.result24
-rw-r--r--mysql-test/r/explain_non_select.result41
-rw-r--r--mysql-test/r/func_if.result17
-rw-r--r--mysql-test/r/func_misc.result204
-rw-r--r--mysql-test/r/information_schema2.result24
-rw-r--r--mysql-test/r/init_file_set_password-7656.result8
-rw-r--r--mysql-test/r/loadxml.result27
-rw-r--r--mysql-test/r/lowercase_fs_on.result3
-rw-r--r--mysql-test/r/lowercase_table3.result11
-rw-r--r--mysql-test/r/mdev-504.result2
-rw-r--r--mysql-test/r/mysql_upgrade-6984.result1
-rw-r--r--mysql-test/r/mysqldump.result29
-rw-r--r--mysql-test/r/partition_alter.result53
-rw-r--r--mysql-test/r/partition_error.result2
-rw-r--r--mysql-test/r/partition_innodb.result34
-rw-r--r--mysql-test/r/ps.result21
-rw-r--r--mysql-test/r/ps_change_master.result22
-rw-r--r--mysql-test/r/selectivity_no_engine.result17
-rw-r--r--mysql-test/r/skip_grants.result4
-rw-r--r--mysql-test/r/subselect.result94
-rw-r--r--mysql-test/r/subselect_no_exists_to_in.result94
-rw-r--r--mysql-test/r/subselect_no_mat.result94
-rw-r--r--mysql-test/r/subselect_no_opts.result94
-rw-r--r--mysql-test/r/subselect_no_scache.result94
-rw-r--r--mysql-test/r/subselect_no_semijoin.result94
-rw-r--r--mysql-test/r/subselect_sj2.result33
-rw-r--r--mysql-test/r/subselect_sj2_jcl6.result33
-rw-r--r--mysql-test/r/subselect_sj2_mat.result33
-rw-r--r--mysql-test/r/update.result15
-rw-r--r--mysql-test/r/view.result137
-rw-r--r--mysql-test/std_data/bug16171518_1.dat59
-rw-r--r--mysql-test/std_data/bug16171518_2.dat12
-rw-r--r--mysql-test/suite/binlog/r/binlog_mysqlbinlog_row.result6
-rw-r--r--mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_innodb.result72
-rw-r--r--mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_myisam.result72
-rw-r--r--mysql-test/suite/innodb/r/innodb-alter-filewrite.result30
-rw-r--r--mysql-test/suite/innodb/r/innodb_bug68148.result36
-rw-r--r--mysql-test/suite/innodb/r/innodb_monitor.result9
-rw-r--r--mysql-test/suite/innodb/r/innodb_simulate_comp_failures.result2
-rw-r--r--mysql-test/suite/innodb/r/snapshot.result8
-rw-r--r--mysql-test/suite/innodb/t/innodb-alter-filewrite.test32
-rw-r--r--mysql-test/suite/innodb/t/innodb_bug60229-master.opt1
-rw-r--r--mysql-test/suite/innodb/t/innodb_bug60229.test4
-rw-r--r--mysql-test/suite/innodb/t/innodb_bug68148.test41
-rw-r--r--mysql-test/suite/innodb/t/innodb_simulate_comp_failures.test4
-rw-r--r--mysql-test/suite/innodb/t/snapshot.test18
-rw-r--r--mysql-test/suite/innodb/t/xa_recovery.test6
-rw-r--r--mysql-test/suite/jp/t/jp_enum_sjis-master.opt1
-rw-r--r--mysql-test/suite/jp/t/jp_enum_sjis.test4
-rw-r--r--mysql-test/suite/jp/t/jp_enum_ucs2-master.opt1
-rw-r--r--mysql-test/suite/jp/t/jp_enum_ucs2.test4
-rw-r--r--mysql-test/suite/jp/t/jp_enum_ujis-master.opt1
-rw-r--r--mysql-test/suite/jp/t/jp_enum_ujis.test4
-rw-r--r--mysql-test/suite/jp/t/jp_enum_utf8-master.opt1
-rw-r--r--mysql-test/suite/jp/t/jp_enum_utf8.test4
-rw-r--r--mysql-test/suite/parts/r/partition_debug.result16
-rw-r--r--mysql-test/suite/parts/t/partition_debug.test18
-rw-r--r--mysql-test/suite/perfschema/r/misc.result15
-rw-r--r--mysql-test/suite/perfschema/r/query_cache.result4
-rw-r--r--mysql-test/suite/perfschema/t/misc.test20
-rw-r--r--mysql-test/suite/perfschema/t/query_cache.test2
-rw-r--r--mysql-test/suite/plugins/r/feedback_plugin_load.result7
-rw-r--r--mysql-test/suite/plugins/r/feedback_plugin_send.result7
-rw-r--r--mysql-test/suite/plugins/t/feedback_plugin_load.test20
-rw-r--r--mysql-test/suite/plugins/t/feedback_plugin_send.test9
-rw-r--r--mysql-test/suite/roles/create_and_drop_role.result4
-rw-r--r--mysql-test/suite/roles/create_and_drop_role.test8
-rw-r--r--mysql-test/suite/roles/ip-6401.test3
-rw-r--r--mysql-test/suite/roles/rebuild_role_grants.result6
-rw-r--r--mysql-test/suite/roles/rebuild_role_grants.test13
-rw-r--r--mysql-test/suite/rpl/r/rpl_gtid_mdev4820.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_mdev8193.result24
-rw-r--r--mysql-test/suite/rpl/r/rpl_parallel.result18
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_reset_slave.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_to_stmt.result28
-rw-r--r--mysql-test/suite/rpl/r/rpl_stm_reset_slave.result2
-rw-r--r--mysql-test/suite/rpl/t/rpl_gtid_mdev4820.test4
-rw-r--r--mysql-test/suite/rpl/t/rpl_innodb_bug30888.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_mdev8193.test56
-rw-r--r--mysql-test/suite/rpl/t/rpl_parallel.test22
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_to_stmt-master.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_to_stmt-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_to_stmt.test23
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_monitor_disable_basic.result9
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_monitor_enable_basic.result9
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_monitor_reset_all_basic.result9
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_monitor_reset_basic.result9
-rw-r--r--mysql-test/t/alter_table.test13
-rw-r--r--mysql-test/t/derived.test35
-rw-r--r--mysql-test/t/dyncol.test12
-rw-r--r--mysql-test/t/empty_server_name-8224.test4
-rw-r--r--mysql-test/t/events_1.test3
-rw-r--r--mysql-test/t/events_restart.test14
-rw-r--r--mysql-test/t/explain_non_select.test42
-rw-r--r--mysql-test/t/func_if.test14
-rw-r--r--mysql-test/t/func_misc.test207
-rw-r--r--mysql-test/t/information_schema2.test19
-rw-r--r--mysql-test/t/init_file_set_password-7656.test26
-rw-r--r--mysql-test/t/loadxml.test14
-rw-r--r--mysql-test/t/lowercase_fs_on.test38
-rw-r--r--mysql-test/t/lowercase_table3-master.opt1
-rw-r--r--mysql-test/t/lowercase_table3.test37
-rw-r--r--mysql-test/t/mdev-504.test4
-rw-r--r--mysql-test/t/mysql_upgrade-6984.test3
-rw-r--r--mysql-test/t/mysqldump.test36
-rw-r--r--mysql-test/t/partition_alter.test66
-rw-r--r--mysql-test/t/partition_error.test2
-rw-r--r--mysql-test/t/partition_innodb.test42
-rw-r--r--mysql-test/t/ps.test22
-rw-r--r--mysql-test/t/ps_change_master.test45
-rw-r--r--mysql-test/t/selectivity_no_engine.test17
-rw-r--r--mysql-test/t/skip_grants.test2
-rw-r--r--mysql-test/t/subselect.test99
-rw-r--r--mysql-test/t/subselect_sj2.test39
-rw-r--r--mysql-test/t/update.test15
-rw-r--r--mysql-test/t/view.test157
124 files changed, 3055 insertions, 219 deletions
diff --git a/mysql-test/disabled.def b/mysql-test/disabled.def
index bb0e243326a..5c4b7421b21 100644
--- a/mysql-test/disabled.def
+++ b/mysql-test/disabled.def
@@ -11,9 +11,7 @@
##############################################################################
tablespace : disabled in MariaDB (no TABLESPACE table attribute)
events_time_zone : Test is not predictable as it depends on precise timing.
-lowercase_table3 : Bug#11762269 2010-06-30 alik main.lowercase_table3 on Mac OSX
read_many_rows_innodb : Bug#11748886 2010-11-15 mattiasj report already exists
-archive-big : Bug#11817185 2011-03-10 Anitha Disabled since this leads to timeout on Solaris Sparc
log_tables-big : Bug#11756699 2010-11-15 mattiasj report already exists
mysql_embedded : Bug#12561297 2011-05-14 Anitha Dependent on PB2 changes - eventum#41836
#show_explain : Psergey: random timeout in range-checked-for-each record query.
@@ -21,3 +19,4 @@ ssl_crl_clients_valid : broken upstream
ssl_crl : broken upstream
ssl_crl_clrpath : broken upstream
file_contents : MDEV-6526 these files are not installed anymore
+lowercase_fs_on : lower_case_table_names=0 is not an error until 10.1
diff --git a/mysql-test/include/restart_mysqld.inc b/mysql-test/include/restart_mysqld.inc
index 3d53fada870..71efb141917 100644
--- a/mysql-test/include/restart_mysqld.inc
+++ b/mysql-test/include/restart_mysqld.inc
@@ -1,3 +1,9 @@
+# ==== Usage ====
+#
+# [--let $shutdown_timeout= 30]
+# [--let $allow_rpl_inited= 1]
+# --source include/restart_mysqld.inc
+
--source include/not_embedded.inc
if ($rpl_inited)
@@ -8,6 +14,16 @@ if ($rpl_inited)
}
}
+--let $server_shutdown_timeout= 60
+if ($shutdown_timeout)
+{
+ --let $server_shutdown_timeout= $shutdown_timeout
+}
+if ($shutdown_timeout == 0)
+{
+ --let $server_shutdown_timeout= 0
+}
+
# Write file to make mysql-test-run.pl expect the "crash", but don't start
# it until it's told to
--let $_server_id= `SELECT @@server_id`
@@ -15,8 +31,8 @@ if ($rpl_inited)
--exec echo "wait" > $_expect_file_name
# Send shutdown to the connected server and give
-# it 60 seconds to die before zapping it
-shutdown_server 60;
+# it 10 seconds to die before zapping it
+shutdown_server $server_shutdown_timeout;
# Write file to make mysql-test-run.pl start up the server again
--exec echo "restart" > $_expect_file_name
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index 60d34ae5e8a..4f514044e84 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -1088,7 +1088,6 @@ sub print_global_resfile {
resfile_global("shutdown-timeout", $opt_shutdown_timeout ? 1 : 0);
resfile_global("warnings", $opt_warnings ? 1 : 0);
resfile_global("max-connections", $opt_max_connections);
-# resfile_global("default-myisam", $opt_default_myisam ? 1 : 0);
resfile_global("product", "MySQL");
# Somewhat hacky code to convert numeric version back to dot notation
my $v1= int($mysql_version_id / 10000);
@@ -1250,7 +1249,6 @@ sub command_line_setup {
'stop-file=s' => \$opt_stop_file,
'stop-keep-alive=i' => \$opt_stop_keep_alive,
'max-connections=i' => \$opt_max_connections,
- 'default-myisam!' => \&collect_option,
'report-times' => \$opt_report_times,
'result-file' => \$opt_resfile,
'stress=s' => \$opt_stress,
@@ -6646,9 +6644,6 @@ Misc options
timediff With --timestamp, also print time passed since
*previous* test started
max-connections=N Max number of open connection to server in mysqltest
- default-myisam Set default storage engine to MyISAM for non-innodb
- tests. This is needed after switching default storage
- engine to InnoDB.
report-times Report how much time has been spent on different
phases of test execution.
stress=ARGS Run stress test, providing options to
diff --git a/mysql-test/r/alter_table.result b/mysql-test/r/alter_table.result
index 5df0c2e3c96..e572fdb197c 100644
--- a/mysql-test/r/alter_table.result
+++ b/mysql-test/r/alter_table.result
@@ -2012,3 +2012,12 @@ t1 CREATE TABLE `t1` (
UNIQUE KEY `idx` (`i`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
+CREATE TABLE t1 (
+`event_id` bigint(20) unsigned NOT NULL DEFAULT '0',
+`market_id` bigint(20) unsigned NOT NULL DEFAULT '0',
+PRIMARY KEY (`event_id`,`market_id`)
+);
+ALTER TABLE t1 ADD PRIMARY KEY IF NOT EXISTS event_id (event_id,market_id);
+Warnings:
+Note 1061 Multiple primary key defined
+DROP TABLE t1;
diff --git a/mysql-test/r/derived.result b/mysql-test/r/derived.result
index 7c44466ae92..2b0b1041936 100644
--- a/mysql-test/r/derived.result
+++ b/mysql-test/r/derived.result
@@ -567,7 +567,31 @@ insert into t1 (accountId,balance) values
update t1 set balance=(select sum(balance) from (SELECT balance FROM t1 where accountId like 'dealer%') AS copied) where accountId = 'OPERATOR';
set optimizer_switch=@save_derived_optimizer_switch_bug;
drop table t1;
-set optimizer_switch=@save_derived_optimizer_switch;
+#
+# MDEV-6219:Server crashes in Bitmap<64u>::merge
+# (this=0x180, map2=...) on 2nd execution of PS with INSERT .. SELECT,
+# derived_merge
+#
+CREATE TABLE t1 (a VARCHAR(8)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES ('foo'),('bar');
+create procedure p1()
+INSERT INTO t1 SELECT * FROM (
+SELECT * FROM t1
+) AS sq
+WHERE sq.a IN ( SELECT 'baz' FROM DUAL );
+call p1();
+call p1();
+drop procedure p1;
+PREPARE stmt FROM "
+ INSERT INTO t1 SELECT * FROM (
+ SELECT * FROM t1
+ ) AS sq
+ WHERE sq.a IN ( SELECT 'baz' FROM DUAL )
+";
+EXECUTE stmt;
+EXECUTE stmt;
+deallocate prepare stmt;
+drop table t1;
#
# MDEV-6892: WHERE does not apply
#
@@ -580,3 +604,4 @@ select x.id, message from (select id from t1) x left join
where coalesce(message,0) <> 0;
id message
drop table t1,t2;
+set optimizer_switch=@save_derived_optimizer_switch;
diff --git a/mysql-test/r/dyncol.result b/mysql-test/r/dyncol.result
index 04ab385bca6..62e3b1c7331 100644
--- a/mysql-test/r/dyncol.result
+++ b/mysql-test/r/dyncol.result
@@ -1805,5 +1805,20 @@ set impressions = column_add(impressions,
);
drop table t1;
#
+# MDEV-8565: COLUMN_CHECK fails on valid data
+#
+SELECT COLUMN_CHECK(COLUMN_CREATE('a',0,'b','1'));
+COLUMN_CHECK(COLUMN_CREATE('a',0,'b','1'))
+1
+SELECT COLUMN_CHECK(COLUMN_CREATE('a',1,'b','1'));
+COLUMN_CHECK(COLUMN_CREATE('a',1,'b','1'))
+1
+SELECT COLUMN_JSON(COLUMN_CREATE('a',0,'b','1'));
+COLUMN_JSON(COLUMN_CREATE('a',0,'b','1'))
+{"a":0,"b":"1"}
+SELECT COLUMN_JSON(COLUMN_CREATE('a',1,'b','1'));
+COLUMN_JSON(COLUMN_CREATE('a',1,'b','1'))
+{"a":1,"b":"1"}
+#
# end of 10.0 tests
#
diff --git a/mysql-test/r/empty_server_name-8224.result b/mysql-test/r/empty_server_name-8224.result
index 6423114470d..4bf592c8932 100644
--- a/mysql-test/r/empty_server_name-8224.result
+++ b/mysql-test/r/empty_server_name-8224.result
@@ -1 +1,2 @@
create server '' foreign data wrapper w2 options (host '127.0.0.1');
+drop server '';
diff --git a/mysql-test/r/events_1.result b/mysql-test/r/events_1.result
index 5a64cf14ef5..475a190d73d 100644
--- a/mysql-test/r/events_1.result
+++ b/mysql-test/r/events_1.result
@@ -114,7 +114,8 @@ create table t_event3 (a int, b float);
drop event if exists event3;
Warnings:
Note 1305 Event event3 does not exist
-create event event3 on schedule every 50 + 10 minute starts date_add("20100101", interval 5 minute) ends date_add("20151010", interval 5 day) comment "portokala_comment" DO insert into t_event3 values (unix_timestamp(), rand());
+create event event3 on schedule every 50 + 10 minute starts date_add("20100101", interval 5 minute) ends date_add("20251010", interval 5 day)
+comment "portokala_comment" DO insert into t_event3 values (unix_timestamp(), rand());
select count(*) from t_event3;
count(*)
0
diff --git a/mysql-test/r/events_restart.result b/mysql-test/r/events_restart.result
index ba3aa503b63..0caac907f64 100644
--- a/mysql-test/r/events_restart.result
+++ b/mysql-test/r/events_restart.result
@@ -18,7 +18,7 @@ change column body body longtext character set utf8 collate utf8_bin;
use events_test;
select @@event_scheduler;
@@event_scheduler
-DISABLED
+OFF
show events;
ERROR HY000: Cannot proceed because system tables used by Event Scheduler were found damaged at server start
select event_name from information_schema.events;
@@ -40,12 +40,12 @@ ERROR HY000: Cannot proceed because system tables used by Event Scheduler were f
drop event intact_check;
ERROR HY000: Cannot proceed because system tables used by Event Scheduler were found damaged at server start
set global event_scheduler=on;
-ERROR HY000: Cannot proceed because system tables used by Event Scheduler were found damaged at server start
+ERROR HY000: Event Scheduler: An error occurred when initializing system tables. Disabling the Event Scheduler.
set global event_scheduler=off;
-ERROR HY000: Cannot proceed because system tables used by Event Scheduler were found damaged at server start
+ERROR HY000: Event Scheduler: An error occurred when initializing system tables. Disabling the Event Scheduler.
show variables like 'event_scheduler';
Variable_name Value
-event_scheduler DISABLED
+event_scheduler OFF
Make sure that we still can create and drop databases,
and no warnings are produced.
drop database if exists mysqltest_database_not_exists;
@@ -58,6 +58,22 @@ Error 1545 Failed to open mysql.event
Restore the original mysql.event table
drop table mysql.event;
rename table event_like to mysql.event;
+check that we can now enable events without restart
+set global event_scheduler=original;
+Warnings:
+Note 1408 Event Scheduler: Loaded 3 events
+select @@global.event_scheduler;
+@@global.event_scheduler
+ON
+set global event_scheduler=on;
+select @@global.event_scheduler;
+@@global.event_scheduler
+ON
+show events;
+Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation
+events_test abc1 root@localhost SYSTEM RECURRING # 1 SECOND # # ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci
+events_test abc2 root@localhost SYSTEM RECURRING # 1 SECOND # # ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci
+events_test abc3 root@localhost SYSTEM RECURRING # 1 SECOND # # ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci
Now let's restart the server again
use events_test;
select @@event_scheduler;
diff --git a/mysql-test/r/explain_non_select.result b/mysql-test/r/explain_non_select.result
index 0eee7ee9b1e..5a6b9f841c2 100644
--- a/mysql-test/r/explain_non_select.result
+++ b/mysql-test/r/explain_non_select.result
@@ -232,3 +232,44 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE user index NULL PRIMARY 420 NULL 4 Using index
DROP TABLE t1;
DROP VIEW v1;
+#
+# MDEV-8299: MyISAM or Aria table gets corrupted after EXPLAIN INSERT and INSERT
+#
+CREATE TABLE t1 (pk INT NOT NULL AUTO_INCREMENT PRIMARY KEY, i INT, KEY(i)) ENGINE=MyISAM;
+INSERT INTO t1 (i) VALUES (100),(200);
+CREATE TABLE t2 (j INT) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (10),(20);
+EXPLAIN INSERT INTO t1 (i) SELECT j FROM t2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 2
+INSERT INTO t1 (i) VALUES (300);
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+DROP TABLE t1, t2;
+#
+# MDEV-8321: Assertion `! is_set()' failed in Diagnostics_area::set_eof_status on EXPLAIN INSERT ... UNION
+#
+CREATE TABLE t1 (a INT);
+CREATE TABLE t2 (b INT);
+CREATE TABLE t3 (c INT);
+INSERT INTO t1 VALUES (1),(2);
+INSERT INTO t2 VALUES (3),(4);
+INSERT INTO t3 VALUES (5),(6);
+EXPLAIN INSERT INTO t1 SELECT * FROM t2 UNION SELECT * FROM t3;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 2
+2 UNION t3 ALL NULL NULL NULL NULL 2
+NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL
+drop table t1,t2,t3;
+#
+# MDEV-6223: Assertion `! is_set()' fails in Diagnostics_area::set_eof_status on EXPLAIN INSERT executed as a PS
+#
+CREATE TABLE t1 (a INT) ENGINE = MyISAM;
+CREATE TABLE t2 (b INT) ENGINE = MyISAM;
+INSERT INTO t2 VALUES (1),(2);
+PREPARE stmt FROM 'EXPLAIN INSERT INTO t1 SELECT * FROM t2';
+EXECUTE stmt;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 2
+drop table t1,t2;
diff --git a/mysql-test/r/func_if.result b/mysql-test/r/func_if.result
index c7f548ae2bc..61f63cc7253 100644
--- a/mysql-test/r/func_if.result
+++ b/mysql-test/r/func_if.result
@@ -234,3 +234,20 @@ SELECT if(1, NULL, (SELECT min('hello')));
if(1, NULL, (SELECT min('hello')))
NULL
End of 5.2 tests
+#
+# MDEV-8663: IF Statement returns multiple values erroneously
+# (or Assertion `!null_value' failed in Item::send(Protocol*, String*)
+#
+CREATE TABLE `t1` (
+`datas` VARCHAR(25) NOT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+Warnings:
+Warning 1286 Unknown storage engine 'InnoDB'
+Warning 1266 Using storage engine MyISAM for table 't1'
+INSERT INTO `t1` VALUES ('1,2'), ('2,3'), ('3,4');
+SELECT IF(FIND_IN_SET('1', `datas`), 1.5, IF(FIND_IN_SET('2', `datas`), 2, NULL)) AS `First`, '1' AS `Second`, '2' AS `Third` FROM `t1`;
+First Second Third
+1.5 1 2
+2.0 1 2
+NULL 1 2
+drop table t1;
diff --git a/mysql-test/r/func_misc.result b/mysql-test/r/func_misc.result
index 496d92223c6..bab360d677d 100644
--- a/mysql-test/r/func_misc.result
+++ b/mysql-test/r/func_misc.result
@@ -374,6 +374,207 @@ NULL
Warnings:
Warning 1411 Incorrect timeout value: '-1' for function get_lock
#
+# MDEV-8624 MariaDB hangs on query with many logical condition
+#
+CREATE TABLE `t1` (
+`id` int(11) NOT NULL AUTO_INCREMENT,
+`submitdate` datetime DEFAULT NULL,
+`lastpage` int(11) DEFAULT NULL,
+`startlanguage` varchar(20) COLLATE utf8_unicode_ci NOT NULL,
+`token` varchar(36) COLLATE utf8_unicode_ci DEFAULT NULL,
+`datestamp` datetime NOT NULL,
+`startdate` datetime NOT NULL,
+`ipaddr` text COLLATE utf8_unicode_ci,
+`refurl` text COLLATE utf8_unicode_ci,
+`57813X540X1723` text COLLATE utf8_unicode_ci,
+`57813X540X1724` text COLLATE utf8_unicode_ci,
+`57813X540X1725` text COLLATE utf8_unicode_ci,
+`57813X540X1726` double DEFAULT NULL,
+`57813X540X1909` double DEFAULT NULL,
+`57813X541X17271` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
+`57813X541X17272` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
+`57813X541X17273` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
+`57813X541X17274` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
+`57813X541X17275` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
+`57813X541X17276` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
+`57813X541X17281` text COLLATE utf8_unicode_ci,
+`57813X541X17282` text COLLATE utf8_unicode_ci,
+`57813X541X17283` text COLLATE utf8_unicode_ci,
+`57813X541X17284` text COLLATE utf8_unicode_ci,
+`57813X541X17285` text COLLATE utf8_unicode_ci,
+`57813X541X17286` text COLLATE utf8_unicode_ci,
+`57813X542X18131` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
+`57813X542X18132` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
+`57813X542X18133` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
+`57813X542X18134` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
+`57813X542X18135` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
+`57813X542X18136` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
+`57813X542X18137` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
+`57813X542X18138` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
+`57813X542X18139` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
+`57813X542X18141` text COLLATE utf8_unicode_ci,
+`57813X542X18142` text COLLATE utf8_unicode_ci,
+`57813X542X18143` text COLLATE utf8_unicode_ci,
+`57813X542X18144` text COLLATE utf8_unicode_ci,
+`57813X542X18145` text COLLATE utf8_unicode_ci,
+`57813X542X18146` text COLLATE utf8_unicode_ci,
+`57813X542X18147` text COLLATE utf8_unicode_ci,
+`57813X542X18148` text COLLATE utf8_unicode_ci,
+`57813X542X18149` text COLLATE utf8_unicode_ci,
+`57813X543X18451` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
+`57813X543X18452` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
+`57813X543X18453` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
+`57813X543X18454` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
+`57813X543X18455` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
+`57813X543X18456` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
+`57813X543X18461` text COLLATE utf8_unicode_ci,
+`57813X543X18462` text COLLATE utf8_unicode_ci,
+`57813X543X18463` text COLLATE utf8_unicode_ci,
+`57813X543X18464` text COLLATE utf8_unicode_ci,
+`57813X543X18465` text COLLATE utf8_unicode_ci,
+`57813X543X18466` text COLLATE utf8_unicode_ci,
+`57813X544X18711` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
+`57813X544X18712` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
+`57813X544X18713` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
+`57813X544X18714` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
+`57813X544X18715` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
+`57813X544X18716` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
+`57813X544X18717` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
+`57813X544X18718` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
+`57813X544X18721` text COLLATE utf8_unicode_ci,
+`57813X544X18722` text COLLATE utf8_unicode_ci,
+`57813X544X18723` text COLLATE utf8_unicode_ci,
+`57813X544X18724` text COLLATE utf8_unicode_ci,
+`57813X544X18725` text COLLATE utf8_unicode_ci,
+`57813X544X18726` text COLLATE utf8_unicode_ci,
+`57813X544X18727` text COLLATE utf8_unicode_ci,
+`57813X544X18728` text COLLATE utf8_unicode_ci,
+`57813X546X1902` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
+`57813X546X1903` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
+`57813X546X1904` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
+`57813X545X1901` varchar(1) COLLATE utf8_unicode_ci DEFAULT NULL,
+PRIMARY KEY (`id`),
+KEY `lime_survey_57813_idx` (`token`),
+KEY `57813X540X1723` (`57813X540X1723`(100)),
+KEY `57813X540X1724` (`57813X540X1724`(100)),
+KEY `57813X540X1726` (`57813X540X1726`),
+KEY `57813X540X1725` (`57813X540X1725`(100)),
+KEY `57813X546X1902` (`57813X546X1902`),
+KEY `57813X546X1903` (`57813X546X1903`),
+KEY `57813X546X1904` (`57813X546X1904`)
+);
+SELECT
+COUNT(*) as `N`,
+ROUND(
+(
+SUM(
+(
+(
+IF( 57813X541X17271 IS NOT NULL AND 57813X541X17271 != '' AND 57813X541X17271 != '99', 57813X541X17271, 0 ) +
+IF( 57813X541X17272 IS NOT NULL AND 57813X541X17272 != '' AND 57813X541X17272 != '99', 57813X541X17272, 0 ) +
+IF( 57813X541X17273 IS NOT NULL AND 57813X541X17273 != '' AND 57813X541X17273 != '99', 57813X541X17273, 0 ) +
+IF( 57813X541X17274 IS NOT NULL AND 57813X541X17274 != '' AND 57813X541X17274 != '99', 57813X541X17274, 0 ) +
+IF( 57813X541X17275 IS NOT NULL AND 57813X541X17275 != '' AND 57813X541X17275 != '99', 57813X541X17275, 0 ) +
+IF( 57813X541X17276 IS NOT NULL AND 57813X541X17276 != '' AND 57813X541X17276 != '99', 57813X541X17276, 0 ) +
+IF( 57813X542X18131 IS NOT NULL AND 57813X542X18131 != '' AND 57813X542X18131 != '99', 57813X542X18131, 0 ) +
+IF( 57813X542X18132 IS NOT NULL AND 57813X542X18132 != '' AND 57813X542X18132 != '99', 57813X542X18132, 0 ) +
+IF( 57813X542X18133 IS NOT NULL AND 57813X542X18133 != '' AND 57813X542X18133 != '99', 57813X542X18133, 0 ) +
+IF( 57813X542X18134 IS NOT NULL AND 57813X542X18134 != '' AND 57813X542X18134 != '99', 57813X542X18134, 0 ) +
+IF( 57813X542X18135 IS NOT NULL AND 57813X542X18135 != '' AND 57813X542X18135 != '99', 57813X542X18135, 0 ) +
+IF( 57813X542X18136 IS NOT NULL AND 57813X542X18136 != '' AND 57813X542X18136 != '99', 57813X542X18136, 0 ) +
+IF( 57813X542X18137 IS NOT NULL AND 57813X542X18137 != '' AND 57813X542X18137 != '99', 57813X542X18137, 0 ) +
+IF( 57813X542X18138 IS NOT NULL AND 57813X542X18138 != '' AND 57813X542X18138 != '99', 57813X542X18138, 0 ) +
+IF( 57813X542X18139 IS NOT NULL AND 57813X542X18139 != '' AND 57813X542X18139 != '99', 57813X542X18139, 0 ) +
+IF( 57813X543X18451 IS NOT NULL AND 57813X543X18451 != '' AND 57813X543X18451 != '99', 57813X543X18451, 0 ) +
+IF( 57813X543X18452 IS NOT NULL AND 57813X543X18452 != '' AND 57813X543X18452 != '99', 57813X543X18452, 0 ) +
+IF( 57813X543X18453 IS NOT NULL AND 57813X543X18453 != '' AND 57813X543X18453 != '99', 57813X543X18453, 0 ) +
+IF( 57813X543X18454 IS NOT NULL AND 57813X543X18454 != '' AND 57813X543X18454 != '99', 57813X543X18454, 0 ) +
+IF( 57813X543X18455 IS NOT NULL AND 57813X543X18455 != '' AND 57813X543X18455 != '99', 57813X543X18455, 0 ) +
+IF( 57813X543X18456 IS NOT NULL AND 57813X543X18456 != '' AND 57813X543X18456 != '99', 57813X543X18456, 0 ) +
+IF( 57813X544X18711 IS NOT NULL AND 57813X544X18711 != '' AND 57813X544X18711 != '99', 57813X544X18711, 0 ) +
+IF( 57813X544X18712 IS NOT NULL AND 57813X544X18712 != '' AND 57813X544X18712 != '99', 57813X544X18712, 0 ) +
+IF( 57813X544X18713 IS NOT NULL AND 57813X544X18713 != '' AND 57813X544X18713 != '99', 57813X544X18713, 0 ) +
+IF( 57813X544X18714 IS NOT NULL AND 57813X544X18714 != '' AND 57813X544X18714 != '99', 57813X544X18714, 0 ) +
+IF( 57813X544X18715 IS NOT NULL AND 57813X544X18715 != '' AND 57813X544X18715 != '99', 57813X544X18715, 0 ) +
+IF( 57813X544X18716 IS NOT NULL AND 57813X544X18716 != '' AND 57813X544X18716 != '99', 57813X544X18716, 0 ) +
+IF( 57813X544X18717 IS NOT NULL AND 57813X544X18717 != '' AND 57813X544X18717 != '99', 57813X544X18717, 0 ) +
+IF( 57813X544X18718 IS NOT NULL AND 57813X544X18718 != '' AND 57813X544X18718 != '99', 57813X544X18718, 0 )
+)
+/
+(
+IF( 57813X541X17271 IS NOT NULL AND 57813X541X17271 != '' AND 57813X541X17271 != '99', 1, 0 ) +
+IF( 57813X541X17272 IS NOT NULL AND 57813X541X17272 != '' AND 57813X541X17272 != '99', 1, 0 ) +
+IF( 57813X541X17273 IS NOT NULL AND 57813X541X17273 != '' AND 57813X541X17273 != '99', 1, 0 ) +
+IF( 57813X541X17274 IS NOT NULL AND 57813X541X17274 != '' AND 57813X541X17274 != '99', 1, 0 ) +
+IF( 57813X541X17275 IS NOT NULL AND 57813X541X17275 != '' AND 57813X541X17275 != '99', 1, 0 ) +
+IF( 57813X541X17276 IS NOT NULL AND 57813X541X17276 != '' AND 57813X541X17276 != '99', 1, 0 ) +
+IF( 57813X542X18131 IS NOT NULL AND 57813X542X18131 != '' AND 57813X542X18131 != '99', 1, 0 ) +
+IF( 57813X542X18132 IS NOT NULL AND 57813X542X18132 != '' AND 57813X542X18132 != '99', 1, 0 ) +
+IF( 57813X542X18133 IS NOT NULL AND 57813X542X18133 != '' AND 57813X542X18133 != '99', 1, 0 ) +
+IF( 57813X542X18134 IS NOT NULL AND 57813X542X18134 != '' AND 57813X542X18134 != '99', 1, 0 ) +
+IF( 57813X542X18135 IS NOT NULL AND 57813X542X18135 != '' AND 57813X542X18135 != '99', 1, 0 ) +
+IF( 57813X542X18136 IS NOT NULL AND 57813X542X18136 != '' AND 57813X542X18136 != '99', 1, 0 ) +
+IF( 57813X542X18137 IS NOT NULL AND 57813X542X18137 != '' AND 57813X542X18137 != '99', 1, 0 ) +
+IF( 57813X542X18138 IS NOT NULL AND 57813X542X18138 != '' AND 57813X542X18138 != '99', 1, 0 ) +
+IF( 57813X542X18139 IS NOT NULL AND 57813X542X18139 != '' AND 57813X542X18139 != '99', 1, 0 ) +
+IF( 57813X543X18451 IS NOT NULL AND 57813X543X18451 != '' AND 57813X543X18451 != '99', 1, 0 ) +
+IF( 57813X543X18452 IS NOT NULL AND 57813X543X18452 != '' AND 57813X543X18452 != '99', 1, 0 ) +
+IF( 57813X543X18453 IS NOT NULL AND 57813X543X18453 != '' AND 57813X543X18453 != '99', 1, 0 ) +
+IF( 57813X543X18454 IS NOT NULL AND 57813X543X18454 != '' AND 57813X543X18454 != '99', 1, 0 ) +
+IF( 57813X543X18455 IS NOT NULL AND 57813X543X18455 != '' AND 57813X543X18455 != '99', 1, 0 ) +
+IF( 57813X543X18456 IS NOT NULL AND 57813X543X18456 != '' AND 57813X543X18456 != '99', 1, 0 ) +
+IF( 57813X544X18711 IS NOT NULL AND 57813X544X18711 != '' AND 57813X544X18711 != '99', 1, 0 ) +
+IF( 57813X544X18712 IS NOT NULL AND 57813X544X18712 != '' AND 57813X544X18712 != '99', 1, 0 ) +
+IF( 57813X544X18713 IS NOT NULL AND 57813X544X18713 != '' AND 57813X544X18713 != '99', 1, 0 ) +
+IF( 57813X544X18714 IS NOT NULL AND 57813X544X18714 != '' AND 57813X544X18714 != '99', 1, 0 ) +
+IF( 57813X544X18715 IS NOT NULL AND 57813X544X18715 != '' AND 57813X544X18715 != '99', 1, 0 ) +
+IF( 57813X544X18716 IS NOT NULL AND 57813X544X18716 != '' AND 57813X544X18716 != '99', 1, 0 ) +
+IF( 57813X544X18717 IS NOT NULL AND 57813X544X18717 != '' AND 57813X544X18717 != '99', 1, 0 ) +
+IF( 57813X544X18718 IS NOT NULL AND 57813X544X18718 != '' AND 57813X544X18718 != '99', 1, 0 )
+)
+)
+)
+/ COUNT(*) ), 4) as `AVG`
+FROM `t1`
+WHERE `submitdate` IS NOT NULL
+AND (
+( 57813X541X17271 IS NOT NULL AND 57813X541X17271 != '' AND 57813X541X17271 != '99' ) OR
+( 57813X541X17272 IS NOT NULL AND 57813X541X17272 != '' AND 57813X541X17272 != '99' ) OR
+( 57813X541X17273 IS NOT NULL AND 57813X541X17273 != '' AND 57813X541X17273 != '99' ) OR
+( 57813X541X17274 IS NOT NULL AND 57813X541X17274 != '' AND 57813X541X17274 != '99' ) OR
+( 57813X541X17275 IS NOT NULL AND 57813X541X17275 != '' AND 57813X541X17275 != '99' ) OR
+( 57813X541X17276 IS NOT NULL AND 57813X541X17276 != '' AND 57813X541X17276 != '99' ) OR
+( 57813X542X18131 IS NOT NULL AND 57813X542X18131 != '' AND 57813X542X18131 != '99' ) OR
+( 57813X542X18132 IS NOT NULL AND 57813X542X18132 != '' AND 57813X542X18132 != '99' ) OR
+( 57813X542X18133 IS NOT NULL AND 57813X542X18133 != '' AND 57813X542X18133 != '99' ) OR
+( 57813X542X18134 IS NOT NULL AND 57813X542X18134 != '' AND 57813X542X18134 != '99' ) OR
+( 57813X542X18135 IS NOT NULL AND 57813X542X18135 != '' AND 57813X542X18135 != '99' ) OR
+( 57813X542X18136 IS NOT NULL AND 57813X542X18136 != '' AND 57813X542X18136 != '99' ) OR
+( 57813X542X18137 IS NOT NULL AND 57813X542X18137 != '' AND 57813X542X18137 != '99' ) OR
+( 57813X542X18138 IS NOT NULL AND 57813X542X18138 != '' AND 57813X542X18138 != '99' ) OR
+( 57813X542X18139 IS NOT NULL AND 57813X542X18139 != '' AND 57813X542X18139 != '99' ) OR
+( 57813X543X18451 IS NOT NULL AND 57813X543X18451 != '' AND 57813X543X18451 != '99' ) OR
+( 57813X543X18452 IS NOT NULL AND 57813X543X18452 != '' AND 57813X543X18452 != '99' ) OR
+( 57813X543X18453 IS NOT NULL AND 57813X543X18453 != '' AND 57813X543X18453 != '99' ) OR
+( 57813X543X18454 IS NOT NULL AND 57813X543X18454 != '' AND 57813X543X18454 != '99' ) OR
+( 57813X543X18455 IS NOT NULL AND 57813X543X18455 != '' AND 57813X543X18455 != '99' ) OR
+( 57813X543X18456 IS NOT NULL AND 57813X543X18456 != '' AND 57813X543X18456 != '99' ) OR
+( 57813X544X18711 IS NOT NULL AND 57813X544X18711 != '' AND 57813X544X18711 != '99' ) OR
+( 57813X544X18712 IS NOT NULL AND 57813X544X18712 != '' AND 57813X544X18712 != '99' ) OR
+( 57813X544X18713 IS NOT NULL AND 57813X544X18713 != '' AND 57813X544X18713 != '99' ) OR
+( 57813X544X18714 IS NOT NULL AND 57813X544X18714 != '' AND 57813X544X18714 != '99' ) OR
+( 57813X544X18715 IS NOT NULL AND 57813X544X18715 != '' AND 57813X544X18715 != '99' ) OR
+( 57813X544X18716 IS NOT NULL AND 57813X544X18716 != '' AND 57813X544X18716 != '99' ) OR
+( 57813X544X18717 IS NOT NULL AND 57813X544X18717 != '' AND 57813X544X18717 != '99' ) OR
+( 57813X544X18718 IS NOT NULL AND 57813X544X18718 != '' AND 57813X544X18718 != '99' ) )
+AND 57813X540X1723 = 'Test';
+N AVG
+0 NULL
+drop table t1;
+#
+# End of 5.5 tests
+#
+#
# GET_LOCK, RELEASE_LOCK, IS_USED_LOCK functions test
#
# IS_USED_LOCK, IS_FREE_LOCK: the lock is not acquired
@@ -594,9 +795,6 @@ select is_free_lock(repeat('a', 193));
ERROR 42000: Identifier name 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' is too long
select release_lock(repeat('a', 193));
ERROR 42000: Identifier name 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' is too long
-#
-# End of 5.5 tests
-#
# --
# -- WL#5787: IPv6-capable INET_ATON and INET_NTOA functions.
diff --git a/mysql-test/r/information_schema2.result b/mysql-test/r/information_schema2.result
index f82301699a7..7e9bdd7088f 100644
--- a/mysql-test/r/information_schema2.result
+++ b/mysql-test/r/information_schema2.result
@@ -6,15 +6,15 @@ select variable_name from information_schema.session_variables where variable_na
(select variable_name from information_schema.session_variables where variable_name = 'basedir');
variable_name
BASEDIR
-create table t1 (a char);
-insert t1 values ('a'),('t'),('z');
-flush status;
-select a, exists (select 1 from information_schema.columns where table_schema=concat('tes',a)) from t1;
-a exists (select 1 from information_schema.columns where table_schema=concat('tes',a))
-a 0
-t 1
-z 0
-show status like 'created_tmp_tables';
-Variable_name Value
-Created_tmp_tables 43
-drop table t1;
+create table t1 (x int);
+create table t2 (x int);
+create table t3 (x int);
+create table t4 AS select table_name from information_schema.TABLES where table_schema = database() and table_type = 'BASE TABLE' ;
+delete from t4 where table_name not in (select table_name from information_schema.TABLES where table_schema = database() and table_type = 'BASE TABLE');
+select * from t4;
+table_name
+t1
+t2
+t3
+t4
+drop table t1, t2, t3, t4;
diff --git a/mysql-test/r/init_file_set_password-7656.result b/mysql-test/r/init_file_set_password-7656.result
new file mode 100644
index 00000000000..e5b3fc75706
--- /dev/null
+++ b/mysql-test/r/init_file_set_password-7656.result
@@ -0,0 +1,8 @@
+create user foo@localhost;
+select user,host,password from mysql.user where user='foo';
+user host password
+foo localhost
+select user,host,password from mysql.user where user='foo';
+user host password
+foo localhost *94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29
+drop user foo@localhost;
diff --git a/mysql-test/r/loadxml.result b/mysql-test/r/loadxml.result
index 7742f456252..1128caf9122 100644
--- a/mysql-test/r/loadxml.result
+++ b/mysql-test/r/loadxml.result
@@ -93,3 +93,30 @@ a b
216 !&bb b;
3 !b3
DROP TABLE t1;
+#
+# Bug#16171518 LOAD XML DOES NOT HANDLE EMPTY ELEMENTS
+#
+CREATE TABLE t1 (col1 VARCHAR(3), col2 VARCHAR(3), col3 VARCHAR(3), col4 VARCHAR(4));
+LOAD XML INFILE '../../std_data/bug16171518_1.dat' INTO TABLE t1;
+SELECT * FROM t1 ORDER BY col1, col2, col3, col4;
+col1 col2 col3 col4
+0bc def ghi jkl
+1no NULL pqr stu
+2BC DEF GHI JKL
+3NO NULL PQR STU
+4bc def ghi jkl
+5no pqr stu vwx
+6BC DEF NULL JKL
+7NO PQR STU VWX
+8bc def ghi NULL
+9kl NULL mno pqr
+ABC DEF NULL JKL
+MNO NULL STU VWX
+DROP TABLE t1;
+CREATE TABLE t1 (col1 VARCHAR(3), col2 VARCHAR(3), col3 INTEGER);
+LOAD XML INFILE '../../std_data/bug16171518_2.dat' INTO TABLE t1;
+SELECT * FROM t1 ORDER BY col1, col2, col3;
+col1 col2 col3
+ABC DEF NULL
+GHI NULL 123
+DROP TABLE t1;
diff --git a/mysql-test/r/lowercase_fs_on.result b/mysql-test/r/lowercase_fs_on.result
new file mode 100644
index 00000000000..a090f46cfbf
--- /dev/null
+++ b/mysql-test/r/lowercase_fs_on.result
@@ -0,0 +1,3 @@
+#
+# Bug#20198490 : LOWER_CASE_TABLE_NAMES=0 ON WINDOWS LEADS TO PROBLEMS
+#
diff --git a/mysql-test/r/lowercase_table3.result b/mysql-test/r/lowercase_table3.result
deleted file mode 100644
index 22e80aaeb26..00000000000
--- a/mysql-test/r/lowercase_table3.result
+++ /dev/null
@@ -1,11 +0,0 @@
-call mtr.add_suppression("Cannot find or open table test/BUG29839 from");
-DROP TABLE IF EXISTS t1,T1;
-CREATE TABLE t1 (a INT);
-SELECT * FROM T1;
-a
-FLUSH TABLES;
-DROP TABLE t1;
-CREATE TABLE bug29839 (a INT) ENGINE=INNODB;
-SELECT * FROM BUG29839;
-ERROR 42S02: Table 'test.BUG29839' doesn't exist
-DROP TABLE bug29839;
diff --git a/mysql-test/r/mdev-504.result b/mysql-test/r/mdev-504.result
index e178127cf2a..4d93e77c6e8 100644
--- a/mysql-test/r/mdev-504.result
+++ b/mysql-test/r/mdev-504.result
@@ -1,3 +1,4 @@
+SET GLOBAL net_write_timeout = 900;
CREATE TABLE A (
pk INTEGER AUTO_INCREMENT PRIMARY KEY,
fdate DATE
@@ -19,3 +20,4 @@ DROP TABLE A;
DROP PROCEDURE p_analyze;
DROP FUNCTION rnd3;
SET GLOBAL use_stat_tables = DEFAULT;
+SET GLOBAL net_write_timeout = DEFAULT;
diff --git a/mysql-test/r/mysql_upgrade-6984.result b/mysql-test/r/mysql_upgrade-6984.result
index 7890b66d494..6aea4806ddb 100644
--- a/mysql-test/r/mysql_upgrade-6984.result
+++ b/mysql-test/r/mysql_upgrade-6984.result
@@ -57,3 +57,4 @@ Phase 6/6: Running 'FLUSH PRIVILEGES'
OK
update mysql.user set password='' where user='root';
flush privileges;
+set global event_scheduler=OFF;
diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result
index 4b0b3faf629..ee2b23428aa 100644
--- a/mysql-test/r/mysqldump.result
+++ b/mysql-test/r/mysqldump.result
@@ -4292,7 +4292,6 @@ Abernathy
aberrant
aberration
drop table words;
-mysqlimport: Error: 1146, Table 'test.words' doesn't exist, when using table: words
drop table t1;
drop table t2;
drop table words2;
@@ -5286,6 +5285,34 @@ drop table t1, t2;
#
# End of 5.1 tests
#
+#
+# Bug #20772273 : MYSQLIMPORT --USE-THREADS DOESN'T USE MULTIPLE THREADS
+#
+CREATE DATABASE db_20772273;
+USE db_20772273;
+CREATE TABLE t1(a INT);
+INSERT INTO t1 VALUES (1), (2);
+CREATE TABLE t2(a INT);
+INSERT INTO t2 VALUES (3), (4);
+SELECT * FROM t1;
+a
+1
+2
+SELECT * FROM t2;
+a
+3
+4
+SELECT * FROM t1;
+a
+1
+2
+SELECT * FROM t2;
+a
+3
+4
+DROP TABLE t1;
+DROP TABLE t2;
+DROP DATABASE db_20772273;
Usage: mysqldump [OPTIONS] database [tables]
OR mysqldump [OPTIONS] --databases [OPTIONS] DB1 [DB2 DB3...]
OR mysqldump [OPTIONS] --all-databases [OPTIONS]
diff --git a/mysql-test/r/partition_alter.result b/mysql-test/r/partition_alter.result
new file mode 100644
index 00000000000..cbd90b5ba7c
--- /dev/null
+++ b/mysql-test/r/partition_alter.result
@@ -0,0 +1,53 @@
+CREATE TABLE `test_data` (
+`hid` bigint(20) unsigned NOT NULL,
+`itid` bigint(20) unsigned NOT NULL,
+`clocktime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+`values` double(16,4) NOT NULL,
+PRIMARY KEY (`hid`,`itid`,`clocktime`)
+) ;
+INSERT INTO `test_data` (`hid`, `itid`, `clocktime`, `values`) VALUES
+(1, 1, '2015-03-10 06:25:16', 0.0000),
+(1, 1, '2015-03-10 06:26:24', 0.0000),
+(1, 1, '2015-03-10 06:27:32', 0.0000),
+(1, 1, '2015-03-10 06:28:40', 0.0000),
+(1, 1, '2015-03-10 06:29:49', 0.0000),
+(1, 1, '2015-03-10 06:30:57', 0.0000),
+(1, 1, '2015-03-10 06:32:05', 0.0000),
+(1, 1, '2015-03-10 06:33:14', 0.0000),
+(1, 1, '2015-03-10 06:34:22', 0.0000),
+(1, 1, '2015-03-10 06:35:30', 0.0000),
+(1, 1, '2015-03-10 06:36:39', 0.0000),
+(1, 1, '2015-03-10 06:37:47', 0.0000),
+(1, 1, '2015-03-10 06:38:55', 0.0000),
+(1, 1, '2015-03-10 06:40:03', 0.0000),
+(1, 1, '2015-03-10 06:41:09', 0.0000),
+(1, 1, '2015-03-10 06:42:21', 0.0000),
+(1, 1, '2015-03-10 06:43:29', 0.0000),
+(1, 1, '2015-03-10 06:44:37', 0.0000),
+(1, 1, '2015-03-10 06:45:46', 0.0000),
+(1, 1, '2015-03-10 06:47:05', 0.0000),
+(1, 1, '2015-03-10 06:48:21', 0.0000),
+(1, 1, '2015-03-10 06:49:41', 0.0000),
+(1, 1, '2015-03-10 06:50:58', 0.0000),
+(1, 1, '2015-03-10 06:52:08', 0.0000),
+(1, 1, '2015-03-10 06:53:17', 0.0000),
+(1, 1, '2015-03-10 06:54:25', 0.0000),
+(563, 1, '2015-03-17 14:28:28', 0.3125),
+(563, 1, '2015-03-17 14:29:39', 0.2775),
+(563, 1, '2015-03-17 14:30:49', 0.2675);
+CREATE PROCEDURE `create_part_max`()
+alter table `test_data`
+ partition by range(unix_timestamp(clocktime)) (
+partition partMAX values less than MAXVALUE
+);
+call create_part_max();
+call create_part_max();
+drop procedure create_part_max;
+prepare stmt from "alter table `test_data`
+ partition by range(unix_timestamp(clocktime)) (
+ partition partMAX values less than MAXVALUE
+ )";
+execute stmt;
+execute stmt;
+deallocate prepare stmt;
+drop table test_data;
diff --git a/mysql-test/r/partition_error.result b/mysql-test/r/partition_error.result
index 847af86913d..f05b145053d 100644
--- a/mysql-test/r/partition_error.result
+++ b/mysql-test/r/partition_error.result
@@ -1099,7 +1099,7 @@ partition by key (a)
subpartition by hash (sin(a+b))
(partition x1 (subpartition x11, subpartition x12),
partition x2 (subpartition x21, subpartition x22));
-ERROR HY000: It is only possible to mix RANGE/LIST partitioning with HASH/KEY partitioning for subpartitioning
+ERROR HY000: This partition function is not allowed
select load_file('$MYSQLD_DATADIR/test/t1.par');
load_file('$MYSQLD_DATADIR/test/t1.par')
NULL
diff --git a/mysql-test/r/partition_innodb.result b/mysql-test/r/partition_innodb.result
index 798e3b9a6bf..f1c3795791a 100644
--- a/mysql-test/r/partition_innodb.result
+++ b/mysql-test/r/partition_innodb.result
@@ -765,3 +765,37 @@ f1 f2 f3 f4 f5 f6
INSERT INTO t3 SELECT * FROM t2 WHERE f3 = 'm' AND f2 ='c';
DROP TABLE t1,t2,t3;
set global default_storage_engine=default;
+#
+# Bug#13737949: CRASH IN HA_PARTITION::INDEX_INIT
+# Bug#18694052: SERVER CRASH IN HA_PARTITION::INIT_RECORD_PRIORITY_QUEUE
+#
+CREATE TABLE t1
+(a INT,
+b INT,
+PRIMARY KEY (a))
+ENGINE = InnoDB
+PARTITION BY HASH (a) PARTITIONS 3;
+START TRANSACTION WITH CONSISTENT SNAPSHOT;
+# con1
+ALTER TABLE t1 ADD INDEX idx1 (b);
+# con default
+SELECT b FROM t1 WHERE b = 0;
+ERROR HY000: Table definition has changed, please retry transaction
+SELECT b FROM t1 WHERE b = 0;
+ERROR HY000: Table definition has changed, please retry transaction
+DROP TABLE t1;
+# Same test without partitioning
+CREATE TABLE t1
+(a INT,
+b INT,
+PRIMARY KEY (a))
+ENGINE = InnoDB;
+START TRANSACTION WITH CONSISTENT SNAPSHOT;
+# con1
+ALTER TABLE t1 ADD INDEX idx1 (b);
+# con default
+SELECT b FROM t1 WHERE b = 0;
+ERROR HY000: Table definition has changed, please retry transaction
+SELECT b FROM t1 WHERE b = 0;
+ERROR HY000: Table definition has changed, please retry transaction
+DROP TABLE t1;
diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result
index 31fcea528aa..8d073f8da1e 100644
--- a/mysql-test/r/ps.result
+++ b/mysql-test/r/ps.result
@@ -4052,3 +4052,24 @@ SELECT 1 FROM t1 GROUP BY 0 OR 18446744073709551615+1;
ERROR 22003: BIGINT UNSIGNED value is out of range in '(18446744073709551615 + 1)'
drop table t1;
# End of 5.3 tests
+#
+# MDEV-8756: MariaDB 10.0.21 crashes during PREPARE
+#
+CREATE TABLE t1 ( id INT(10), value INT(10) );
+CREATE TABLE t2 ( id INT(10) );
+SET @save_sql_mode= @@sql_mode;
+SET SESSION sql_mode = 'ONLY_FULL_GROUP_BY';
+PREPARE stmt FROM 'UPDATE t1 t1 SET value = (SELECT 1 FROM t2 WHERE id = t1.id)';
+execute stmt;
+insert into t1 values (1,10),(2,10),(3,10);
+insert into t2 values (1),(2);
+execute stmt;
+select * from t1;
+id value
+1 1
+2 1
+3 NULL
+deallocate prepare stmt;
+SET SESSION sql_mode = @save_sql_mode;
+DROP TABLE t1,t2;
+# End of 10.0 tests
diff --git a/mysql-test/r/ps_change_master.result b/mysql-test/r/ps_change_master.result
new file mode 100644
index 00000000000..25069a537a5
--- /dev/null
+++ b/mysql-test/r/ps_change_master.result
@@ -0,0 +1,22 @@
+#
+# CHANGE MASTER TO doesn't work with prepared statements
+#
+CHANGE MASTER TO MASTER_HOST='host1', MASTER_USER='user1';
+# Master_Host : host1
+# Master_User : user1
+SET @s := "CHANGE MASTER TO MASTER_HOST='host2'";
+PREPARE stmt FROM @s;
+EXECUTE stmt;
+DEALLOCATE PREPARE stmt;
+# Master_Host : host2
+# Master_User : user1
+SET @s := "CHANGE MASTER TO MASTER_USER='user2'";
+PREPARE stmt FROM @s;
+EXECUTE stmt;
+EXECUTE stmt;
+EXECUTE stmt;
+DEALLOCATE PREPARE stmt;
+# Master_Host : host2
+# Master_User : user2
+CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root';
+# End of test
diff --git a/mysql-test/r/selectivity_no_engine.result b/mysql-test/r/selectivity_no_engine.result
index a14832f9c0a..31037e90a84 100644
--- a/mysql-test/r/selectivity_no_engine.result
+++ b/mysql-test/r/selectivity_no_engine.result
@@ -276,6 +276,23 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
Warnings:
Note 1003 select `test`.`ta`.`a` AS `a`,`test`.`tb`.`a` AS `a` from `test`.`t1` `ta` join `test`.`t2` `tb` where ((`test`.`tb`.`a` = `test`.`ta`.`a`) and (`test`.`ta`.`a` < 40) and (`test`.`ta`.`a` < 100))
drop table t0,t1,t2;
+#
+# MDEV-8779: mysqld got signal 11 in sql/opt_range_mrr.cc:100(step_down_to)
+#
+set @tmp_mdev8779=@@optimizer_use_condition_selectivity;
+set optimizer_use_condition_selectivity=5;
+CREATE TABLE t1 (
+i int(10) unsigned NOT NULL AUTO_INCREMENT,
+n varchar(2048) NOT NULL,
+d tinyint(1) unsigned NOT NULL,
+p int(10) unsigned NOT NULL,
+PRIMARY KEY (i)
+) DEFAULT CHARSET=utf8;
+insert into t1 values (1,'aaa',1,1), (2,'bbb',2,2);
+SELECT * FROM t1 WHERE t1.d = 0 AND t1.p = '1' AND t1.i != '-1' AND t1.n = 'some text';
+i n d p
+set optimizer_use_condition_selectivity= @tmp_mdev8779;
+DROP TABLE t1;
#
# End of the test file
#
diff --git a/mysql-test/r/skip_grants.result b/mysql-test/r/skip_grants.result
index b178e0ecfa7..75792a15afa 100644
--- a/mysql-test/r/skip_grants.result
+++ b/mysql-test/r/skip_grants.result
@@ -59,7 +59,9 @@ DROP FUNCTION f1;
DROP FUNCTION f2;
DROP FUNCTION f3;
set global event_scheduler=1;
-ERROR HY000: The MariaDB server is running with the --event-scheduler=DISABLED or --skip-grant-tables option so it cannot execute this statement
+Warnings:
+Note 1408 Event Scheduler: Loaded 0 events
+set global event_scheduler=0;
select count(*) from information_schema.COLUMN_PRIVILEGES;
count(*)
0
diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result
index 5678a455234..f49a9bc4aa0 100644
--- a/mysql-test/r/subselect.result
+++ b/mysql-test/r/subselect.result
@@ -81,7 +81,7 @@ SELECT 1 FROM (SELECT 1 as a) b WHERE 1 IN (SELECT (SELECT a));
select (SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE(1));
ERROR HY000: Incorrect usage of PROCEDURE and subquery
SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE((SELECT 1));
-ERROR HY000: Incorrect parameters to procedure 'ANALYSE'
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'SELECT 1))' at line 1
SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NULL;
ERROR 42S22: Unknown column 'a' in 'field list'
SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NOT NULL;
@@ -3591,7 +3591,7 @@ delete from t1 where c <= 1140006215 and (select b from t2 where a = 2) = 1;
drop table t1, t2;
CREATE TABLE t1 (a INT);
CREATE VIEW v1 AS SELECT * FROM t1 WHERE no_such_column = ANY (SELECT 1);
-ERROR 42S22: Unknown column 'no_such_column' in 'where clause'
+ERROR 42S22: Unknown column 'no_such_column' in 'IN/ALL/ANY subquery'
CREATE VIEW v2 AS SELECT * FROM t1 WHERE no_such_column = (SELECT 1);
ERROR 42S22: Unknown column 'no_such_column' in 'where clause'
SELECT * FROM t1 WHERE no_such_column = ANY (SELECT 1);
@@ -7019,3 +7019,93 @@ select exists(select 1 from t1 group by `c` in (select `c` from t1));
exists(select 1 from t1 group by `c` in (select `c` from t1))
0
drop table t1;
+#
+# MDEV-7565: Server crash with Signal 6 (part 2)
+#
+Select
+(Select Sum(`TestCase`.Revenue) From mysql.slow_log E
+Where TestCase.TemplateID not in (Select 1 from mysql.slow_log where 2=2)
+) As `ControlRev`
+From
+(Select 3 as Revenue, 4 as TemplateID) As `TestCase`
+Group By TestCase.Revenue, TestCase.TemplateID;
+ControlRev
+NULL
+#
+# MDEV-7445:Server crash with Signal 6
+#
+CREATE PROCEDURE procedure2()
+BEGIN
+Select
+(Select Sum(`TestCase`.Revenue) From mysql.slow_log E
+Where TestCase.TemplateID not in (Select 1 from mysql.slow_log where 2=2)
+) As `ControlRev`
+ From
+(Select 3 as Revenue, 4 as TemplateID) As `TestCase`
+Group By TestCase.Revenue, TestCase.TemplateID;
+END |
+call procedure2();
+ControlRev
+NULL
+call procedure2();
+ControlRev
+NULL
+drop procedure procedure2;
+SELECT
+(SELECT user FROM mysql.user
+WHERE h.host in (SELECT host FROM mysql.user)
+) AS sq
+FROM mysql.host h GROUP BY h.host;
+sq
+#
+# MDEV-7846:Server crashes in Item_subselect::fix
+#_fields or fails with Thread stack overrun
+#
+CREATE TABLE t1 (column1 INT) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (3),(9);
+CREATE TABLE t2 (column2 INT) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (1),(4);
+CREATE TABLE t3 (column3 INT) ENGINE=MyISAM;
+INSERT INTO t3 VALUES (6),(8);
+CREATE TABLE t4 (column4 INT) ENGINE=MyISAM;
+INSERT INTO t4 VALUES (2),(5);
+PREPARE stmt FROM "
+SELECT (
+ SELECT MAX( table1.column1 ) AS field1
+ FROM t1 AS table1
+ WHERE table3.column3 IN ( SELECT table2.column2 AS field2 FROM t2 AS table2 )
+) AS sq
+FROM t3 AS table3, t4 AS table4 GROUP BY sq
+";
+EXECUTE stmt;
+sq
+NULL
+EXECUTE stmt;
+sq
+NULL
+deallocate prepare stmt;
+drop table t1,t2,t3,t4;
+#
+# MDEV-7930: Assertion `table_share->tmp_table != NO_TMP_TABLE ||
+# m_lock_type != 2' failed in handler::ha_index_read_map
+#
+CREATE TABLE t1 (f1 INT);
+INSERT INTO t1 VALUES (1),(2);
+CREATE TABLE t2 (f2 INT, KEY(f2));
+INSERT INTO t2 VALUES (3);
+CREATE ALGORITHM=MERGE VIEW v2 AS SELECT * FROM t2;
+SELECT ( SELECT MIN(v2.f2) FROM t1 ) AS sq FROM v2 GROUP BY sq;
+sq
+3
+SELECT * FROM v2 where ( SELECT MIN(v2.f2) FROM t1 ) > 0;
+f2
+3
+SELECT count(*) FROM v2 group by ( SELECT MIN(v2.f2) FROM t1 );
+count(*)
+1
+delete from t1;
+SELECT ( SELECT MIN(v2.f2) FROM t1 ) AS sq FROM v2 GROUP BY sq;
+sq
+NULL
+drop view v2;
+drop table t1,t2;
diff --git a/mysql-test/r/subselect_no_exists_to_in.result b/mysql-test/r/subselect_no_exists_to_in.result
index 5434bb920e3..f6434c8fe4c 100644
--- a/mysql-test/r/subselect_no_exists_to_in.result
+++ b/mysql-test/r/subselect_no_exists_to_in.result
@@ -85,7 +85,7 @@ SELECT 1 FROM (SELECT 1 as a) b WHERE 1 IN (SELECT (SELECT a));
select (SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE(1));
ERROR HY000: Incorrect usage of PROCEDURE and subquery
SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE((SELECT 1));
-ERROR HY000: Incorrect parameters to procedure 'ANALYSE'
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'SELECT 1))' at line 1
SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NULL;
ERROR 42S22: Unknown column 'a' in 'field list'
SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NOT NULL;
@@ -3594,7 +3594,7 @@ delete from t1 where c <= 1140006215 and (select b from t2 where a = 2) = 1;
drop table t1, t2;
CREATE TABLE t1 (a INT);
CREATE VIEW v1 AS SELECT * FROM t1 WHERE no_such_column = ANY (SELECT 1);
-ERROR 42S22: Unknown column 'no_such_column' in 'where clause'
+ERROR 42S22: Unknown column 'no_such_column' in 'IN/ALL/ANY subquery'
CREATE VIEW v2 AS SELECT * FROM t1 WHERE no_such_column = (SELECT 1);
ERROR 42S22: Unknown column 'no_such_column' in 'where clause'
SELECT * FROM t1 WHERE no_such_column = ANY (SELECT 1);
@@ -7019,6 +7019,96 @@ select exists(select 1 from t1 group by `c` in (select `c` from t1));
exists(select 1 from t1 group by `c` in (select `c` from t1))
0
drop table t1;
+#
+# MDEV-7565: Server crash with Signal 6 (part 2)
+#
+Select
+(Select Sum(`TestCase`.Revenue) From mysql.slow_log E
+Where TestCase.TemplateID not in (Select 1 from mysql.slow_log where 2=2)
+) As `ControlRev`
+From
+(Select 3 as Revenue, 4 as TemplateID) As `TestCase`
+Group By TestCase.Revenue, TestCase.TemplateID;
+ControlRev
+NULL
+#
+# MDEV-7445:Server crash with Signal 6
+#
+CREATE PROCEDURE procedure2()
+BEGIN
+Select
+(Select Sum(`TestCase`.Revenue) From mysql.slow_log E
+Where TestCase.TemplateID not in (Select 1 from mysql.slow_log where 2=2)
+) As `ControlRev`
+ From
+(Select 3 as Revenue, 4 as TemplateID) As `TestCase`
+Group By TestCase.Revenue, TestCase.TemplateID;
+END |
+call procedure2();
+ControlRev
+NULL
+call procedure2();
+ControlRev
+NULL
+drop procedure procedure2;
+SELECT
+(SELECT user FROM mysql.user
+WHERE h.host in (SELECT host FROM mysql.user)
+) AS sq
+FROM mysql.host h GROUP BY h.host;
+sq
+#
+# MDEV-7846:Server crashes in Item_subselect::fix
+#_fields or fails with Thread stack overrun
+#
+CREATE TABLE t1 (column1 INT) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (3),(9);
+CREATE TABLE t2 (column2 INT) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (1),(4);
+CREATE TABLE t3 (column3 INT) ENGINE=MyISAM;
+INSERT INTO t3 VALUES (6),(8);
+CREATE TABLE t4 (column4 INT) ENGINE=MyISAM;
+INSERT INTO t4 VALUES (2),(5);
+PREPARE stmt FROM "
+SELECT (
+ SELECT MAX( table1.column1 ) AS field1
+ FROM t1 AS table1
+ WHERE table3.column3 IN ( SELECT table2.column2 AS field2 FROM t2 AS table2 )
+) AS sq
+FROM t3 AS table3, t4 AS table4 GROUP BY sq
+";
+EXECUTE stmt;
+sq
+NULL
+EXECUTE stmt;
+sq
+NULL
+deallocate prepare stmt;
+drop table t1,t2,t3,t4;
+#
+# MDEV-7930: Assertion `table_share->tmp_table != NO_TMP_TABLE ||
+# m_lock_type != 2' failed in handler::ha_index_read_map
+#
+CREATE TABLE t1 (f1 INT);
+INSERT INTO t1 VALUES (1),(2);
+CREATE TABLE t2 (f2 INT, KEY(f2));
+INSERT INTO t2 VALUES (3);
+CREATE ALGORITHM=MERGE VIEW v2 AS SELECT * FROM t2;
+SELECT ( SELECT MIN(v2.f2) FROM t1 ) AS sq FROM v2 GROUP BY sq;
+sq
+3
+SELECT * FROM v2 where ( SELECT MIN(v2.f2) FROM t1 ) > 0;
+f2
+3
+SELECT count(*) FROM v2 group by ( SELECT MIN(v2.f2) FROM t1 );
+count(*)
+1
+delete from t1;
+SELECT ( SELECT MIN(v2.f2) FROM t1 ) AS sq FROM v2 GROUP BY sq;
+sq
+NULL
+drop view v2;
+drop table t1,t2;
set optimizer_switch=default;
select @@optimizer_switch like '%exists_to_in=off%';
@@optimizer_switch like '%exists_to_in=off%'
diff --git a/mysql-test/r/subselect_no_mat.result b/mysql-test/r/subselect_no_mat.result
index 3325889e1e0..49ad0ed4037 100644
--- a/mysql-test/r/subselect_no_mat.result
+++ b/mysql-test/r/subselect_no_mat.result
@@ -88,7 +88,7 @@ SELECT 1 FROM (SELECT 1 as a) b WHERE 1 IN (SELECT (SELECT a));
select (SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE(1));
ERROR HY000: Incorrect usage of PROCEDURE and subquery
SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE((SELECT 1));
-ERROR HY000: Incorrect parameters to procedure 'ANALYSE'
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'SELECT 1))' at line 1
SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NULL;
ERROR 42S22: Unknown column 'a' in 'field list'
SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NOT NULL;
@@ -3594,7 +3594,7 @@ delete from t1 where c <= 1140006215 and (select b from t2 where a = 2) = 1;
drop table t1, t2;
CREATE TABLE t1 (a INT);
CREATE VIEW v1 AS SELECT * FROM t1 WHERE no_such_column = ANY (SELECT 1);
-ERROR 42S22: Unknown column 'no_such_column' in 'where clause'
+ERROR 42S22: Unknown column 'no_such_column' in 'IN/ALL/ANY subquery'
CREATE VIEW v2 AS SELECT * FROM t1 WHERE no_such_column = (SELECT 1);
ERROR 42S22: Unknown column 'no_such_column' in 'where clause'
SELECT * FROM t1 WHERE no_such_column = ANY (SELECT 1);
@@ -7012,6 +7012,96 @@ select exists(select 1 from t1 group by `c` in (select `c` from t1));
exists(select 1 from t1 group by `c` in (select `c` from t1))
0
drop table t1;
+#
+# MDEV-7565: Server crash with Signal 6 (part 2)
+#
+Select
+(Select Sum(`TestCase`.Revenue) From mysql.slow_log E
+Where TestCase.TemplateID not in (Select 1 from mysql.slow_log where 2=2)
+) As `ControlRev`
+From
+(Select 3 as Revenue, 4 as TemplateID) As `TestCase`
+Group By TestCase.Revenue, TestCase.TemplateID;
+ControlRev
+NULL
+#
+# MDEV-7445:Server crash with Signal 6
+#
+CREATE PROCEDURE procedure2()
+BEGIN
+Select
+(Select Sum(`TestCase`.Revenue) From mysql.slow_log E
+Where TestCase.TemplateID not in (Select 1 from mysql.slow_log where 2=2)
+) As `ControlRev`
+ From
+(Select 3 as Revenue, 4 as TemplateID) As `TestCase`
+Group By TestCase.Revenue, TestCase.TemplateID;
+END |
+call procedure2();
+ControlRev
+NULL
+call procedure2();
+ControlRev
+NULL
+drop procedure procedure2;
+SELECT
+(SELECT user FROM mysql.user
+WHERE h.host in (SELECT host FROM mysql.user)
+) AS sq
+FROM mysql.host h GROUP BY h.host;
+sq
+#
+# MDEV-7846:Server crashes in Item_subselect::fix
+#_fields or fails with Thread stack overrun
+#
+CREATE TABLE t1 (column1 INT) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (3),(9);
+CREATE TABLE t2 (column2 INT) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (1),(4);
+CREATE TABLE t3 (column3 INT) ENGINE=MyISAM;
+INSERT INTO t3 VALUES (6),(8);
+CREATE TABLE t4 (column4 INT) ENGINE=MyISAM;
+INSERT INTO t4 VALUES (2),(5);
+PREPARE stmt FROM "
+SELECT (
+ SELECT MAX( table1.column1 ) AS field1
+ FROM t1 AS table1
+ WHERE table3.column3 IN ( SELECT table2.column2 AS field2 FROM t2 AS table2 )
+) AS sq
+FROM t3 AS table3, t4 AS table4 GROUP BY sq
+";
+EXECUTE stmt;
+sq
+NULL
+EXECUTE stmt;
+sq
+NULL
+deallocate prepare stmt;
+drop table t1,t2,t3,t4;
+#
+# MDEV-7930: Assertion `table_share->tmp_table != NO_TMP_TABLE ||
+# m_lock_type != 2' failed in handler::ha_index_read_map
+#
+CREATE TABLE t1 (f1 INT);
+INSERT INTO t1 VALUES (1),(2);
+CREATE TABLE t2 (f2 INT, KEY(f2));
+INSERT INTO t2 VALUES (3);
+CREATE ALGORITHM=MERGE VIEW v2 AS SELECT * FROM t2;
+SELECT ( SELECT MIN(v2.f2) FROM t1 ) AS sq FROM v2 GROUP BY sq;
+sq
+3
+SELECT * FROM v2 where ( SELECT MIN(v2.f2) FROM t1 ) > 0;
+f2
+3
+SELECT count(*) FROM v2 group by ( SELECT MIN(v2.f2) FROM t1 );
+count(*)
+1
+delete from t1;
+SELECT ( SELECT MIN(v2.f2) FROM t1 ) AS sq FROM v2 GROUP BY sq;
+sq
+NULL
+drop view v2;
+drop table t1,t2;
set optimizer_switch=default;
select @@optimizer_switch like '%materialization=on%';
@@optimizer_switch like '%materialization=on%'
diff --git a/mysql-test/r/subselect_no_opts.result b/mysql-test/r/subselect_no_opts.result
index 01af3ea4b16..2122747d262 100644
--- a/mysql-test/r/subselect_no_opts.result
+++ b/mysql-test/r/subselect_no_opts.result
@@ -84,7 +84,7 @@ SELECT 1 FROM (SELECT 1 as a) b WHERE 1 IN (SELECT (SELECT a));
select (SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE(1));
ERROR HY000: Incorrect usage of PROCEDURE and subquery
SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE((SELECT 1));
-ERROR HY000: Incorrect parameters to procedure 'ANALYSE'
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'SELECT 1))' at line 1
SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NULL;
ERROR 42S22: Unknown column 'a' in 'field list'
SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NOT NULL;
@@ -3590,7 +3590,7 @@ delete from t1 where c <= 1140006215 and (select b from t2 where a = 2) = 1;
drop table t1, t2;
CREATE TABLE t1 (a INT);
CREATE VIEW v1 AS SELECT * FROM t1 WHERE no_such_column = ANY (SELECT 1);
-ERROR 42S22: Unknown column 'no_such_column' in 'where clause'
+ERROR 42S22: Unknown column 'no_such_column' in 'IN/ALL/ANY subquery'
CREATE VIEW v2 AS SELECT * FROM t1 WHERE no_such_column = (SELECT 1);
ERROR 42S22: Unknown column 'no_such_column' in 'where clause'
SELECT * FROM t1 WHERE no_such_column = ANY (SELECT 1);
@@ -7010,4 +7010,94 @@ select exists(select 1 from t1 group by `c` in (select `c` from t1));
exists(select 1 from t1 group by `c` in (select `c` from t1))
0
drop table t1;
+#
+# MDEV-7565: Server crash with Signal 6 (part 2)
+#
+Select
+(Select Sum(`TestCase`.Revenue) From mysql.slow_log E
+Where TestCase.TemplateID not in (Select 1 from mysql.slow_log where 2=2)
+) As `ControlRev`
+From
+(Select 3 as Revenue, 4 as TemplateID) As `TestCase`
+Group By TestCase.Revenue, TestCase.TemplateID;
+ControlRev
+NULL
+#
+# MDEV-7445:Server crash with Signal 6
+#
+CREATE PROCEDURE procedure2()
+BEGIN
+Select
+(Select Sum(`TestCase`.Revenue) From mysql.slow_log E
+Where TestCase.TemplateID not in (Select 1 from mysql.slow_log where 2=2)
+) As `ControlRev`
+ From
+(Select 3 as Revenue, 4 as TemplateID) As `TestCase`
+Group By TestCase.Revenue, TestCase.TemplateID;
+END |
+call procedure2();
+ControlRev
+NULL
+call procedure2();
+ControlRev
+NULL
+drop procedure procedure2;
+SELECT
+(SELECT user FROM mysql.user
+WHERE h.host in (SELECT host FROM mysql.user)
+) AS sq
+FROM mysql.host h GROUP BY h.host;
+sq
+#
+# MDEV-7846:Server crashes in Item_subselect::fix
+#_fields or fails with Thread stack overrun
+#
+CREATE TABLE t1 (column1 INT) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (3),(9);
+CREATE TABLE t2 (column2 INT) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (1),(4);
+CREATE TABLE t3 (column3 INT) ENGINE=MyISAM;
+INSERT INTO t3 VALUES (6),(8);
+CREATE TABLE t4 (column4 INT) ENGINE=MyISAM;
+INSERT INTO t4 VALUES (2),(5);
+PREPARE stmt FROM "
+SELECT (
+ SELECT MAX( table1.column1 ) AS field1
+ FROM t1 AS table1
+ WHERE table3.column3 IN ( SELECT table2.column2 AS field2 FROM t2 AS table2 )
+) AS sq
+FROM t3 AS table3, t4 AS table4 GROUP BY sq
+";
+EXECUTE stmt;
+sq
+NULL
+EXECUTE stmt;
+sq
+NULL
+deallocate prepare stmt;
+drop table t1,t2,t3,t4;
+#
+# MDEV-7930: Assertion `table_share->tmp_table != NO_TMP_TABLE ||
+# m_lock_type != 2' failed in handler::ha_index_read_map
+#
+CREATE TABLE t1 (f1 INT);
+INSERT INTO t1 VALUES (1),(2);
+CREATE TABLE t2 (f2 INT, KEY(f2));
+INSERT INTO t2 VALUES (3);
+CREATE ALGORITHM=MERGE VIEW v2 AS SELECT * FROM t2;
+SELECT ( SELECT MIN(v2.f2) FROM t1 ) AS sq FROM v2 GROUP BY sq;
+sq
+3
+SELECT * FROM v2 where ( SELECT MIN(v2.f2) FROM t1 ) > 0;
+f2
+3
+SELECT count(*) FROM v2 group by ( SELECT MIN(v2.f2) FROM t1 );
+count(*)
+1
+delete from t1;
+SELECT ( SELECT MIN(v2.f2) FROM t1 ) AS sq FROM v2 GROUP BY sq;
+sq
+NULL
+drop view v2;
+drop table t1,t2;
set @optimizer_switch_for_subselect_test=null;
diff --git a/mysql-test/r/subselect_no_scache.result b/mysql-test/r/subselect_no_scache.result
index 16ebf7a4199..a1c468ba334 100644
--- a/mysql-test/r/subselect_no_scache.result
+++ b/mysql-test/r/subselect_no_scache.result
@@ -87,7 +87,7 @@ SELECT 1 FROM (SELECT 1 as a) b WHERE 1 IN (SELECT (SELECT a));
select (SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE(1));
ERROR HY000: Incorrect usage of PROCEDURE and subquery
SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE((SELECT 1));
-ERROR HY000: Incorrect parameters to procedure 'ANALYSE'
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'SELECT 1))' at line 1
SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NULL;
ERROR 42S22: Unknown column 'a' in 'field list'
SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NOT NULL;
@@ -3597,7 +3597,7 @@ delete from t1 where c <= 1140006215 and (select b from t2 where a = 2) = 1;
drop table t1, t2;
CREATE TABLE t1 (a INT);
CREATE VIEW v1 AS SELECT * FROM t1 WHERE no_such_column = ANY (SELECT 1);
-ERROR 42S22: Unknown column 'no_such_column' in 'where clause'
+ERROR 42S22: Unknown column 'no_such_column' in 'IN/ALL/ANY subquery'
CREATE VIEW v2 AS SELECT * FROM t1 WHERE no_such_column = (SELECT 1);
ERROR 42S22: Unknown column 'no_such_column' in 'where clause'
SELECT * FROM t1 WHERE no_such_column = ANY (SELECT 1);
@@ -7025,6 +7025,96 @@ select exists(select 1 from t1 group by `c` in (select `c` from t1));
exists(select 1 from t1 group by `c` in (select `c` from t1))
0
drop table t1;
+#
+# MDEV-7565: Server crash with Signal 6 (part 2)
+#
+Select
+(Select Sum(`TestCase`.Revenue) From mysql.slow_log E
+Where TestCase.TemplateID not in (Select 1 from mysql.slow_log where 2=2)
+) As `ControlRev`
+From
+(Select 3 as Revenue, 4 as TemplateID) As `TestCase`
+Group By TestCase.Revenue, TestCase.TemplateID;
+ControlRev
+NULL
+#
+# MDEV-7445:Server crash with Signal 6
+#
+CREATE PROCEDURE procedure2()
+BEGIN
+Select
+(Select Sum(`TestCase`.Revenue) From mysql.slow_log E
+Where TestCase.TemplateID not in (Select 1 from mysql.slow_log where 2=2)
+) As `ControlRev`
+ From
+(Select 3 as Revenue, 4 as TemplateID) As `TestCase`
+Group By TestCase.Revenue, TestCase.TemplateID;
+END |
+call procedure2();
+ControlRev
+NULL
+call procedure2();
+ControlRev
+NULL
+drop procedure procedure2;
+SELECT
+(SELECT user FROM mysql.user
+WHERE h.host in (SELECT host FROM mysql.user)
+) AS sq
+FROM mysql.host h GROUP BY h.host;
+sq
+#
+# MDEV-7846:Server crashes in Item_subselect::fix
+#_fields or fails with Thread stack overrun
+#
+CREATE TABLE t1 (column1 INT) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (3),(9);
+CREATE TABLE t2 (column2 INT) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (1),(4);
+CREATE TABLE t3 (column3 INT) ENGINE=MyISAM;
+INSERT INTO t3 VALUES (6),(8);
+CREATE TABLE t4 (column4 INT) ENGINE=MyISAM;
+INSERT INTO t4 VALUES (2),(5);
+PREPARE stmt FROM "
+SELECT (
+ SELECT MAX( table1.column1 ) AS field1
+ FROM t1 AS table1
+ WHERE table3.column3 IN ( SELECT table2.column2 AS field2 FROM t2 AS table2 )
+) AS sq
+FROM t3 AS table3, t4 AS table4 GROUP BY sq
+";
+EXECUTE stmt;
+sq
+NULL
+EXECUTE stmt;
+sq
+NULL
+deallocate prepare stmt;
+drop table t1,t2,t3,t4;
+#
+# MDEV-7930: Assertion `table_share->tmp_table != NO_TMP_TABLE ||
+# m_lock_type != 2' failed in handler::ha_index_read_map
+#
+CREATE TABLE t1 (f1 INT);
+INSERT INTO t1 VALUES (1),(2);
+CREATE TABLE t2 (f2 INT, KEY(f2));
+INSERT INTO t2 VALUES (3);
+CREATE ALGORITHM=MERGE VIEW v2 AS SELECT * FROM t2;
+SELECT ( SELECT MIN(v2.f2) FROM t1 ) AS sq FROM v2 GROUP BY sq;
+sq
+3
+SELECT * FROM v2 where ( SELECT MIN(v2.f2) FROM t1 ) > 0;
+f2
+3
+SELECT count(*) FROM v2 group by ( SELECT MIN(v2.f2) FROM t1 );
+count(*)
+1
+delete from t1;
+SELECT ( SELECT MIN(v2.f2) FROM t1 ) AS sq FROM v2 GROUP BY sq;
+sq
+NULL
+drop view v2;
+drop table t1,t2;
set optimizer_switch=default;
select @@optimizer_switch like '%subquery_cache=on%';
@@optimizer_switch like '%subquery_cache=on%'
diff --git a/mysql-test/r/subselect_no_semijoin.result b/mysql-test/r/subselect_no_semijoin.result
index d98f7ad67de..168908aa356 100644
--- a/mysql-test/r/subselect_no_semijoin.result
+++ b/mysql-test/r/subselect_no_semijoin.result
@@ -84,7 +84,7 @@ SELECT 1 FROM (SELECT 1 as a) b WHERE 1 IN (SELECT (SELECT a));
select (SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE(1));
ERROR HY000: Incorrect usage of PROCEDURE and subquery
SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE((SELECT 1));
-ERROR HY000: Incorrect parameters to procedure 'ANALYSE'
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'SELECT 1))' at line 1
SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NULL;
ERROR 42S22: Unknown column 'a' in 'field list'
SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NOT NULL;
@@ -3590,7 +3590,7 @@ delete from t1 where c <= 1140006215 and (select b from t2 where a = 2) = 1;
drop table t1, t2;
CREATE TABLE t1 (a INT);
CREATE VIEW v1 AS SELECT * FROM t1 WHERE no_such_column = ANY (SELECT 1);
-ERROR 42S22: Unknown column 'no_such_column' in 'where clause'
+ERROR 42S22: Unknown column 'no_such_column' in 'IN/ALL/ANY subquery'
CREATE VIEW v2 AS SELECT * FROM t1 WHERE no_such_column = (SELECT 1);
ERROR 42S22: Unknown column 'no_such_column' in 'where clause'
SELECT * FROM t1 WHERE no_such_column = ANY (SELECT 1);
@@ -7010,5 +7010,95 @@ select exists(select 1 from t1 group by `c` in (select `c` from t1));
exists(select 1 from t1 group by `c` in (select `c` from t1))
0
drop table t1;
+#
+# MDEV-7565: Server crash with Signal 6 (part 2)
+#
+Select
+(Select Sum(`TestCase`.Revenue) From mysql.slow_log E
+Where TestCase.TemplateID not in (Select 1 from mysql.slow_log where 2=2)
+) As `ControlRev`
+From
+(Select 3 as Revenue, 4 as TemplateID) As `TestCase`
+Group By TestCase.Revenue, TestCase.TemplateID;
+ControlRev
+NULL
+#
+# MDEV-7445:Server crash with Signal 6
+#
+CREATE PROCEDURE procedure2()
+BEGIN
+Select
+(Select Sum(`TestCase`.Revenue) From mysql.slow_log E
+Where TestCase.TemplateID not in (Select 1 from mysql.slow_log where 2=2)
+) As `ControlRev`
+ From
+(Select 3 as Revenue, 4 as TemplateID) As `TestCase`
+Group By TestCase.Revenue, TestCase.TemplateID;
+END |
+call procedure2();
+ControlRev
+NULL
+call procedure2();
+ControlRev
+NULL
+drop procedure procedure2;
+SELECT
+(SELECT user FROM mysql.user
+WHERE h.host in (SELECT host FROM mysql.user)
+) AS sq
+FROM mysql.host h GROUP BY h.host;
+sq
+#
+# MDEV-7846:Server crashes in Item_subselect::fix
+#_fields or fails with Thread stack overrun
+#
+CREATE TABLE t1 (column1 INT) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (3),(9);
+CREATE TABLE t2 (column2 INT) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (1),(4);
+CREATE TABLE t3 (column3 INT) ENGINE=MyISAM;
+INSERT INTO t3 VALUES (6),(8);
+CREATE TABLE t4 (column4 INT) ENGINE=MyISAM;
+INSERT INTO t4 VALUES (2),(5);
+PREPARE stmt FROM "
+SELECT (
+ SELECT MAX( table1.column1 ) AS field1
+ FROM t1 AS table1
+ WHERE table3.column3 IN ( SELECT table2.column2 AS field2 FROM t2 AS table2 )
+) AS sq
+FROM t3 AS table3, t4 AS table4 GROUP BY sq
+";
+EXECUTE stmt;
+sq
+NULL
+EXECUTE stmt;
+sq
+NULL
+deallocate prepare stmt;
+drop table t1,t2,t3,t4;
+#
+# MDEV-7930: Assertion `table_share->tmp_table != NO_TMP_TABLE ||
+# m_lock_type != 2' failed in handler::ha_index_read_map
+#
+CREATE TABLE t1 (f1 INT);
+INSERT INTO t1 VALUES (1),(2);
+CREATE TABLE t2 (f2 INT, KEY(f2));
+INSERT INTO t2 VALUES (3);
+CREATE ALGORITHM=MERGE VIEW v2 AS SELECT * FROM t2;
+SELECT ( SELECT MIN(v2.f2) FROM t1 ) AS sq FROM v2 GROUP BY sq;
+sq
+3
+SELECT * FROM v2 where ( SELECT MIN(v2.f2) FROM t1 ) > 0;
+f2
+3
+SELECT count(*) FROM v2 group by ( SELECT MIN(v2.f2) FROM t1 );
+count(*)
+1
+delete from t1;
+SELECT ( SELECT MIN(v2.f2) FROM t1 ) AS sq FROM v2 GROUP BY sq;
+sq
+NULL
+drop view v2;
+drop table t1,t2;
set @optimizer_switch_for_subselect_test=null;
set @join_cache_level_for_subselect_test=NULL;
diff --git a/mysql-test/r/subselect_sj2.result b/mysql-test/r/subselect_sj2.result
index 9a5da710a4c..e6259a3979b 100644
--- a/mysql-test/r/subselect_sj2.result
+++ b/mysql-test/r/subselect_sj2.result
@@ -1262,5 +1262,38 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY T2_0_ ref FK_T2_T1Id FK_T2_T1Id 8 test.T2_1_.t1idref 1 Using index; End temporary
drop table t3,t2,t1;
set optimizer_search_depth=@tmp7474;
+#
+#
+#
+CREATE TABLE t1 (
+id int(16) NOT NULL AUTO_INCREMENT,
+PRIMARY KEY (id)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+CREATE TABLE t2 (
+id int(16) NOT NULL AUTO_INCREMENT,
+t3_id int(16) NOT NULL DEFAULT '0',
+t1_id int(16) NOT NULL DEFAULT '0',
+PRIMARY KEY (id),
+KEY t3_idx (t3_id),
+KEY t1_idx (t1_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+CREATE TABLE t3 (
+id int(16) NOT NULL AUTO_INCREMENT,
+PRIMARY KEY (id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+INSERT INTO t3 VALUES (1);
+INSERT INTO t2 VALUES (1, 1, 1);
+INSERT INTO t2 VALUES (2, 1, 2);
+INSERT INTO t2 VALUES (3, 1, 2);
+INSERT INTO t2 VALUES (4, 1, 1);
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+SELECT * FROM t1 WHERE t1.id IN (
+SELECT t2.t1_id FROM t3 JOIN t2 ON t3.id = t2.t3_id WHERE t3.id = 1
+);
+id
+1
+2
+drop table t1,t2,t3;
# This must be the last in the file:
set optimizer_switch=@subselect_sj2_tmp;
diff --git a/mysql-test/r/subselect_sj2_jcl6.result b/mysql-test/r/subselect_sj2_jcl6.result
index c10b550d11a..64f7ab2e6bf 100644
--- a/mysql-test/r/subselect_sj2_jcl6.result
+++ b/mysql-test/r/subselect_sj2_jcl6.result
@@ -1277,6 +1277,39 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY T2_0_ ref FK_T2_T1Id FK_T2_T1Id 8 test.T2_1_.t1idref 1 Using index; End temporary
drop table t3,t2,t1;
set optimizer_search_depth=@tmp7474;
+#
+#
+#
+CREATE TABLE t1 (
+id int(16) NOT NULL AUTO_INCREMENT,
+PRIMARY KEY (id)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+CREATE TABLE t2 (
+id int(16) NOT NULL AUTO_INCREMENT,
+t3_id int(16) NOT NULL DEFAULT '0',
+t1_id int(16) NOT NULL DEFAULT '0',
+PRIMARY KEY (id),
+KEY t3_idx (t3_id),
+KEY t1_idx (t1_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+CREATE TABLE t3 (
+id int(16) NOT NULL AUTO_INCREMENT,
+PRIMARY KEY (id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+INSERT INTO t3 VALUES (1);
+INSERT INTO t2 VALUES (1, 1, 1);
+INSERT INTO t2 VALUES (2, 1, 2);
+INSERT INTO t2 VALUES (3, 1, 2);
+INSERT INTO t2 VALUES (4, 1, 1);
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+SELECT * FROM t1 WHERE t1.id IN (
+SELECT t2.t1_id FROM t3 JOIN t2 ON t3.id = t2.t3_id WHERE t3.id = 1
+);
+id
+1
+2
+drop table t1,t2,t3;
# This must be the last in the file:
set optimizer_switch=@subselect_sj2_tmp;
#
diff --git a/mysql-test/r/subselect_sj2_mat.result b/mysql-test/r/subselect_sj2_mat.result
index 4e75aee24a2..08a97175487 100644
--- a/mysql-test/r/subselect_sj2_mat.result
+++ b/mysql-test/r/subselect_sj2_mat.result
@@ -1264,6 +1264,39 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY T2_0_ ref FK_T2_T1Id FK_T2_T1Id 8 test.T2_1_.t1idref 1 Using index; End temporary
drop table t3,t2,t1;
set optimizer_search_depth=@tmp7474;
+#
+#
+#
+CREATE TABLE t1 (
+id int(16) NOT NULL AUTO_INCREMENT,
+PRIMARY KEY (id)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+CREATE TABLE t2 (
+id int(16) NOT NULL AUTO_INCREMENT,
+t3_id int(16) NOT NULL DEFAULT '0',
+t1_id int(16) NOT NULL DEFAULT '0',
+PRIMARY KEY (id),
+KEY t3_idx (t3_id),
+KEY t1_idx (t1_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+CREATE TABLE t3 (
+id int(16) NOT NULL AUTO_INCREMENT,
+PRIMARY KEY (id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+INSERT INTO t3 VALUES (1);
+INSERT INTO t2 VALUES (1, 1, 1);
+INSERT INTO t2 VALUES (2, 1, 2);
+INSERT INTO t2 VALUES (3, 1, 2);
+INSERT INTO t2 VALUES (4, 1, 1);
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+SELECT * FROM t1 WHERE t1.id IN (
+SELECT t2.t1_id FROM t3 JOIN t2 ON t3.id = t2.t3_id WHERE t3.id = 1
+);
+id
+1
+2
+drop table t1,t2,t3;
# This must be the last in the file:
set optimizer_switch=@subselect_sj2_tmp;
set optimizer_switch=default;
diff --git a/mysql-test/r/update.result b/mysql-test/r/update.result
index 9eaf1a46d89..db7c2380398 100644
--- a/mysql-test/r/update.result
+++ b/mysql-test/r/update.result
@@ -561,6 +561,21 @@ ERROR HY000: View 'test.v1' references invalid table(s) or column(s) or function
DROP VIEW v1;
DROP FUNCTION f1;
DROP TABLE t1;
+# Bug #21143080: UPDATE ON VARCHAR AND TEXT COLUMNS PRODUCE INCORRECT
+# RESULTS
+CREATE TABLE t1 (a VARCHAR(50), b TEXT, c CHAR(50)) ENGINE=INNODB;
+INSERT INTO t1 (a, b, c) VALUES ('start trail', '', 'even longer string');
+UPDATE t1 SET b = a, a = 'inject';
+SELECT a, b FROM t1;
+a b
+inject start trail
+UPDATE t1 SET b = c, c = 'inject';
+SELECT c, b FROM t1;
+c b
+inject even longer string
+DROP TABLE t1;
+#
+# MDEV-3948 Assertion `records_are_comparable(table)' fails in compare_record(const TABLE*) on UPDATE with simple AND condition, index_merge+index_merge_intersection, InnoDB
#
# Verify that UPDATE does the same number of handler_update
# operations, no matter if there is ORDER BY or not.
diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result
index 2ddcaf54cc9..f697f63ca76 100644
--- a/mysql-test/r/view.result
+++ b/mysql-test/r/view.result
@@ -4828,6 +4828,41 @@ 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;
#
+# BUG#19886430: VIEW CREATION WITH NAMED COLUMNS, OVER UNION,
+# IS REJECTED
+# Without the patch, reports an error.
+CREATE VIEW v1 (fld1, fld2) AS
+SELECT 1 AS a, 2 AS b
+UNION ALL
+SELECT 1 AS a, 1 AS a;
+# The column names are explicitly specified and not duplicates, hence
+# succeeds.
+CREATE VIEW v2 (fld1, fld2) AS
+SELECT 1 AS a, 2 AS a
+UNION ALL
+SELECT 1 AS a, 1 AS a;
+# The column name in the first SELECT are not duplicates, hence succeeds.
+CREATE VIEW v3 AS
+SELECT 1 AS a, 2 AS b
+UNION ALL
+SELECT 1 AS a, 1 AS a;
+# Should report an error, since the explicitly specified column names are
+# duplicates.
+CREATE VIEW v4 (fld1, fld1) AS
+SELECT 1 AS a, 2 AS b
+UNION ALL
+SELECT 1 AS a, 1 AS a;
+ERROR 42S21: Duplicate column name 'fld1'
+# Should report an error, since duplicate column name is specified in the
+# First SELECT.
+CREATE VIEW v4 AS
+SELECT 1 AS a, 2 AS a
+UNION ALL
+SELECT 1 AS a, 1 AS a;
+ERROR 42S21: Duplicate column name 'a'
+# Cleanup
+DROP VIEW v1, v2, v3;
+#
# lp:833600 Wrong result with view + outer join + uncorrelated subquery (non-semijoin)
#
CREATE TABLE t1 ( a int, b int );
@@ -5562,6 +5597,108 @@ count(v3.i)
0
drop table t1, t2;
drop view v3;
+#
+# MDEV-8525: mariadb 10.0.20 crashing when data is read by Kodi
+# media center (http://kodi.tv).
+#
+CREATE TABLE `t1` (
+`idSong` int(11) NOT NULL AUTO_INCREMENT,
+`idAlbum` int(11) DEFAULT NULL,
+`idPath` int(11) DEFAULT NULL,
+`strArtists` text,
+`strGenres` text,
+`strTitle` varchar(512) DEFAULT NULL,
+`iTrack` int(11) DEFAULT NULL,
+`iDuration` int(11) DEFAULT NULL,
+`iYear` int(11) DEFAULT NULL,
+`dwFileNameCRC` text,
+`strFileName` text,
+`strMusicBrainzTrackID` text,
+`iTimesPlayed` int(11) DEFAULT NULL,
+`iStartOffset` int(11) DEFAULT NULL,
+`iEndOffset` int(11) DEFAULT NULL,
+`idThumb` int(11) DEFAULT NULL,
+`lastplayed` varchar(20) DEFAULT NULL,
+`rating` char(1) DEFAULT '0',
+`comment` text,
+`mood` text,
+PRIMARY KEY (`idSong`),
+UNIQUE KEY `idxSong7` (`idAlbum`,`strMusicBrainzTrackID`(36)),
+KEY `idxSong` (`strTitle`(255)),
+KEY `idxSong1` (`iTimesPlayed`),
+KEY `idxSong2` (`lastplayed`),
+KEY `idxSong3` (`idAlbum`),
+KEY `idxSong6` (`idPath`,`strFileName`(255))
+) DEFAULT CHARSET=utf8;
+INSERT INTO `t1` VALUES (1,1,1,'strArtists1','strGenres1','strTitle1',1,100,2000,NULL,'strFileName1','strMusicBrainzTrackID1',0,0,0,NULL,NULL,'0','',''),(2,2,2,'strArtists2','strGenres2','strTitle2',2,200,2001,NULL,'strFileName2','strMusicBrainzTrackID2',0,0,0,NULL,NULL,'0','','');
+CREATE TABLE `t2` (
+`idAlbum` int(11) NOT NULL AUTO_INCREMENT,
+`strAlbum` varchar(256) DEFAULT NULL,
+`strMusicBrainzAlbumID` text,
+`strArtists` text,
+`strGenres` text,
+`iYear` int(11) DEFAULT NULL,
+`idThumb` int(11) DEFAULT NULL,
+`bCompilation` int(11) NOT NULL DEFAULT '0',
+`strMoods` text,
+`strStyles` text,
+`strThemes` text,
+`strReview` text,
+`strImage` text,
+`strLabel` text,
+`strType` text,
+`iRating` int(11) DEFAULT NULL,
+`lastScraped` varchar(20) DEFAULT NULL,
+`dateAdded` varchar(20) DEFAULT NULL,
+`strReleaseType` text,
+PRIMARY KEY (`idAlbum`),
+UNIQUE KEY `idxAlbum_2` (`strMusicBrainzAlbumID`(36)),
+KEY `idxAlbum` (`strAlbum`(255)),
+KEY `idxAlbum_1` (`bCompilation`)
+) DEFAULT CHARSET=utf8;
+INSERT INTO `t2` VALUES (1,'strAlbum1','strMusicBrainzAlbumID1','strArtists1','strGenres1',2000,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'album');
+CREATE TABLE `t3` (
+`idArtist` int(11) DEFAULT NULL,
+`idAlbum` int(11) DEFAULT NULL,
+`strJoinPhrase` text,
+`boolFeatured` int(11) DEFAULT NULL,
+`iOrder` int(11) DEFAULT NULL,
+`strArtist` text,
+UNIQUE KEY `idxAlbumArtist_1` (`idAlbum`,`idArtist`),
+UNIQUE KEY `idxAlbumArtist_2` (`idArtist`,`idAlbum`),
+KEY `idxAlbumArtist_3` (`boolFeatured`)
+) DEFAULT CHARSET=utf8;
+INSERT INTO `t3` VALUES (1,1,'',0,0,'strArtist1');
+CREATE TABLE `t4` (
+`idArtist` int(11) NOT NULL AUTO_INCREMENT,
+`strArtist` varchar(256) DEFAULT NULL,
+`strMusicBrainzArtistID` text,
+`strBorn` text,
+`strFormed` text,
+`strGenres` text,
+`strMoods` text,
+`strStyles` text,
+`strInstruments` text,
+`strBiography` text,
+`strDied` text,
+`strDisbanded` text,
+`strYearsActive` text,
+`strImage` text,
+`strFanart` text,
+`lastScraped` varchar(20) DEFAULT NULL,
+`dateAdded` varchar(20) DEFAULT NULL,
+PRIMARY KEY (`idArtist`),
+UNIQUE KEY `idxArtist1` (`strMusicBrainzArtistID`(36)),
+KEY `idxArtist` (`strArtist`(255))
+) DEFAULT CHARSET=utf8;
+INSERT INTO `t4` VALUES (1,'strArtist1','strMusicBrainzArtistID',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
+CREATE VIEW `v1` AS select `t2`.`idAlbum` AS `idAlbum`,`t2`.`strAlbum` AS `strAlbum`,`t2`.`strMusicBrainzAlbumID` AS `strMusicBrainzAlbumID`,`t2`.`strArtists` AS `strArtists`,`t2`.`strGenres` AS `strGenres`,`t2`.`iYear` AS `iYear`,`t2`.`strMoods` AS `strMoods`,`t2`.`strStyles` AS `strStyles`,`t2`.`strThemes` AS `strThemes`,`t2`.`strReview` AS `strReview`,`t2`.`strLabel` AS `strLabel`,`t2`.`strType` AS `strType`,`t2`.`strImage` AS `strImage`,`t2`.`iRating` AS `iRating`,`t2`.`bCompilation` AS `bCompilation`,(select min(`t1`.`iTimesPlayed`) from `t1` where (`t1`.`idAlbum` = `t2`.`idAlbum`)) AS `iTimesPlayed`,`t2`.`strReleaseType` AS `strReleaseType` from `t2`;
+CREATE VIEW `v2` AS select `t3`.`idAlbum` AS `idAlbum`,`t3`.`idArtist` AS `idArtist`,`t4`.`strArtist` AS `strArtist`,`t4`.`strMusicBrainzArtistID` AS `strMusicBrainzArtistID`,`t3`.`boolFeatured` AS `boolFeatured`,`t3`.`strJoinPhrase` AS `strJoinPhrase`,`t3`.`iOrder` AS `iOrder` from (`t3` join `t4` on((`t3`.`idArtist` = `t4`.`idArtist`)));
+SELECT v1.*,v2.* FROM v1 LEFT JOIN v2 ON v1.idAlbum = v2.idAlbum WHERE v1.idAlbum = 1 ORDER BY v2.iOrder;
+idAlbum strAlbum strMusicBrainzAlbumID strArtists strGenres iYear strMoods strStyles strThemes strReview strLabel strType strImage iRating bCompilation iTimesPlayed strReleaseType idAlbum idArtist strArtist strMusicBrainzArtistID boolFeatured strJoinPhrase iOrder
+1 strAlbum1 strMusicBrainzAlbumID1 strArtists1 strGenres1 2000 NULL NULL NULL NULL NULL NULL NULL NULL 0 0 album 1 1 strArtist1 strMusicBrainzArtistID 0 0
+drop view v1,v2;
+drop table t1,t2,t3,t4;
# -----------------------------------------------------------------
# -- End of 10.0 tests.
# -----------------------------------------------------------------
diff --git a/mysql-test/std_data/bug16171518_1.dat b/mysql-test/std_data/bug16171518_1.dat
new file mode 100644
index 00000000000..b65b9359ce1
--- /dev/null
+++ b/mysql-test/std_data/bug16171518_1.dat
@@ -0,0 +1,59 @@
+<test_rows>
+ <row>
+ <col1>0bc</col1>
+ <col2>def</col2>
+ <col3>ghi</col3>
+ <col4>jkl</col4>
+ </row>
+ <row>
+ <col1>1no</col1>
+ <col2/>
+ <col3>pqr</col3>
+ <col4>stu</col4>
+ </row>
+
+ <row>
+ <col1>2BC</col1>
+ <col2>DEF</col2>
+ <col3>GHI</col3>
+ <col4>JKL</col4>
+ </row>
+ <row>
+ <col1>3NO</col1>
+ <col2 />
+ <col3>PQR</col3>
+ <col4>STU</col4>
+ </row>
+
+ <row col1="4bc" col2="def" col3="ghi" col4="jkl"/>
+ <row col1="5no" col2="pqr" col3="stu" col4="vwx" />
+
+ <row>
+ <field name='col1'>6BC</field>
+ <field name='col2'>DEF</field>
+ <field name='col3'></field>
+ <field name='col4'>JKL</field>
+ </row>
+ <row>
+ <field name='col1'>7NO</field>
+ <field name='col2'>PQR</field>
+ <field name='col3'>STU</field>
+ <field name='col4'>VWX</field>
+ </row>
+
+ <row>
+ <col1>8bc</col1>
+ <col2>def</col2>
+ <col3>ghi</col3>
+ <col4 />
+ </row>
+ <row>
+ <col1>9kl</col1>
+ <col2/>
+ <col3>mno</col3>
+ <col4>pqr</col4>
+ </row>
+
+ <row col1="ABC" col2="DEF" col3="" col4="JKL"/>
+ <row col1="MNO" col2="" col3="STU" col4="VWX"/>
+</test_rows>
diff --git a/mysql-test/std_data/bug16171518_2.dat b/mysql-test/std_data/bug16171518_2.dat
new file mode 100644
index 00000000000..8a483337a0f
--- /dev/null
+++ b/mysql-test/std_data/bug16171518_2.dat
@@ -0,0 +1,12 @@
+<test_rows>
+ <row>
+ <col1>ABC</col1>
+ <col2>DEF</col2>
+ <col3 />
+ </row>
+ <row>
+ <col1>GHI</col1>
+ <col2 />
+ <col3>123</col3>
+ </row>
+</test_rows>
diff --git a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row.result b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row.result
index 86c4c68d02b..3dbc422e47a 100644
--- a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row.result
+++ b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row.result
@@ -1520,7 +1520,7 @@ BEGIN
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
### INSERT INTO `test`.`t1`
### SET
-### @1=000000124.450000000 /* DECIMAL(10,5) meta=2565 nullable=1 is_null=0 */
+### @1=124.45000 /* DECIMAL(10,5) meta=2565 nullable=1 is_null=0 */
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
@@ -1537,7 +1537,7 @@ BEGIN
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
### INSERT INTO `test`.`t1`
### SET
-### @1=-000000543.210000000 /* DECIMAL(10,5) meta=2565 nullable=1 is_null=0 */
+### @1=-543.21000 /* DECIMAL(10,5) meta=2565 nullable=1 is_null=0 */
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
@@ -1554,7 +1554,7 @@ BEGIN
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
### DELETE FROM `test`.`t1`
### WHERE
-### @1=000000124.450000000 /* DECIMAL(10,5) meta=2565 nullable=1 is_null=0 */
+### @1=124.45000 /* DECIMAL(10,5) meta=2565 nullable=1 is_null=0 */
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
diff --git a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_innodb.result b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_innodb.result
index 0c44061c4e9..8d23c58732a 100644
--- a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_innodb.result
+++ b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_innodb.result
@@ -2398,9 +2398,9 @@ BEGIN
### @22=-1.797... /* DOUBLE meta=8 nullable=1 is_null=0 */
### @23=2.225... /* DOUBLE meta=8 nullable=1 is_null=0 */
### @24=0 /* DOUBLE meta=8 nullable=1 is_null=0 */
-### @25=-000000009.999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
-### @26=000000000 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
-### @27=000000000 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
+### @25=-9999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
+### @26=0 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
+### @27=0 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
### @28='1000:01:01' /* DATE meta=0 nullable=1 is_null=0 */
### @29=1000-01-01 00:00:00 /* DATETIME meta=0 nullable=1 is_null=0 */
### @30=75601 /* TIMESTAMP meta=0 nullable=0 is_null=0 */
@@ -2491,9 +2491,9 @@ BEGIN
### @22=1.797... /* DOUBLE meta=8 nullable=1 is_null=0 */
### @23=1.797... /* DOUBLE meta=8 nullable=1 is_null=0 */
### @24=1.797... /* DOUBLE meta=8 nullable=1 is_null=0 */
-### @25=000000009.999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
-### @26=000000009.999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
-### @27=000000009.999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
+### @25=9999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
+### @26=9999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
+### @27=9999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
### @28='9999:12:31' /* DATE meta=0 nullable=1 is_null=0 */
### @29=9999-12-31 23:59:59 /* DATETIME meta=0 nullable=1 is_null=0 */
### @30=2146522447 /* TIMESTAMP meta=0 nullable=0 is_null=0 */
@@ -2667,9 +2667,9 @@ BEGIN
### @22=-2.225... /* DOUBLE meta=8 nullable=1 is_null=0 */
### @23=2.225... /* DOUBLE meta=8 nullable=1 is_null=0 */
### @24=1 /* DOUBLE meta=8 nullable=1 is_null=0 */
-### @25=-000000009.999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
-### @26=000000009.999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
-### @27=000000001 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
+### @25=-9999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
+### @26=9999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
+### @27=1 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
### @28='2008:08:04' /* DATE meta=0 nullable=1 is_null=0 */
### @29=2008-08-04 16:18:06 /* DATETIME meta=0 nullable=1 is_null=0 */
### @30=1217855904 /* TIMESTAMP meta=0 nullable=0 is_null=0 */
@@ -2760,9 +2760,9 @@ BEGIN
### @22=-1.797... /* DOUBLE meta=8 nullable=1 is_null=0 */
### @23=2.225... /* DOUBLE meta=8 nullable=1 is_null=0 */
### @24=0 /* DOUBLE meta=8 nullable=1 is_null=0 */
-### @25=-000000009.999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
-### @26=000000000 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
-### @27=000000000 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
+### @25=-9999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
+### @26=0 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
+### @27=0 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
### @28='1000:01:01' /* DATE meta=0 nullable=1 is_null=0 */
### @29=1000-01-01 00:00:00 /* DATETIME meta=0 nullable=1 is_null=0 */
### @30=75601 /* TIMESTAMP meta=0 nullable=0 is_null=0 */
@@ -2840,9 +2840,9 @@ BEGIN
### @22=1.797... /* DOUBLE meta=8 nullable=1 is_null=0 */
### @23=1.797... /* DOUBLE meta=8 nullable=1 is_null=0 */
### @24=1.797... /* DOUBLE meta=8 nullable=1 is_null=0 */
-### @25=000000009.999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
-### @26=000000009.999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
-### @27=000000009.999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
+### @25=9999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
+### @26=9999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
+### @27=9999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
### @28='9999:12:31' /* DATE meta=0 nullable=1 is_null=0 */
### @29=9999-12-31 23:59:59 /* DATETIME meta=0 nullable=1 is_null=0 */
### @30=2146522447 /* TIMESTAMP meta=0 nullable=0 is_null=0 */
@@ -2933,9 +2933,9 @@ BEGIN
### @22=1.797... /* DOUBLE meta=8 nullable=1 is_null=0 */
### @23=1.797... /* DOUBLE meta=8 nullable=1 is_null=0 */
### @24=1.797... /* DOUBLE meta=8 nullable=1 is_null=0 */
-### @25=000000009.999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
-### @26=000000009.999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
-### @27=000000009.999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
+### @25=9999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
+### @26=9999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
+### @27=9999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
### @28='9999:12:31' /* DATE meta=0 nullable=1 is_null=0 */
### @29=9999-12-31 23:59:59 /* DATETIME meta=0 nullable=1 is_null=0 */
### @30=2146522447 /* TIMESTAMP meta=0 nullable=0 is_null=0 */
@@ -3013,9 +3013,9 @@ BEGIN
### @22=-1.797... /* DOUBLE meta=8 nullable=1 is_null=0 */
### @23=2.225... /* DOUBLE meta=8 nullable=1 is_null=0 */
### @24=0 /* DOUBLE meta=8 nullable=1 is_null=0 */
-### @25=-000000009.999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
-### @26=000000000 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
-### @27=000000000 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
+### @25=-9999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
+### @26=0 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
+### @27=0 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
### @28='1000:01:01' /* DATE meta=0 nullable=1 is_null=0 */
### @29=1000-01-01 00:00:00 /* DATETIME meta=0 nullable=1 is_null=0 */
### @30=75601 /* TIMESTAMP meta=0 nullable=0 is_null=0 */
@@ -3186,9 +3186,9 @@ BEGIN
### @22=-2.225... /* DOUBLE meta=8 nullable=1 is_null=0 */
### @23=2.225... /* DOUBLE meta=8 nullable=1 is_null=0 */
### @24=1 /* DOUBLE meta=8 nullable=1 is_null=0 */
-### @25=-000000009.999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
-### @26=000000009.999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
-### @27=000000001 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
+### @25=-9999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
+### @26=9999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
+### @27=1 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
### @28='2008:08:04' /* DATE meta=0 nullable=1 is_null=0 */
### @29=2008-08-04 16:18:06 /* DATETIME meta=0 nullable=1 is_null=0 */
### @30=1217855904 /* TIMESTAMP meta=0 nullable=0 is_null=0 */
@@ -3279,9 +3279,9 @@ BEGIN
### @22=-2.225... /* DOUBLE meta=8 nullable=1 is_null=0 */
### @23=2.225... /* DOUBLE meta=8 nullable=1 is_null=0 */
### @24=1 /* DOUBLE meta=8 nullable=1 is_null=0 */
-### @25=-000000009.999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
-### @26=000000009.999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
-### @27=000000001 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
+### @25=-9999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
+### @26=9999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
+### @27=1 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
### @28='2008:08:04' /* DATE meta=0 nullable=1 is_null=0 */
### @29=2008-08-04 16:18:06 /* DATETIME meta=0 nullable=1 is_null=0 */
### @30=1217855904 /* TIMESTAMP meta=0 nullable=0 is_null=0 */
@@ -3452,9 +3452,9 @@ BEGIN
### @22=1.797... /* DOUBLE meta=8 nullable=1 is_null=0 */
### @23=1.797... /* DOUBLE meta=8 nullable=1 is_null=0 */
### @24=1.797... /* DOUBLE meta=8 nullable=1 is_null=0 */
-### @25=000000009.999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
-### @26=000000009.999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
-### @27=000000009.999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
+### @25=9999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
+### @26=9999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
+### @27=9999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
### @28='9999:12:31' /* DATE meta=0 nullable=1 is_null=0 */
### @29=9999-12-31 23:59:59 /* DATETIME meta=0 nullable=1 is_null=0 */
### @30=2146522447 /* TIMESTAMP meta=0 nullable=0 is_null=0 */
@@ -3545,9 +3545,9 @@ BEGIN
### @22=-1.797... /* DOUBLE meta=8 nullable=1 is_null=0 */
### @23=2.225... /* DOUBLE meta=8 nullable=1 is_null=0 */
### @24=0 /* DOUBLE meta=8 nullable=1 is_null=0 */
-### @25=-000000009.999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
-### @26=000000000 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
-### @27=000000000 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
+### @25=-9999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
+### @26=0 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
+### @27=0 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
### @28='1000:01:01' /* DATE meta=0 nullable=1 is_null=0 */
### @29=1000-01-01 00:00:00 /* DATETIME meta=0 nullable=1 is_null=0 */
### @30=75601 /* TIMESTAMP meta=0 nullable=0 is_null=0 */
@@ -3638,9 +3638,9 @@ BEGIN
### @22=-2.225... /* DOUBLE meta=8 nullable=1 is_null=0 */
### @23=2.225... /* DOUBLE meta=8 nullable=1 is_null=0 */
### @24=1 /* DOUBLE meta=8 nullable=1 is_null=0 */
-### @25=-000000009.999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
-### @26=000000009.999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
-### @27=000000001 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
+### @25=-9999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
+### @26=9999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
+### @27=1 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
### @28='2008:08:04' /* DATE meta=0 nullable=1 is_null=0 */
### @29=2008-08-04 16:18:06 /* DATETIME meta=0 nullable=1 is_null=0 */
### @30=1217855904 /* TIMESTAMP meta=0 nullable=0 is_null=0 */
diff --git a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_myisam.result b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_myisam.result
index e54e33283fd..ce503b7371f 100644
--- a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_myisam.result
+++ b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_myisam.result
@@ -2398,9 +2398,9 @@ BEGIN
### @22=-1.797... /* DOUBLE meta=8 nullable=1 is_null=0 */
### @23=2.225... /* DOUBLE meta=8 nullable=1 is_null=0 */
### @24=0 /* DOUBLE meta=8 nullable=1 is_null=0 */
-### @25=-000000009.999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
-### @26=000000000 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
-### @27=000000000 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
+### @25=-9999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
+### @26=0 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
+### @27=0 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
### @28='1000:01:01' /* DATE meta=0 nullable=1 is_null=0 */
### @29=1000-01-01 00:00:00 /* DATETIME meta=0 nullable=1 is_null=0 */
### @30=75601 /* TIMESTAMP meta=0 nullable=0 is_null=0 */
@@ -2494,9 +2494,9 @@ BEGIN
### @22=1.797... /* DOUBLE meta=8 nullable=1 is_null=0 */
### @23=1.797... /* DOUBLE meta=8 nullable=1 is_null=0 */
### @24=1.797... /* DOUBLE meta=8 nullable=1 is_null=0 */
-### @25=000000009.999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
-### @26=000000009.999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
-### @27=000000009.999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
+### @25=9999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
+### @26=9999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
+### @27=9999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
### @28='9999:12:31' /* DATE meta=0 nullable=1 is_null=0 */
### @29=9999-12-31 23:59:59 /* DATETIME meta=0 nullable=1 is_null=0 */
### @30=2146522447 /* TIMESTAMP meta=0 nullable=0 is_null=0 */
@@ -2672,9 +2672,9 @@ BEGIN
### @22=-2.225... /* DOUBLE meta=8 nullable=1 is_null=0 */
### @23=2.225... /* DOUBLE meta=8 nullable=1 is_null=0 */
### @24=1 /* DOUBLE meta=8 nullable=1 is_null=0 */
-### @25=-000000009.999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
-### @26=000000009.999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
-### @27=000000001 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
+### @25=-9999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
+### @26=9999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
+### @27=1 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
### @28='2008:08:04' /* DATE meta=0 nullable=1 is_null=0 */
### @29=2008-08-04 16:18:06 /* DATETIME meta=0 nullable=1 is_null=0 */
### @30=1217855904 /* TIMESTAMP meta=0 nullable=0 is_null=0 */
@@ -2767,9 +2767,9 @@ BEGIN
### @22=-1.797... /* DOUBLE meta=8 nullable=1 is_null=0 */
### @23=2.225... /* DOUBLE meta=8 nullable=1 is_null=0 */
### @24=0 /* DOUBLE meta=8 nullable=1 is_null=0 */
-### @25=-000000009.999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
-### @26=000000000 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
-### @27=000000000 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
+### @25=-9999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
+### @26=0 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
+### @27=0 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
### @28='1000:01:01' /* DATE meta=0 nullable=1 is_null=0 */
### @29=1000-01-01 00:00:00 /* DATETIME meta=0 nullable=1 is_null=0 */
### @30=75601 /* TIMESTAMP meta=0 nullable=0 is_null=0 */
@@ -2847,9 +2847,9 @@ BEGIN
### @22=1.797... /* DOUBLE meta=8 nullable=1 is_null=0 */
### @23=1.797... /* DOUBLE meta=8 nullable=1 is_null=0 */
### @24=1.797... /* DOUBLE meta=8 nullable=1 is_null=0 */
-### @25=000000009.999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
-### @26=000000009.999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
-### @27=000000009.999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
+### @25=9999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
+### @26=9999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
+### @27=9999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
### @28='9999:12:31' /* DATE meta=0 nullable=1 is_null=0 */
### @29=9999-12-31 23:59:59 /* DATETIME meta=0 nullable=1 is_null=0 */
### @30=2146522447 /* TIMESTAMP meta=0 nullable=0 is_null=0 */
@@ -2942,9 +2942,9 @@ BEGIN
### @22=1.797... /* DOUBLE meta=8 nullable=1 is_null=0 */
### @23=1.797... /* DOUBLE meta=8 nullable=1 is_null=0 */
### @24=1.797... /* DOUBLE meta=8 nullable=1 is_null=0 */
-### @25=000000009.999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
-### @26=000000009.999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
-### @27=000000009.999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
+### @25=9999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
+### @26=9999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
+### @27=9999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
### @28='9999:12:31' /* DATE meta=0 nullable=1 is_null=0 */
### @29=9999-12-31 23:59:59 /* DATETIME meta=0 nullable=1 is_null=0 */
### @30=2146522447 /* TIMESTAMP meta=0 nullable=0 is_null=0 */
@@ -3022,9 +3022,9 @@ BEGIN
### @22=-1.797... /* DOUBLE meta=8 nullable=1 is_null=0 */
### @23=2.225... /* DOUBLE meta=8 nullable=1 is_null=0 */
### @24=0 /* DOUBLE meta=8 nullable=1 is_null=0 */
-### @25=-000000009.999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
-### @26=000000000 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
-### @27=000000000 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
+### @25=-9999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
+### @26=0 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
+### @27=0 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
### @28='1000:01:01' /* DATE meta=0 nullable=1 is_null=0 */
### @29=1000-01-01 00:00:00 /* DATETIME meta=0 nullable=1 is_null=0 */
### @30=75601 /* TIMESTAMP meta=0 nullable=0 is_null=0 */
@@ -3197,9 +3197,9 @@ BEGIN
### @22=-2.225... /* DOUBLE meta=8 nullable=1 is_null=0 */
### @23=2.225... /* DOUBLE meta=8 nullable=1 is_null=0 */
### @24=1 /* DOUBLE meta=8 nullable=1 is_null=0 */
-### @25=-000000009.999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
-### @26=000000009.999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
-### @27=000000001 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
+### @25=-9999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
+### @26=9999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
+### @27=1 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
### @28='2008:08:04' /* DATE meta=0 nullable=1 is_null=0 */
### @29=2008-08-04 16:18:06 /* DATETIME meta=0 nullable=1 is_null=0 */
### @30=1217855904 /* TIMESTAMP meta=0 nullable=0 is_null=0 */
@@ -3292,9 +3292,9 @@ BEGIN
### @22=-2.225... /* DOUBLE meta=8 nullable=1 is_null=0 */
### @23=2.225... /* DOUBLE meta=8 nullable=1 is_null=0 */
### @24=1 /* DOUBLE meta=8 nullable=1 is_null=0 */
-### @25=-000000009.999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
-### @26=000000009.999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
-### @27=000000001 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
+### @25=-9999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
+### @26=9999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
+### @27=1 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
### @28='2008:08:04' /* DATE meta=0 nullable=1 is_null=0 */
### @29=2008-08-04 16:18:06 /* DATETIME meta=0 nullable=1 is_null=0 */
### @30=1217855904 /* TIMESTAMP meta=0 nullable=0 is_null=0 */
@@ -3467,9 +3467,9 @@ BEGIN
### @22=1.797... /* DOUBLE meta=8 nullable=1 is_null=0 */
### @23=1.797... /* DOUBLE meta=8 nullable=1 is_null=0 */
### @24=1.797... /* DOUBLE meta=8 nullable=1 is_null=0 */
-### @25=000000009.999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
-### @26=000000009.999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
-### @27=000000009.999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
+### @25=9999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
+### @26=9999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
+### @27=9999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
### @28='9999:12:31' /* DATE meta=0 nullable=1 is_null=0 */
### @29=9999-12-31 23:59:59 /* DATETIME meta=0 nullable=1 is_null=0 */
### @30=2146522447 /* TIMESTAMP meta=0 nullable=0 is_null=0 */
@@ -3562,9 +3562,9 @@ BEGIN
### @22=-1.797... /* DOUBLE meta=8 nullable=1 is_null=0 */
### @23=2.225... /* DOUBLE meta=8 nullable=1 is_null=0 */
### @24=0 /* DOUBLE meta=8 nullable=1 is_null=0 */
-### @25=-000000009.999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
-### @26=000000000 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
-### @27=000000000 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
+### @25=-9999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
+### @26=0 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
+### @27=0 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
### @28='1000:01:01' /* DATE meta=0 nullable=1 is_null=0 */
### @29=1000-01-01 00:00:00 /* DATETIME meta=0 nullable=1 is_null=0 */
### @30=75601 /* TIMESTAMP meta=0 nullable=0 is_null=0 */
@@ -3657,9 +3657,9 @@ BEGIN
### @22=-2.225... /* DOUBLE meta=8 nullable=1 is_null=0 */
### @23=2.225... /* DOUBLE meta=8 nullable=1 is_null=0 */
### @24=1 /* DOUBLE meta=8 nullable=1 is_null=0 */
-### @25=-000000009.999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
-### @26=000000009.999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
-### @27=000000001 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
+### @25=-9999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
+### @26=9999999999 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
+### @27=1 /* DECIMAL(10,0) meta=2560 nullable=1 is_null=0 */
### @28='2008:08:04' /* DATE meta=0 nullable=1 is_null=0 */
### @29=2008-08-04 16:18:06 /* DATETIME meta=0 nullable=1 is_null=0 */
### @30=1217855904 /* TIMESTAMP meta=0 nullable=0 is_null=0 */
diff --git a/mysql-test/suite/innodb/r/innodb-alter-filewrite.result b/mysql-test/suite/innodb/r/innodb-alter-filewrite.result
new file mode 100644
index 00000000000..444b09ad440
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb-alter-filewrite.result
@@ -0,0 +1,30 @@
+CREATE TABLE `test_wo_keys` (
+`f01` int AUTO_INCREMENT,
+`f02` bigint, `f03` bigint, `f04` enum('a','b'),
+`f05` date, `f06` int, `f07` int, `f08` double, `f09` int,
+`f10` bigint, `f11` double, `f12` enum('a','b','c','d','e'),
+`f13` int, `f14` int, `f15` varchar(255), `f16` int, `f17` int, `f18` int,
+`f19` double, `f20` double, `f21` double, `f22` double, `f23` double, `f24` tinyint,
+`f25` double, `f26` double, `f27` double, `f28` double, `f29` int unsigned,
+`f30` int unsigned, `f31` bigint, `f32` int unsigned, `f33` bigint,
+`f34` int unsigned, `f35` int unsigned,
+PRIMARY KEY `f01` (`f01`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+show status like '%merge_buffers%';
+Variable_name Value
+Innodb_os_merge_buffers_written 0
+Innodb_os_merge_buffers_read 0
+Innodb_os_merge_buffers_merged 0
+ALTER TABLE test_wo_keys
+ADD KEY `f06` (`f06`), ADD KEY `f05` (`f05`), ADD KEY `f04` (`f04`), ADD KEY `f23` (`f23`),
+ADD KEY `f10` (`f10`), ADD KEY `f11` (`f11`), ADD KEY `f09` (`f09`), ADD KEY `f22` (`f22`),
+ADD KEY `f21` (`f21`), ADD KEY `f07` (`f07`), ADD KEY `f08` (`f08`), ADD KEY `f18` (`f18`),
+ADD KEY `f19` (`f19`), ADD KEY `f20` (`f20`), ADD KEY `f29` (`f29`,`f31`,`f33`),
+ADD KEY `f35` (`f35`), ADD KEY `f25` (`f25`), ADD KEY `f26` (`f26`),
+ADD KEY `f27` (`f27`), ADD KEY `f28` (`f28`);
+show status like '%merge_buffers%';
+Variable_name Value
+Innodb_os_merge_buffers_written 0
+Innodb_os_merge_buffers_read 0
+Innodb_os_merge_buffers_merged 0
+DROP TABLE test_wo_keys;
diff --git a/mysql-test/suite/innodb/r/innodb_bug68148.result b/mysql-test/suite/innodb/r/innodb_bug68148.result
new file mode 100644
index 00000000000..88247053389
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb_bug68148.result
@@ -0,0 +1,36 @@
+set global innodb_file_per_table=1;
+CREATE TABLE ref_table1 (id int(11) NOT NULL, PRIMARY KEY(id)) ENGINE=InnoDB;
+CREATE TABLE ref_table2 (id int(11) NOT NULL, PRIMARY KEY(id)) ENGINE=InnoDB;
+CREATE TABLE `main` (
+`id` int(11) NOT NULL AUTO_INCREMENT,
+`ref_id1` int(11) NOT NULL,
+`ref_id2` int(11) NOT NULL,
+PRIMARY KEY (`id`),
+UNIQUE KEY `idx_1` (`ref_id1`,`ref_id2`),
+KEY `FK_set_out_analysis_route_id` (`ref_id2`),
+CONSTRAINT `FK_1` FOREIGN KEY (`ref_id1`) REFERENCES `ref_table1` (`id`) ,
+CONSTRAINT `FK_2` FOREIGN KEY (`ref_id2`) REFERENCES `ref_table2` (`id`)
+) ENGINE=InnoDB;
+SET FOREIGN_KEY_CHECKS=0;
+DROP INDEX `idx_1` ON `main`;
+SHOW TABLES;
+Tables_in_test
+main
+ref_table1
+ref_table2
+# restart and see if we can still access the main table
+SET FOREIGN_KEY_CHECKS=0;
+ALTER TABLE `main` ADD INDEX `idx_1` (`ref_id1`);
+SHOW CREATE TABLE `main`;
+Table Create Table
+main CREATE TABLE `main` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `ref_id1` int(11) NOT NULL,
+ `ref_id2` int(11) NOT NULL,
+ PRIMARY KEY (`id`),
+ KEY `FK_set_out_analysis_route_id` (`ref_id2`),
+ KEY `idx_1` (`ref_id1`),
+ CONSTRAINT `FK_1` FOREIGN KEY (`ref_id1`) REFERENCES `ref_table1` (`id`),
+ CONSTRAINT `FK_2` FOREIGN KEY (`ref_id2`) REFERENCES `ref_table2` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+DROP TABLE main, ref_table1, ref_table2;
diff --git a/mysql-test/suite/innodb/r/innodb_monitor.result b/mysql-test/suite/innodb/r/innodb_monitor.result
index f8d24f4e6f5..89ce676e38b 100644
--- a/mysql-test/suite/innodb/r/innodb_monitor.result
+++ b/mysql-test/suite/innodb/r/innodb_monitor.result
@@ -123,6 +123,9 @@ os_log_bytes_written disabled
os_log_fsyncs disabled
os_log_pending_fsyncs disabled
os_log_pending_writes disabled
+os_merge_blocks_written disabled
+os_merge_blocks_read disabled
+os_merge_blocks_merged disabled
trx_rw_commits disabled
trx_ro_commits disabled
trx_nl_ro_commits disabled
@@ -254,6 +257,9 @@ lock_row_lock_time disabled
lock_row_lock_time_max disabled
lock_row_lock_waits disabled
lock_row_lock_time_avg disabled
+os_merge_blocks_written disabled
+os_merge_blocks_read disabled
+os_merge_blocks_merged disabled
innodb_rwlock_s_spin_waits disabled
innodb_rwlock_x_spin_waits disabled
innodb_rwlock_s_spin_rounds disabled
@@ -292,6 +298,9 @@ os_log_bytes_written disabled
os_log_fsyncs disabled
os_log_pending_fsyncs enabled
os_log_pending_writes enabled
+os_merge_blocks_written disabled
+os_merge_blocks_read disabled
+os_merge_blocks_merged disabled
set global innodb_monitor_enable="";
ERROR 42000: Variable 'innodb_monitor_enable' can't be set to the value of ''
set global innodb_monitor_enable="_";
diff --git a/mysql-test/suite/innodb/r/innodb_simulate_comp_failures.result b/mysql-test/suite/innodb/r/innodb_simulate_comp_failures.result
index 1cb2cf77050..c2a8ba1f4db 100644
--- a/mysql-test/suite/innodb/r/innodb_simulate_comp_failures.result
+++ b/mysql-test/suite/innodb/r/innodb_simulate_comp_failures.result
@@ -5,4 +5,4 @@ CREATE TABLE t1(id INT AUTO_INCREMENT PRIMARY KEY, msg VARCHAR(255), KEY msg_i(m
SET GLOBAL innodb_simulate_comp_failures = 25;
SELECT COUNT(*) FROM t1;
COUNT(*)
-10000
+1500
diff --git a/mysql-test/suite/innodb/r/snapshot.result b/mysql-test/suite/innodb/r/snapshot.result
new file mode 100644
index 00000000000..dcb3d242fc2
--- /dev/null
+++ b/mysql-test/suite/innodb/r/snapshot.result
@@ -0,0 +1,8 @@
+START TRANSACTION WITH CONSISTENT SNAPSHOT;
+CREATE TABLE IF NOT EXISTS t1 (pk INT PRIMARY KEY, i INT, KEY(i)) ENGINE=InnoDB;
+UPDATE t1 SET i = 0;
+ERROR HY000: Table definition has changed, please retry transaction
+UPDATE t1 SET pk = 0;
+ERROR HY000: Table definition has changed, please retry transaction
+commit;
+drop table t1;
diff --git a/mysql-test/suite/innodb/t/innodb-alter-filewrite.test b/mysql-test/suite/innodb/t/innodb-alter-filewrite.test
new file mode 100644
index 00000000000..d0372056937
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb-alter-filewrite.test
@@ -0,0 +1,32 @@
+--source include/have_innodb.inc
+
+#
+# MDEV-8696: Adding indexes on empty table is slow with large innodb_sort_buffer_size.
+#
+
+CREATE TABLE `test_wo_keys` (
+`f01` int AUTO_INCREMENT,
+`f02` bigint, `f03` bigint, `f04` enum('a','b'),
+`f05` date, `f06` int, `f07` int, `f08` double, `f09` int,
+`f10` bigint, `f11` double, `f12` enum('a','b','c','d','e'),
+`f13` int, `f14` int, `f15` varchar(255), `f16` int, `f17` int, `f18` int,
+`f19` double, `f20` double, `f21` double, `f22` double, `f23` double, `f24` tinyint,
+`f25` double, `f26` double, `f27` double, `f28` double, `f29` int unsigned,
+`f30` int unsigned, `f31` bigint, `f32` int unsigned, `f33` bigint,
+`f34` int unsigned, `f35` int unsigned,
+PRIMARY KEY `f01` (`f01`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+show status like '%merge_buffers%';
+
+ALTER TABLE test_wo_keys
+ADD KEY `f06` (`f06`), ADD KEY `f05` (`f05`), ADD KEY `f04` (`f04`), ADD KEY `f23` (`f23`),
+ADD KEY `f10` (`f10`), ADD KEY `f11` (`f11`), ADD KEY `f09` (`f09`), ADD KEY `f22` (`f22`),
+ADD KEY `f21` (`f21`), ADD KEY `f07` (`f07`), ADD KEY `f08` (`f08`), ADD KEY `f18` (`f18`),
+ADD KEY `f19` (`f19`), ADD KEY `f20` (`f20`), ADD KEY `f29` (`f29`,`f31`,`f33`),
+ADD KEY `f35` (`f35`), ADD KEY `f25` (`f25`), ADD KEY `f26` (`f26`),
+ADD KEY `f27` (`f27`), ADD KEY `f28` (`f28`);
+
+show status like '%merge_buffers%';
+
+DROP TABLE test_wo_keys;
diff --git a/mysql-test/suite/innodb/t/innodb_bug60229-master.opt b/mysql-test/suite/innodb/t/innodb_bug60229-master.opt
deleted file mode 100644
index 9b27aef9bf8..00000000000
--- a/mysql-test/suite/innodb/t/innodb_bug60229-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---lower_case_table_names=0
diff --git a/mysql-test/suite/innodb/t/innodb_bug60229.test b/mysql-test/suite/innodb/t/innodb_bug60229.test
index 8dcf15157d6..aee0b96a942 100644
--- a/mysql-test/suite/innodb/t/innodb_bug60229.test
+++ b/mysql-test/suite/innodb/t/innodb_bug60229.test
@@ -2,6 +2,10 @@
# Bug #13083023 - 60229: BROKEN COMPATIBILITY: ERROR WHILE CREATE TABLE
# WITH FOREIGN KEY CONSTRAINT.
+#Server variable option 'lower_case_table_names' sets '0' as default value
+#in case sensitive filesystem. Using 'lower_case_table_names=0' in case of
+#insensitive filsystem is not allowed.
+-- source include/have_case_sensitive_file_system.inc
-- source include/have_innodb.inc
CREATE TABLE PERSON (
diff --git a/mysql-test/suite/innodb/t/innodb_bug68148.test b/mysql-test/suite/innodb/t/innodb_bug68148.test
new file mode 100644
index 00000000000..531baa30e48
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_bug68148.test
@@ -0,0 +1,41 @@
+-- source include/have_innodb.inc
+-- source include/not_embedded.inc
+
+#
+# Bug #68148: drop index on a foreign key column leads to missing table
+# MDEV-8845: Table disappear after modifying FK
+#
+
+set global innodb_file_per_table=1;
+
+CREATE TABLE ref_table1 (id int(11) NOT NULL, PRIMARY KEY(id)) ENGINE=InnoDB;
+
+CREATE TABLE ref_table2 (id int(11) NOT NULL, PRIMARY KEY(id)) ENGINE=InnoDB;
+
+CREATE TABLE `main` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `ref_id1` int(11) NOT NULL,
+ `ref_id2` int(11) NOT NULL,
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `idx_1` (`ref_id1`,`ref_id2`),
+ KEY `FK_set_out_analysis_route_id` (`ref_id2`),
+ CONSTRAINT `FK_1` FOREIGN KEY (`ref_id1`) REFERENCES `ref_table1` (`id`) ,
+ CONSTRAINT `FK_2` FOREIGN KEY (`ref_id2`) REFERENCES `ref_table2` (`id`)
+) ENGINE=InnoDB;
+
+SET FOREIGN_KEY_CHECKS=0;
+
+DROP INDEX `idx_1` ON `main`;
+SHOW TABLES;
+
+--echo # restart and see if we can still access the main table
+--source include/restart_mysqld.inc
+
+# This is required to access the table
+SET FOREIGN_KEY_CHECKS=0;
+ALTER TABLE `main` ADD INDEX `idx_1` (`ref_id1`);
+SHOW CREATE TABLE `main`;
+
+DROP TABLE main, ref_table1, ref_table2;
+
+
diff --git a/mysql-test/suite/innodb/t/innodb_simulate_comp_failures.test b/mysql-test/suite/innodb/t/innodb_simulate_comp_failures.test
index ae9e0a9b984..cf22935fad6 100644
--- a/mysql-test/suite/innodb/t/innodb_simulate_comp_failures.test
+++ b/mysql-test/suite/innodb/t/innodb_simulate_comp_failures.test
@@ -1,8 +1,8 @@
--source include/big_test.inc
# test takes too long with valgrind
--source include/not_valgrind.inc
---let $num_inserts = 10000
---let $num_ops = 10000
+--let $num_inserts = 1500
+--let $num_ops = 3500
--source suite/innodb/include/innodb_simulate_comp_failures.inc
# clean exit
--exit
diff --git a/mysql-test/suite/innodb/t/snapshot.test b/mysql-test/suite/innodb/t/snapshot.test
new file mode 100644
index 00000000000..8e3dc76fe54
--- /dev/null
+++ b/mysql-test/suite/innodb/t/snapshot.test
@@ -0,0 +1,18 @@
+
+--source include/have_log_bin.inc
+--source include/have_binlog_format_row.inc
+--source include/have_innodb.inc
+
+START TRANSACTION WITH CONSISTENT SNAPSHOT;
+
+--connect (con1,localhost,root,,test)
+CREATE TABLE IF NOT EXISTS t1 (pk INT PRIMARY KEY, i INT, KEY(i)) ENGINE=InnoDB;
+
+--connection default
+--error 1412
+UPDATE t1 SET i = 0;
+--error 1412
+UPDATE t1 SET pk = 0;
+commit;
+
+drop table t1;
diff --git a/mysql-test/suite/innodb/t/xa_recovery.test b/mysql-test/suite/innodb/t/xa_recovery.test
index 837b33cb3c4..2c1034f3c4d 100644
--- a/mysql-test/suite/innodb/t/xa_recovery.test
+++ b/mysql-test/suite/innodb/t/xa_recovery.test
@@ -6,6 +6,12 @@ if (`select plugin_auth_version <= "5.6.24" from information_schema.plugins wher
# Embedded server does not support restarting.
--source include/not_embedded.inc
+# MDEV-8841 - close tables opened by previous tests,
+# so they don't get marked crashed when the server gets crashed
+--disable_query_log
+FLUSH TABLES;
+--enable_query_log
+
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
connect (con1,localhost,root);
diff --git a/mysql-test/suite/jp/t/jp_enum_sjis-master.opt b/mysql-test/suite/jp/t/jp_enum_sjis-master.opt
deleted file mode 100644
index 9b27aef9bf8..00000000000
--- a/mysql-test/suite/jp/t/jp_enum_sjis-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---lower_case_table_names=0
diff --git a/mysql-test/suite/jp/t/jp_enum_sjis.test b/mysql-test/suite/jp/t/jp_enum_sjis.test
index e1f22f6fe27..1060f83ec06 100644
--- a/mysql-test/suite/jp/t/jp_enum_sjis.test
+++ b/mysql-test/suite/jp/t/jp_enum_sjis.test
@@ -1,3 +1,7 @@
+#Server variable option 'lower_case_table_names' sets '0' as default value
+#in case sensitive filesystem. Using 'lower_case_table_names=0' in case of
+#insensitive filsystem is not allowed.
+-- source include/have_case_sensitive_file_system.inc
--source include/have_sjis.inc
--source include/have_innodb.inc
--character_set sjis
diff --git a/mysql-test/suite/jp/t/jp_enum_ucs2-master.opt b/mysql-test/suite/jp/t/jp_enum_ucs2-master.opt
deleted file mode 100644
index 9b27aef9bf8..00000000000
--- a/mysql-test/suite/jp/t/jp_enum_ucs2-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---lower_case_table_names=0
diff --git a/mysql-test/suite/jp/t/jp_enum_ucs2.test b/mysql-test/suite/jp/t/jp_enum_ucs2.test
index a3d7c47705d..321f8952148 100644
--- a/mysql-test/suite/jp/t/jp_enum_ucs2.test
+++ b/mysql-test/suite/jp/t/jp_enum_ucs2.test
@@ -1,3 +1,7 @@
+#Server variable option 'lower_case_table_names' sets '0' as default value
+#in case sensitive filesystem. Using 'lower_case_table_names=0' in case of
+#insensitive filsystem is not allowed.
+-- source include/have_case_sensitive_file_system.inc
--source include/have_ucs2.inc
--source include/have_innodb.inc
diff --git a/mysql-test/suite/jp/t/jp_enum_ujis-master.opt b/mysql-test/suite/jp/t/jp_enum_ujis-master.opt
deleted file mode 100644
index 9b27aef9bf8..00000000000
--- a/mysql-test/suite/jp/t/jp_enum_ujis-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---lower_case_table_names=0
diff --git a/mysql-test/suite/jp/t/jp_enum_ujis.test b/mysql-test/suite/jp/t/jp_enum_ujis.test
index 17e41e0691e..10e8ad55a3c 100644
--- a/mysql-test/suite/jp/t/jp_enum_ujis.test
+++ b/mysql-test/suite/jp/t/jp_enum_ujis.test
@@ -1,3 +1,7 @@
+#Server variable option 'lower_case_table_names' sets '0' as default value
+#in case sensitive filesystem. Using 'lower_case_table_names=0' in case of
+#insensitive filsystem is not allowed.
+-- source include/have_case_sensitive_file_system.inc
--source include/have_ujis.inc
--source include/have_innodb.inc
diff --git a/mysql-test/suite/jp/t/jp_enum_utf8-master.opt b/mysql-test/suite/jp/t/jp_enum_utf8-master.opt
deleted file mode 100644
index 9b27aef9bf8..00000000000
--- a/mysql-test/suite/jp/t/jp_enum_utf8-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---lower_case_table_names=0
diff --git a/mysql-test/suite/jp/t/jp_enum_utf8.test b/mysql-test/suite/jp/t/jp_enum_utf8.test
index ff5978da69c..f67939bd02b 100644
--- a/mysql-test/suite/jp/t/jp_enum_utf8.test
+++ b/mysql-test/suite/jp/t/jp_enum_utf8.test
@@ -1,3 +1,7 @@
+#Server variable option 'lower_case_table_names' sets '0' as default value
+#in case sensitive filesystem. Using 'lower_case_table_names=0' in case of
+#insensitive filsystem is not allowed.
+-- source include/have_case_sensitive_file_system.inc
--source include/have_utf8.inc
--source include/have_innodb.inc
--disable_warnings
diff --git a/mysql-test/suite/parts/r/partition_debug.result b/mysql-test/suite/parts/r/partition_debug.result
index 3f0f2def790..109072be49c 100644
--- a/mysql-test/suite/parts/r/partition_debug.result
+++ b/mysql-test/suite/parts/r/partition_debug.result
@@ -1,5 +1,21 @@
DROP TABLE IF EXISTS t1;
#
+# Bug#13737949: CRASH IN HA_PARTITION::INDEX_INIT
+# Bug#18694052: SERVER CRASH IN HA_PARTITION::INIT_RECORD_PRIORITY_QUEUE
+#
+CREATE TABLE t1 (a INT, b VARCHAR(64), KEY(b,a))
+PARTITION BY HASH (a) PARTITIONS 3;
+INSERT INTO t1 VALUES (1, "1"), (2, "2"), (3, "3"), (4, "Four"), (5, "Five"),
+(6, "Six"), (7, "Seven"), (8, "Eight"), (9, "Nine");
+SET SESSION debug_dbug="+d,ha_partition_fail_index_init";
+SELECT * FROM t1 WHERE b = "Seven";
+ERROR HY000: Table has no partition for value 0
+SET SESSION debug_dbug="-d,ha_partition_fail_index_init";
+SELECT * FROM t1 WHERE b = "Seven";
+a b
+7 Seven
+DROP TABLE t1;
+#
# WL#4445: EXCHANGE PARTITION WITH TABLE
# Verify ddl_log in case of crashing.
call mtr.add_suppression("Attempting backtrace. You can use the following information to find out");
diff --git a/mysql-test/suite/parts/t/partition_debug.test b/mysql-test/suite/parts/t/partition_debug.test
index aa943e5fbe1..11b66e4afd8 100644
--- a/mysql-test/suite/parts/t/partition_debug.test
+++ b/mysql-test/suite/parts/t/partition_debug.test
@@ -12,6 +12,24 @@
DROP TABLE IF EXISTS t1;
--enable_warnings
+# Partitioning test that require debug features
+
+--echo #
+--echo # Bug#13737949: CRASH IN HA_PARTITION::INDEX_INIT
+--echo # Bug#18694052: SERVER CRASH IN HA_PARTITION::INIT_RECORD_PRIORITY_QUEUE
+--echo #
+CREATE TABLE t1 (a INT, b VARCHAR(64), KEY(b,a))
+ PARTITION BY HASH (a) PARTITIONS 3;
+ INSERT INTO t1 VALUES (1, "1"), (2, "2"), (3, "3"), (4, "Four"), (5, "Five"),
+ (6, "Six"), (7, "Seven"), (8, "Eight"), (9, "Nine");
+SET SESSION debug_dbug="+d,ha_partition_fail_index_init";
+--error ER_NO_PARTITION_FOR_GIVEN_VALUE
+SELECT * FROM t1 WHERE b = "Seven";
+SET SESSION debug_dbug="-d,ha_partition_fail_index_init";
+SELECT * FROM t1 WHERE b = "Seven";
+DROP TABLE t1;
+
+
--let $DATADIR= `SELECT @@datadir;`
--echo #
diff --git a/mysql-test/suite/perfschema/r/misc.result b/mysql-test/suite/perfschema/r/misc.result
index a50c4ffa297..433d793909f 100644
--- a/mysql-test/suite/perfschema/r/misc.result
+++ b/mysql-test/suite/perfschema/r/misc.result
@@ -92,3 +92,18 @@ object_schema object_name index_name count_fetch count_insert count_update count
test t_60905 i 2 0 0 1
test t_60905 NULL 5 5 0 1
DROP TABLE t_60905;
+use test;
+truncate performance_schema.events_statements_history;
+truncate performance_schema.events_statements_history_long;
+select * from t1;
+ERROR 42S02: Table 'test.t1' doesn't exist
+
+select mysql_errno, returned_sqlstate, message_text, errors, warnings
+from performance_schema.events_statements_history where errors > 0;
+mysql_errno returned_sqlstate message_text errors warnings
+1146 42S02 Table 'test.t1' doesn't exist 1 0
+
+select mysql_errno, returned_sqlstate, message_text, errors, warnings from
+performance_schema.events_statements_history_long where errors > 0;
+mysql_errno returned_sqlstate message_text errors warnings
+1146 42S02 Table 'test.t1' doesn't exist 1 0
diff --git a/mysql-test/suite/perfschema/r/query_cache.result b/mysql-test/suite/perfschema/r/query_cache.result
index 8786cd055ca..837c2573a72 100644
--- a/mysql-test/suite/perfschema/r/query_cache.result
+++ b/mysql-test/suite/perfschema/r/query_cache.result
@@ -38,7 +38,7 @@ spins
NULL
select * from performance_schema.setup_timers where name='wait';
NAME TIMER_NAME
-wait CYCLE
+wait {CYCLE_OR_NANOSECOND}
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 1
@@ -53,7 +53,7 @@ spins
NULL
select * from performance_schema.setup_timers where name='wait';
NAME TIMER_NAME
-wait CYCLE
+wait {CYCLE_OR_NANOSECOND}
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 1
diff --git a/mysql-test/suite/perfschema/t/misc.test b/mysql-test/suite/perfschema/t/misc.test
index af19e8db51d..00b175ec391 100644
--- a/mysql-test/suite/perfschema/t/misc.test
+++ b/mysql-test/suite/perfschema/t/misc.test
@@ -169,3 +169,23 @@ SELECT object_schema,
DROP TABLE t_60905;
+
+#
+# Bug#11929832 - EVENTS_STATEMENTS_HISTORY HAS ERRORS=0 WHEN THERE ARE ERRORS
+#
+# Verify that SQL errors are properly counted.
+
+use test;
+truncate performance_schema.events_statements_history;
+truncate performance_schema.events_statements_history_long;
+
+--error ER_NO_SUCH_TABLE
+select * from t1;
+
+--echo
+select mysql_errno, returned_sqlstate, message_text, errors, warnings
+ from performance_schema.events_statements_history where errors > 0;
+
+--echo
+select mysql_errno, returned_sqlstate, message_text, errors, warnings from
+ performance_schema.events_statements_history_long where errors > 0;
diff --git a/mysql-test/suite/perfschema/t/query_cache.test b/mysql-test/suite/perfschema/t/query_cache.test
index 60d4a648222..802e574f89b 100644
--- a/mysql-test/suite/perfschema/t/query_cache.test
+++ b/mysql-test/suite/perfschema/t/query_cache.test
@@ -34,6 +34,7 @@ show status like "Qcache_hits";
select spins from performance_schema.events_waits_current order by event_name limit 1;
+--replace_result CYCLE {CYCLE_OR_NANOSECOND} NANOSECOND {CYCLE_OR_NANOSECOND}
select * from performance_schema.setup_timers where name='wait';
show status like "Qcache_queries_in_cache";
@@ -42,6 +43,7 @@ show status like "Qcache_hits";
select spins from performance_schema.events_waits_current order by event_name limit 1;
+--replace_result CYCLE {CYCLE_OR_NANOSECOND} NANOSECOND {CYCLE_OR_NANOSECOND}
select * from performance_schema.setup_timers where name='wait';
show status like "Qcache_queries_in_cache";
diff --git a/mysql-test/suite/plugins/r/feedback_plugin_load.result b/mysql-test/suite/plugins/r/feedback_plugin_load.result
index e5d1296ae53..fa8724c321d 100644
--- a/mysql-test/suite/plugins/r/feedback_plugin_load.result
+++ b/mysql-test/suite/plugins/r/feedback_plugin_load.result
@@ -1,10 +1,13 @@
select plugin_status from information_schema.plugins where plugin_name='feedback';
plugin_status
ACTIVE
+SELECT variable_value INTO @feedback_used FROM information_schema.feedback where variable_name = 'FEEDBACK used';
+SELECT variable_value = @feedback_used + 1 FROM information_schema.feedback where variable_name = 'FEEDBACK used';
+variable_value = @feedback_used + 1
+1
select * from information_schema.feedback where variable_name like 'feed%'
- and variable_name not like '%_uid';
+ and variable_name not like '%_uid' and variable_name not like 'FEEDBACK used';
VARIABLE_NAME VARIABLE_VALUE
-FEEDBACK used 1
FEEDBACK version 1.1
FEEDBACK_SEND_RETRY_WAIT 60
FEEDBACK_SEND_TIMEOUT 60
diff --git a/mysql-test/suite/plugins/r/feedback_plugin_send.result b/mysql-test/suite/plugins/r/feedback_plugin_send.result
index 304294b417e..c4ad3717a16 100644
--- a/mysql-test/suite/plugins/r/feedback_plugin_send.result
+++ b/mysql-test/suite/plugins/r/feedback_plugin_send.result
@@ -1,10 +1,13 @@
select plugin_status from information_schema.plugins where plugin_name='feedback';
plugin_status
ACTIVE
+SELECT variable_value INTO @feedback_used FROM information_schema.feedback where variable_name = 'FEEDBACK used';
+SELECT variable_value = @feedback_used + 1 FROM information_schema.feedback where variable_name = 'FEEDBACK used';
+variable_value = @feedback_used + 1
+1
select * from information_schema.feedback where variable_name like 'feed%'
- and variable_name not like '%_uid';
+ and variable_name not like '%_uid' and variable_name not like 'FEEDBACK used';
VARIABLE_NAME VARIABLE_VALUE
-FEEDBACK used 3
FEEDBACK version 1.1
FEEDBACK_SEND_RETRY_WAIT 60
FEEDBACK_SEND_TIMEOUT 60
diff --git a/mysql-test/suite/plugins/t/feedback_plugin_load.test b/mysql-test/suite/plugins/t/feedback_plugin_load.test
index b1bcb2a6bbd..f2f8c1f97a7 100644
--- a/mysql-test/suite/plugins/t/feedback_plugin_load.test
+++ b/mysql-test/suite/plugins/t/feedback_plugin_load.test
@@ -4,11 +4,27 @@ if (`select count(*) = 0 from information_schema.plugins where plugin_name = 'fe
}
select plugin_status from information_schema.plugins where plugin_name='feedback';
+
+# Every SELECT from INFORMATION_SCHEMA.FEEDBACK increases the value of 'FEEDBACK used'.
+# We cannot record the actual value, because the test can be executed more than once,
+# but we can check that the value indeed increases as expected.
+# There is still a room for some race condition, e.g. if at the very moment
+# between first SELECT to store the value and the next SELECT to check that it increases,
+# the feedback plugin is activated. But the probability of it is close to 0,
+# so lets get back to it if it ever happens.
+
+# Lets say the plugin was used X times before this SELECT
+SELECT variable_value INTO @feedback_used FROM information_schema.feedback where variable_name = 'FEEDBACK used';
+
+# Now $feedback_used == X+1, and 'FEEDBACK used' is also X+1. And variable_value is increased again when we run the next SELECT
+SELECT variable_value = @feedback_used + 1 FROM information_schema.feedback where variable_name = 'FEEDBACK used';
+
+# Now when we are happy with 'FEEDBACK used', we can check everything else
+
--replace_result https http
--sorted_result
select * from information_schema.feedback where variable_name like 'feed%'
- and variable_name not like '%_uid';
-
+ and variable_name not like '%_uid' and variable_name not like 'FEEDBACK used';
# Embedded server does not use the table mysqld.user and thus
# does not automatically use latin1_bin on startup. Use it manually.
diff --git a/mysql-test/suite/plugins/t/feedback_plugin_send.test b/mysql-test/suite/plugins/t/feedback_plugin_send.test
index 45b507f8e78..31542c33482 100644
--- a/mysql-test/suite/plugins/t/feedback_plugin_send.test
+++ b/mysql-test/suite/plugins/t/feedback_plugin_send.test
@@ -14,6 +14,15 @@ if (!$MTR_FEEDBACK_PLUGIN) {
# is doing some work in other workers.
#
sleep 310;
+
+# The test expects that the plugin will send a report at least 2 times,
+# now (5 min after loading) and on server shutdown which happens below.
+# Since we have already waited for 5 min, let's be generous
+# and make sure the server has enough time to shut down properly.
+# We won't lose anything if the shutdown is fast, but if it's slow, the plugin
+# will still be able to finish the job and write about it in the error log.
+
+--let $shutdown_timeout= 60
source include/restart_mysqld.inc;
replace_result https http;
diff --git a/mysql-test/suite/roles/create_and_drop_role.result b/mysql-test/suite/roles/create_and_drop_role.result
index 79c6f412111..d565b888c5f 100644
--- a/mysql-test/suite/roles/create_and_drop_role.result
+++ b/mysql-test/suite/roles/create_and_drop_role.result
@@ -36,6 +36,10 @@ select user, host, is_role from user where user like 'test%';
user host is_role
create role '';
ERROR OP000: Invalid role specification ``.
+create role ' ';
+ERROR OP000: Invalid role specification ``.
+create role 'foo ';
+drop role foo;
create role r1;
drop user r1;
ERROR HY000: Operation DROP USER failed for 'r1'@'%'
diff --git a/mysql-test/suite/roles/create_and_drop_role.test b/mysql-test/suite/roles/create_and_drop_role.test
index 0bf5b744e6b..71d6de7053f 100644
--- a/mysql-test/suite/roles/create_and_drop_role.test
+++ b/mysql-test/suite/roles/create_and_drop_role.test
@@ -53,6 +53,14 @@ connection default;
create role '';
#
+# MDEV-8609 Server crashes in is_invalid_role_name on reloading ACL with a blank role name
+#
+--error ER_INVALID_ROLE
+create role ' ';
+create role 'foo ';
+drop role foo;
+
+#
# MDEV-5523 Server crashes on DROP USER <rolename>
#
create role r1;
diff --git a/mysql-test/suite/roles/ip-6401.test b/mysql-test/suite/roles/ip-6401.test
index 34d8553afa3..b7d4b168b75 100644
--- a/mysql-test/suite/roles/ip-6401.test
+++ b/mysql-test/suite/roles/ip-6401.test
@@ -1,3 +1,6 @@
+#
+# MDEV-6401 SET ROLE returning ERROR 1959 Invalid role specification for valid role
+#
--source include/not_embedded.inc
create role r1;
create user foo@'127.0.0.1';
diff --git a/mysql-test/suite/roles/rebuild_role_grants.result b/mysql-test/suite/roles/rebuild_role_grants.result
index 2817c046ae9..bc68d8ddc9f 100644
--- a/mysql-test/suite/roles/rebuild_role_grants.result
+++ b/mysql-test/suite/roles/rebuild_role_grants.result
@@ -56,3 +56,9 @@ Host User Role Admin_option
localhost root r1 Y
drop role r1;
drop user u2;
+create user foo@localhost;
+grant create user on *.* to foo@localhost;
+create role look, isp, xxx, ppp;
+rename user current_user to nnnn@'%';
+drop role look, isp, xxx, ppp;
+drop user nnnn@'%';
diff --git a/mysql-test/suite/roles/rebuild_role_grants.test b/mysql-test/suite/roles/rebuild_role_grants.test
index 3ec3577317a..84dbdf78fb8 100644
--- a/mysql-test/suite/roles/rebuild_role_grants.test
+++ b/mysql-test/suite/roles/rebuild_role_grants.test
@@ -54,3 +54,16 @@ select * from mysql.roles_mapping;
drop role r1;
drop user u2;
+
+#
+# MDEV-8614 Assertion `status == 0' failed in add_role_user_mapping_action on RENAME USER
+#
+create user foo@localhost;
+grant create user on *.* to foo@localhost;
+--connect (con1, localhost, foo,,)
+create role look, isp, xxx, ppp;
+rename user current_user to nnnn@'%';
+drop role look, isp, xxx, ppp;
+connection default;
+disconnect con1;
+drop user nnnn@'%';
diff --git a/mysql-test/suite/rpl/r/rpl_gtid_mdev4820.result b/mysql-test/suite/rpl/r/rpl_gtid_mdev4820.result
index cf488e889b4..be420cb021b 100644
--- a/mysql-test/suite/rpl/r/rpl_gtid_mdev4820.result
+++ b/mysql-test/suite/rpl/r/rpl_gtid_mdev4820.result
@@ -18,6 +18,7 @@ RESET MASTER;
SET GLOBAL gtid_slave_pos= 'OLD_GTID_POS';
include/start_slave.inc
INSERT INTO t1 VALUES (4);
+include/save_master_gtid.inc
SET sql_log_bin= 0;
CALL mtr.add_suppression("The binlog on the master is missing the GTID");
SET sql_log_bin= 1;
@@ -25,6 +26,7 @@ include/wait_for_slave_io_error.inc [errno=1236]
STOP SLAVE SQL_THREAD;
SET GLOBAL gtid_slave_pos= 'OLD_GTID_POS';
include/start_slave.inc
+include/sync_with_master_gtid.inc
SELECT * FROM t1 ORDER BY a;
a
1
diff --git a/mysql-test/suite/rpl/r/rpl_mdev8193.result b/mysql-test/suite/rpl/r/rpl_mdev8193.result
new file mode 100644
index 00000000000..ad92d32e7d4
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_mdev8193.result
@@ -0,0 +1,24 @@
+include/master-slave.inc
+[connection master]
+include/stop_slave_sql.inc
+CALL mtr.add_suppression("Statement is unsafe because it uses a system function that may return a different value on the slave");
+create table t1 (i int);
+insert into t1 values (1),(2);
+insert into t1 values (3),(4);
+insert into t1 select i+20+0*sleep(1) from t1 where i=1;
+Warnings:
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
+flush logs;
+insert into t1 values (5),(6);
+insert into t1 values (7),(8);
+insert into t1 values (9),(10);
+insert into t1 values (11),(12);
+insert into t1 values (13),(14);
+insert into t1 values (15),(16);
+set global slave_parallel_threads = 1;
+start slave until master_log_file='MASTER_FILE', master_log_pos=MASTER_POS;
+drop table t1;
+include/stop_slave_io.inc
+set global slave_parallel_threads = DEFAULT;
+drop table t1;
+include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_parallel.result b/mysql-test/suite/rpl/r/rpl_parallel.result
index de67f5f0610..81243bbba49 100644
--- a/mysql-test/suite/rpl/r/rpl_parallel.result
+++ b/mysql-test/suite/rpl/r/rpl_parallel.result
@@ -1689,6 +1689,24 @@ a b
include/stop_slave.inc
SET GLOBAL debug_dbug=@old_dbug;
include/start_slave.inc
+*** MDEV-8725: Assertion on ROLLBACK statement in the binary log ***
+BEGIN;
+INSERT INTO t2 VALUES (200);
+INSERT INTO t1 VALUES (200);
+INSERT INTO t2 VALUES (201);
+ROLLBACK;
+SELECT * FROM t1 WHERE a>=200 ORDER BY a;
+a
+200
+SELECT * FROM t2 WHERE a>=200 ORDER BY a;
+a
+include/save_master_gtid.inc
+include/sync_with_master_gtid.inc
+SELECT * FROM t1 WHERE a>=200 ORDER BY a;
+a
+200
+SELECT * FROM t2 WHERE a>=200 ORDER BY a;
+a
include/stop_slave.inc
SET GLOBAL slave_parallel_threads=@old_parallel_threads;
include/start_slave.inc
diff --git a/mysql-test/suite/rpl/r/rpl_row_reset_slave.result b/mysql-test/suite/rpl/r/rpl_row_reset_slave.result
index 1cf70ba7e67..33284ce58c6 100644
--- a/mysql-test/suite/rpl/r/rpl_row_reset_slave.result
+++ b/mysql-test/suite/rpl/r/rpl_row_reset_slave.result
@@ -47,7 +47,7 @@ include/start_slave.inc
include/stop_slave.inc
reset slave all;
start slave;
-ERROR HY000: The server is not configured as slave; fix in config file or with CHANGE MASTER TO
+ERROR HY000: Misconfigured slave: MASTER_HOST was not set; Fix in config file or with CHANGE MASTER TO
CHANGE MASTER TO MASTER_HOST= 'MASTER_HOST', MASTER_USER= 'MASTER_USER', MASTER_PORT= MASTER_PORT;
include/start_slave.inc
include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_row_to_stmt.result b/mysql-test/suite/rpl/r/rpl_row_to_stmt.result
new file mode 100644
index 00000000000..2dfa82b0305
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_row_to_stmt.result
@@ -0,0 +1,28 @@
+include/master-slave.inc
+[connection master]
+use test;
+create table t1 (a int primary key);
+insert into t1 values (1),(2),(3),(4),(5);
+update t1 set a=a*10;
+use test;
+select * from t1;
+a
+10
+20
+30
+40
+50
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+slave-bin.000001 # Gtid # # GTID #-#-#
+slave-bin.000001 # Query # # use `test`; create table t1 (a int primary key)
+slave-bin.000001 # Gtid # # BEGIN GTID #-#-#
+slave-bin.000001 # Table_map # # table_id: # (test.t1)
+slave-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
+slave-bin.000001 # Query # # COMMIT
+slave-bin.000001 # Gtid # # BEGIN GTID #-#-#
+slave-bin.000001 # Table_map # # table_id: # (test.t1)
+slave-bin.000001 # Update_rows_v1 # # table_id: # flags: STMT_END_F
+slave-bin.000001 # Query # # COMMIT
+drop table t1;
+include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_stm_reset_slave.result b/mysql-test/suite/rpl/r/rpl_stm_reset_slave.result
index e5870cec2c9..7eb29085099 100644
--- a/mysql-test/suite/rpl/r/rpl_stm_reset_slave.result
+++ b/mysql-test/suite/rpl/r/rpl_stm_reset_slave.result
@@ -47,7 +47,7 @@ include/start_slave.inc
include/stop_slave.inc
reset slave all;
start slave;
-ERROR HY000: The server is not configured as slave; fix in config file or with CHANGE MASTER TO
+ERROR HY000: Misconfigured slave: MASTER_HOST was not set; Fix in config file or with CHANGE MASTER TO
CHANGE MASTER TO MASTER_HOST= 'MASTER_HOST', MASTER_USER= 'MASTER_USER', MASTER_PORT= MASTER_PORT;
include/start_slave.inc
include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_gtid_mdev4820.test b/mysql-test/suite/rpl/t/rpl_gtid_mdev4820.test
index 304816a65d1..7f4d851f95c 100644
--- a/mysql-test/suite/rpl/t/rpl_gtid_mdev4820.test
+++ b/mysql-test/suite/rpl/t/rpl_gtid_mdev4820.test
@@ -34,7 +34,7 @@ eval SET GLOBAL gtid_slave_pos= '$old_gtid_pos';
--connection server_1
INSERT INTO t1 VALUES (4);
---save_master_pos
+--source include/save_master_gtid.inc
--connection server_2
SET sql_log_bin= 0;
@@ -48,7 +48,7 @@ STOP SLAVE SQL_THREAD;
eval SET GLOBAL gtid_slave_pos= '$old_gtid_pos';
--source include/start_slave.inc
---sync_with_master
+--source include/sync_with_master_gtid.inc
SELECT * FROM t1 ORDER BY a;
--source include/stop_slave.inc
diff --git a/mysql-test/suite/rpl/t/rpl_innodb_bug30888.opt b/mysql-test/suite/rpl/t/rpl_innodb_bug30888.opt
new file mode 100644
index 00000000000..e6685732d90
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_innodb_bug30888.opt
@@ -0,0 +1 @@
+--innodb-flush-log-at-trx-commit=2
diff --git a/mysql-test/suite/rpl/t/rpl_mdev8193.test b/mysql-test/suite/rpl/t/rpl_mdev8193.test
new file mode 100644
index 00000000000..29c26bb3da4
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_mdev8193.test
@@ -0,0 +1,56 @@
+--source include/master-slave.inc
+--source include/have_binlog_format_statement.inc
+
+--connection slave
+
+--source include/stop_slave_sql.inc
+
+--connection master
+
+CALL mtr.add_suppression("Statement is unsafe because it uses a system function that may return a different value on the slave");
+create table t1 (i int);
+insert into t1 values (1),(2);
+insert into t1 values (3),(4);
+# This sleep() helps trigger the failure more reliably.
+insert into t1 select i+20+0*sleep(1) from t1 where i=1;
+flush logs;
+insert into t1 values (5),(6);
+insert into t1 values (7),(8);
+insert into t1 values (9),(10);
+
+--let $master_file = query_get_value(show master status,File,1)
+--let $master_pos = query_get_value(show master status,Position,1)
+
+insert into t1 values (11),(12);
+insert into t1 values (13),(14);
+insert into t1 values (15),(16);
+
+--connection slave
+
+set global slave_parallel_threads = 1;
+--replace_result $master_file MASTER_FILE $master_pos MASTER_POS
+eval start slave until master_log_file='$master_file', master_log_pos=$master_pos;
+
+--let $show_statement = SHOW SLAVE STATUS
+--let $field = Slave_SQL_Running
+--let $condition = = 'No'
+--let $wait_timeout = 10
+
+--source include/wait_show_condition.inc
+
+if (`select COUNT(*) > 11 from t1`)
+{
+ query_vertical show slave status;
+ SELECT * FROM t1;
+ die "Wrong number of rows in the table";
+}
+
+drop table t1;
+--source include/stop_slave_io.inc
+set global slave_parallel_threads = DEFAULT;
+
+--connection master
+drop table t1;
+
+--let $rpl_only_running_threads= 1
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_parallel.test b/mysql-test/suite/rpl/t/rpl_parallel.test
index e70dcfa5bb0..01a46637f07 100644
--- a/mysql-test/suite/rpl/t/rpl_parallel.test
+++ b/mysql-test/suite/rpl/t/rpl_parallel.test
@@ -2369,6 +2369,28 @@ SET GLOBAL debug_dbug=@old_dbug;
+--echo *** MDEV-8725: Assertion on ROLLBACK statement in the binary log ***
+--connection server_1
+# Inject an event group terminated by ROLLBACK, by mixing MyISAM and InnoDB
+# in a transaction. The bug was an assertion on the ROLLBACK due to
+# mark_start_commit() being already called.
+--disable_warnings
+BEGIN;
+INSERT INTO t2 VALUES (200);
+INSERT INTO t1 VALUES (200);
+INSERT INTO t2 VALUES (201);
+ROLLBACK;
+--enable_warnings
+SELECT * FROM t1 WHERE a>=200 ORDER BY a;
+SELECT * FROM t2 WHERE a>=200 ORDER BY a;
+--source include/save_master_gtid.inc
+
+--connection server_2
+--source include/sync_with_master_gtid.inc
+SELECT * FROM t1 WHERE a>=200 ORDER BY a;
+SELECT * FROM t2 WHERE a>=200 ORDER BY a;
+
+
# Clean up.
--connection server_2
--source include/stop_slave.inc
diff --git a/mysql-test/suite/rpl/t/rpl_row_to_stmt-master.opt b/mysql-test/suite/rpl/t/rpl_row_to_stmt-master.opt
new file mode 100644
index 00000000000..83ed8522e72
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_row_to_stmt-master.opt
@@ -0,0 +1 @@
+--binlog-format=row
diff --git a/mysql-test/suite/rpl/t/rpl_row_to_stmt-slave.opt b/mysql-test/suite/rpl/t/rpl_row_to_stmt-slave.opt
new file mode 100644
index 00000000000..af3a211967b
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_row_to_stmt-slave.opt
@@ -0,0 +1 @@
+--binlog-format=statement
diff --git a/mysql-test/suite/rpl/t/rpl_row_to_stmt.test b/mysql-test/suite/rpl/t/rpl_row_to_stmt.test
new file mode 100644
index 00000000000..5ca583d881f
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_row_to_stmt.test
@@ -0,0 +1,23 @@
+#
+# check that master starterd with log-format=ROW replication can replicate to
+# slave started with log-format=STATEMENT
+#
+
+--source include/have_binlog_format_row.inc
+--source include/master-slave.inc
+
+use test;
+
+create table t1 (a int primary key);
+insert into t1 values (1),(2),(3),(4),(5);
+update t1 set a=a*10;
+
+sync_slave_with_master;
+use test;
+select * from t1;
+source include/show_binlog_events.inc;
+
+connection master;
+drop table t1;
+
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/sys_vars/r/innodb_monitor_disable_basic.result b/mysql-test/suite/sys_vars/r/innodb_monitor_disable_basic.result
index 8c0af874228..654b6fc51dd 100644
--- a/mysql-test/suite/sys_vars/r/innodb_monitor_disable_basic.result
+++ b/mysql-test/suite/sys_vars/r/innodb_monitor_disable_basic.result
@@ -123,6 +123,9 @@ os_log_bytes_written disabled
os_log_fsyncs disabled
os_log_pending_fsyncs disabled
os_log_pending_writes disabled
+os_merge_blocks_written disabled
+os_merge_blocks_read disabled
+os_merge_blocks_merged disabled
trx_rw_commits disabled
trx_ro_commits disabled
trx_nl_ro_commits disabled
@@ -254,6 +257,9 @@ lock_row_lock_time disabled
lock_row_lock_time_max disabled
lock_row_lock_waits disabled
lock_row_lock_time_avg disabled
+os_merge_blocks_written disabled
+os_merge_blocks_read disabled
+os_merge_blocks_merged disabled
innodb_rwlock_s_spin_waits disabled
innodb_rwlock_x_spin_waits disabled
innodb_rwlock_s_spin_rounds disabled
@@ -292,6 +298,9 @@ os_log_bytes_written disabled
os_log_fsyncs disabled
os_log_pending_fsyncs enabled
os_log_pending_writes enabled
+os_merge_blocks_written disabled
+os_merge_blocks_read disabled
+os_merge_blocks_merged disabled
set global innodb_monitor_enable="";
ERROR 42000: Variable 'innodb_monitor_enable' can't be set to the value of ''
set global innodb_monitor_enable="_";
diff --git a/mysql-test/suite/sys_vars/r/innodb_monitor_enable_basic.result b/mysql-test/suite/sys_vars/r/innodb_monitor_enable_basic.result
index 8c0af874228..654b6fc51dd 100644
--- a/mysql-test/suite/sys_vars/r/innodb_monitor_enable_basic.result
+++ b/mysql-test/suite/sys_vars/r/innodb_monitor_enable_basic.result
@@ -123,6 +123,9 @@ os_log_bytes_written disabled
os_log_fsyncs disabled
os_log_pending_fsyncs disabled
os_log_pending_writes disabled
+os_merge_blocks_written disabled
+os_merge_blocks_read disabled
+os_merge_blocks_merged disabled
trx_rw_commits disabled
trx_ro_commits disabled
trx_nl_ro_commits disabled
@@ -254,6 +257,9 @@ lock_row_lock_time disabled
lock_row_lock_time_max disabled
lock_row_lock_waits disabled
lock_row_lock_time_avg disabled
+os_merge_blocks_written disabled
+os_merge_blocks_read disabled
+os_merge_blocks_merged disabled
innodb_rwlock_s_spin_waits disabled
innodb_rwlock_x_spin_waits disabled
innodb_rwlock_s_spin_rounds disabled
@@ -292,6 +298,9 @@ os_log_bytes_written disabled
os_log_fsyncs disabled
os_log_pending_fsyncs enabled
os_log_pending_writes enabled
+os_merge_blocks_written disabled
+os_merge_blocks_read disabled
+os_merge_blocks_merged disabled
set global innodb_monitor_enable="";
ERROR 42000: Variable 'innodb_monitor_enable' can't be set to the value of ''
set global innodb_monitor_enable="_";
diff --git a/mysql-test/suite/sys_vars/r/innodb_monitor_reset_all_basic.result b/mysql-test/suite/sys_vars/r/innodb_monitor_reset_all_basic.result
index 8c0af874228..654b6fc51dd 100644
--- a/mysql-test/suite/sys_vars/r/innodb_monitor_reset_all_basic.result
+++ b/mysql-test/suite/sys_vars/r/innodb_monitor_reset_all_basic.result
@@ -123,6 +123,9 @@ os_log_bytes_written disabled
os_log_fsyncs disabled
os_log_pending_fsyncs disabled
os_log_pending_writes disabled
+os_merge_blocks_written disabled
+os_merge_blocks_read disabled
+os_merge_blocks_merged disabled
trx_rw_commits disabled
trx_ro_commits disabled
trx_nl_ro_commits disabled
@@ -254,6 +257,9 @@ lock_row_lock_time disabled
lock_row_lock_time_max disabled
lock_row_lock_waits disabled
lock_row_lock_time_avg disabled
+os_merge_blocks_written disabled
+os_merge_blocks_read disabled
+os_merge_blocks_merged disabled
innodb_rwlock_s_spin_waits disabled
innodb_rwlock_x_spin_waits disabled
innodb_rwlock_s_spin_rounds disabled
@@ -292,6 +298,9 @@ os_log_bytes_written disabled
os_log_fsyncs disabled
os_log_pending_fsyncs enabled
os_log_pending_writes enabled
+os_merge_blocks_written disabled
+os_merge_blocks_read disabled
+os_merge_blocks_merged disabled
set global innodb_monitor_enable="";
ERROR 42000: Variable 'innodb_monitor_enable' can't be set to the value of ''
set global innodb_monitor_enable="_";
diff --git a/mysql-test/suite/sys_vars/r/innodb_monitor_reset_basic.result b/mysql-test/suite/sys_vars/r/innodb_monitor_reset_basic.result
index 8c0af874228..654b6fc51dd 100644
--- a/mysql-test/suite/sys_vars/r/innodb_monitor_reset_basic.result
+++ b/mysql-test/suite/sys_vars/r/innodb_monitor_reset_basic.result
@@ -123,6 +123,9 @@ os_log_bytes_written disabled
os_log_fsyncs disabled
os_log_pending_fsyncs disabled
os_log_pending_writes disabled
+os_merge_blocks_written disabled
+os_merge_blocks_read disabled
+os_merge_blocks_merged disabled
trx_rw_commits disabled
trx_ro_commits disabled
trx_nl_ro_commits disabled
@@ -254,6 +257,9 @@ lock_row_lock_time disabled
lock_row_lock_time_max disabled
lock_row_lock_waits disabled
lock_row_lock_time_avg disabled
+os_merge_blocks_written disabled
+os_merge_blocks_read disabled
+os_merge_blocks_merged disabled
innodb_rwlock_s_spin_waits disabled
innodb_rwlock_x_spin_waits disabled
innodb_rwlock_s_spin_rounds disabled
@@ -292,6 +298,9 @@ os_log_bytes_written disabled
os_log_fsyncs disabled
os_log_pending_fsyncs enabled
os_log_pending_writes enabled
+os_merge_blocks_written disabled
+os_merge_blocks_read disabled
+os_merge_blocks_merged disabled
set global innodb_monitor_enable="";
ERROR 42000: Variable 'innodb_monitor_enable' can't be set to the value of ''
set global innodb_monitor_enable="_";
diff --git a/mysql-test/t/alter_table.test b/mysql-test/t/alter_table.test
index 4dde3ed6971..05d915ec478 100644
--- a/mysql-test/t/alter_table.test
+++ b/mysql-test/t/alter_table.test
@@ -1699,3 +1699,16 @@ alter table t1 add unique index if not exists idx(i);
alter table t1 add unique index if not exists idx(i);
show create table t1;
DROP TABLE t1;
+
+#
+# MDEV-8358 ADD PRIMARY KEY IF NOT EXISTS -> ERROR 1068 (42000): Multiple primary key
+#
+
+CREATE TABLE t1 (
+ `event_id` bigint(20) unsigned NOT NULL DEFAULT '0',
+ `market_id` bigint(20) unsigned NOT NULL DEFAULT '0',
+ PRIMARY KEY (`event_id`,`market_id`)
+ );
+ALTER TABLE t1 ADD PRIMARY KEY IF NOT EXISTS event_id (event_id,market_id);
+DROP TABLE t1;
+
diff --git a/mysql-test/t/derived.test b/mysql-test/t/derived.test
index ddce7f55292..d98e7b56905 100644
--- a/mysql-test/t/derived.test
+++ b/mysql-test/t/derived.test
@@ -492,7 +492,38 @@ update t1 set balance=(select sum(balance) from (SELECT balance FROM t1 where ac
set optimizer_switch=@save_derived_optimizer_switch_bug;
drop table t1;
-set optimizer_switch=@save_derived_optimizer_switch;
+--echo #
+--echo # MDEV-6219:Server crashes in Bitmap<64u>::merge
+--echo # (this=0x180, map2=...) on 2nd execution of PS with INSERT .. SELECT,
+--echo # derived_merge
+--echo #
+
+CREATE TABLE t1 (a VARCHAR(8)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES ('foo'),('bar');
+
+create procedure p1()
+ INSERT INTO t1 SELECT * FROM (
+ SELECT * FROM t1
+ ) AS sq
+ WHERE sq.a IN ( SELECT 'baz' FROM DUAL );
+
+call p1();
+call p1();
+drop procedure p1;
+
+PREPARE stmt FROM "
+ INSERT INTO t1 SELECT * FROM (
+ SELECT * FROM t1
+ ) AS sq
+ WHERE sq.a IN ( SELECT 'baz' FROM DUAL )
+";
+
+EXECUTE stmt;
+EXECUTE stmt;
+
+deallocate prepare stmt;
+
+drop table t1;
--echo #
--echo # MDEV-6892: WHERE does not apply
@@ -506,3 +537,5 @@ select x.id, message from (select id from t1) x left join
(select id, 1 as message from t2) y on x.id=y.id
where coalesce(message,0) <> 0;
drop table t1,t2;
+
+set optimizer_switch=@save_derived_optimizer_switch;
diff --git a/mysql-test/t/dyncol.test b/mysql-test/t/dyncol.test
index 86dcee8148a..ac55fec3e2b 100644
--- a/mysql-test/t/dyncol.test
+++ b/mysql-test/t/dyncol.test
@@ -872,5 +872,17 @@ set impressions = column_add(impressions,
drop table t1;
--echo #
+--echo # MDEV-8565: COLUMN_CHECK fails on valid data
+--echo #
+
+SELECT COLUMN_CHECK(COLUMN_CREATE('a',0,'b','1'));
+
+SELECT COLUMN_CHECK(COLUMN_CREATE('a',1,'b','1'));
+
+SELECT COLUMN_JSON(COLUMN_CREATE('a',0,'b','1'));
+
+SELECT COLUMN_JSON(COLUMN_CREATE('a',1,'b','1'));
+
+--echo #
--echo # end of 10.0 tests
--echo #
diff --git a/mysql-test/t/empty_server_name-8224.test b/mysql-test/t/empty_server_name-8224.test
index 528bce5dac5..b15e9d82eb8 100644
--- a/mysql-test/t/empty_server_name-8224.test
+++ b/mysql-test/t/empty_server_name-8224.test
@@ -7,3 +7,7 @@ create server '' foreign data wrapper w2 options (host '127.0.0.1');
--shutdown_server 10
--source include/wait_until_disconnected.inc
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+
+-- enable_reconnect
+-- source include/wait_until_connected_again.inc
+drop server '';
diff --git a/mysql-test/t/events_1.test b/mysql-test/t/events_1.test
index 89e8f9ca7dc..eecd11da5f6 100644
--- a/mysql-test/t/events_1.test
+++ b/mysql-test/t/events_1.test
@@ -125,7 +125,8 @@ drop event existant;
create table t_event3 (a int, b float);
drop event if exists event3;
-create event event3 on schedule every 50 + 10 minute starts date_add("20100101", interval 5 minute) ends date_add("20151010", interval 5 day) comment "portokala_comment" DO insert into t_event3 values (unix_timestamp(), rand());
+create event event3 on schedule every 50 + 10 minute starts date_add("20100101", interval 5 minute) ends date_add("20251010", interval 5 day)
+ comment "portokala_comment" DO insert into t_event3 values (unix_timestamp(), rand());
let $wait_condition=SELECT count(*)=0 from t_event3;
--source include/wait_condition.inc
select count(*) from t_event3;
diff --git a/mysql-test/t/events_restart.test b/mysql-test/t/events_restart.test
index c6152e5d961..7f01859e059 100644
--- a/mysql-test/t/events_restart.test
+++ b/mysql-test/t/events_restart.test
@@ -71,9 +71,9 @@ drop event intact_check_1;
drop event intact_check_2;
--error ER_EVENTS_DB_ERROR
drop event intact_check;
---error ER_EVENTS_DB_ERROR
+--error ER_STARTUP
set global event_scheduler=on;
---error ER_EVENTS_DB_ERROR
+--error ER_STARTUP
set global event_scheduler=off;
show variables like 'event_scheduler';
--echo Make sure that we still can create and drop databases,
@@ -84,6 +84,16 @@ drop database mysqltest_db1;
--echo Restore the original mysql.event table
drop table mysql.event;
rename table event_like to mysql.event;
+
+--echo check that we can now enable events without restart
+set global event_scheduler=original;
+select @@global.event_scheduler;
+set global event_scheduler=on;
+select @@global.event_scheduler;
+--sorted_result
+--replace_column 6 # 9 # 10 #
+show events;
+
--echo Now let's restart the server again
--source include/restart_mysqld.inc
diff --git a/mysql-test/t/explain_non_select.test b/mysql-test/t/explain_non_select.test
index e36fd518b61..d9ff0fb7245 100644
--- a/mysql-test/t/explain_non_select.test
+++ b/mysql-test/t/explain_non_select.test
@@ -208,3 +208,45 @@ INSERT INTO t1 VALUES (1),(2);
EXPLAIN UPDATE v1, mysql.user SET v1.a = v1.a + 1;
DROP TABLE t1;
DROP VIEW v1;
+
+--echo #
+--echo # MDEV-8299: MyISAM or Aria table gets corrupted after EXPLAIN INSERT and INSERT
+--echo #
+CREATE TABLE t1 (pk INT NOT NULL AUTO_INCREMENT PRIMARY KEY, i INT, KEY(i)) ENGINE=MyISAM;
+INSERT INTO t1 (i) VALUES (100),(200);
+
+CREATE TABLE t2 (j INT) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (10),(20);
+
+EXPLAIN INSERT INTO t1 (i) SELECT j FROM t2;
+INSERT INTO t1 (i) VALUES (300);
+CHECK TABLE t1;
+
+DROP TABLE t1, t2;
+
+--echo #
+--echo # MDEV-8321: Assertion `! is_set()' failed in Diagnostics_area::set_eof_status on EXPLAIN INSERT ... UNION
+--echo #
+
+CREATE TABLE t1 (a INT);
+CREATE TABLE t2 (b INT);
+CREATE TABLE t3 (c INT);
+
+# Data is not necessary, tables can be empty as well
+INSERT INTO t1 VALUES (1),(2);
+INSERT INTO t2 VALUES (3),(4);
+INSERT INTO t3 VALUES (5),(6);
+
+EXPLAIN INSERT INTO t1 SELECT * FROM t2 UNION SELECT * FROM t3;
+drop table t1,t2,t3;
+
+--echo #
+--echo # MDEV-6223: Assertion `! is_set()' fails in Diagnostics_area::set_eof_status on EXPLAIN INSERT executed as a PS
+--echo #
+CREATE TABLE t1 (a INT) ENGINE = MyISAM;
+CREATE TABLE t2 (b INT) ENGINE = MyISAM;
+INSERT INTO t2 VALUES (1),(2);
+PREPARE stmt FROM 'EXPLAIN INSERT INTO t1 SELECT * FROM t2';
+EXECUTE stmt;
+drop table t1,t2;
+
diff --git a/mysql-test/t/func_if.test b/mysql-test/t/func_if.test
index 2b89a618aa6..8fdba77db9b 100644
--- a/mysql-test/t/func_if.test
+++ b/mysql-test/t/func_if.test
@@ -206,6 +206,20 @@ SELECT if(1, NULL, (SELECT min('hello')));
--echo End of 5.2 tests
+--echo #
+--echo # MDEV-8663: IF Statement returns multiple values erroneously
+--echo # (or Assertion `!null_value' failed in Item::send(Protocol*, String*)
+--echo #
+CREATE TABLE `t1` (
+`datas` VARCHAR(25) NOT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+INSERT INTO `t1` VALUES ('1,2'), ('2,3'), ('3,4');
+
+SELECT IF(FIND_IN_SET('1', `datas`), 1.5, IF(FIND_IN_SET('2', `datas`), 2, NULL)) AS `First`, '1' AS `Second`, '2' AS `Third` FROM `t1`;
+
+drop table t1;
+
--disable_query_log
# Restore timezone to default
set time_zone= @@global.time_zone;
diff --git a/mysql-test/t/func_misc.test b/mysql-test/t/func_misc.test
index 916a952fa3a..26e379299fc 100644
--- a/mysql-test/t/func_misc.test
+++ b/mysql-test/t/func_misc.test
@@ -398,6 +398,209 @@ SELECT GET_LOCK('ul1', NULL);
SELECT GET_LOCK('ul1', -1);
--echo #
+--echo # MDEV-8624 MariaDB hangs on query with many logical condition
+--echo #
+CREATE TABLE `t1` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `submitdate` datetime DEFAULT NULL,
+ `lastpage` int(11) DEFAULT NULL,
+ `startlanguage` varchar(20) COLLATE utf8_unicode_ci NOT NULL,
+ `token` varchar(36) COLLATE utf8_unicode_ci DEFAULT NULL,
+ `datestamp` datetime NOT NULL,
+ `startdate` datetime NOT NULL,
+ `ipaddr` text COLLATE utf8_unicode_ci,
+ `refurl` text COLLATE utf8_unicode_ci,
+ `57813X540X1723` text COLLATE utf8_unicode_ci,
+ `57813X540X1724` text COLLATE utf8_unicode_ci,
+ `57813X540X1725` text COLLATE utf8_unicode_ci,
+ `57813X540X1726` double DEFAULT NULL,
+ `57813X540X1909` double DEFAULT NULL,
+ `57813X541X17271` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
+ `57813X541X17272` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
+ `57813X541X17273` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
+ `57813X541X17274` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
+ `57813X541X17275` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
+ `57813X541X17276` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
+ `57813X541X17281` text COLLATE utf8_unicode_ci,
+ `57813X541X17282` text COLLATE utf8_unicode_ci,
+ `57813X541X17283` text COLLATE utf8_unicode_ci,
+ `57813X541X17284` text COLLATE utf8_unicode_ci,
+ `57813X541X17285` text COLLATE utf8_unicode_ci,
+ `57813X541X17286` text COLLATE utf8_unicode_ci,
+ `57813X542X18131` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
+ `57813X542X18132` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
+ `57813X542X18133` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
+ `57813X542X18134` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
+ `57813X542X18135` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
+ `57813X542X18136` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
+ `57813X542X18137` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
+ `57813X542X18138` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
+ `57813X542X18139` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
+ `57813X542X18141` text COLLATE utf8_unicode_ci,
+ `57813X542X18142` text COLLATE utf8_unicode_ci,
+ `57813X542X18143` text COLLATE utf8_unicode_ci,
+ `57813X542X18144` text COLLATE utf8_unicode_ci,
+ `57813X542X18145` text COLLATE utf8_unicode_ci,
+ `57813X542X18146` text COLLATE utf8_unicode_ci,
+ `57813X542X18147` text COLLATE utf8_unicode_ci,
+ `57813X542X18148` text COLLATE utf8_unicode_ci,
+ `57813X542X18149` text COLLATE utf8_unicode_ci,
+ `57813X543X18451` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
+ `57813X543X18452` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
+ `57813X543X18453` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
+ `57813X543X18454` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
+ `57813X543X18455` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
+ `57813X543X18456` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
+ `57813X543X18461` text COLLATE utf8_unicode_ci,
+ `57813X543X18462` text COLLATE utf8_unicode_ci,
+ `57813X543X18463` text COLLATE utf8_unicode_ci,
+ `57813X543X18464` text COLLATE utf8_unicode_ci,
+ `57813X543X18465` text COLLATE utf8_unicode_ci,
+ `57813X543X18466` text COLLATE utf8_unicode_ci,
+ `57813X544X18711` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
+ `57813X544X18712` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
+ `57813X544X18713` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
+ `57813X544X18714` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
+ `57813X544X18715` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
+ `57813X544X18716` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
+ `57813X544X18717` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
+ `57813X544X18718` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
+ `57813X544X18721` text COLLATE utf8_unicode_ci,
+ `57813X544X18722` text COLLATE utf8_unicode_ci,
+ `57813X544X18723` text COLLATE utf8_unicode_ci,
+ `57813X544X18724` text COLLATE utf8_unicode_ci,
+ `57813X544X18725` text COLLATE utf8_unicode_ci,
+ `57813X544X18726` text COLLATE utf8_unicode_ci,
+ `57813X544X18727` text COLLATE utf8_unicode_ci,
+ `57813X544X18728` text COLLATE utf8_unicode_ci,
+ `57813X546X1902` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
+ `57813X546X1903` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
+ `57813X546X1904` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
+ `57813X545X1901` varchar(1) COLLATE utf8_unicode_ci DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ KEY `lime_survey_57813_idx` (`token`),
+ KEY `57813X540X1723` (`57813X540X1723`(100)),
+ KEY `57813X540X1724` (`57813X540X1724`(100)),
+ KEY `57813X540X1726` (`57813X540X1726`),
+ KEY `57813X540X1725` (`57813X540X1725`(100)),
+ KEY `57813X546X1902` (`57813X546X1902`),
+ KEY `57813X546X1903` (`57813X546X1903`),
+ KEY `57813X546X1904` (`57813X546X1904`)
+);
+
+SELECT
+COUNT(*) as `N`,
+ROUND(
+ (
+ SUM(
+ (
+ (
+ IF( 57813X541X17271 IS NOT NULL AND 57813X541X17271 != '' AND 57813X541X17271 != '99', 57813X541X17271, 0 ) +
+ IF( 57813X541X17272 IS NOT NULL AND 57813X541X17272 != '' AND 57813X541X17272 != '99', 57813X541X17272, 0 ) +
+ IF( 57813X541X17273 IS NOT NULL AND 57813X541X17273 != '' AND 57813X541X17273 != '99', 57813X541X17273, 0 ) +
+ IF( 57813X541X17274 IS NOT NULL AND 57813X541X17274 != '' AND 57813X541X17274 != '99', 57813X541X17274, 0 ) +
+ IF( 57813X541X17275 IS NOT NULL AND 57813X541X17275 != '' AND 57813X541X17275 != '99', 57813X541X17275, 0 ) +
+ IF( 57813X541X17276 IS NOT NULL AND 57813X541X17276 != '' AND 57813X541X17276 != '99', 57813X541X17276, 0 ) +
+ IF( 57813X542X18131 IS NOT NULL AND 57813X542X18131 != '' AND 57813X542X18131 != '99', 57813X542X18131, 0 ) +
+ IF( 57813X542X18132 IS NOT NULL AND 57813X542X18132 != '' AND 57813X542X18132 != '99', 57813X542X18132, 0 ) +
+ IF( 57813X542X18133 IS NOT NULL AND 57813X542X18133 != '' AND 57813X542X18133 != '99', 57813X542X18133, 0 ) +
+ IF( 57813X542X18134 IS NOT NULL AND 57813X542X18134 != '' AND 57813X542X18134 != '99', 57813X542X18134, 0 ) +
+ IF( 57813X542X18135 IS NOT NULL AND 57813X542X18135 != '' AND 57813X542X18135 != '99', 57813X542X18135, 0 ) +
+ IF( 57813X542X18136 IS NOT NULL AND 57813X542X18136 != '' AND 57813X542X18136 != '99', 57813X542X18136, 0 ) +
+ IF( 57813X542X18137 IS NOT NULL AND 57813X542X18137 != '' AND 57813X542X18137 != '99', 57813X542X18137, 0 ) +
+ IF( 57813X542X18138 IS NOT NULL AND 57813X542X18138 != '' AND 57813X542X18138 != '99', 57813X542X18138, 0 ) +
+ IF( 57813X542X18139 IS NOT NULL AND 57813X542X18139 != '' AND 57813X542X18139 != '99', 57813X542X18139, 0 ) +
+ IF( 57813X543X18451 IS NOT NULL AND 57813X543X18451 != '' AND 57813X543X18451 != '99', 57813X543X18451, 0 ) +
+ IF( 57813X543X18452 IS NOT NULL AND 57813X543X18452 != '' AND 57813X543X18452 != '99', 57813X543X18452, 0 ) +
+ IF( 57813X543X18453 IS NOT NULL AND 57813X543X18453 != '' AND 57813X543X18453 != '99', 57813X543X18453, 0 ) +
+ IF( 57813X543X18454 IS NOT NULL AND 57813X543X18454 != '' AND 57813X543X18454 != '99', 57813X543X18454, 0 ) +
+ IF( 57813X543X18455 IS NOT NULL AND 57813X543X18455 != '' AND 57813X543X18455 != '99', 57813X543X18455, 0 ) +
+ IF( 57813X543X18456 IS NOT NULL AND 57813X543X18456 != '' AND 57813X543X18456 != '99', 57813X543X18456, 0 ) +
+ IF( 57813X544X18711 IS NOT NULL AND 57813X544X18711 != '' AND 57813X544X18711 != '99', 57813X544X18711, 0 ) +
+ IF( 57813X544X18712 IS NOT NULL AND 57813X544X18712 != '' AND 57813X544X18712 != '99', 57813X544X18712, 0 ) +
+ IF( 57813X544X18713 IS NOT NULL AND 57813X544X18713 != '' AND 57813X544X18713 != '99', 57813X544X18713, 0 ) +
+ IF( 57813X544X18714 IS NOT NULL AND 57813X544X18714 != '' AND 57813X544X18714 != '99', 57813X544X18714, 0 ) +
+ IF( 57813X544X18715 IS NOT NULL AND 57813X544X18715 != '' AND 57813X544X18715 != '99', 57813X544X18715, 0 ) +
+ IF( 57813X544X18716 IS NOT NULL AND 57813X544X18716 != '' AND 57813X544X18716 != '99', 57813X544X18716, 0 ) +
+ IF( 57813X544X18717 IS NOT NULL AND 57813X544X18717 != '' AND 57813X544X18717 != '99', 57813X544X18717, 0 ) +
+ IF( 57813X544X18718 IS NOT NULL AND 57813X544X18718 != '' AND 57813X544X18718 != '99', 57813X544X18718, 0 )
+ )
+ /
+ (
+ IF( 57813X541X17271 IS NOT NULL AND 57813X541X17271 != '' AND 57813X541X17271 != '99', 1, 0 ) +
+ IF( 57813X541X17272 IS NOT NULL AND 57813X541X17272 != '' AND 57813X541X17272 != '99', 1, 0 ) +
+ IF( 57813X541X17273 IS NOT NULL AND 57813X541X17273 != '' AND 57813X541X17273 != '99', 1, 0 ) +
+ IF( 57813X541X17274 IS NOT NULL AND 57813X541X17274 != '' AND 57813X541X17274 != '99', 1, 0 ) +
+ IF( 57813X541X17275 IS NOT NULL AND 57813X541X17275 != '' AND 57813X541X17275 != '99', 1, 0 ) +
+ IF( 57813X541X17276 IS NOT NULL AND 57813X541X17276 != '' AND 57813X541X17276 != '99', 1, 0 ) +
+ IF( 57813X542X18131 IS NOT NULL AND 57813X542X18131 != '' AND 57813X542X18131 != '99', 1, 0 ) +
+ IF( 57813X542X18132 IS NOT NULL AND 57813X542X18132 != '' AND 57813X542X18132 != '99', 1, 0 ) +
+ IF( 57813X542X18133 IS NOT NULL AND 57813X542X18133 != '' AND 57813X542X18133 != '99', 1, 0 ) +
+ IF( 57813X542X18134 IS NOT NULL AND 57813X542X18134 != '' AND 57813X542X18134 != '99', 1, 0 ) +
+ IF( 57813X542X18135 IS NOT NULL AND 57813X542X18135 != '' AND 57813X542X18135 != '99', 1, 0 ) +
+ IF( 57813X542X18136 IS NOT NULL AND 57813X542X18136 != '' AND 57813X542X18136 != '99', 1, 0 ) +
+ IF( 57813X542X18137 IS NOT NULL AND 57813X542X18137 != '' AND 57813X542X18137 != '99', 1, 0 ) +
+ IF( 57813X542X18138 IS NOT NULL AND 57813X542X18138 != '' AND 57813X542X18138 != '99', 1, 0 ) +
+ IF( 57813X542X18139 IS NOT NULL AND 57813X542X18139 != '' AND 57813X542X18139 != '99', 1, 0 ) +
+ IF( 57813X543X18451 IS NOT NULL AND 57813X543X18451 != '' AND 57813X543X18451 != '99', 1, 0 ) +
+ IF( 57813X543X18452 IS NOT NULL AND 57813X543X18452 != '' AND 57813X543X18452 != '99', 1, 0 ) +
+ IF( 57813X543X18453 IS NOT NULL AND 57813X543X18453 != '' AND 57813X543X18453 != '99', 1, 0 ) +
+ IF( 57813X543X18454 IS NOT NULL AND 57813X543X18454 != '' AND 57813X543X18454 != '99', 1, 0 ) +
+ IF( 57813X543X18455 IS NOT NULL AND 57813X543X18455 != '' AND 57813X543X18455 != '99', 1, 0 ) +
+ IF( 57813X543X18456 IS NOT NULL AND 57813X543X18456 != '' AND 57813X543X18456 != '99', 1, 0 ) +
+ IF( 57813X544X18711 IS NOT NULL AND 57813X544X18711 != '' AND 57813X544X18711 != '99', 1, 0 ) +
+ IF( 57813X544X18712 IS NOT NULL AND 57813X544X18712 != '' AND 57813X544X18712 != '99', 1, 0 ) +
+ IF( 57813X544X18713 IS NOT NULL AND 57813X544X18713 != '' AND 57813X544X18713 != '99', 1, 0 ) +
+ IF( 57813X544X18714 IS NOT NULL AND 57813X544X18714 != '' AND 57813X544X18714 != '99', 1, 0 ) +
+ IF( 57813X544X18715 IS NOT NULL AND 57813X544X18715 != '' AND 57813X544X18715 != '99', 1, 0 ) +
+ IF( 57813X544X18716 IS NOT NULL AND 57813X544X18716 != '' AND 57813X544X18716 != '99', 1, 0 ) +
+ IF( 57813X544X18717 IS NOT NULL AND 57813X544X18717 != '' AND 57813X544X18717 != '99', 1, 0 ) +
+ IF( 57813X544X18718 IS NOT NULL AND 57813X544X18718 != '' AND 57813X544X18718 != '99', 1, 0 )
+ )
+ )
+ )
+ / COUNT(*) ), 4) as `AVG`
+FROM `t1`
+WHERE `submitdate` IS NOT NULL
+AND (
+ ( 57813X541X17271 IS NOT NULL AND 57813X541X17271 != '' AND 57813X541X17271 != '99' ) OR
+ ( 57813X541X17272 IS NOT NULL AND 57813X541X17272 != '' AND 57813X541X17272 != '99' ) OR
+ ( 57813X541X17273 IS NOT NULL AND 57813X541X17273 != '' AND 57813X541X17273 != '99' ) OR
+ ( 57813X541X17274 IS NOT NULL AND 57813X541X17274 != '' AND 57813X541X17274 != '99' ) OR
+ ( 57813X541X17275 IS NOT NULL AND 57813X541X17275 != '' AND 57813X541X17275 != '99' ) OR
+ ( 57813X541X17276 IS NOT NULL AND 57813X541X17276 != '' AND 57813X541X17276 != '99' ) OR
+ ( 57813X542X18131 IS NOT NULL AND 57813X542X18131 != '' AND 57813X542X18131 != '99' ) OR
+ ( 57813X542X18132 IS NOT NULL AND 57813X542X18132 != '' AND 57813X542X18132 != '99' ) OR
+ ( 57813X542X18133 IS NOT NULL AND 57813X542X18133 != '' AND 57813X542X18133 != '99' ) OR
+ ( 57813X542X18134 IS NOT NULL AND 57813X542X18134 != '' AND 57813X542X18134 != '99' ) OR
+ ( 57813X542X18135 IS NOT NULL AND 57813X542X18135 != '' AND 57813X542X18135 != '99' ) OR
+ ( 57813X542X18136 IS NOT NULL AND 57813X542X18136 != '' AND 57813X542X18136 != '99' ) OR
+ ( 57813X542X18137 IS NOT NULL AND 57813X542X18137 != '' AND 57813X542X18137 != '99' ) OR
+ ( 57813X542X18138 IS NOT NULL AND 57813X542X18138 != '' AND 57813X542X18138 != '99' ) OR
+ ( 57813X542X18139 IS NOT NULL AND 57813X542X18139 != '' AND 57813X542X18139 != '99' ) OR
+ ( 57813X543X18451 IS NOT NULL AND 57813X543X18451 != '' AND 57813X543X18451 != '99' ) OR
+ ( 57813X543X18452 IS NOT NULL AND 57813X543X18452 != '' AND 57813X543X18452 != '99' ) OR
+ ( 57813X543X18453 IS NOT NULL AND 57813X543X18453 != '' AND 57813X543X18453 != '99' ) OR
+ ( 57813X543X18454 IS NOT NULL AND 57813X543X18454 != '' AND 57813X543X18454 != '99' ) OR
+ ( 57813X543X18455 IS NOT NULL AND 57813X543X18455 != '' AND 57813X543X18455 != '99' ) OR
+ ( 57813X543X18456 IS NOT NULL AND 57813X543X18456 != '' AND 57813X543X18456 != '99' ) OR
+ ( 57813X544X18711 IS NOT NULL AND 57813X544X18711 != '' AND 57813X544X18711 != '99' ) OR
+ ( 57813X544X18712 IS NOT NULL AND 57813X544X18712 != '' AND 57813X544X18712 != '99' ) OR
+ ( 57813X544X18713 IS NOT NULL AND 57813X544X18713 != '' AND 57813X544X18713 != '99' ) OR
+ ( 57813X544X18714 IS NOT NULL AND 57813X544X18714 != '' AND 57813X544X18714 != '99' ) OR
+ ( 57813X544X18715 IS NOT NULL AND 57813X544X18715 != '' AND 57813X544X18715 != '99' ) OR
+ ( 57813X544X18716 IS NOT NULL AND 57813X544X18716 != '' AND 57813X544X18716 != '99' ) OR
+ ( 57813X544X18717 IS NOT NULL AND 57813X544X18717 != '' AND 57813X544X18717 != '99' ) OR
+ ( 57813X544X18718 IS NOT NULL AND 57813X544X18718 != '' AND 57813X544X18718 != '99' ) )
+AND 57813X540X1723 = 'Test';
+
+drop table t1;
+
+--echo #
+--echo # End of 5.5 tests
+--echo #
+
+--echo #
--echo # GET_LOCK, RELEASE_LOCK, IS_USED_LOCK functions test
--echo #
@@ -574,10 +777,6 @@ select is_free_lock(repeat('a', 193));
--error ER_TOO_LONG_IDENT
select release_lock(repeat('a', 193));
---echo #
---echo # End of 5.5 tests
---echo #
-
--echo
--echo # --
diff --git a/mysql-test/t/information_schema2.test b/mysql-test/t/information_schema2.test
index d577cdc1e4d..9810c5a0aae 100644
--- a/mysql-test/t/information_schema2.test
+++ b/mysql-test/t/information_schema2.test
@@ -8,15 +8,12 @@ select variable_name from information_schema.session_variables where variable_na
(select variable_name from information_schema.session_variables where variable_name = 'basedir');
#
-# information_schema tables inside subqueries, they should not be re-populated
-# (i_s.columns needs to scan i_s itself, creating a tmp table for every i_s
-# table. if it's re-populated, it'll do that multiple times)
+# MDEV-8796 Delete with sub query with information_schema.TABLES deletes too many rows
#
-create table t1 (a char);
-insert t1 values ('a'),('t'),('z');
-flush status;
-select a, exists (select 1 from information_schema.columns where table_schema=concat('tes',a)) from t1;
-# fix the result in ps-protocol
---replace_result 44 43
-show status like 'created_tmp_tables';
-drop table t1;
+create table t1 (x int);
+create table t2 (x int);
+create table t3 (x int);
+create table t4 AS select table_name from information_schema.TABLES where table_schema = database() and table_type = 'BASE TABLE' ;
+delete from t4 where table_name not in (select table_name from information_schema.TABLES where table_schema = database() and table_type = 'BASE TABLE');
+select * from t4;
+drop table t1, t2, t3, t4;
diff --git a/mysql-test/t/init_file_set_password-7656.test b/mysql-test/t/init_file_set_password-7656.test
new file mode 100644
index 00000000000..ecee3924355
--- /dev/null
+++ b/mysql-test/t/init_file_set_password-7656.test
@@ -0,0 +1,26 @@
+#
+# MDEV-7656 init_file option does not allow changing passwords
+#
+--source include/not_embedded.inc
+
+create user foo@localhost;
+
+select user,host,password from mysql.user where user='foo';
+
+--write_file $MYSQLTEST_VARDIR/init.file
+grant all on *.* to foo@localhost identified by 'test';
+EOF
+
+--enable_reconnect
+
+--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+
+--shutdown_server 10
+--source include/wait_until_disconnected.inc
+
+--exec echo "restart:--init-file=$MYSQLTEST_VARDIR/init.file " > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+
+--source include/wait_until_connected_again.inc
+select user,host,password from mysql.user where user='foo';
+
+drop user foo@localhost;
diff --git a/mysql-test/t/loadxml.test b/mysql-test/t/loadxml.test
index 6faf712b6ce..93e6e82189f 100644
--- a/mysql-test/t/loadxml.test
+++ b/mysql-test/t/loadxml.test
@@ -116,3 +116,17 @@ LOAD XML INFILE '../../std_data/loadxml.dat' INTO TABLE t1
ROWS IDENTIFIED BY '<row>' (a,@b) SET b=concat('!',@b);
SELECT * FROM t1 ORDER BY a;
DROP TABLE t1;
+
+
+--echo #
+--echo # Bug#16171518 LOAD XML DOES NOT HANDLE EMPTY ELEMENTS
+--echo #
+CREATE TABLE t1 (col1 VARCHAR(3), col2 VARCHAR(3), col3 VARCHAR(3), col4 VARCHAR(4));
+LOAD XML INFILE '../../std_data/bug16171518_1.dat' INTO TABLE t1;
+SELECT * FROM t1 ORDER BY col1, col2, col3, col4;
+DROP TABLE t1;
+
+CREATE TABLE t1 (col1 VARCHAR(3), col2 VARCHAR(3), col3 INTEGER);
+LOAD XML INFILE '../../std_data/bug16171518_2.dat' INTO TABLE t1;
+SELECT * FROM t1 ORDER BY col1, col2, col3;
+DROP TABLE t1;
diff --git a/mysql-test/t/lowercase_fs_on.test b/mysql-test/t/lowercase_fs_on.test
new file mode 100644
index 00000000000..6da3ef32a0b
--- /dev/null
+++ b/mysql-test/t/lowercase_fs_on.test
@@ -0,0 +1,38 @@
+#
+# Specific tests for case-insensitive file systems
+# i.e. lower_case_filesystem=ON
+#
+-- source include/have_case_insensitive_file_system.inc
+# Embedded server does not support restarting.
+--source include/not_embedded.inc
+
+--echo #
+--echo # Bug#20198490 : LOWER_CASE_TABLE_NAMES=0 ON WINDOWS LEADS TO PROBLEMS
+--echo #
+
+let SEARCH_FILE= $MYSQLTEST_VARDIR/log/my_restart.err;
+
+--error 0,1
+--remove_file $SEARCH_FILE
+
+#Shutdown the server
+--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+--shutdown_server
+--source include/wait_until_disconnected.inc
+
+#Start the server with --lower_case_table_names=0 in Windows.
+--enable_reconnect
+--error 1
+--exec $MYSQLD_CMD --lower_case_table_names=0 > $SEARCH_FILE 2>&1
+
+#Search for the error messege in the server error log.
+let SEARCH_PATTERN= \[ERROR\] The server option \'lower_case_table_names\' is configured to use case sensitive table names but the data directory is on a case-insensitive file system which is an unsupported combination\. Please consider either using a case sensitive file system for your data directory or switching to a case-insensitive table name mode\.;
+--source include/search_pattern_in_file.inc
+
+#Restart the server
+--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+--source include/wait_until_connected_again.inc
+
+#Cleanup
+--error 0,1
+--remove_file $SEARCH_FILE
diff --git a/mysql-test/t/lowercase_table3-master.opt b/mysql-test/t/lowercase_table3-master.opt
deleted file mode 100644
index 9b27aef9bf8..00000000000
--- a/mysql-test/t/lowercase_table3-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---lower_case_table_names=0
diff --git a/mysql-test/t/lowercase_table3.test b/mysql-test/t/lowercase_table3.test
deleted file mode 100644
index f7ca8211288..00000000000
--- a/mysql-test/t/lowercase_table3.test
+++ /dev/null
@@ -1,37 +0,0 @@
-#
-# Test of force of lower-case-table-names=0
-# (User has case insensitive file system and wants to preserve case of
-# table names)
-#
-
---source include/have_innodb.inc
---source include/have_lowercase0.inc
---source include/have_case_insensitive_file_system.inc
---source include/not_windows.inc
-
-call mtr.add_suppression("Cannot find or open table test/BUG29839 from");
-
---disable_warnings
-DROP TABLE IF EXISTS t1,T1;
---enable_warnings
-
-#
-# This is actually an error, but ok as the user has forced this
-# by using --lower-case-table-names=0
-CREATE TABLE t1 (a INT);
-SELECT * FROM T1;
-FLUSH TABLES;
-DROP TABLE t1;
-
-#
-# InnoDB should in this case be case sensitive
-# Note that this is not true on windows as no this OS, InnoDB is always
-# storing things in lower case.
-#
-
-CREATE TABLE bug29839 (a INT) ENGINE=INNODB;
---error ER_NO_SUCH_TABLE
-SELECT * FROM BUG29839;
-DROP TABLE bug29839;
-
-# End of 4.1 tests
diff --git a/mysql-test/t/mdev-504.test b/mysql-test/t/mdev-504.test
index bc38e99067a..fb5c7666d33 100644
--- a/mysql-test/t/mdev-504.test
+++ b/mysql-test/t/mdev-504.test
@@ -1,5 +1,7 @@
--disable_ps_protocol
+SET GLOBAL net_write_timeout = 900;
+
CREATE TABLE A (
pk INTEGER AUTO_INCREMENT PRIMARY KEY,
fdate DATE
@@ -74,4 +76,4 @@ DROP TABLE A;
DROP PROCEDURE p_analyze;
DROP FUNCTION rnd3;
SET GLOBAL use_stat_tables = DEFAULT;
-
+SET GLOBAL net_write_timeout = DEFAULT;
diff --git a/mysql-test/t/mysql_upgrade-6984.test b/mysql-test/t/mysql_upgrade-6984.test
index 6f10d3f33e9..9bbfbeb3f87 100644
--- a/mysql-test/t/mysql_upgrade-6984.test
+++ b/mysql-test/t/mysql_upgrade-6984.test
@@ -19,4 +19,5 @@ connect(con1,localhost,root,foo,,,);
update mysql.user set password='' where user='root';
flush privileges;
-
+# Load event table
+set global event_scheduler=OFF;
diff --git a/mysql-test/t/mysqldump.test b/mysql-test/t/mysqldump.test
index 9d6789541c0..677a66ab4c8 100644
--- a/mysql-test/t/mysqldump.test
+++ b/mysql-test/t/mysqldump.test
@@ -904,13 +904,8 @@ select * from t1;
create view v1 as
select * from v3 where b in (1, 2, 3, 4, 5, 6, 7);
-# Disable warnings since LIMIT warning for unsafe statement if
-# binlog_format = STATEMENT. Note: after BUG#45832, the warning should
-# not be issued.
---disable_warnings
create view v2 as
select v3.a from v3, v1 where v1.a=v3.a and v3.b=3 limit 1;
---enable_warnings
--exec $MYSQL_DUMP --skip-comments test
@@ -1780,7 +1775,7 @@ drop table words;
--replace_regex /.*mysqlimport(\.exe)*/mysqlimport/
--replace_result mysqldump.exe mysqldump
--error 1
---exec $MYSQL_IMPORT --silent --use-threads=2 test $MYSQLTEST_VARDIR/tmp/t1.txt $MYSQLTEST_VARDIR/tmp/t2.txt $MYSQLTEST_VARDIR/std_data/words.dat $MYSQLTEST_VARDIR/std_data/words2.dat 2>&1
+--exec $MYSQL_IMPORT --silent --use-threads=2 test $MYSQLTEST_VARDIR/tmp/t1.txt $MYSQLTEST_VARDIR/tmp/t2.txt $MYSQLTEST_VARDIR/std_data/words.dat $MYSQLTEST_VARDIR/std_data/words2.dat
drop table t1;
drop table t2;
@@ -2459,6 +2454,35 @@ drop table t1, t2;
--echo # End of 5.1 tests
--echo #
+--echo #
+--echo # Bug #20772273 : MYSQLIMPORT --USE-THREADS DOESN'T USE MULTIPLE THREADS
+--echo #
+
+CREATE DATABASE db_20772273;
+USE db_20772273;
+CREATE TABLE t1(a INT);
+INSERT INTO t1 VALUES (1), (2);
+CREATE TABLE t2(a INT);
+INSERT INTO t2 VALUES (3), (4);
+
+SELECT * FROM t1;
+SELECT * FROM t2;
+
+--exec $MYSQL_DUMP --tab=$MYSQLTEST_VARDIR/tmp/ db_20772273
+--exec $MYSQL db_20772273 < $MYSQLTEST_VARDIR/tmp/t1.sql
+--exec $MYSQL db_20772273 < $MYSQLTEST_VARDIR/tmp/t2.sql
+
+# Test mysqlimport with multiple threads
+--exec $MYSQL_IMPORT --silent --use-threads=2 db_20772273 $MYSQLTEST_VARDIR/tmp/t1.txt $MYSQLTEST_VARDIR/tmp/t2.txt
+
+SELECT * FROM t1;
+SELECT * FROM t2;
+
+#Cleanup
+DROP TABLE t1;
+DROP TABLE t2;
+DROP DATABASE db_20772273;
+
#
# MDEV-6091 mysqldump goes in a loop and segfaults if --dump-slave is specified and it cannot connect to the server
#
diff --git a/mysql-test/t/partition_alter.test b/mysql-test/t/partition_alter.test
new file mode 100644
index 00000000000..592d8fdaeaa
--- /dev/null
+++ b/mysql-test/t/partition_alter.test
@@ -0,0 +1,66 @@
+--source include/have_partition.inc
+
+CREATE TABLE `test_data` (
+ `hid` bigint(20) unsigned NOT NULL,
+ `itid` bigint(20) unsigned NOT NULL,
+ `clocktime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `values` double(16,4) NOT NULL,
+ PRIMARY KEY (`hid`,`itid`,`clocktime`)
+ ) ;
+
+INSERT INTO `test_data` (`hid`, `itid`, `clocktime`, `values`) VALUES
+ (1, 1, '2015-03-10 06:25:16', 0.0000),
+ (1, 1, '2015-03-10 06:26:24', 0.0000),
+ (1, 1, '2015-03-10 06:27:32', 0.0000),
+ (1, 1, '2015-03-10 06:28:40', 0.0000),
+ (1, 1, '2015-03-10 06:29:49', 0.0000),
+ (1, 1, '2015-03-10 06:30:57', 0.0000),
+ (1, 1, '2015-03-10 06:32:05', 0.0000),
+ (1, 1, '2015-03-10 06:33:14', 0.0000),
+ (1, 1, '2015-03-10 06:34:22', 0.0000),
+ (1, 1, '2015-03-10 06:35:30', 0.0000),
+ (1, 1, '2015-03-10 06:36:39', 0.0000),
+ (1, 1, '2015-03-10 06:37:47', 0.0000),
+ (1, 1, '2015-03-10 06:38:55', 0.0000),
+ (1, 1, '2015-03-10 06:40:03', 0.0000),
+ (1, 1, '2015-03-10 06:41:09', 0.0000),
+ (1, 1, '2015-03-10 06:42:21', 0.0000),
+ (1, 1, '2015-03-10 06:43:29', 0.0000),
+ (1, 1, '2015-03-10 06:44:37', 0.0000),
+ (1, 1, '2015-03-10 06:45:46', 0.0000),
+ (1, 1, '2015-03-10 06:47:05', 0.0000),
+ (1, 1, '2015-03-10 06:48:21', 0.0000),
+ (1, 1, '2015-03-10 06:49:41', 0.0000),
+ (1, 1, '2015-03-10 06:50:58', 0.0000),
+ (1, 1, '2015-03-10 06:52:08', 0.0000),
+ (1, 1, '2015-03-10 06:53:17', 0.0000),
+ (1, 1, '2015-03-10 06:54:25', 0.0000),
+ (563, 1, '2015-03-17 14:28:28', 0.3125),
+ (563, 1, '2015-03-17 14:29:39', 0.2775),
+ (563, 1, '2015-03-17 14:30:49', 0.2675);
+
+
+CREATE PROCEDURE `create_part_max`()
+ alter table `test_data`
+ partition by range(unix_timestamp(clocktime)) (
+ partition partMAX values less than MAXVALUE
+ );
+
+call create_part_max();
+
+call create_part_max();
+
+drop procedure create_part_max;
+
+prepare stmt from "alter table `test_data`
+ partition by range(unix_timestamp(clocktime)) (
+ partition partMAX values less than MAXVALUE
+ )";
+
+execute stmt;
+execute stmt;
+
+deallocate prepare stmt;
+
+drop table test_data;
+
diff --git a/mysql-test/t/partition_error.test b/mysql-test/t/partition_error.test
index 5396b9e3543..858213b1e30 100644
--- a/mysql-test/t/partition_error.test
+++ b/mysql-test/t/partition_error.test
@@ -1157,7 +1157,7 @@ subpartition by hash (rand(a+b));
#
# Subpartition by hash, wrong subpartition function
#
---error ER_SUBPARTITION_ERROR
+--error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
CREATE TABLE t1 (
a int not null,
b int not null,
diff --git a/mysql-test/t/partition_innodb.test b/mysql-test/t/partition_innodb.test
index 2d90764da0d..6845cca10fb 100644
--- a/mysql-test/t/partition_innodb.test
+++ b/mysql-test/t/partition_innodb.test
@@ -856,3 +856,45 @@ INSERT INTO t3 SELECT * FROM t2 WHERE f3 = 'm' AND f2 ='c';
DROP TABLE t1,t2,t3;
set global default_storage_engine=default;
+
+--echo #
+--echo # Bug#13737949: CRASH IN HA_PARTITION::INDEX_INIT
+--echo # Bug#18694052: SERVER CRASH IN HA_PARTITION::INIT_RECORD_PRIORITY_QUEUE
+--echo #
+CREATE TABLE t1
+(a INT,
+ b INT,
+ PRIMARY KEY (a))
+ ENGINE = InnoDB
+ PARTITION BY HASH (a) PARTITIONS 3;
+ START TRANSACTION WITH CONSISTENT SNAPSHOT;
+ --connect (con1, localhost, root,,)
+ --echo # con1
+ ALTER TABLE t1 ADD INDEX idx1 (b);
+ --connection default
+ --echo # con default
+ --error ER_TABLE_DEF_CHANGED
+ SELECT b FROM t1 WHERE b = 0;
+ --error ER_TABLE_DEF_CHANGED
+ SELECT b FROM t1 WHERE b = 0;
+ --disconnect con1
+ DROP TABLE t1;
+
+--echo # Same test without partitioning
+CREATE TABLE t1
+(a INT,
+ b INT,
+ PRIMARY KEY (a))
+ ENGINE = InnoDB;
+START TRANSACTION WITH CONSISTENT SNAPSHOT;
+--echo # con1
+--connect (con1, localhost, root,,)
+ALTER TABLE t1 ADD INDEX idx1 (b);
+--connection default
+--echo # con default
+--error ER_TABLE_DEF_CHANGED
+SELECT b FROM t1 WHERE b = 0;
+--error ER_TABLE_DEF_CHANGED
+SELECT b FROM t1 WHERE b = 0;
+--disconnect con1
+DROP TABLE t1;
diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test
index 0233b2e428b..c45b27281a7 100644
--- a/mysql-test/t/ps.test
+++ b/mysql-test/t/ps.test
@@ -3633,3 +3633,25 @@ SELECT 1 FROM t1 GROUP BY 0 OR 18446744073709551615+1;
drop table t1;
--echo # End of 5.3 tests
+
+--echo #
+--echo # MDEV-8756: MariaDB 10.0.21 crashes during PREPARE
+--echo #
+
+CREATE TABLE t1 ( id INT(10), value INT(10) );
+CREATE TABLE t2 ( id INT(10) );
+SET @save_sql_mode= @@sql_mode;
+SET SESSION sql_mode = 'ONLY_FULL_GROUP_BY';
+
+PREPARE stmt FROM 'UPDATE t1 t1 SET value = (SELECT 1 FROM t2 WHERE id = t1.id)';
+execute stmt;
+insert into t1 values (1,10),(2,10),(3,10);
+insert into t2 values (1),(2);
+execute stmt;
+select * from t1;
+deallocate prepare stmt;
+SET SESSION sql_mode = @save_sql_mode;
+DROP TABLE t1,t2;
+
+
+--echo # End of 10.0 tests
diff --git a/mysql-test/t/ps_change_master.test b/mysql-test/t/ps_change_master.test
new file mode 100644
index 00000000000..d756b8cd4fb
--- /dev/null
+++ b/mysql-test/t/ps_change_master.test
@@ -0,0 +1,45 @@
+--source include/not_embedded.inc
+--source include/have_log_bin.inc
+
+--echo #
+--echo # CHANGE MASTER TO doesn't work with prepared statements
+--echo #
+
+CHANGE MASTER TO MASTER_HOST='host1', MASTER_USER='user1';
+
+let $master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1);
+let $master_user= query_get_value(SHOW SLAVE STATUS, Master_User, 1);
+
+--echo # Master_Host : $master_host
+--echo # Master_User : $master_user
+
+SET @s := "CHANGE MASTER TO MASTER_HOST='host2'";
+PREPARE stmt FROM @s;
+EXECUTE stmt;
+DEALLOCATE PREPARE stmt;
+
+let $master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1);
+let $master_user= query_get_value(SHOW SLAVE STATUS, Master_User, 1);
+
+--echo # Master_Host : $master_host
+--echo # Master_User : $master_user
+
+SET @s := "CHANGE MASTER TO MASTER_USER='user2'";
+PREPARE stmt FROM @s;
+EXECUTE stmt;
+# Multiple executions should not hurt.
+EXECUTE stmt;
+EXECUTE stmt;
+DEALLOCATE PREPARE stmt;
+
+let $master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1);
+let $master_user= query_get_value(SHOW SLAVE STATUS, Master_User, 1);
+
+--echo # Master_Host : $master_host
+--echo # Master_User : $master_user
+
+
+# Reset
+CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root';
+
+--echo # End of test
diff --git a/mysql-test/t/selectivity_no_engine.test b/mysql-test/t/selectivity_no_engine.test
index fc425daff6d..2a31c01ed97 100644
--- a/mysql-test/t/selectivity_no_engine.test
+++ b/mysql-test/t/selectivity_no_engine.test
@@ -210,6 +210,23 @@ explain extended select * from t1 ta, t2 tb where ta.a < 40 and tb.a < 100 and t
drop table t0,t1,t2;
+--echo #
+--echo # MDEV-8779: mysqld got signal 11 in sql/opt_range_mrr.cc:100(step_down_to)
+--echo #
+set @tmp_mdev8779=@@optimizer_use_condition_selectivity;
+set optimizer_use_condition_selectivity=5;
+CREATE TABLE t1 (
+ i int(10) unsigned NOT NULL AUTO_INCREMENT,
+ n varchar(2048) NOT NULL,
+ d tinyint(1) unsigned NOT NULL,
+ p int(10) unsigned NOT NULL,
+ PRIMARY KEY (i)
+) DEFAULT CHARSET=utf8;
+insert into t1 values (1,'aaa',1,1), (2,'bbb',2,2);
+SELECT * FROM t1 WHERE t1.d = 0 AND t1.p = '1' AND t1.i != '-1' AND t1.n = 'some text';
+set optimizer_use_condition_selectivity= @tmp_mdev8779;
+DROP TABLE t1;
+
--echo #
--echo # End of the test file
--echo #
diff --git a/mysql-test/t/skip_grants.test b/mysql-test/t/skip_grants.test
index 6f4d23e1e14..77339478fdb 100644
--- a/mysql-test/t/skip_grants.test
+++ b/mysql-test/t/skip_grants.test
@@ -112,8 +112,8 @@ DROP FUNCTION f3;
#
# Bug #26807 "set global event_scheduler=1" and --skip-grant-tables crashes server
#
---error ER_OPTION_PREVENTS_STATEMENT
set global event_scheduler=1;
+set global event_scheduler=0;
#
# Bug#26285 Selecting information_schema crahes server
diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test
index d1c3774947a..d6a7300b03a 100644
--- a/mysql-test/t/subselect.test
+++ b/mysql-test/t/subselect.test
@@ -53,7 +53,7 @@ SELECT 1 IN (SELECT 1);
SELECT 1 FROM (SELECT 1 as a) b WHERE 1 IN (SELECT (SELECT a));
-- error ER_WRONG_USAGE
select (SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE(1));
--- error ER_WRONG_PARAMETERS_TO_PROCEDURE
+-- error ER_PARSE_ERROR
SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE((SELECT 1));
-- error ER_BAD_FIELD_ERROR
SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NULL;
@@ -5890,3 +5890,100 @@ DROP TABLE t1,t2;
create table t1 (c int);
select exists(select 1 from t1 group by `c` in (select `c` from t1));
drop table t1;
+
+--echo #
+--echo # MDEV-7565: Server crash with Signal 6 (part 2)
+--echo #
+Select
+ (Select Sum(`TestCase`.Revenue) From mysql.slow_log E
+ Where TestCase.TemplateID not in (Select 1 from mysql.slow_log where 2=2)
+ ) As `ControlRev`
+From
+(Select 3 as Revenue, 4 as TemplateID) As `TestCase`
+Group By TestCase.Revenue, TestCase.TemplateID;
+
+--echo #
+--echo # MDEV-7445:Server crash with Signal 6
+--echo #
+
+--delimiter |
+CREATE PROCEDURE procedure2()
+BEGIN
+ Select
+ (Select Sum(`TestCase`.Revenue) From mysql.slow_log E
+ Where TestCase.TemplateID not in (Select 1 from mysql.slow_log where 2=2)
+ ) As `ControlRev`
+ From
+ (Select 3 as Revenue, 4 as TemplateID) As `TestCase`
+ Group By TestCase.Revenue, TestCase.TemplateID;
+
+END |
+--delimiter ;
+call procedure2();
+call procedure2();
+
+drop procedure procedure2;
+
+
+SELECT
+ (SELECT user FROM mysql.user
+ WHERE h.host in (SELECT host FROM mysql.user)
+ ) AS sq
+FROM mysql.host h GROUP BY h.host;
+
+
+--echo #
+--echo # MDEV-7846:Server crashes in Item_subselect::fix
+--echo #_fields or fails with Thread stack overrun
+--echo #
+CREATE TABLE t1 (column1 INT) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (3),(9);
+
+CREATE TABLE t2 (column2 INT) ENGINE=MyISAM;
+
+INSERT INTO t2 VALUES (1),(4);
+
+CREATE TABLE t3 (column3 INT) ENGINE=MyISAM;
+INSERT INTO t3 VALUES (6),(8);
+
+CREATE TABLE t4 (column4 INT) ENGINE=MyISAM;
+INSERT INTO t4 VALUES (2),(5);
+
+
+PREPARE stmt FROM "
+SELECT (
+ SELECT MAX( table1.column1 ) AS field1
+ FROM t1 AS table1
+ WHERE table3.column3 IN ( SELECT table2.column2 AS field2 FROM t2 AS table2 )
+) AS sq
+FROM t3 AS table3, t4 AS table4 GROUP BY sq
+";
+
+EXECUTE stmt;
+EXECUTE stmt;
+
+deallocate prepare stmt;
+drop table t1,t2,t3,t4;
+
+--echo #
+--echo # MDEV-7930: Assertion `table_share->tmp_table != NO_TMP_TABLE ||
+--echo # m_lock_type != 2' failed in handler::ha_index_read_map
+--echo #
+
+CREATE TABLE t1 (f1 INT);
+INSERT INTO t1 VALUES (1),(2);
+
+CREATE TABLE t2 (f2 INT, KEY(f2));
+INSERT INTO t2 VALUES (3);
+
+CREATE ALGORITHM=MERGE VIEW v2 AS SELECT * FROM t2;
+
+SELECT ( SELECT MIN(v2.f2) FROM t1 ) AS sq FROM v2 GROUP BY sq;
+SELECT * FROM v2 where ( SELECT MIN(v2.f2) FROM t1 ) > 0;
+SELECT count(*) FROM v2 group by ( SELECT MIN(v2.f2) FROM t1 );
+
+delete from t1;
+SELECT ( SELECT MIN(v2.f2) FROM t1 ) AS sq FROM v2 GROUP BY sq;
+
+drop view v2;
+drop table t1,t2;
diff --git a/mysql-test/t/subselect_sj2.test b/mysql-test/t/subselect_sj2.test
index 0bf9c6d9d10..6ed36083b33 100644
--- a/mysql-test/t/subselect_sj2.test
+++ b/mysql-test/t/subselect_sj2.test
@@ -1391,5 +1391,44 @@ eval explain $query;
drop table t3,t2,t1;
set optimizer_search_depth=@tmp7474;
+--echo #
+--echo #
+--echo #
+CREATE TABLE t1 (
+ id int(16) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+CREATE TABLE t2 (
+ id int(16) NOT NULL AUTO_INCREMENT,
+ t3_id int(16) NOT NULL DEFAULT '0',
+ t1_id int(16) NOT NULL DEFAULT '0',
+ PRIMARY KEY (id),
+ KEY t3_idx (t3_id),
+ KEY t1_idx (t1_id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
+CREATE TABLE t3 (
+ id int(16) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
+
+INSERT INTO t3 VALUES (1);
+
+INSERT INTO t2 VALUES (1, 1, 1);
+INSERT INTO t2 VALUES (2, 1, 2);
+INSERT INTO t2 VALUES (3, 1, 2);
+INSERT INTO t2 VALUES (4, 1, 1);
+
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+
+SELECT * FROM t1 WHERE t1.id IN (
+ SELECT t2.t1_id FROM t3 JOIN t2 ON t3.id = t2.t3_id WHERE t3.id = 1
+);
+
+drop table t1,t2,t3;
+
--echo # This must be the last in the file:
set optimizer_switch=@subselect_sj2_tmp;
diff --git a/mysql-test/t/update.test b/mysql-test/t/update.test
index 09d32966c50..05f9ce39bec 100644
--- a/mysql-test/t/update.test
+++ b/mysql-test/t/update.test
@@ -506,6 +506,21 @@ DROP VIEW v1;
DROP FUNCTION f1;
DROP TABLE t1;
+--echo # Bug #21143080: UPDATE ON VARCHAR AND TEXT COLUMNS PRODUCE INCORRECT
+--echo # RESULTS
+
+CREATE TABLE t1 (a VARCHAR(50), b TEXT, c CHAR(50)) ENGINE=INNODB;
+
+INSERT INTO t1 (a, b, c) VALUES ('start trail', '', 'even longer string');
+UPDATE t1 SET b = a, a = 'inject';
+SELECT a, b FROM t1;
+UPDATE t1 SET b = c, c = 'inject';
+SELECT c, b FROM t1;
+
+DROP TABLE t1;
+
+--echo #
+--echo # MDEV-3948 Assertion `records_are_comparable(table)' fails in compare_record(const TABLE*) on UPDATE with simple AND condition, index_merge+index_merge_intersection, InnoDB
--echo #
--echo # Verify that UPDATE does the same number of handler_update
--echo # operations, no matter if there is ORDER BY or not.
diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test
index 8c2a8ac8dc2..773df49de6f 100644
--- a/mysql-test/t/view.test
+++ b/mysql-test/t/view.test
@@ -4741,6 +4741,50 @@ SHOW CREATE VIEW v4;
DROP VIEW v1, v2, v3, v4, v5;
+
+--echo #
+--echo # BUG#19886430: VIEW CREATION WITH NAMED COLUMNS, OVER UNION,
+--echo # IS REJECTED
+
+--echo # Without the patch, reports an error.
+CREATE VIEW v1 (fld1, fld2) AS
+ SELECT 1 AS a, 2 AS b
+ UNION ALL
+ SELECT 1 AS a, 1 AS a;
+
+--echo # The column names are explicitly specified and not duplicates, hence
+--echo # succeeds.
+CREATE VIEW v2 (fld1, fld2) AS
+ SELECT 1 AS a, 2 AS a
+ UNION ALL
+ SELECT 1 AS a, 1 AS a;
+
+--echo # The column name in the first SELECT are not duplicates, hence succeeds.
+CREATE VIEW v3 AS
+ SELECT 1 AS a, 2 AS b
+ UNION ALL
+ SELECT 1 AS a, 1 AS a;
+
+--echo # Should report an error, since the explicitly specified column names are
+--echo # duplicates.
+--error ER_DUP_FIELDNAME
+CREATE VIEW v4 (fld1, fld1) AS
+ SELECT 1 AS a, 2 AS b
+ UNION ALL
+ SELECT 1 AS a, 1 AS a;
+
+--echo # Should report an error, since duplicate column name is specified in the
+--echo # First SELECT.
+--error ER_DUP_FIELDNAME
+CREATE VIEW v4 AS
+ SELECT 1 AS a, 2 AS a
+ UNION ALL
+ SELECT 1 AS a, 1 AS a;
+
+--echo # Cleanup
+DROP VIEW v1, v2, v3;
+
+
# 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
@@ -5445,6 +5489,119 @@ execute stmt;
drop table t1, t2;
drop view v3;
+--echo #
+--echo # MDEV-8525: mariadb 10.0.20 crashing when data is read by Kodi
+--echo # media center (http://kodi.tv).
+--echo #
+
+CREATE TABLE `t1` (
+ `idSong` int(11) NOT NULL AUTO_INCREMENT,
+ `idAlbum` int(11) DEFAULT NULL,
+ `idPath` int(11) DEFAULT NULL,
+ `strArtists` text,
+ `strGenres` text,
+ `strTitle` varchar(512) DEFAULT NULL,
+ `iTrack` int(11) DEFAULT NULL,
+ `iDuration` int(11) DEFAULT NULL,
+ `iYear` int(11) DEFAULT NULL,
+ `dwFileNameCRC` text,
+ `strFileName` text,
+ `strMusicBrainzTrackID` text,
+ `iTimesPlayed` int(11) DEFAULT NULL,
+ `iStartOffset` int(11) DEFAULT NULL,
+ `iEndOffset` int(11) DEFAULT NULL,
+ `idThumb` int(11) DEFAULT NULL,
+ `lastplayed` varchar(20) DEFAULT NULL,
+ `rating` char(1) DEFAULT '0',
+ `comment` text,
+ `mood` text,
+ PRIMARY KEY (`idSong`),
+ UNIQUE KEY `idxSong7` (`idAlbum`,`strMusicBrainzTrackID`(36)),
+ KEY `idxSong` (`strTitle`(255)),
+ KEY `idxSong1` (`iTimesPlayed`),
+ KEY `idxSong2` (`lastplayed`),
+ KEY `idxSong3` (`idAlbum`),
+ KEY `idxSong6` (`idPath`,`strFileName`(255))
+) DEFAULT CHARSET=utf8;
+
+INSERT INTO `t1` VALUES (1,1,1,'strArtists1','strGenres1','strTitle1',1,100,2000,NULL,'strFileName1','strMusicBrainzTrackID1',0,0,0,NULL,NULL,'0','',''),(2,2,2,'strArtists2','strGenres2','strTitle2',2,200,2001,NULL,'strFileName2','strMusicBrainzTrackID2',0,0,0,NULL,NULL,'0','','');
+
+CREATE TABLE `t2` (
+ `idAlbum` int(11) NOT NULL AUTO_INCREMENT,
+ `strAlbum` varchar(256) DEFAULT NULL,
+ `strMusicBrainzAlbumID` text,
+ `strArtists` text,
+ `strGenres` text,
+ `iYear` int(11) DEFAULT NULL,
+ `idThumb` int(11) DEFAULT NULL,
+ `bCompilation` int(11) NOT NULL DEFAULT '0',
+ `strMoods` text,
+ `strStyles` text,
+ `strThemes` text,
+ `strReview` text,
+ `strImage` text,
+ `strLabel` text,
+ `strType` text,
+ `iRating` int(11) DEFAULT NULL,
+ `lastScraped` varchar(20) DEFAULT NULL,
+ `dateAdded` varchar(20) DEFAULT NULL,
+ `strReleaseType` text,
+ PRIMARY KEY (`idAlbum`),
+ UNIQUE KEY `idxAlbum_2` (`strMusicBrainzAlbumID`(36)),
+ KEY `idxAlbum` (`strAlbum`(255)),
+ KEY `idxAlbum_1` (`bCompilation`)
+) DEFAULT CHARSET=utf8;
+
+INSERT INTO `t2` VALUES (1,'strAlbum1','strMusicBrainzAlbumID1','strArtists1','strGenres1',2000,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'album');
+
+CREATE TABLE `t3` (
+ `idArtist` int(11) DEFAULT NULL,
+ `idAlbum` int(11) DEFAULT NULL,
+ `strJoinPhrase` text,
+ `boolFeatured` int(11) DEFAULT NULL,
+ `iOrder` int(11) DEFAULT NULL,
+ `strArtist` text,
+ UNIQUE KEY `idxAlbumArtist_1` (`idAlbum`,`idArtist`),
+ UNIQUE KEY `idxAlbumArtist_2` (`idArtist`,`idAlbum`),
+ KEY `idxAlbumArtist_3` (`boolFeatured`)
+) DEFAULT CHARSET=utf8;
+
+INSERT INTO `t3` VALUES (1,1,'',0,0,'strArtist1');
+
+CREATE TABLE `t4` (
+ `idArtist` int(11) NOT NULL AUTO_INCREMENT,
+ `strArtist` varchar(256) DEFAULT NULL,
+ `strMusicBrainzArtistID` text,
+ `strBorn` text,
+ `strFormed` text,
+ `strGenres` text,
+ `strMoods` text,
+ `strStyles` text,
+ `strInstruments` text,
+ `strBiography` text,
+ `strDied` text,
+ `strDisbanded` text,
+ `strYearsActive` text,
+ `strImage` text,
+ `strFanart` text,
+ `lastScraped` varchar(20) DEFAULT NULL,
+ `dateAdded` varchar(20) DEFAULT NULL,
+ PRIMARY KEY (`idArtist`),
+ UNIQUE KEY `idxArtist1` (`strMusicBrainzArtistID`(36)),
+ KEY `idxArtist` (`strArtist`(255))
+) DEFAULT CHARSET=utf8;
+
+INSERT INTO `t4` VALUES (1,'strArtist1','strMusicBrainzArtistID',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
+
+CREATE VIEW `v1` AS select `t2`.`idAlbum` AS `idAlbum`,`t2`.`strAlbum` AS `strAlbum`,`t2`.`strMusicBrainzAlbumID` AS `strMusicBrainzAlbumID`,`t2`.`strArtists` AS `strArtists`,`t2`.`strGenres` AS `strGenres`,`t2`.`iYear` AS `iYear`,`t2`.`strMoods` AS `strMoods`,`t2`.`strStyles` AS `strStyles`,`t2`.`strThemes` AS `strThemes`,`t2`.`strReview` AS `strReview`,`t2`.`strLabel` AS `strLabel`,`t2`.`strType` AS `strType`,`t2`.`strImage` AS `strImage`,`t2`.`iRating` AS `iRating`,`t2`.`bCompilation` AS `bCompilation`,(select min(`t1`.`iTimesPlayed`) from `t1` where (`t1`.`idAlbum` = `t2`.`idAlbum`)) AS `iTimesPlayed`,`t2`.`strReleaseType` AS `strReleaseType` from `t2`;
+
+CREATE VIEW `v2` AS select `t3`.`idAlbum` AS `idAlbum`,`t3`.`idArtist` AS `idArtist`,`t4`.`strArtist` AS `strArtist`,`t4`.`strMusicBrainzArtistID` AS `strMusicBrainzArtistID`,`t3`.`boolFeatured` AS `boolFeatured`,`t3`.`strJoinPhrase` AS `strJoinPhrase`,`t3`.`iOrder` AS `iOrder` from (`t3` join `t4` on((`t3`.`idArtist` = `t4`.`idArtist`)));
+
+SELECT v1.*,v2.* FROM v1 LEFT JOIN v2 ON v1.idAlbum = v2.idAlbum WHERE v1.idAlbum = 1 ORDER BY v2.iOrder;
+
+drop view v1,v2;
+drop table t1,t2,t3,t4;
+
--echo # -----------------------------------------------------------------
--echo # -- End of 10.0 tests.
--echo # -----------------------------------------------------------------