summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/collections/buildbot_suites.bat3
-rw-r--r--mysql-test/include/index_merge1.inc14
-rw-r--r--mysql-test/include/is_embedded.inc4
-rw-r--r--mysql-test/include/is_embedded_no_privileges.inc16
-rw-r--r--mysql-test/include/not_windows_embedded.inc4
-rw-r--r--mysql-test/lib/My/Options.pm4
-rw-r--r--mysql-test/main/alter_user.result10
-rw-r--r--mysql-test/main/alter_user.test11
-rw-r--r--mysql-test/main/derived.result53
-rw-r--r--mysql-test/main/derived.test51
-rw-r--r--mysql-test/main/derived_view.result130
-rw-r--r--mysql-test/main/derived_view.test111
-rw-r--r--mysql-test/main/events_embedded.test1
-rw-r--r--mysql-test/main/func_default.result121
-rw-r--r--mysql-test/main/func_default.test102
-rw-r--r--mysql-test/main/func_json.result18
-rw-r--r--mysql-test/main/func_json.test15
-rw-r--r--mysql-test/main/func_str.result53
-rw-r--r--mysql-test/main/func_str.test36
-rw-r--r--mysql-test/main/func_system.result20
-rw-r--r--mysql-test/main/func_system.test20
-rw-r--r--mysql-test/main/index_merge_myisam.result18
-rw-r--r--mysql-test/main/information_schema_inno.result1
-rw-r--r--mysql-test/main/information_schema_inno.test4
-rw-r--r--mysql-test/main/insert_select.result19
-rw-r--r--mysql-test/main/insert_select.test25
-rw-r--r--mysql-test/main/mysql_client_test-master.opt1
-rw-r--r--mysql-test/main/mysql_client_test_comp-master.opt1
-rw-r--r--mysql-test/main/mysql_client_test_nonblock-master.opt1
-rw-r--r--mysql-test/main/mysql_upgrade-6984.test4
-rw-r--r--mysql-test/main/mysql_upgrade.result41
-rw-r--r--mysql-test/main/mysql_upgrade.test81
-rw-r--r--mysql-test/main/mysql_upgrade_noengine.result4
-rw-r--r--mysql-test/main/mysql_upgrade_noengine.test9
-rw-r--r--mysql-test/main/mysql_upgrade_view.result4
-rw-r--r--mysql-test/main/order_by.result23
-rw-r--r--mysql-test/main/order_by.test23
-rw-r--r--mysql-test/main/partition_sp.result22
-rw-r--r--mysql-test/main/partition_sp.test35
-rw-r--r--mysql-test/main/partition_symlink.result94
-rw-r--r--mysql-test/main/partition_symlink.test55
-rw-r--r--mysql-test/main/range_innodb.result105
-rw-r--r--mysql-test/main/range_innodb.test93
-rw-r--r--mysql-test/main/show.result11
-rw-r--r--mysql-test/main/show.test8
-rw-r--r--mysql-test/main/sp.result28
-rw-r--r--mysql-test/main/sp.test42
-rw-r--r--mysql-test/main/trigger.result7
-rw-r--r--mysql-test/main/trigger.test8
-rw-r--r--mysql-test/main/type_enum.result21
-rw-r--r--mysql-test/main/type_enum.test20
-rw-r--r--mysql-test/main/view.result61
-rw-r--r--mysql-test/main/view.test70
-rwxr-xr-xmysql-test/mysql-test-run.pl2
-rw-r--r--mysql-test/suite/binlog/include/mysqlbinlog_row_engine.inc25
-rw-r--r--mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_innodb.result20
-rw-r--r--mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_myisam.result26
-rw-r--r--mysql-test/suite/binlog/r/binlog_xa_handling.result11
-rw-r--r--mysql-test/suite/binlog/t/binlog_xa_handling.test28
-rw-r--r--mysql-test/suite/encryption/t/innodb-first-page-read.test1
-rw-r--r--mysql-test/suite/federated/rpl.result18
-rw-r--r--mysql-test/suite/federated/rpl.test19
-rw-r--r--mysql-test/suite/funcs_1/datadict/columns.inc4
-rw-r--r--mysql-test/suite/funcs_1/t/is_columns_is_embedded.test2
-rw-r--r--mysql-test/suite/funcs_1/t/is_columns_myisam_embedded.test6
-rw-r--r--mysql-test/suite/funcs_1/t/is_columns_mysql_embedded.test5
-rw-r--r--mysql-test/suite/galera/r/enforce_storage_engine2.result1
-rw-r--r--mysql-test/suite/galera/r/galera_create_table_like.result5
-rw-r--r--mysql-test/suite/galera/r/galera_myisam_transactions.result11
-rw-r--r--mysql-test/suite/galera/r/wsrep_slave_threads_basic.result (renamed from mysql-test/suite/sys_vars/r/wsrep_slave_threads_basic.result)0
-rw-r--r--mysql-test/suite/galera/t/galera_create_table_like.test9
-rw-r--r--mysql-test/suite/galera/t/galera_myisam_transactions.test13
-rw-r--r--mysql-test/suite/galera/t/wsrep_slave_threads_basic.test (renamed from mysql-test/suite/sys_vars/t/wsrep_slave_threads_basic.test)2
-rw-r--r--mysql-test/suite/innodb/r/innodb-wl5522.result18
-rw-r--r--mysql-test/suite/innodb/r/innodb_buffer_pool_resize_with_chunks.result8
-rw-r--r--mysql-test/suite/innodb/r/innodb_information_schema.result28
-rw-r--r--mysql-test/suite/innodb/r/restart,16k,innodb.rdiff16
-rw-r--r--mysql-test/suite/innodb/r/restart,32k,innodb.rdiff16
-rw-r--r--mysql-test/suite/innodb/r/restart,4k,innodb.rdiff16
-rw-r--r--mysql-test/suite/innodb/r/restart,64k,innodb.rdiff16
-rw-r--r--mysql-test/suite/innodb/r/restart,8k,innodb.rdiff16
-rw-r--r--mysql-test/suite/innodb/r/restart.result13
-rw-r--r--mysql-test/suite/innodb/r/skip_symbolic_links.result54
-rw-r--r--mysql-test/suite/innodb/t/101_compatibility.test1
-rw-r--r--mysql-test/suite/innodb/t/create_isl_with_direct.test1
-rw-r--r--mysql-test/suite/innodb/t/innodb-wl5522.test37
-rw-r--r--mysql-test/suite/innodb/t/innodb-wl5980-alter.test1
-rw-r--r--mysql-test/suite/innodb/t/innodb-wl5980-debug.test1
-rw-r--r--mysql-test/suite/innodb/t/innodb_buffer_pool_resize_with_chunks.opt2
-rw-r--r--mysql-test/suite/innodb/t/innodb_buffer_pool_resize_with_chunks.test2
-rw-r--r--mysql-test/suite/innodb/t/innodb_information_schema.test2
-rw-r--r--mysql-test/suite/innodb/t/restart.opt2
-rw-r--r--mysql-test/suite/innodb/t/restart.test24
-rw-r--r--mysql-test/suite/innodb/t/skip_symbolic_links.opt1
-rw-r--r--mysql-test/suite/innodb/t/skip_symbolic_links.test51
-rw-r--r--mysql-test/suite/innodb_fts/r/innodb_fts_plugin.result1
-rw-r--r--mysql-test/suite/innodb_fts/t/innodb_fts_plugin.test2
-rw-r--r--mysql-test/suite/innodb_gis/r/rtree_split.result7
-rw-r--r--mysql-test/suite/innodb_gis/t/rtree_split.test8
-rw-r--r--mysql-test/suite/innodb_zip/r/wl5522_zip.result2
-rw-r--r--mysql-test/suite/innodb_zip/t/restart.test1
-rw-r--r--mysql-test/suite/maria/fulltext2.result7
-rw-r--r--mysql-test/suite/maria/fulltext2.test9
-rw-r--r--mysql-test/suite/mariabackup/create_with_data_directory_during_backup.test1
-rw-r--r--mysql-test/suite/mariabackup/data_directory.test1
-rw-r--r--mysql-test/suite/mariabackup/partition_datadir.test1
-rw-r--r--mysql-test/suite/parts/t/alter_data_directory_innodb.test1
-rw-r--r--mysql-test/suite/parts/t/reorganize_partition_innodb.test1
-rw-r--r--mysql-test/suite/plugins/r/locales.result36
-rw-r--r--mysql-test/suite/rpl/r/rpl_seconds_behind_master_spike.result40
-rw-r--r--mysql-test/suite/rpl/t/rpl_seconds_behind_master_spike.test88
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_innodb.result2
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_server_embedded,32bit.rdiff14
-rw-r--r--mysql-test/suite/vcol/r/not_supported.result8
-rw-r--r--mysql-test/suite/vcol/t/not_supported.test10
115 files changed, 2326 insertions, 184 deletions
diff --git a/mysql-test/collections/buildbot_suites.bat b/mysql-test/collections/buildbot_suites.bat
index 6228199c793..0880e0124dd 100644
--- a/mysql-test/collections/buildbot_suites.bat
+++ b/mysql-test/collections/buildbot_suites.bat
@@ -1,4 +1,5 @@
-perl mysql-test-run.pl --verbose-restart --force --suite-timeout=120 --max-test-fail=10 --retry=3 --parallel=4 --suite=^
+if "%MTR_PARALLEL%"=="" set MTR_PARALLEL=%NUMBER_OF_PROCESSORS%
+perl mysql-test-run.pl --verbose-restart --force --suite-timeout=120 --max-test-fail=10 --retry=3 --suite=^
vcol,gcol,perfschema,^
main,^
innodb,^
diff --git a/mysql-test/include/index_merge1.inc b/mysql-test/include/index_merge1.inc
index b168a767d7c..ebadb5077ae 100644
--- a/mysql-test/include/index_merge1.inc
+++ b/mysql-test/include/index_merge1.inc
@@ -150,12 +150,22 @@ explain select * from t0 where
(((key3 <7 and key7 < 6) or key5 < 2) and (key5 < 5 or key6 < 6));
explain select * from t0 where
- ((key3 <5 or key5 < 4) and (key1 < 4 or key2 < 4))
+ ((key3 < 4 or key5 < 4) and (key1 < 4 or key2 < 4))
or
((key3 >=5 or key5 < 2) and (key5 < 5 or key6 < 6));
explain select * from t0 force index(i1, i2, i3, i4, i5, i6 ) where
- ((key3 <5 or key5 < 4) and (key1 < 4 or key2 < 4))
+ ((key3 < 4 or key5 < 4) and (key1 < 4 or key2 < 4))
+ or
+ ((key3 >=5 or key5 < 2) and (key5 < 5 or key6 < 6));
+
+explain select * from t0 force index(i1, i2, i3, i4, i5, i6 ) where
+ ((key3 < 5 or key5 < 4) and (key1 < 4 or key2 < 4))
+ or
+ ((key3 >=5 or key5 < 2) and (key5 < 5 or key6 < 6));
+
+explain select * from t0 force index(i1, i2, i3, i4, i5, i6 ) where
+ ((key3 < 10 or key5 < 4) and (key1 < 4 or key2 < 4))
or
((key3 >=5 or key5 < 2) and (key5 < 5 or key6 < 6));
diff --git a/mysql-test/include/is_embedded.inc b/mysql-test/include/is_embedded.inc
index b20f21953f0..a440406edd4 100644
--- a/mysql-test/include/is_embedded.inc
+++ b/mysql-test/include/is_embedded.inc
@@ -1,5 +1,7 @@
+#
+# Check if the current used server is an embedded server#
+#
if (`SELECT VERSION() NOT LIKE '%embedded%'`)
{
--skip Test requires: embedded server
}
-
diff --git a/mysql-test/include/is_embedded_no_privileges.inc b/mysql-test/include/is_embedded_no_privileges.inc
new file mode 100644
index 00000000000..364c697c5a8
--- /dev/null
+++ b/mysql-test/include/is_embedded_no_privileges.inc
@@ -0,0 +1,16 @@
+#
+# Test that we do not have an embedded server compiled with privileges.
+# This is not a regular setup, but we are running this in buildbot for
+# testing of embedded + privileges.
+# Some funcs_1 test cannot handle this combination, which is why we have this
+# file to disable them
+#
+
+--source include/is_embedded.inc
+
+let priv=`SELECT privileges FROM information_schema.columns limit 1`;
+
+if (`SELECT "$priv" <> ""`)
+{
+ --skip Embedded server is compiled with privileges; Test disabled.
+}
diff --git a/mysql-test/include/not_windows_embedded.inc b/mysql-test/include/not_windows_embedded.inc
index 46f5e0ccfce..50ff0f80c7d 100644
--- a/mysql-test/include/not_windows_embedded.inc
+++ b/mysql-test/include/not_windows_embedded.inc
@@ -1,10 +1,8 @@
let $is_win = `select convert(@@version_compile_os using latin1) IN ("Win32","Win64","Windows")`;
-let $is_embedded = `select version() like '%embedded%'`;
#echo is_win: $is_win;
-#echo is_embedded: $is_embedded;
if ($is_win)
{
- if ($is_embedded)
+ if(!$MYSQL_EMBEDDED)
{
skip Not supported with embedded on windows;
}
diff --git a/mysql-test/lib/My/Options.pm b/mysql-test/lib/My/Options.pm
index 5827e0666a6..b3ae64cb4c2 100644
--- a/mysql-test/lib/My/Options.pm
+++ b/mysql-test/lib/My/Options.pm
@@ -142,11 +142,11 @@ sub diff {
sub is_subset {
my ($set, $subset)= @_;
- my %cache = map { _split_option($_) } @$set;
+ my %cache = map { join('=', _split_option($_)), 1 } @$set;
for (@$subset){
my ($name, $value)= _split_option($_);
- return 0 unless exists $cache{$name} and $cache{$name} eq $value;
+ return 0 unless $cache{"$name=$value"};
}
return 1;
diff --git a/mysql-test/main/alter_user.result b/mysql-test/main/alter_user.result
index 7ba9549e73c..46420420386 100644
--- a/mysql-test/main/alter_user.result
+++ b/mysql-test/main/alter_user.result
@@ -91,3 +91,13 @@ select * from mysql.user where user = 'foo';
Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv Delete_history_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time
% foo *88C89BE093D4ECF72D039F62EBB7477EA1FD4D63 N N N N N N N N N N N N N N N Y N N N N N N N N N Y N N N N SPECIFIED text foo_issuer foo_subject 10 20 30 40 N N 0.000000
drop user foo;
+#
+# Bug #29882299: ALTER USER ... IDENTIFIED WITH ... BY ... SHOULD BE A PRIVILEGED OPERATION
+#
+create user foo@localhost;
+connect x,localhost,foo;
+alter user current_user identified with 'something';
+ERROR 42000: Access denied; you need (at least one of) the CREATE USER privilege(s) for this operation
+connection default;
+disconnect x;
+drop user foo@localhost;
diff --git a/mysql-test/main/alter_user.test b/mysql-test/main/alter_user.test
index 3a1052a98f6..e71fba271b1 100644
--- a/mysql-test/main/alter_user.test
+++ b/mysql-test/main/alter_user.test
@@ -77,3 +77,14 @@ alter user foo with MAX_QUERIES_PER_HOUR 10
MAX_USER_CONNECTIONS 40;
select * from mysql.user where user = 'foo';
drop user foo;
+
+--echo #
+--echo # Bug #29882299: ALTER USER ... IDENTIFIED WITH ... BY ... SHOULD BE A PRIVILEGED OPERATION
+--echo #
+create user foo@localhost;
+--connect x,localhost,foo
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+alter user current_user identified with 'something';
+--connection default
+--disconnect x
+drop user foo@localhost;
diff --git a/mysql-test/main/derived.result b/mysql-test/main/derived.result
index 0f917509e20..c3421a288a1 100644
--- a/mysql-test/main/derived.result
+++ b/mysql-test/main/derived.result
@@ -1204,6 +1204,59 @@ REPLACE INTO v2 ( SELECT * FROM v4 ) UNION ( SELECT f FROM v2 );
drop view v1,v2,v3,v4;
drop table t1,t2,t3;
#
+# MDEV-20325: Assertion `outer_context || !*from_field || *from_field == not_found_field' failed in Item_field::fix_outer_field | `!derived->is_excluded()' failed in TABLE_LIST::set_check_materialized | SIGEGV in st_select_lex::mark_as_dependent (optimized builds)
+#
+CREATE TABLE t1 (a INT);
+# Check that re-execution of a stored routine containing
+# a query with subquery in the FROM clause doesn't result in
+# assert failure in case the 'derived_merge' optimizer option
+# has been turned on/off
+CREATE PROCEDURE sp() SELECT * FROM (SELECT a FROM t1) tb;
+CALL sp();
+a
+SET optimizer_switch='derived_merge=off';
+# Without the patch the following statement would result in assert
+# failure
+CALL sp();
+a
+# Check the same test case for Prepared Statement
+SET optimizer_switch='derived_merge=on';
+PREPARE stmt FROM "SELECT * FROM (SELECT a FROM t1) tb";
+EXECUTE stmt;
+a
+SET optimizer_switch='derived_merge=off';
+# Without the patch the following statement would result in assert
+# failure
+EXECUTE stmt;
+a
+DEALLOCATE PREPARE stmt;
+# Here check the reverse test case - first turn off the 'derived_merge'
+# optimizer option, run the stored routine containing a query with
+# subquery in the FROM clause, then turn on the 'derived_merge'
+# optimizer option and re-execute the same stored routine to check that
+# the routine is finished successfully.
+CREATE PROCEDURE sp1() SELECT * FROM (SELECT a FROM t1) tb;
+SET optimizer_switch='derived_merge=off';
+CALL sp1();
+a
+SET optimizer_switch='derived_merge=on';
+CALL sp1();
+a
+# Check the same test case for Prepared Statement
+SET optimizer_switch='derived_merge=off';
+PREPARE stmt FROM "SELECT * FROM (SELECT a FROM t1) tb";
+EXECUTE stmt;
+a
+SET optimizer_switch='derived_merge=on';
+# Without the patch the following statement would result in assert
+# failure
+EXECUTE stmt;
+a
+DEALLOCATE PREPARE stmt;
+DROP PROCEDURE sp;
+DROP PROCEDURE sp1;
+DROP TABLE t1;
+#
# End of 10.2 tests
#
#
diff --git a/mysql-test/main/derived.test b/mysql-test/main/derived.test
index f4477ce8550..4ff0cf4165c 100644
--- a/mysql-test/main/derived.test
+++ b/mysql-test/main/derived.test
@@ -1037,6 +1037,57 @@ drop view v1,v2,v3,v4;
drop table t1,t2,t3;
--echo #
+--echo # MDEV-20325: Assertion `outer_context || !*from_field || *from_field == not_found_field' failed in Item_field::fix_outer_field | `!derived->is_excluded()' failed in TABLE_LIST::set_check_materialized | SIGEGV in st_select_lex::mark_as_dependent (optimized builds)
+--echo #
+CREATE TABLE t1 (a INT);
+
+--echo # Check that re-execution of a stored routine containing
+--echo # a query with subquery in the FROM clause doesn't result in
+--echo # assert failure in case the 'derived_merge' optimizer option
+--echo # has been turned on/off
+CREATE PROCEDURE sp() SELECT * FROM (SELECT a FROM t1) tb;
+CALL sp();
+SET optimizer_switch='derived_merge=off';
+--echo # Without the patch the following statement would result in assert
+--echo # failure
+CALL sp();
+
+--echo # Check the same test case for Prepared Statement
+SET optimizer_switch='derived_merge=on';
+PREPARE stmt FROM "SELECT * FROM (SELECT a FROM t1) tb";
+EXECUTE stmt;
+SET optimizer_switch='derived_merge=off';
+--echo # Without the patch the following statement would result in assert
+--echo # failure
+EXECUTE stmt;
+DEALLOCATE PREPARE stmt;
+
+--echo # Here check the reverse test case - first turn off the 'derived_merge'
+--echo # optimizer option, run the stored routine containing a query with
+--echo # subquery in the FROM clause, then turn on the 'derived_merge'
+--echo # optimizer option and re-execute the same stored routine to check that
+--echo # the routine is finished successfully.
+CREATE PROCEDURE sp1() SELECT * FROM (SELECT a FROM t1) tb;
+SET optimizer_switch='derived_merge=off';
+CALL sp1();
+SET optimizer_switch='derived_merge=on';
+CALL sp1();
+
+--echo # Check the same test case for Prepared Statement
+SET optimizer_switch='derived_merge=off';
+PREPARE stmt FROM "SELECT * FROM (SELECT a FROM t1) tb";
+EXECUTE stmt;
+SET optimizer_switch='derived_merge=on';
+--echo # Without the patch the following statement would result in assert
+--echo # failure
+EXECUTE stmt;
+DEALLOCATE PREPARE stmt;
+
+DROP PROCEDURE sp;
+DROP PROCEDURE sp1;
+DROP TABLE t1;
+
+--echo #
--echo # End of 10.2 tests
--echo #
diff --git a/mysql-test/main/derived_view.result b/mysql-test/main/derived_view.result
index 65a1adcaddd..af5f8cc1d3b 100644
--- a/mysql-test/main/derived_view.result
+++ b/mysql-test/main/derived_view.result
@@ -3498,4 +3498,134 @@ a
3
drop view v1;
drop table t1;
+#
+# MDEV-24454 Second execution of SELECT containing set function
+# MDEV-25086: whose only argument is an outer reference to a column
+# of mergeable view/derived/table/CTE
+#
+create table t1 (a int);
+create table t2 (b int);
+insert into t1 values (3), (1), (3);
+insert into t2 values (70), (30), (70);
+create view v1 as select * from t2;
+prepare stmt from "
+select (select sum(b) from t1 where a=1) as r from v1;
+";
+execute stmt;
+r
+170
+execute stmt;
+r
+170
+deallocate prepare stmt;
+prepare stmt from "
+select (select sum(b) from t1 where a=1) as r from (select * from t2) dt;
+";
+execute stmt;
+r
+170
+execute stmt;
+r
+170
+deallocate prepare stmt;
+prepare stmt from "
+with cte as (select * from t2)
+select (select sum(b) from t1 where a=1) as r from cte;
+";
+execute stmt;
+r
+170
+execute stmt;
+r
+170
+deallocate prepare stmt;
+prepare stmt from "
+select (select sum(b) from t1 where a=1) as r
+from (select * from v1 where b > 50) dt;
+";
+execute stmt;
+r
+140
+execute stmt;
+r
+140
+deallocate prepare stmt;
+prepare stmt from "
+select (select sum(b) from t1 where a=1) as r
+from (select * from (select * from t2) dt1 where b > 50) dt;
+";
+execute stmt;
+r
+140
+execute stmt;
+r
+140
+deallocate prepare stmt;
+prepare stmt from "
+with cte as (select * from (select * from t2) dt1 where b > 50)
+select (select sum(b) from t1 where a=1) as r from cte;
+";
+execute stmt;
+r
+140
+execute stmt;
+r
+140
+deallocate prepare stmt;
+create procedure sp1()
+begin
+select (select sum(b) from t1 where a=1) as r from v1;
+end |
+call sp1();
+r
+170
+call sp1();
+r
+170
+drop procedure sp1;
+create procedure sp1()
+begin
+select (select sum(b) from t1 where a=1) as r from (select * from t2) dt;
+end |
+call sp1();
+r
+170
+call sp1();
+r
+170
+drop procedure sp1;
+create procedure sp1()
+begin
+with cte as (select * from t2)
+select (select sum(b) from t1 where a=1) as r from cte;
+end |
+call sp1();
+r
+170
+call sp1();
+r
+170
+drop procedure sp1;
+drop view v1;
+drop table t1,t2;
+CREATE TABLE t1(f0 INT);
+INSERT INTO t1 VALUES (3);
+CREATE VIEW v1 AS SELECT f0 AS f1 FROM t1;
+CREATE VIEW v2 AS
+SELECT
+(SELECT GROUP_CONCAT(v1.f1 SEPARATOR ', ') FROM v1 n) AS f2,
+GROUP_CONCAT('aa' SEPARATOR ', ') AS f3
+FROM v1;
+CREATE VIEW v3 AS SELECT * FROM v2;
+CREATE PROCEDURE p1()
+SELECT * FROM v3;
+CALL p1();
+f2 f3
+3 aa
+CALL p1();
+f2 f3
+3 aa
+DROP PROCEDURE p1;
+DROP VIEW v1,v2,v3;
+DROP TABLE t1;
# End of 10.2 tests
diff --git a/mysql-test/main/derived_view.test b/mysql-test/main/derived_view.test
index 9ab1ddd3a76..584bde2d75d 100644
--- a/mysql-test/main/derived_view.test
+++ b/mysql-test/main/derived_view.test
@@ -2289,4 +2289,115 @@ select * from ((select a from t1 limit 2) order by a desc) dt;
drop view v1;
drop table t1;
+--echo #
+--echo # MDEV-24454 Second execution of SELECT containing set function
+--echo # MDEV-25086: whose only argument is an outer reference to a column
+--echo # of mergeable view/derived/table/CTE
+--echo #
+
+create table t1 (a int);
+create table t2 (b int);
+insert into t1 values (3), (1), (3);
+insert into t2 values (70), (30), (70);
+create view v1 as select * from t2;
+
+prepare stmt from "
+select (select sum(b) from t1 where a=1) as r from v1;
+";
+execute stmt;
+execute stmt;
+deallocate prepare stmt;
+
+prepare stmt from "
+select (select sum(b) from t1 where a=1) as r from (select * from t2) dt;
+";
+execute stmt;
+execute stmt;
+deallocate prepare stmt;
+
+prepare stmt from "
+with cte as (select * from t2)
+select (select sum(b) from t1 where a=1) as r from cte;
+";
+execute stmt;
+execute stmt;
+deallocate prepare stmt;
+
+prepare stmt from "
+select (select sum(b) from t1 where a=1) as r
+from (select * from v1 where b > 50) dt;
+";
+execute stmt;
+execute stmt;
+deallocate prepare stmt;
+
+prepare stmt from "
+select (select sum(b) from t1 where a=1) as r
+from (select * from (select * from t2) dt1 where b > 50) dt;
+";
+execute stmt;
+execute stmt;
+deallocate prepare stmt;
+
+prepare stmt from "
+with cte as (select * from (select * from t2) dt1 where b > 50)
+select (select sum(b) from t1 where a=1) as r from cte;
+";
+execute stmt;
+execute stmt;
+deallocate prepare stmt;
+
+--delimiter |
+create procedure sp1()
+begin
+select (select sum(b) from t1 where a=1) as r from v1;
+end |
+--delimiter ;
+call sp1();
+call sp1();
+drop procedure sp1;
+
+--delimiter |
+create procedure sp1()
+begin
+select (select sum(b) from t1 where a=1) as r from (select * from t2) dt;
+end |
+--delimiter ;
+call sp1();
+call sp1();
+drop procedure sp1;
+
+--delimiter |
+create procedure sp1()
+begin
+with cte as (select * from t2)
+select (select sum(b) from t1 where a=1) as r from cte;
+end |
+--delimiter ;
+call sp1();
+call sp1();
+drop procedure sp1;
+
+drop view v1;
+drop table t1,t2;
+
+CREATE TABLE t1(f0 INT);
+INSERT INTO t1 VALUES (3);
+CREATE VIEW v1 AS SELECT f0 AS f1 FROM t1;
+CREATE VIEW v2 AS
+SELECT
+ (SELECT GROUP_CONCAT(v1.f1 SEPARATOR ', ') FROM v1 n) AS f2,
+ GROUP_CONCAT('aa' SEPARATOR ', ') AS f3
+FROM v1;
+CREATE VIEW v3 AS SELECT * FROM v2;
+
+CREATE PROCEDURE p1()
+ SELECT * FROM v3;
+CALL p1();
+CALL p1();
+
+DROP PROCEDURE p1;
+DROP VIEW v1,v2,v3;
+DROP TABLE t1;
+
--echo # End of 10.2 tests
diff --git a/mysql-test/main/events_embedded.test b/mysql-test/main/events_embedded.test
index 9922ea6dfee..f6921f302bf 100644
--- a/mysql-test/main/events_embedded.test
+++ b/mysql-test/main/events_embedded.test
@@ -2,4 +2,3 @@
--error 1193
set global event_scheduler=ON;
-
diff --git a/mysql-test/main/func_default.result b/mysql-test/main/func_default.result
index 9699f0795e3..8721270ca1c 100644
--- a/mysql-test/main/func_default.result
+++ b/mysql-test/main/func_default.result
@@ -29,6 +29,9 @@ INSERT INTO t1 VALUES (1, 'one'), (2, 'two'), (3, 'three');
SELECT s, 32 AS mi FROM t1 GROUP BY s HAVING DEFAULT(mi) IS NULL;
ERROR HY000: Field 'mi' doesn't have a default value
DROP TABLE t1;
+#
+# Start of 10.2 tests
+#
set timestamp=unix_timestamp('2001-01-01 10:20:30.123456');
create table t1 (a int default 1, b int default (a+1),
c varchar(100) default 'foo', d text default 'bar',
@@ -40,3 +43,121 @@ default(a) default(b) default(c) default(d) default(e) default(f)
1 2 foo bar 2001-01-01 10:20:30 2001-01-01 10:20:30.120000
1 11 foo bar 2001-01-01 10:20:30 2001-01-01 10:20:30.120000
drop table t1;
+#
+# MDEV-21639 DEFAULT(col) evaluates to a bad value in WHERE clause
+#
+CREATE TABLE t1 (a BIGINT NOT NULL DEFAULT (IF(false,UNIX_TIMESTAMP(),10)));
+INSERT INTO t1 VALUES (10000);
+SELECT
+a,
+DEFAULT(a),
+CASE WHEN a THEN DEFAULT(a) END AS c,
+CASE WHEN a THEN DEFAULT(a) END = 10 AS ce
+FROM t1;
+a DEFAULT(a) c ce
+10000 10 10 1
+SELECT a FROM t1 WHERE CASE WHEN a THEN DEFAULT(a) END=10;
+a
+10000
+DROP TABLE t1;
+CREATE TABLE t1 (a DOUBLE NOT NULL DEFAULT (IF(false,UNIX_TIMESTAMP(),10)));
+INSERT INTO t1 VALUES (10000);
+SELECT
+a,
+DEFAULT(a),
+CASE WHEN a THEN DEFAULT(a) END AS c,
+CASE WHEN a THEN DEFAULT(a) END = 10 AS ce
+FROM t1;
+a DEFAULT(a) c ce
+10000 10 10 1
+SELECT a FROM t1 WHERE CASE WHEN a THEN DEFAULT(a) END=10;
+a
+10000
+DROP TABLE t1;
+CREATE TABLE t1 (a DECIMAL(10,0) NOT NULL DEFAULT (IF(false,UNIX_TIMESTAMP(),10)));
+INSERT INTO t1 VALUES (10000);
+SELECT
+a,
+DEFAULT(a),
+CASE WHEN a THEN DEFAULT(a) END AS c,
+CASE WHEN a THEN DEFAULT(a) END = 10 AS ce
+FROM t1;
+a DEFAULT(a) c ce
+10000 10 10 1
+SELECT a FROM t1 WHERE CASE WHEN a THEN DEFAULT(a) END=10;
+a
+10000
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(32) NOT NULL DEFAULT (IF(false,UNIX_TIMESTAMP(),10)));
+INSERT INTO t1 VALUES (10000);
+SELECT
+a,
+DEFAULT(a),
+CASE WHEN a THEN DEFAULT(a) END AS c,
+CASE WHEN a THEN DEFAULT(a) END = '10' AS ce
+FROM t1;
+a DEFAULT(a) c ce
+10000 10 10 1
+SELECT a FROM t1 WHERE CASE WHEN a THEN DEFAULT(a) END='10';
+a
+10000
+DROP TABLE t1;
+CREATE TABLE t1 (a DATE NOT NULL DEFAULT (IF(false,UNIX_TIMESTAMP()%10,DATE'2001-01-01')));
+INSERT INTO t1 VALUES ('2000-01-01');
+SELECT
+a,
+DEFAULT(a),
+CASE WHEN a THEN DEFAULT(a) END AS c,
+CASE WHEN a THEN DEFAULT(a) END = '2001-01-01' AS ce
+FROM t1;
+a DEFAULT(a) c ce
+2000-01-01 2001-01-01 2001-01-01 1
+SELECT a FROM t1 WHERE CASE WHEN a THEN DEFAULT(a) END='2001-01-01';
+a
+2000-01-01
+DROP TABLE t1;
+CREATE TABLE t1 (a TIME NOT NULL DEFAULT (IF(false,UNIX_TIMESTAMP()%10,TIME'10:20:30')));
+INSERT INTO t1 VALUES ('10:00:00');
+SELECT
+a,
+DEFAULT(a),
+CASE WHEN a THEN DEFAULT(a) END AS c,
+CASE WHEN a THEN DEFAULT(a) END = '10:20:30' AS ce
+FROM t1;
+a DEFAULT(a) c ce
+10:00:00 10:20:30 10:20:30 1
+SELECT a FROM t1 WHERE CASE WHEN a THEN DEFAULT(a) END='10:20:30';
+a
+10:00:00
+DROP TABLE t1;
+CREATE TABLE t1 (a DATETIME NOT NULL DEFAULT (IF(false,UNIX_TIMESTAMP(),TIMESTAMP'2001-01-01 10:20:30')));
+INSERT INTO t1 VALUES ('2000-01-01 10:00:00');
+SELECT
+a,
+DEFAULT(a),
+CASE WHEN a THEN DEFAULT(a) END AS c,
+CASE WHEN a THEN DEFAULT(a) END = '2001-01-01 10:20:30' AS ce
+FROM t1;
+a DEFAULT(a) c ce
+2000-01-01 10:00:00 2001-01-01 10:20:30 2001-01-01 10:20:30 1
+SELECT a FROM t1 WHERE CASE WHEN a THEN DEFAULT(a) END='2001-01-01 10:20:30';
+a
+2000-01-01 10:00:00
+DROP TABLE t1;
+CREATE TABLE t1 (a INT NOT NULL DEFAULT (IF(false,UNIX_TIMESTAMP(),FALSE)));
+INSERT INTO t1 VALUES (10);
+SELECT
+a,
+DEFAULT(a),
+CASE WHEN a THEN DEFAULT(a) END AS c,
+CASE WHEN a THEN DEFAULT(a) END IS FALSE AS ce
+FROM t1;
+a DEFAULT(a) c ce
+10 0 0 1
+SELECT a FROM t1 WHERE CASE WHEN a THEN DEFAULT(a) END IS FALSE;
+a
+10
+DROP TABLE t1;
+#
+# End of 10.2 tests
+#
diff --git a/mysql-test/main/func_default.test b/mysql-test/main/func_default.test
index 332bfca021f..cba7842c68f 100644
--- a/mysql-test/main/func_default.test
+++ b/mysql-test/main/func_default.test
@@ -34,9 +34,9 @@ INSERT INTO t1 VALUES (1, 'one'), (2, 'two'), (3, 'three');
SELECT s, 32 AS mi FROM t1 GROUP BY s HAVING DEFAULT(mi) IS NULL;
DROP TABLE t1;
-#
-# 10.2 tests
-#
+--echo #
+--echo # Start of 10.2 tests
+--echo #
set timestamp=unix_timestamp('2001-01-01 10:20:30.123456');
create table t1 (a int default 1, b int default (a+1),
@@ -46,3 +46,99 @@ insert t1 () values ();
insert t1 (a) values (10);
select default(a),default(b),default(c),default(d),default(e),default(f) from t1;
drop table t1;
+
+--echo #
+--echo # MDEV-21639 DEFAULT(col) evaluates to a bad value in WHERE clause
+--echo #
+
+CREATE TABLE t1 (a BIGINT NOT NULL DEFAULT (IF(false,UNIX_TIMESTAMP(),10)));
+INSERT INTO t1 VALUES (10000);
+SELECT
+ a,
+ DEFAULT(a),
+ CASE WHEN a THEN DEFAULT(a) END AS c,
+ CASE WHEN a THEN DEFAULT(a) END = 10 AS ce
+FROM t1;
+SELECT a FROM t1 WHERE CASE WHEN a THEN DEFAULT(a) END=10;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a DOUBLE NOT NULL DEFAULT (IF(false,UNIX_TIMESTAMP(),10)));
+INSERT INTO t1 VALUES (10000);
+SELECT
+ a,
+ DEFAULT(a),
+ CASE WHEN a THEN DEFAULT(a) END AS c,
+ CASE WHEN a THEN DEFAULT(a) END = 10 AS ce
+FROM t1;
+SELECT a FROM t1 WHERE CASE WHEN a THEN DEFAULT(a) END=10;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a DECIMAL(10,0) NOT NULL DEFAULT (IF(false,UNIX_TIMESTAMP(),10)));
+INSERT INTO t1 VALUES (10000);
+SELECT
+ a,
+ DEFAULT(a),
+ CASE WHEN a THEN DEFAULT(a) END AS c,
+ CASE WHEN a THEN DEFAULT(a) END = 10 AS ce
+FROM t1;
+SELECT a FROM t1 WHERE CASE WHEN a THEN DEFAULT(a) END=10;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a VARCHAR(32) NOT NULL DEFAULT (IF(false,UNIX_TIMESTAMP(),10)));
+INSERT INTO t1 VALUES (10000);
+SELECT
+ a,
+ DEFAULT(a),
+ CASE WHEN a THEN DEFAULT(a) END AS c,
+ CASE WHEN a THEN DEFAULT(a) END = '10' AS ce
+FROM t1;
+SELECT a FROM t1 WHERE CASE WHEN a THEN DEFAULT(a) END='10';
+DROP TABLE t1;
+
+CREATE TABLE t1 (a DATE NOT NULL DEFAULT (IF(false,UNIX_TIMESTAMP()%10,DATE'2001-01-01')));
+INSERT INTO t1 VALUES ('2000-01-01');
+SELECT
+ a,
+ DEFAULT(a),
+ CASE WHEN a THEN DEFAULT(a) END AS c,
+ CASE WHEN a THEN DEFAULT(a) END = '2001-01-01' AS ce
+FROM t1;
+SELECT a FROM t1 WHERE CASE WHEN a THEN DEFAULT(a) END='2001-01-01';
+DROP TABLE t1;
+
+CREATE TABLE t1 (a TIME NOT NULL DEFAULT (IF(false,UNIX_TIMESTAMP()%10,TIME'10:20:30')));
+INSERT INTO t1 VALUES ('10:00:00');
+SELECT
+ a,
+ DEFAULT(a),
+ CASE WHEN a THEN DEFAULT(a) END AS c,
+ CASE WHEN a THEN DEFAULT(a) END = '10:20:30' AS ce
+FROM t1;
+SELECT a FROM t1 WHERE CASE WHEN a THEN DEFAULT(a) END='10:20:30';
+DROP TABLE t1;
+
+CREATE TABLE t1 (a DATETIME NOT NULL DEFAULT (IF(false,UNIX_TIMESTAMP(),TIMESTAMP'2001-01-01 10:20:30')));
+INSERT INTO t1 VALUES ('2000-01-01 10:00:00');
+SELECT
+ a,
+ DEFAULT(a),
+ CASE WHEN a THEN DEFAULT(a) END AS c,
+ CASE WHEN a THEN DEFAULT(a) END = '2001-01-01 10:20:30' AS ce
+FROM t1;
+SELECT a FROM t1 WHERE CASE WHEN a THEN DEFAULT(a) END='2001-01-01 10:20:30';
+DROP TABLE t1;
+
+CREATE TABLE t1 (a INT NOT NULL DEFAULT (IF(false,UNIX_TIMESTAMP(),FALSE)));
+INSERT INTO t1 VALUES (10);
+SELECT
+ a,
+ DEFAULT(a),
+ CASE WHEN a THEN DEFAULT(a) END AS c,
+ CASE WHEN a THEN DEFAULT(a) END IS FALSE AS ce
+FROM t1;
+SELECT a FROM t1 WHERE CASE WHEN a THEN DEFAULT(a) END IS FALSE;
+DROP TABLE t1;
+
+--echo #
+--echo # End of 10.2 tests
+--echo #
diff --git a/mysql-test/main/func_json.result b/mysql-test/main/func_json.result
index 6656e0d5e51..cba57b0853e 100644
--- a/mysql-test/main/func_json.result
+++ b/mysql-test/main/func_json.result
@@ -940,6 +940,24 @@ SELECT JSON_REPLACE( JSON_DETAILED('["x"]'), '$.a', 'xx' );
JSON_REPLACE( JSON_DETAILED('["x"]'), '$.a', 'xx' )
["x"]
#
+# MDEV-18284 JSON casting using JSON_COMPACT doesn't always work
+# with values from subqueries
+#
+CREATE TABLE json_test(a JSON, b JSON);
+INSERT INTO json_test VALUES ("[1,2,3]", '{"a":"foo"}');
+SELECT * FROM json_test;
+a b
+[1,2,3] {"a":"foo"}
+SELECT json_object("a", json_compact(a), "b", b)
+FROM (SELECT * FROM json_test) AS json_test_values;
+json_object("a", json_compact(a), "b", b)
+{"a": [1,2,3], "b": "{\"a\":\"foo\"}"}
+SELECT json_object("a", json_compact(a), "b", json_compact(b))
+FROM (SELECT * FROM json_test) AS json_test_values;
+json_object("a", json_compact(a), "b", json_compact(b))
+{"a": [1,2,3], "b": {"a":"foo"}}
+DROP TABLE json_test;
+#
# End of 10.2 tests
#
#
diff --git a/mysql-test/main/func_json.test b/mysql-test/main/func_json.test
index 24f2ae9267c..aa461433dfe 100644
--- a/mysql-test/main/func_json.test
+++ b/mysql-test/main/func_json.test
@@ -558,6 +558,21 @@ SELECT
SELECT JSON_REPLACE( JSON_DETAILED('["x"]'), '$.a', 'xx' );
--echo #
+--echo # MDEV-18284 JSON casting using JSON_COMPACT doesn't always work
+--echo # with values from subqueries
+--echo #
+
+CREATE TABLE json_test(a JSON, b JSON);
+INSERT INTO json_test VALUES ("[1,2,3]", '{"a":"foo"}');
+SELECT * FROM json_test;
+
+SELECT json_object("a", json_compact(a), "b", b)
+ FROM (SELECT * FROM json_test) AS json_test_values;
+SELECT json_object("a", json_compact(a), "b", json_compact(b))
+ FROM (SELECT * FROM json_test) AS json_test_values;
+DROP TABLE json_test;
+
+--echo #
--echo # End of 10.2 tests
--echo #
diff --git a/mysql-test/main/func_str.result b/mysql-test/main/func_str.result
index 23ec1724d59..a7168567115 100644
--- a/mysql-test/main/func_str.result
+++ b/mysql-test/main/func_str.result
@@ -5023,6 +5023,59 @@ SELECT NULL IN (RIGHT(AES_ENCRYPT('foo','bar'), LAST_INSERT_ID()), 'qux');
NULL IN (RIGHT(AES_ENCRYPT('foo','bar'), LAST_INSERT_ID()), 'qux')
NULL
#
+# Bug#31374305 - FORMAT() NOT DISPLAYING WHOLE NUMBER SIDE CORRECTLY
+# FOR ES_MX AND ES_ES LOCALES
+#
+CREATE PROCEDURE load_locale_format_table()
+BEGIN
+DECLARE locale_list VARCHAR(1000) DEFAULT '
+ es_AR,es_BO,es_CL,es_CO,es_CR,es_DO,es_EC,es_ES,es_GT,es_HN,
+ es_MX,es_NI,es_PA,es_PE,es_PR,es_PY,es_SV,es_US,es_UY,es_VE';
+SET @fmt_stmt = 'INSERT INTO locale_format VALUES
+ (?, FORMAT(12131254123412541,2,?));';
+PREPARE stmt FROM @fmt_stmt;
+WHILE locale_list != '' DO
+/* get the first locale from the list */
+SET @locale =
+TRIM(REPLACE((SUBSTRING_INDEX(locale_list, ',', 1)), '\n',''));
+EXECUTE stmt USING @locale, @locale;
+/* remove the first locale from the list */
+IF LOCATE(',', locale_list) > 0 THEN
+SET locale_list =
+SUBSTRING(locale_list, LOCATE(',', locale_list) + 1);
+ELSE
+SET locale_list = '';
+END IF;
+END WHILE;
+DEALLOCATE PREPARE stmt;
+END|
+CREATE TABLE locale_format(locale VARCHAR(10), formatted_string VARCHAR(100));
+CALL load_locale_format_table();
+SELECT * FROM locale_format;
+locale formatted_string
+es_AR 12.131.254.123.412.541,00
+es_BO 12.131.254.123.412.541,00
+es_CL 12.131.254.123.412.541,00
+es_CO 12.131.254.123.412.541,00
+es_CR 12 131 254 123 412 541,00
+es_DO 12,131,254,123,412,541.00
+es_EC 12.131.254.123.412.541,00
+es_ES 12.131.254.123.412.541,00
+es_GT 12,131,254,123,412,541.00
+es_HN 12,131,254,123,412,541.00
+es_MX 12,131,254,123,412,541.00
+es_NI 12,131,254,123,412,541.00
+es_PA 12,131,254,123,412,541.00
+es_PE 12,131,254,123,412,541.00
+es_PR 12,131,254,123,412,541.00
+es_PY 12.131.254.123.412.541,00
+es_SV 12,131,254,123,412,541.00
+es_US 12,131,254,123,412,541.00
+es_UY 12.131.254.123.412.541,00
+es_VE 12.131.254.123.412.541,00
+DROP PROCEDURE load_locale_format_table;
+DROP TABLE locale_format;
+#
# End of 10.2 tests
#
#
diff --git a/mysql-test/main/func_str.test b/mysql-test/main/func_str.test
index b65cc98ff5a..11bafe4988a 100644
--- a/mysql-test/main/func_str.test
+++ b/mysql-test/main/func_str.test
@@ -1997,6 +1997,42 @@ DROP TABLE t1;
SELECT NULL IN (RIGHT(AES_ENCRYPT('foo','bar'), LAST_INSERT_ID()), 'qux');
+--echo #
+--echo # Bug#31374305 - FORMAT() NOT DISPLAYING WHOLE NUMBER SIDE CORRECTLY
+--echo # FOR ES_MX AND ES_ES LOCALES
+--echo #
+
+DELIMITER |;
+CREATE PROCEDURE load_locale_format_table()
+BEGIN
+ DECLARE locale_list VARCHAR(1000) DEFAULT '
+ es_AR,es_BO,es_CL,es_CO,es_CR,es_DO,es_EC,es_ES,es_GT,es_HN,
+ es_MX,es_NI,es_PA,es_PE,es_PR,es_PY,es_SV,es_US,es_UY,es_VE';
+ SET @fmt_stmt = 'INSERT INTO locale_format VALUES
+ (?, FORMAT(12131254123412541,2,?));';
+ PREPARE stmt FROM @fmt_stmt;
+ WHILE locale_list != '' DO
+ /* get the first locale from the list */
+ SET @locale =
+ TRIM(REPLACE((SUBSTRING_INDEX(locale_list, ',', 1)), '\n',''));
+ EXECUTE stmt USING @locale, @locale;
+ /* remove the first locale from the list */
+ IF LOCATE(',', locale_list) > 0 THEN
+ SET locale_list =
+ SUBSTRING(locale_list, LOCATE(',', locale_list) + 1);
+ ELSE
+ SET locale_list = '';
+ END IF;
+ END WHILE;
+ DEALLOCATE PREPARE stmt;
+END|
+DELIMITER ;|
+
+CREATE TABLE locale_format(locale VARCHAR(10), formatted_string VARCHAR(100));
+CALL load_locale_format_table();
+SELECT * FROM locale_format;
+DROP PROCEDURE load_locale_format_table;
+DROP TABLE locale_format;
--echo #
--echo # End of 10.2 tests
diff --git a/mysql-test/main/func_system.result b/mysql-test/main/func_system.result
index 06fb7e44cf0..688f4a30b50 100644
--- a/mysql-test/main/func_system.result
+++ b/mysql-test/main/func_system.result
@@ -46,7 +46,7 @@ create table t1 (version char(60)) select database(), user(), version() as 'vers
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `database()` varchar(34) CHARACTER SET utf8 DEFAULT NULL,
+ `database()` varchar(64) CHARACTER SET utf8 DEFAULT NULL,
`user()` varchar(141) CHARACTER SET utf8 DEFAULT NULL,
`version` char(60) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
@@ -95,3 +95,21 @@ select left(concat(a,version()),1) from t1;
left(concat(a,version()),1)
a
drop table t1;
+#
+# Start of 10.2 tests
+#
+
+MDEV-27544 database() function under UNION ALL truncates results to 34 characters
+
+
+SET NAMES utf8;
+create database betäubungsmittelverschreibungsverordnung;
+use betäubungsmittelverschreibungsverordnung;
+select database() as "database" union all select database();
+database
+betäubungsmittelverschreibungsverordnung
+betäubungsmittelverschreibungsverordnung
+drop database betäubungsmittelverschreibungsverordnung;
+#
+# End of 10.2 tests
+#
diff --git a/mysql-test/main/func_system.test b/mysql-test/main/func_system.test
index fa09e81a300..d9f2bda750a 100644
--- a/mysql-test/main/func_system.test
+++ b/mysql-test/main/func_system.test
@@ -55,3 +55,23 @@ select left(concat(a,version()),1) from t1;
drop table t1;
# End of 4.1 tests
+
+--echo #
+--echo # Start of 10.2 tests
+--echo #
+
+--echo
+--echo MDEV-27544 database() function under UNION ALL truncates results to 34 characters
+--echo
+--echo
+
+SET NAMES utf8;
+create database betäubungsmittelverschreibungsverordnung;
+use betäubungsmittelverschreibungsverordnung;
+select database() as "database" union all select database();
+drop database betäubungsmittelverschreibungsverordnung;
+
+
+--echo #
+--echo # End of 10.2 tests
+--echo #
diff --git a/mysql-test/main/index_merge_myisam.result b/mysql-test/main/index_merge_myisam.result
index 0663b2d4e90..bf60bda2708 100644
--- a/mysql-test/main/index_merge_myisam.result
+++ b/mysql-test/main/index_merge_myisam.result
@@ -173,17 +173,29 @@ or
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t0 index_merge i1,i2,i3,i5,i6,i7 i3,i5 4,4 NULL 11 Using sort_union(i3,i5); Using where
explain select * from t0 where
-((key3 <5 or key5 < 4) and (key1 < 4 or key2 < 4))
+((key3 < 4 or key5 < 4) and (key1 < 4 or key2 < 4))
or
((key3 >=5 or key5 < 2) and (key5 < 5 or key6 < 6));
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t0 ALL i1,i2,i3,i5,i6 NULL NULL NULL 1024 Using where
explain select * from t0 force index(i1, i2, i3, i4, i5, i6 ) where
-((key3 <5 or key5 < 4) and (key1 < 4 or key2 < 4))
+((key3 < 4 or key5 < 4) and (key1 < 4 or key2 < 4))
+or
+((key3 >=5 or key5 < 2) and (key5 < 5 or key6 < 6));
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t0 index_merge i1,i2,i3,i5,i6 i3,i5 4,4 NULL 1024 Using sort_union(i3,i5); Using where
+explain select * from t0 force index(i1, i2, i3, i4, i5, i6 ) where
+((key3 < 5 or key5 < 4) and (key1 < 4 or key2 < 4))
or
((key3 >=5 or key5 < 2) and (key5 < 5 or key6 < 6));
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t0 index_merge i1,i2,i3,i5,i6 i3,i5 0,4 NULL 1024 Using sort_union(i3,i5); Using where
+1 SIMPLE t0 ALL i1,i2,i3,i5,i6 NULL NULL NULL 1024 Using where
+explain select * from t0 force index(i1, i2, i3, i4, i5, i6 ) where
+((key3 < 10 or key5 < 4) and (key1 < 4 or key2 < 4))
+or
+((key3 >=5 or key5 < 2) and (key5 < 5 or key6 < 6));
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t0 ALL i1,i2,i3,i5,i6 NULL NULL NULL 1024 Using where
select * from t0 where key1 < 5 or key8 < 4 order by key1;
key1 key2 key3 key4 key5 key6 key7 key8
1 1 1 1 1 1 1 1023
diff --git a/mysql-test/main/information_schema_inno.result b/mysql-test/main/information_schema_inno.result
index d952e4372ca..c81631728f0 100644
--- a/mysql-test/main/information_schema_inno.result
+++ b/mysql-test/main/information_schema_inno.result
@@ -1,4 +1,3 @@
-DROP TABLE IF EXISTS t1,t2,t3;
CREATE TABLE t1 (id INT NOT NULL, PRIMARY KEY (id)) ENGINE=INNODB;
CREATE TABLE t2 (id INT PRIMARY KEY, t1_id INT, INDEX par_ind (t1_id, id),
FOREIGN KEY (t1_id) REFERENCES t1(id) ON DELETE CASCADE,
diff --git a/mysql-test/main/information_schema_inno.test b/mysql-test/main/information_schema_inno.test
index 3cdbb8111d9..6c50ff3ece0 100644
--- a/mysql-test/main/information_schema_inno.test
+++ b/mysql-test/main/information_schema_inno.test
@@ -1,8 +1,6 @@
-- source include/testdb_only.inc
-- source include/have_innodb.inc
---disable_warnings
-DROP TABLE IF EXISTS t1,t2,t3;
---enable_warnings
+-- source include/have_symlink.inc
#
# Test for KEY_COLUMN_USAGE & TABLE_CONSTRAINTS tables
diff --git a/mysql-test/main/insert_select.result b/mysql-test/main/insert_select.result
index 5094638c92b..e85c4982137 100644
--- a/mysql-test/main/insert_select.result
+++ b/mysql-test/main/insert_select.result
@@ -865,3 +865,22 @@ t2 CREATE TABLE `t2` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1, t2;
End of 5.5 tests
+#
+# Beginning of 10.2 test
+#
+# MDEV-26698: Incorrect row number upon INSERT .. SELECT from the same
+# table: rows are counted twice
+#
+CREATE TABLE t1(a TINYINT);
+INSERT INTO t1 VALUES (1), (100);
+INSERT INTO t1 SELECT a*2 FROM t1;
+Warnings:
+Warning 1264 Out of range value for column 'a' at row 2
+TRUNCATE TABLE t1;
+# using ORDER BY
+INSERT INTO t1 VALUES(1), (2), (100), (3);
+INSERT INTO t1 SELECT a*2 FROM t1 ORDER BY a;
+Warnings:
+Warning 1264 Out of range value for column 'a' at row 4
+DROP TABLE t1;
+# End of 10.2 test
diff --git a/mysql-test/main/insert_select.test b/mysql-test/main/insert_select.test
index 0b5cdf95daf..91b2cc6f981 100644
--- a/mysql-test/main/insert_select.test
+++ b/mysql-test/main/insert_select.test
@@ -435,3 +435,28 @@ show create table t2;
drop table t1, t2;
--echo End of 5.5 tests
+
+--echo #
+--echo # Beginning of 10.2 test
+--echo #
+--echo # MDEV-26698: Incorrect row number upon INSERT .. SELECT from the same
+--echo # table: rows are counted twice
+--echo #
+
+CREATE TABLE t1(a TINYINT);
+
+INSERT INTO t1 VALUES (1), (100);
+
+INSERT INTO t1 SELECT a*2 FROM t1;
+
+TRUNCATE TABLE t1;
+
+--echo # using ORDER BY
+
+INSERT INTO t1 VALUES(1), (2), (100), (3);
+
+INSERT INTO t1 SELECT a*2 FROM t1 ORDER BY a;
+
+DROP TABLE t1;
+
+--echo # End of 10.2 test
diff --git a/mysql-test/main/mysql_client_test-master.opt b/mysql-test/main/mysql_client_test-master.opt
index 8d49abf6a10..e3d42121b45 100644
--- a/mysql-test/main/mysql_client_test-master.opt
+++ b/mysql-test/main/mysql_client_test-master.opt
@@ -3,3 +3,4 @@
--log-output=FILE,TABLE
--max-allowed-packet=32000000
--proxy-protocol-networks=*
+--sequence=on
diff --git a/mysql-test/main/mysql_client_test_comp-master.opt b/mysql-test/main/mysql_client_test_comp-master.opt
index 6c4a5e4c782..ccaa4a8ee6e 100644
--- a/mysql-test/main/mysql_client_test_comp-master.opt
+++ b/mysql-test/main/mysql_client_test_comp-master.opt
@@ -1,3 +1,4 @@
--loose-enable-performance-schema
--max-allowed-packet=32000000
--proxy-protocol-networks=::1/32,127.0.0.0/8,localhost
+--sequence=on
diff --git a/mysql-test/main/mysql_client_test_nonblock-master.opt b/mysql-test/main/mysql_client_test_nonblock-master.opt
index a39d0089562..f306d27feac 100644
--- a/mysql-test/main/mysql_client_test_nonblock-master.opt
+++ b/mysql-test/main/mysql_client_test_nonblock-master.opt
@@ -1,3 +1,4 @@
--general-log --general-log-file=$MYSQLTEST_VARDIR/log/master.log --log-output=FILE,TABLE
--max-allowed-packet=32000000
--proxy-protocol-networks=::1,::ffff:127.0.0.1/97,localhost
+--sequence=on
diff --git a/mysql-test/main/mysql_upgrade-6984.test b/mysql-test/main/mysql_upgrade-6984.test
index 9bbfbeb3f87..89ebd46e3ba 100644
--- a/mysql-test/main/mysql_upgrade-6984.test
+++ b/mysql-test/main/mysql_upgrade-6984.test
@@ -13,6 +13,7 @@
update mysql.user set password=password("foo") where user='root';
+--replace_regex /[^ ]*mysql_upgrade_info/...mysql_upgrade_info/
--exec $MYSQL_UPGRADE
connect(con1,localhost,root,foo,,,);
@@ -21,3 +22,6 @@ update mysql.user set password='' where user='root';
flush privileges;
# Load event table
set global event_scheduler=OFF;
+
+let MYSQLD_DATADIR= `select @@datadir`;
+--remove_file $MYSQLD_DATADIR/mysql_upgrade_info
diff --git a/mysql-test/main/mysql_upgrade.result b/mysql-test/main/mysql_upgrade.result
index f4c51e17c04..d750f8f91b5 100644
--- a/mysql-test/main/mysql_upgrade.result
+++ b/mysql-test/main/mysql_upgrade.result
@@ -47,7 +47,8 @@ test
Phase 7/7: Running 'FLUSH PRIVILEGES'
OK
Run it again - should say already completed
-This installation of MySQL is already upgraded to VERSION, use --force if you still need to run mysql_upgrade
+This installation of MariaDB is already upgraded to VERSION.There is no need to run mysql_upgrade again for VERSION.
+You can use --force if you still want to run mysql_upgrade
Force should run it regardless of whether it has been run before
Phase 1/7: Checking and upgrading mysql database
Processing databases
@@ -145,11 +146,12 @@ test
Phase 7/7: Running 'FLUSH PRIVILEGES'
OK
DROP USER mysqltest1@'%';
-Version check failed. Got the following error when calling the 'mysql' command line client
+Reading datadir from the MariaDB server failed. Got the following error when executing the 'mysql' command line client
ERROR 1045 (28000): Access denied for user 'mysqltest1'@'localhost' (using password: YES)
FATAL ERROR: Upgrade failed
Run mysql_upgrade with a non existing server socket
-mysqlcheck: Got error: 2005: Unknown MySQL server host 'not_existing_host' (errno) when trying to connect
+Reading datadir from the MariaDB server failed. Got the following error when executing the 'mysql' command line client
+ERROR 2005 (HY000): Unknown MySQL server host 'not_existing_host' (errno)
FATAL ERROR: Upgrade failed
set GLOBAL sql_mode='STRICT_ALL_TABLES,ANSI_QUOTES,NO_ZERO_DATE';
Phase 1/7: Checking and upgrading mysql database
@@ -413,9 +415,12 @@ OK
# Bug #21489398: MYSQL_UPGRADE: FATAL ERROR: UPGRADE FAILED - IMPROVE ERROR
#
Run mysql_upgrade with unauthorized access
-Version check failed. Got the following error when calling the 'mysql' command line client
+Reading datadir from the MariaDB server failed. Got the following error when executing the 'mysql' command line client
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
FATAL ERROR: Upgrade failed
+Reading datadir from the MariaDB server failed. Got the following error when executing the 'mysql' command line client
+ERROR 1045 (errno): Access denied for user 'root'@'localhost' (using password: YES)
+FATAL ERROR: Upgrade failed
#
# MDEV-4332 Increase username length from 16 characters
# MDEV-6068, MDEV-6178 mysql_upgrade breaks databases with long user names
@@ -868,6 +873,34 @@ GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION
GRANT USAGE ON *.* TO `aRole`
DROP ROLE `aRole`;
FLUSH PRIVILEGES;
+#
+# MDEV-27279: mariadb_upgrade add --check-if-upgrade-is-needed
+#
+This installation of MariaDB is already upgraded to MariaDB .
+There is no need to run mysql_upgrade again for MariaDB .
+Looking for 'mysql' as: mysql
+This installation of MariaDB is already upgraded to MariaDB .
+There is no need to run mysql_upgrade again for MariaDB .
+#
+# MDEV-27279: mariadb_upgrade check-if-upgrade absence is do it
+#
+Looking for 'mysql' as: mysql
+Empty or non existent ...mysql_upgrade_info. Assuming mysql_upgrade has to be run!
+#
+# MDEV-27279: mariadb_upgrade check-if-upgrade with minor version change
+#
+Looking for 'mysql' as: mysql
+This installation of MariaDB is already upgraded to MariaDB .
+There is no need to run mysql_upgrade again for MariaDB .
+This installation of MariaDB is already upgraded to MariaDB .
+There is no need to run mysql_upgrade again for MariaDB .
+You can use --force if you still want to run mysql_upgrade
+#
+# MDEV-27279: mariadb_upgrade check-if-upgrade with major version change
+#
+Major version upgrade detected from MariaDB to MariaDB . Check required!
+Looking for 'mysql' as: mysql
+Major version upgrade detected from MariaDB to MariaDB . Check required!
End of 10.2 tests
#
# Ensure that mysql_upgrade correctly sets truncate_versioning_priv
diff --git a/mysql-test/main/mysql_upgrade.test b/mysql-test/main/mysql_upgrade.test
index afc7c97f7d0..0e42bb81fd9 100644
--- a/mysql-test/main/mysql_upgrade.test
+++ b/mysql-test/main/mysql_upgrade.test
@@ -17,7 +17,7 @@ let $MYSQLD_DATADIR= `select @@datadir`;
file_exists $MYSQLD_DATADIR/mysql_upgrade_info;
--echo Run it again - should say already completed
---replace_regex /upgraded to .*, use/upgraded to VERSION, use/
+--replace_regex /upgraded to [^\n].*/upgraded to VERSION./ /again for [^\n]*/again for VERSION./
--exec $MYSQL_UPGRADE 2>&1
# It should have created a file in the MySQL Servers datadir
@@ -126,7 +126,7 @@ let $MYSQLD_DATADIR= `select @@datadir`;
--remove_file $MYSQLD_DATADIR/mysql_upgrade_info
--echo # Running mysql_upgrade with --skip-write-binlog..
---replace_result $MYSQLTEST_VARDIR var
+--replace_regex /[^ ]*mysql_upgrade_info/...mysql_upgrade_info/
--exec $MYSQL_UPGRADE --skip-write-binlog
# mysql_upgrade must have created mysql_upgrade_info file,
@@ -140,6 +140,9 @@ let $MYSQLD_DATADIR= `select @@datadir`;
--echo Run mysql_upgrade with unauthorized access
--error 1
--exec $MYSQL_UPGRADE --skip-verbose --user=root --password=wrong_password 2>&1
+--replace_regex /.*mysqlcheck.*: Got/mysqlcheck: Got/ /\([0-9|-]*\)/(errno)/
+--error 1
+--exec $MYSQL_UPGRADE --skip-verbose --skip-version-check --user=root --password=wrong_password 2>&1
--echo #
--echo # MDEV-4332 Increase username length from 16 characters
@@ -235,6 +238,7 @@ FLUSH TABLES mysql.user;
FLUSH PRIVILEGES;
SHOW CREATE TABLE mysql.user;
+--replace_result $MYSQLTEST_VARDIR var
--exec $MYSQL_UPGRADE --force 2>&1
SHOW CREATE TABLE mysql.user;
@@ -279,6 +283,79 @@ SHOW GRANTS;
DROP ROLE `aRole`;
--exec $MYSQL mysql < $MYSQLTEST_VARDIR/tmp/user.sql
FLUSH PRIVILEGES;
+
+--echo #
+--echo # MDEV-27279: mariadb_upgrade add --check-if-upgrade-is-needed
+--echo #
+
+--error 1
+--exec $MYSQL_UPGRADE --check-if-upgrade-is-needed --silent
+--replace_regex /\d\d\.\d*\.\d*[^ .\n]*/MariaDB /
+--error 1
+--exec $MYSQL_UPGRADE --check-if-upgrade-is-needed
+--replace_regex /\d\d\.\d*\.\d*[^ .\n]*/MariaDB / /'mysql.* as:[^\n]*/'mysql' as: mysql/
+--error 1
+--exec $MYSQL_UPGRADE --check-if-upgrade-is-needed --verbose
+
+--echo #
+--echo # MDEV-27279: mariadb_upgrade check-if-upgrade absence is do it
+--echo #
+
+--remove_file $MYSQLD_DATADIR/mysql_upgrade_info
+--replace_regex /[^ ]*mysql_upgrade_info/...mysql_upgrade_info/
+--exec $MYSQL_UPGRADE --check-if-upgrade-is-needed
+
+--replace_regex /'mysql.* as:[^\n]*/'mysql' as: mysql/ /open .* Assuming/open XXX. Assuming/ /[^ ]*mysql_upgrade_info/...mysql_upgrade_info/
+--exec $MYSQL_UPGRADE --check-if-upgrade-is-needed --verbose
+
+--echo #
+--echo # MDEV-27279: mariadb_upgrade check-if-upgrade with minor version change
+--echo #
+
+# take 3rd number of version and change to 0
+
+let DATADIR= $MYSQLD_DATADIR;
+
+perl;
+ my $ver= $ENV{'MYSQL_SERVER_VERSION'} or die "MYSQL_SERVER_VERSION not set";
+ my $file= $ENV{'DATADIR'} or die "MYSQLD_DATADIR not set";
+ $ver =~ s/^(\d*)\.(\d*).(\d*)(.*)/$1.$2.0$4/;
+ open(FILE, ">$file/mysql_upgrade_info") or die "Failed to open $file";
+ print FILE "$ver\n";
+ close(FILE);
+EOF
+
+--error 1
+--exec $MYSQL_UPGRADE --check-if-upgrade-is-needed --silent
+--replace_regex /\d\d\.\d*\.\d*[^ .\n]*/MariaDB / /'mysql.* as:[^\n]*/'mysql' as: mysql/
+--error 1
+--exec $MYSQL_UPGRADE --check-if-upgrade-is-needed --verbose
+--replace_regex /\d\d\.\d*\.\d*[^ .\n]*/MariaDB /
+--exec $MYSQL_UPGRADE
+--remove_file $MYSQLD_DATADIR/mysql_upgrade_info
+
+--echo #
+--echo # MDEV-27279: mariadb_upgrade check-if-upgrade with major version change
+--echo #
+
+# take 2rd number of version and change to 0
+
+let DATADIR= $MYSQLD_DATADIR;
+
+perl;
+ my $ver= $ENV{'MYSQL_SERVER_VERSION'} or die "MYSQL_SERVER_VERSION not set";
+ my $file= $ENV{'DATADIR'} or die "MYSQLD_DATADIR not set";
+ $ver =~ s/^(\d*)\.(\d*).(\d*)(.*)/$1.0.$3$4/;
+ open(FILE, ">$file/mysql_upgrade_info") or die "Failed to open $file";
+ print FILE "$ver\n";
+ close(FILE);
+EOF
+
+--exec $MYSQL_UPGRADE --check-if-upgrade-is-needed --silent
+--replace_regex /\d\d\.\d*\.\d*[^ .\n]*/MariaDB /
+--exec $MYSQL_UPGRADE --check-if-upgrade-is-needed
+--replace_regex /\d\d\.\d*\.\d*[^ .\n]*/MariaDB / /'mysql.* as:[^\n]*/'mysql' as: mysql/
+--exec $MYSQL_UPGRADE --check-if-upgrade-is-needed --verbose
--remove_file $MYSQLD_DATADIR/mysql_upgrade_info
--echo End of 10.2 tests
diff --git a/mysql-test/main/mysql_upgrade_noengine.result b/mysql-test/main/mysql_upgrade_noengine.result
index 7b3b1610ee0..8bd82dce7af 100644
--- a/mysql-test/main/mysql_upgrade_noengine.result
+++ b/mysql-test/main/mysql_upgrade_noengine.result
@@ -53,6 +53,7 @@ Warnings:
Level Warning
Code 1286
Message Unknown storage engine 'ARCHIVE'
+# upgrade from 10.1 - engines aren't enabled
Phase 1/7: Checking and upgrading mysql database
Processing databases
mysql
@@ -142,6 +143,8 @@ Level Warning
Code 1286
Message Unknown storage engine 'ARCHIVE'
alter table mysql.user drop column default_role, drop column max_statement_time;
+# still upgrade from 10.1
+Major version upgrade detected from MariaDB to MariaDB . Check required!
Phase 1/7: Checking and upgrading mysql database
Processing databases
mysql
@@ -231,6 +234,7 @@ Level Warning
Code 1286
Message Unknown storage engine 'ARCHIVE'
alter table mysql.user drop column default_role, drop column max_statement_time;
+# upgrade from 10.0 - engines are enabled
Phase 1/7: Checking and upgrading mysql database
Processing databases
mysql
diff --git a/mysql-test/main/mysql_upgrade_noengine.test b/mysql-test/main/mysql_upgrade_noengine.test
index 1d65e7ffa1c..cf7b84feff4 100644
--- a/mysql-test/main/mysql_upgrade_noengine.test
+++ b/mysql-test/main/mysql_upgrade_noengine.test
@@ -28,7 +28,8 @@ uninstall plugin archive;
select table_catalog, table_schema, table_name, table_type, engine, row_format, table_rows, data_length, table_comment from information_schema.tables where table_schema='test' and table_name='t1';
select table_catalog, table_schema, table_name, table_type, engine, row_format, table_rows, data_length, table_comment from information_schema.tables where table_schema='test' and table_name='t2';
-# upgrade from 10.1 - engines aren't enabled
+--echo # upgrade from 10.1 - engines aren't enabled
+--replace_regex /\d\d\.\d*\.\d*[^ .\n]*/MariaDB /
exec $MYSQL_UPGRADE 2>&1;
select table_catalog, table_schema, table_name, table_type, engine, row_format, table_rows, data_length, table_comment from information_schema.tables where table_schema='test' and table_name='t1';
select table_catalog, table_schema, table_name, table_type, engine, row_format, table_rows, data_length, table_comment from information_schema.tables where table_schema='test' and table_name='t2';
@@ -42,7 +43,8 @@ write_file $datadir/mysql_upgrade_info;
10.1.10-MariaDB
EOF
-# still upgrade from 10.1
+--echo # still upgrade from 10.1
+--replace_regex /\d\d\.\d*\.\d*[^ .\n]*/MariaDB /
exec $MYSQL_UPGRADE 2>&1;
select table_catalog, table_schema, table_name, table_type, engine, row_format, table_rows, data_length, table_comment from information_schema.tables where table_schema='test' and table_name='t1';
select table_catalog, table_schema, table_name, table_type, engine, row_format, table_rows, data_length, table_comment from information_schema.tables where table_schema='test' and table_name='t2';
@@ -50,7 +52,8 @@ select table_catalog, table_schema, table_name, table_type, engine, row_format,
alter table mysql.user drop column default_role, drop column max_statement_time;
remove_file $datadir/mysql_upgrade_info;
-# upgrade from 10.0 - engines are enabled
+--echo # upgrade from 10.0 - engines are enabled
+--replace_regex /\d\d\.\d*\.\d*[^ .\n]*/MariaDB /
exec $MYSQL_UPGRADE 2>&1;
select table_catalog, table_schema, table_name, table_type, engine, row_format, table_rows, data_length, table_comment from information_schema.tables where table_schema='test' and table_name='t1';
select table_catalog, table_schema, table_name, table_type, engine, row_format, table_rows, data_length, table_comment from information_schema.tables where table_schema='test' and table_name='t2';
diff --git a/mysql-test/main/mysql_upgrade_view.result b/mysql-test/main/mysql_upgrade_view.result
index 813138b57a8..172ef7e4159 100644
--- a/mysql-test/main/mysql_upgrade_view.result
+++ b/mysql-test/main/mysql_upgrade_view.result
@@ -211,7 +211,7 @@ v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VI
show create view v4;
View Create View character_set_client collation_connection
v4 CREATE ALGORITHM=TEMPTABLE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v4` AS select `t1`.`a` AS `a` from `t1` latin1 latin1_swedish_ci
-MySQL upgrade detected
+MariaDB upgrade detected
Phase 1/7: Checking and upgrading mysql database
Processing databases
mysql
@@ -336,7 +336,7 @@ drop view v1,v2,v3,v4;
rename table mysql.event to mysql.ev_bk;
flush tables;
The --upgrade-system-tables option was used, user tables won't be touched.
-MySQL upgrade detected
+MariaDB upgrade detected
Phase 1/7: Checking and upgrading mysql database
Processing databases
mysql
diff --git a/mysql-test/main/order_by.result b/mysql-test/main/order_by.result
index c8f63f881cc..214d848981a 100644
--- a/mysql-test/main/order_by.result
+++ b/mysql-test/main/order_by.result
@@ -3485,6 +3485,29 @@ b a
40 1
30 4
drop table t1,t2;
+#
+# MDEV-22256 Assertion `length == pack_length()' failed in Field_timestamp_with_dec::sort_string
+#
+SET sql_mode='';
+SET @@SESSION.max_sort_length=4;
+Warnings:
+Warning 1292 Truncated incorrect max_sort_length value: '4'
+CREATE TABLE t1 (c TIMESTAMP(1));
+INSERT INTO t1 VALUES(0);
+DELETE FROM t1 ORDER BY c;
+DROP TABLE t1;
+SET @@SESSION.max_sort_length=DEFAULT;
+SET sql_mode=DEFAULT;
+SET sql_mode='';
+SET @@SESSION.max_sort_length=1;
+Warnings:
+Warning 1292 Truncated incorrect max_sort_length value: '1'
+CREATE TEMPORARY TABLE t1 (c DATETIME);
+INSERT INTO t1 VALUES(0);
+DELETE FROM t1 ORDER BY c;
+DROP TABLE t1;
+SET @@SESSION.max_sort_length=DEFAULT;
+SET sql_mode=DEFAULT;
# End of 10.2 tests
#
# MDEV-16214: Incorrect plan taken by the optimizer , uses INDEX instead of ref access with ORDER BY
diff --git a/mysql-test/main/order_by.test b/mysql-test/main/order_by.test
index 08d5982b220..1a0235c5c53 100644
--- a/mysql-test/main/order_by.test
+++ b/mysql-test/main/order_by.test
@@ -2309,6 +2309,29 @@ explain (select b,a from t2 order by a limit 3) order by b desc;
drop table t1,t2;
+--echo #
+--echo # MDEV-22256 Assertion `length == pack_length()' failed in Field_timestamp_with_dec::sort_string
+--echo #
+
+SET sql_mode='';
+SET @@SESSION.max_sort_length=4;
+CREATE TABLE t1 (c TIMESTAMP(1));
+INSERT INTO t1 VALUES(0);
+DELETE FROM t1 ORDER BY c;
+DROP TABLE t1;
+SET @@SESSION.max_sort_length=DEFAULT;
+SET sql_mode=DEFAULT;
+
+SET sql_mode='';
+SET @@SESSION.max_sort_length=1;
+CREATE TEMPORARY TABLE t1 (c DATETIME);
+INSERT INTO t1 VALUES(0);
+DELETE FROM t1 ORDER BY c;
+DROP TABLE t1;
+SET @@SESSION.max_sort_length=DEFAULT;
+SET sql_mode=DEFAULT;
+
+
--echo # End of 10.2 tests
--echo #
diff --git a/mysql-test/main/partition_sp.result b/mysql-test/main/partition_sp.result
new file mode 100644
index 00000000000..585e2c7ab9d
--- /dev/null
+++ b/mysql-test/main/partition_sp.result
@@ -0,0 +1,22 @@
+#
+# MDEV-8652: Partitioned table creation problem when
+# creating from procedure context twice in same session
+#
+CREATE PROCEDURE p1()
+BEGIN
+DROP TABLE IF EXISTS t1 ;
+CREATE TABLE t1 (
+id INT PRIMARY KEY
+)
+PARTITION BY RANGE (id) (
+PARTITION P1 VALUES LESS THAN (2),
+PARTITION P2 VALUES LESS THAN (3)
+);
+END |
+call p1();
+call p1();
+drop procedure p1;
+drop table t1;
+#
+# End of 10.2 tests
+#
diff --git a/mysql-test/main/partition_sp.test b/mysql-test/main/partition_sp.test
new file mode 100644
index 00000000000..1d3d1d707c7
--- /dev/null
+++ b/mysql-test/main/partition_sp.test
@@ -0,0 +1,35 @@
+--source include/have_partition.inc
+
+--echo #
+--echo # MDEV-8652: Partitioned table creation problem when
+--echo # creating from procedure context twice in same session
+--echo #
+
+
+DELIMITER |;
+
+CREATE PROCEDURE p1()
+BEGIN
+ DROP TABLE IF EXISTS t1 ;
+
+ CREATE TABLE t1 (
+ id INT PRIMARY KEY
+ )
+ PARTITION BY RANGE (id) (
+ PARTITION P1 VALUES LESS THAN (2),
+ PARTITION P2 VALUES LESS THAN (3)
+ );
+END |
+
+DELIMITER ;|
+
+call p1();
+call p1();
+
+drop procedure p1;
+drop table t1;
+
+--echo #
+--echo # End of 10.2 tests
+--echo #
+
diff --git a/mysql-test/main/partition_symlink.result b/mysql-test/main/partition_symlink.result
index 90048eb3438..b5a976e3a9e 100644
--- a/mysql-test/main/partition_symlink.result
+++ b/mysql-test/main/partition_symlink.result
@@ -177,3 +177,97 @@ partition by key (a)
(partition p0,
partition p1 DATA DIRECTORY 'part-data' INDEX DIRECTORY 'part-data');
Got one of the listed errors
+#
+# MDEV-25917 create table like fails if source table is partitioned and engine is myisam or aria with data directory.
+#
+CREATE TABLE t1 (a INT)
+ENGINE = MyISAM
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0)
+DATA DIRECTORY 'MYSQLTEST_VARDIR/tmp'
+ INDEX DIRECTORY 'MYSQLTEST_VARDIR/tmp',
+PARTITION p1 VALUES IN (1)
+DATA DIRECTORY 'MYSQLTEST_VARDIR/tmp'
+ INDEX DIRECTORY 'MYSQLTEST_VARDIR/tmp',
+PARTITION p2 VALUES IN (2));
+CREATE TABLE t2 LIKE t1;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+ PARTITION BY LIST (`a`)
+(PARTITION `p0` VALUES IN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/tmp' ENGINE = MyISAM,
+ PARTITION `p1` VALUES IN (1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/tmp' ENGINE = MyISAM,
+ PARTITION `p2` VALUES IN (2) ENGINE = MyISAM)
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+ PARTITION BY LIST (`a`)
+(PARTITION `p0` VALUES IN (0) ENGINE = MyISAM,
+ PARTITION `p1` VALUES IN (1) ENGINE = MyISAM,
+ PARTITION `p2` VALUES IN (2) ENGINE = MyISAM)
+DROP TABLE t1, t2;
+CREATE TABLE t1 (
+ID int(11) NOT NULL,
+type int(11)) Engine=MyISAM
+PARTITION BY RANGE(ID)
+SUBPARTITION BY HASH(type)
+(
+PARTITION p01 VALUES LESS THAN(100)
+(SUBPARTITION s11
+DATA DIRECTORY 'MYSQLTEST_VARDIR/tmp'
+ INDEX DIRECTORY 'MYSQLTEST_VARDIR/tmp',
+SUBPARTITION s12
+DATA DIRECTORY 'MYSQLTEST_VARDIR/tmp'
+ INDEX DIRECTORY 'MYSQLTEST_VARDIR/tmp'
+ ),
+PARTITION p11 VALUES LESS THAN(200)
+(SUBPARTITION s21, SUBPARTITION s22),
+PARTITION p21 VALUES LESS THAN MAXVALUE
+(SUBPARTITION s31
+DATA DIRECTORY 'MYSQLTEST_VARDIR/tmp'
+ INDEX DIRECTORY 'MYSQLTEST_VARDIR/tmp',
+SUBPARTITION s32
+DATA DIRECTORY 'MYSQLTEST_VARDIR/tmp'
+ INDEX DIRECTORY 'MYSQLTEST_VARDIR/tmp'
+ )
+);
+CREATE TABLE t2 LIKE t1;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `ID` int(11) NOT NULL,
+ `type` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+ PARTITION BY RANGE (`ID`)
+SUBPARTITION BY HASH (`type`)
+(PARTITION `p01` VALUES LESS THAN (100)
+ (SUBPARTITION `s11` DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/tmp' ENGINE = MyISAM,
+ SUBPARTITION `s12` DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/tmp' ENGINE = MyISAM),
+ PARTITION `p11` VALUES LESS THAN (200)
+ (SUBPARTITION `s21` ENGINE = MyISAM,
+ SUBPARTITION `s22` ENGINE = MyISAM),
+ PARTITION `p21` VALUES LESS THAN MAXVALUE
+ (SUBPARTITION `s31` DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/tmp' ENGINE = MyISAM,
+ SUBPARTITION `s32` DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/tmp' ENGINE = MyISAM))
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `ID` int(11) NOT NULL,
+ `type` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+ PARTITION BY RANGE (`ID`)
+SUBPARTITION BY HASH (`type`)
+(PARTITION `p01` VALUES LESS THAN (100)
+ (SUBPARTITION `s11` ENGINE = MyISAM,
+ SUBPARTITION `s12` ENGINE = MyISAM),
+ PARTITION `p11` VALUES LESS THAN (200)
+ (SUBPARTITION `s21` ENGINE = MyISAM,
+ SUBPARTITION `s22` ENGINE = MyISAM),
+ PARTITION `p21` VALUES LESS THAN MAXVALUE
+ (SUBPARTITION `s31` ENGINE = MyISAM,
+ SUBPARTITION `s32` ENGINE = MyISAM))
+DROP TABLE t1, t2;
diff --git a/mysql-test/main/partition_symlink.test b/mysql-test/main/partition_symlink.test
index 8f6e837299a..7e09c7d0642 100644
--- a/mysql-test/main/partition_symlink.test
+++ b/mysql-test/main/partition_symlink.test
@@ -220,3 +220,58 @@ ENGINE = MyISAM
partition by key (a)
(partition p0,
partition p1 DATA DIRECTORY 'part-data' INDEX DIRECTORY 'part-data');
+
+--echo #
+--echo # MDEV-25917 create table like fails if source table is partitioned and engine is myisam or aria with data directory.
+--echo #
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+eval CREATE TABLE t1 (a INT)
+ENGINE = MyISAM
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0)
+ DATA DIRECTORY '$MYSQLTEST_VARDIR/tmp'
+ INDEX DIRECTORY '$MYSQLTEST_VARDIR/tmp',
+ PARTITION p1 VALUES IN (1)
+ DATA DIRECTORY '$MYSQLTEST_VARDIR/tmp'
+ INDEX DIRECTORY '$MYSQLTEST_VARDIR/tmp',
+ PARTITION p2 VALUES IN (2));
+
+CREATE TABLE t2 LIKE t1;
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+SHOW CREATE TABLE t1;
+SHOW CREATE TABLE t2;
+DROP TABLE t1, t2;
+
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+eval CREATE TABLE t1 (
+ ID int(11) NOT NULL,
+ type int(11)) Engine=MyISAM
+PARTITION BY RANGE(ID)
+SUBPARTITION BY HASH(type)
+(
+ PARTITION p01 VALUES LESS THAN(100)
+ (SUBPARTITION s11
+ DATA DIRECTORY '$MYSQLTEST_VARDIR/tmp'
+ INDEX DIRECTORY '$MYSQLTEST_VARDIR/tmp',
+ SUBPARTITION s12
+ DATA DIRECTORY '$MYSQLTEST_VARDIR/tmp'
+ INDEX DIRECTORY '$MYSQLTEST_VARDIR/tmp'
+ ),
+ PARTITION p11 VALUES LESS THAN(200)
+ (SUBPARTITION s21, SUBPARTITION s22),
+ PARTITION p21 VALUES LESS THAN MAXVALUE
+ (SUBPARTITION s31
+ DATA DIRECTORY '$MYSQLTEST_VARDIR/tmp'
+ INDEX DIRECTORY '$MYSQLTEST_VARDIR/tmp',
+ SUBPARTITION s32
+ DATA DIRECTORY '$MYSQLTEST_VARDIR/tmp'
+ INDEX DIRECTORY '$MYSQLTEST_VARDIR/tmp'
+ )
+);
+
+CREATE TABLE t2 LIKE t1;
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+SHOW CREATE TABLE t1;
+SHOW CREATE TABLE t2;
+
+DROP TABLE t1, t2;
diff --git a/mysql-test/main/range_innodb.result b/mysql-test/main/range_innodb.result
index f2349f26571..df111bc05be 100644
--- a/mysql-test/main/range_innodb.result
+++ b/mysql-test/main/range_innodb.result
@@ -108,3 +108,108 @@ DROP TABLE t0,t1;
SET @@GLOBAL.debug_dbug = @saved_dbug;
set @@optimizer_switch= @optimizer_switch_save;
# End of 10.1 tests
+#
+# MDEV-27262: Index intersection with full scan over an index
+#
+CREATE TABLE t1 (
+id int(10) unsigned NOT NULL AUTO_INCREMENT,
+p char(32) DEFAULT NULL,
+es tinyint(3) unsigned NOT NULL DEFAULT 0,
+er tinyint(3) unsigned NOT NULL DEFAULT 0,
+x mediumint(8) unsigned NOT NULL DEFAULT 0,
+PRIMARY KEY (id),
+INDEX es (es),
+INDEX x (x),
+INDEX er (er,x),
+INDEX p (p)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+insert into t1(es,er) select 0, 1 from seq_1_to_45;
+insert into t1(es,er) select 0, 2 from seq_1_to_49;
+insert into t1(es,er) select 0, 3 from seq_1_to_951;
+insert into t1(es,er) select 0, 3 from seq_1_to_1054;
+insert into t1(es,er) select 0, 6 from seq_1_to_25;
+insert into t1(es,er) select 0, 11 from seq_1_to_1;
+insert into t1(es,er) select 1, 1 from seq_1_to_45;
+insert into t1(es,er) select 1, 2 from seq_1_to_16;
+insert into t1(es,er) select 1, 3 from seq_1_to_511;
+insert into t1(es,er) select 1, 4 from seq_1_to_687;
+insert into t1(es,er) select 1, 6 from seq_1_to_50;
+insert into t1(es,er) select 1, 7 from seq_1_to_4;
+insert into t1(es,er) select 1, 11 from seq_1_to_1;
+insert into t1(es,er) select 2, 1 from seq_1_to_82;
+insert into t1(es,er) select 2, 2 from seq_1_to_82;
+insert into t1(es,er) select 2, 3 from seq_1_to_1626;
+insert into t1(es,er) select 2, 4 from seq_1_to_977;
+insert into t1(es,er) select 2, 6 from seq_1_to_33;
+insert into t1(es,er) select 2, 11 from seq_1_to_1;
+insert into t1(es,er) select 3, 1 from seq_1_to_245;
+insert into t1(es,er) select 3, 2 from seq_1_to_81;
+insert into t1(es,er) select 3, 3 from seq_1_to_852;
+insert into t1(es,er) select 3, 4 from seq_1_to_2243;
+insert into t1(es,er) select 3, 6 from seq_1_to_44;
+insert into t1(es,er) select 3, 11 from seq_1_to_1;
+insert into t1(es,er) select 4, 1 from seq_1_to_91;
+insert into t1(es,er) select 4, 2 from seq_1_to_83;
+insert into t1(es,er) select 4, 3 from seq_1_to_297;
+insert into t1(es,er) select 4, 4 from seq_1_to_2456;
+insert into t1(es,er) select 4, 6 from seq_1_to_19;
+insert into t1(es,er) select 4, 11 from seq_1_to_1;
+update t1 set p='foobar';
+update t1 set x=0;
+set @save_isp=@@innodb_stats_persistent;
+set global innodb_stats_persistent= 1;
+analyze table t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+set optimizer_switch='index_merge_sort_intersection=on';
+SELECT * FROM t1
+WHERE ((p = 'foo' AND er != 4) OR er = 4 ) AND (es >= 4) LIMIT 2;
+id p es er x
+14645 foobar 4 4 0
+14646 foobar 4 4 0
+EXPLAIN EXTENDED SELECT * FROM t1
+WHERE ((p = 'foo' AND er != 4) OR er = 4 ) AND (es >= 4) LIMIT 2;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 range es,er,p es 1 NULL # 100.00 Using index condition; Using where
+Warnings:
+Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`p` AS `p`,`test`.`t1`.`es` AS `es`,`test`.`t1`.`er` AS `er`,`test`.`t1`.`x` AS `x` from `test`.`t1` where (`test`.`t1`.`p` = 'foo' and `test`.`t1`.`er` <> 4 or `test`.`t1`.`er` = 4) and `test`.`t1`.`es` >= 4 limit 2
+set optimizer_switch='index_merge_sort_intersection=off';
+SELECT * FROM t1
+WHERE ((p = 'foo' AND er != 4) OR er = 4 ) AND (es >= 4) LIMIT 2;
+id p es er x
+14645 foobar 4 4 0
+14646 foobar 4 4 0
+EXPLAIN EXTENDED SELECT * FROM t1
+WHERE ((p = 'foo' AND er != 4) OR er = 4 ) AND (es >= 4) LIMIT 2;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 range es,er,p es 1 NULL # 100.00 Using index condition; Using where
+Warnings:
+Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`p` AS `p`,`test`.`t1`.`es` AS `es`,`test`.`t1`.`er` AS `er`,`test`.`t1`.`x` AS `x` from `test`.`t1` where (`test`.`t1`.`p` = 'foo' and `test`.`t1`.`er` <> 4 or `test`.`t1`.`er` = 4) and `test`.`t1`.`es` >= 4 limit 2
+set optimizer_switch='index_merge_sort_intersection=on';
+SELECT * FROM t1
+WHERE ((p = 'foo' AND er < 6) OR er >=2 ) AND (es >= 4) LIMIT 2;
+id p es er x
+14007 foobar 4 2 0
+14008 foobar 4 2 0
+EXPLAIN EXTENDED SELECT * FROM t1
+WHERE ((p = 'foo' AND er < 6) OR er >=2 ) AND (es >= 4) LIMIT 2;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 range es,er,p es 1 NULL # 100.00 Using index condition; Using where
+Warnings:
+Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`p` AS `p`,`test`.`t1`.`es` AS `es`,`test`.`t1`.`er` AS `er`,`test`.`t1`.`x` AS `x` from `test`.`t1` where (`test`.`t1`.`p` = 'foo' and `test`.`t1`.`er` < 6 or `test`.`t1`.`er` >= 2) and `test`.`t1`.`es` >= 4 limit 2
+set optimizer_switch='index_merge_sort_intersection=off';
+SELECT * FROM t1
+WHERE ((p = 'foo' AND er < 6) OR er >=2 ) AND (es >= 4) LIMIT 2;
+id p es er x
+14007 foobar 4 2 0
+14008 foobar 4 2 0
+EXPLAIN EXTENDED SELECT * FROM t1
+WHERE ((p = 'foo' AND er < 6) OR er >=2 ) AND (es >= 4) LIMIT 2;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 range es,er,p es 1 NULL # 100.00 Using index condition; Using where
+Warnings:
+Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`p` AS `p`,`test`.`t1`.`es` AS `es`,`test`.`t1`.`er` AS `er`,`test`.`t1`.`x` AS `x` from `test`.`t1` where (`test`.`t1`.`p` = 'foo' and `test`.`t1`.`er` < 6 or `test`.`t1`.`er` >= 2) and `test`.`t1`.`es` >= 4 limit 2
+set optimizer_switch='index_merge_sort_intersection=default';
+set global innodb_stats_persistent= @save_isp;
+DROP TABLE t1;
+# End of 10.2 tests
diff --git a/mysql-test/main/range_innodb.test b/mysql-test/main/range_innodb.test
index 428e5c26e5c..b8a6a7c960c 100644
--- a/mysql-test/main/range_innodb.test
+++ b/mysql-test/main/range_innodb.test
@@ -116,3 +116,96 @@ SET @@GLOBAL.debug_dbug = @saved_dbug;
set @@optimizer_switch= @optimizer_switch_save;
--echo # End of 10.1 tests
+
+--echo #
+--echo # MDEV-27262: Index intersection with full scan over an index
+--echo #
+
+--source include/have_sequence.inc
+
+CREATE TABLE t1 (
+ id int(10) unsigned NOT NULL AUTO_INCREMENT,
+ p char(32) DEFAULT NULL,
+ es tinyint(3) unsigned NOT NULL DEFAULT 0,
+ er tinyint(3) unsigned NOT NULL DEFAULT 0,
+ x mediumint(8) unsigned NOT NULL DEFAULT 0,
+ PRIMARY KEY (id),
+ INDEX es (es),
+ INDEX x (x),
+ INDEX er (er,x),
+ INDEX p (p)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+insert into t1(es,er) select 0, 1 from seq_1_to_45;
+insert into t1(es,er) select 0, 2 from seq_1_to_49;
+insert into t1(es,er) select 0, 3 from seq_1_to_951;
+insert into t1(es,er) select 0, 3 from seq_1_to_1054;
+insert into t1(es,er) select 0, 6 from seq_1_to_25;
+insert into t1(es,er) select 0, 11 from seq_1_to_1;
+insert into t1(es,er) select 1, 1 from seq_1_to_45;
+insert into t1(es,er) select 1, 2 from seq_1_to_16;
+insert into t1(es,er) select 1, 3 from seq_1_to_511;
+insert into t1(es,er) select 1, 4 from seq_1_to_687;
+insert into t1(es,er) select 1, 6 from seq_1_to_50;
+insert into t1(es,er) select 1, 7 from seq_1_to_4;
+insert into t1(es,er) select 1, 11 from seq_1_to_1;
+insert into t1(es,er) select 2, 1 from seq_1_to_82;
+insert into t1(es,er) select 2, 2 from seq_1_to_82;
+insert into t1(es,er) select 2, 3 from seq_1_to_1626;
+insert into t1(es,er) select 2, 4 from seq_1_to_977;
+insert into t1(es,er) select 2, 6 from seq_1_to_33;
+insert into t1(es,er) select 2, 11 from seq_1_to_1;
+insert into t1(es,er) select 3, 1 from seq_1_to_245;
+insert into t1(es,er) select 3, 2 from seq_1_to_81;
+insert into t1(es,er) select 3, 3 from seq_1_to_852;
+insert into t1(es,er) select 3, 4 from seq_1_to_2243;
+insert into t1(es,er) select 3, 6 from seq_1_to_44;
+insert into t1(es,er) select 3, 11 from seq_1_to_1;
+insert into t1(es,er) select 4, 1 from seq_1_to_91;
+insert into t1(es,er) select 4, 2 from seq_1_to_83;
+insert into t1(es,er) select 4, 3 from seq_1_to_297;
+insert into t1(es,er) select 4, 4 from seq_1_to_2456;
+insert into t1(es,er) select 4, 6 from seq_1_to_19;
+insert into t1(es,er) select 4, 11 from seq_1_to_1;
+update t1 set p='foobar';
+update t1 set x=0;
+set @save_isp=@@innodb_stats_persistent;
+set global innodb_stats_persistent= 1;
+analyze table t1;
+
+let $q=
+SELECT * FROM t1
+ WHERE ((p = 'foo' AND er != 4) OR er = 4 ) AND (es >= 4) LIMIT 2;
+
+set optimizer_switch='index_merge_sort_intersection=on';
+eval $q;
+--replace_column 9 #
+eval EXPLAIN EXTENDED $q;
+
+set optimizer_switch='index_merge_sort_intersection=off';
+# execution of $q and explain for it led to an assertion failure in 10.4
+# (with the optimizer switch rowid_filter set to 'on')
+eval $q;
+--replace_column 9 #
+eval EXPLAIN EXTENDED $q;
+
+let $q=
+SELECT * FROM t1
+ WHERE ((p = 'foo' AND er < 6) OR er >=2 ) AND (es >= 4) LIMIT 2;
+
+set optimizer_switch='index_merge_sort_intersection=on';
+eval $q;
+--replace_column 9 #
+eval EXPLAIN EXTENDED $q;
+
+set optimizer_switch='index_merge_sort_intersection=off';
+eval $q;
+--replace_column 9 #
+eval EXPLAIN EXTENDED $q;
+
+set optimizer_switch='index_merge_sort_intersection=default';
+
+set global innodb_stats_persistent= @save_isp;
+DROP TABLE t1;
+
+--echo # End of 10.2 tests
diff --git a/mysql-test/main/show.result b/mysql-test/main/show.result
index d1b373d8969..4a9e2738346 100644
--- a/mysql-test/main/show.result
+++ b/mysql-test/main/show.result
@@ -40,5 +40,16 @@ nm varchar(32) YES NULL
a int(11) YES NULL
drop table t1;
#
+# MDEV-4621 select returns null for information_schema.statistics.collation field
+#
+create table t1 (f varchar(64), key(f));
+select index_name, column_name, collation, cardinality from information_schema.STATISTICS where table_schema='test' and table_name='t1';
+index_name column_name collation cardinality
+f f A NULL
+select index_name, column_name, collation from information_schema.STATISTICS where table_schema='test' and table_name='t1';
+index_name column_name collation
+f f A
+drop table t1;
+#
# End of 10.2 tests
#
diff --git a/mysql-test/main/show.test b/mysql-test/main/show.test
index f2f6efc4e45..9b0b58349d5 100644
--- a/mysql-test/main/show.test
+++ b/mysql-test/main/show.test
@@ -35,5 +35,13 @@ show fields from test.t1 where field in
drop table t1;
--echo #
+--echo # MDEV-4621 select returns null for information_schema.statistics.collation field
+--echo #
+create table t1 (f varchar(64), key(f));
+select index_name, column_name, collation, cardinality from information_schema.STATISTICS where table_schema='test' and table_name='t1';
+select index_name, column_name, collation from information_schema.STATISTICS where table_schema='test' and table_name='t1';
+drop table t1;
+
+--echo #
--echo # End of 10.2 tests
--echo #
diff --git a/mysql-test/main/sp.result b/mysql-test/main/sp.result
index 6510eaf77f5..6e8ae437d8b 100644
--- a/mysql-test/main/sp.result
+++ b/mysql-test/main/sp.result
@@ -8502,6 +8502,34 @@ b-c
0
drop procedure p1|
drop function f1|
+#
+# MDEV-24827: MariaDB 10.5.5 crash (sig 11) during a SELECT
+#
+CREATE TABLE t1 (c1 INT PRIMARY KEY, c2 INT);
+CREATE TABLE t2 (c1 INT PRIMARY KEY, c2 INT, KEY idx_c2(c2));
+INSERT INTO t1 (c1, c2) SELECT seq, seq FROM seq_1_to_10000;
+INSERT INTO t2 (c1, c2) SELECT seq, seq FROM seq_1_to_20000;
+CREATE OR REPLACE PROCEDURE p1()
+begin
+DECLARE done INT DEFAULT FALSE;
+DECLARE a INT;
+DECLARE cur1 CURSOR FOR
+SELECT t2.c1 AS c1 FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1
+WHERE EXISTS (SELECT 1 FROM t1 WHERE c2 = -1) ORDER BY c1;
+DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
+OPEN cur1;
+read_loop: LOOP
+FETCH cur1 INTO a;
+IF done THEN
+LEAVE read_loop;
+END IF;
+END LOOP;
+CLOSE cur1;
+END $
+CALL p1();
+DROP PROCEDURE p1;
+DROP TABLE t1;
+DROP TABLE t2;
#End of 10.2 tests
#
# MDEV-12007 Allow ROW variables as a cursor FETCH target
diff --git a/mysql-test/main/sp.test b/mysql-test/main/sp.test
index 18317e02f3e..f311baccd08 100644
--- a/mysql-test/main/sp.test
+++ b/mysql-test/main/sp.test
@@ -1,4 +1,6 @@
--source include/have_partition.inc
+--source include/have_sequence.inc
+
#
# Basic stored PROCEDURE tests
#
@@ -10045,6 +10047,46 @@ drop procedure p1|
drop function f1|
delimiter ;|
+--echo #
+--echo # MDEV-24827: MariaDB 10.5.5 crash (sig 11) during a SELECT
+--echo #
+
+CREATE TABLE t1 (c1 INT PRIMARY KEY, c2 INT);
+CREATE TABLE t2 (c1 INT PRIMARY KEY, c2 INT, KEY idx_c2(c2));
+
+INSERT INTO t1 (c1, c2) SELECT seq, seq FROM seq_1_to_10000;
+INSERT INTO t2 (c1, c2) SELECT seq, seq FROM seq_1_to_20000;
+
+--delimiter $
+
+CREATE OR REPLACE PROCEDURE p1()
+begin
+ DECLARE done INT DEFAULT FALSE;
+ DECLARE a INT;
+
+ DECLARE cur1 CURSOR FOR
+ SELECT t2.c1 AS c1 FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1
+ WHERE EXISTS (SELECT 1 FROM t1 WHERE c2 = -1) ORDER BY c1;
+
+ DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
+
+ OPEN cur1;
+ read_loop: LOOP
+ FETCH cur1 INTO a;
+ IF done THEN
+ LEAVE read_loop;
+ END IF;
+ END LOOP;
+ CLOSE cur1;
+END $
+
+--delimiter ;
+
+CALL p1();
+
+DROP PROCEDURE p1;
+DROP TABLE t1;
+DROP TABLE t2;
--echo #End of 10.2 tests
diff --git a/mysql-test/main/trigger.result b/mysql-test/main/trigger.result
index 912b3383adf..49b8b9977fe 100644
--- a/mysql-test/main/trigger.result
+++ b/mysql-test/main/trigger.result
@@ -2424,6 +2424,13 @@ CREATE TRIGGER t1_trigger BEFORE INSERT ON t1 FOR EACH ROW BEGIN END;
INSERT INTO t1 () VALUES ();
DROP TABLE t1;
#
+# Bug#33141958 - THE FIRST ASAN UAF ISSUE OF MYSQL SERVER
+#
+create table t1 (a int);
+create trigger tr1 after insert on t1 for each row alter table t1 tablespace s2;
+ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger
+drop table t1;
+#
# End of 10.2 tests
#
#
diff --git a/mysql-test/main/trigger.test b/mysql-test/main/trigger.test
index 581015a45e6..56e9246b95c 100644
--- a/mysql-test/main/trigger.test
+++ b/mysql-test/main/trigger.test
@@ -2757,6 +2757,14 @@ INSERT INTO t1 () VALUES ();
DROP TABLE t1;
--echo #
+--echo # Bug#33141958 - THE FIRST ASAN UAF ISSUE OF MYSQL SERVER
+--echo #
+create table t1 (a int);
+--error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
+create trigger tr1 after insert on t1 for each row alter table t1 tablespace s2;
+drop table t1;
+
+--echo #
--echo # End of 10.2 tests
--echo #
diff --git a/mysql-test/main/type_enum.result b/mysql-test/main/type_enum.result
index 02d71c6bd9f..58c723ac1eb 100644
--- a/mysql-test/main/type_enum.result
+++ b/mysql-test/main/type_enum.result
@@ -2225,6 +2225,27 @@ a
DROP TABLE t1;
#
+# MDEV-26129 Bad results with join comparing case insensitive VARCHAR/ENUM/SET expression to a _bin ENUM column
+#
+CREATE TABLE t1 (a ENUM('a') CHARACTER SET latin1 PRIMARY KEY);
+INSERT INTO t1 VALUES ('a');
+CREATE TABLE t2 (a ENUM('a','A','b','B','c','C','d','D','e','E') CHARACTER SET latin1 COLLATE latin1_bin);
+INSERT INTO t2 VALUES ('a'),('A');
+INSERT INTO t2 VALUES ('b'),('B'),('c'),('C'),('d'),('D'),('e'),('E');
+ALTER TABLE t2 ADD PRIMARY KEY(a);
+SELECT t1.a res FROM t1 JOIN t2 ON t1.a COLLATE latin1_swedish_ci=t2.a;
+res
+a
+a
+SELECT t1.a res FROM t1 LEFT JOIN t2 ON t1.a COLLATE latin1_swedish_ci=t2.a;
+res
+a
+a
+DROP TABLE IF EXISTS t1,t2;
+#
+# End of 10.2. tests
+#
+#
# Start of 10.3 tests
#
#
diff --git a/mysql-test/main/type_enum.test b/mysql-test/main/type_enum.test
index a79335960bc..5c461922166 100644
--- a/mysql-test/main/type_enum.test
+++ b/mysql-test/main/type_enum.test
@@ -458,6 +458,26 @@ SELECT * FROM t1;
DROP TABLE t1;
--echo #
+--echo # MDEV-26129 Bad results with join comparing case insensitive VARCHAR/ENUM/SET expression to a _bin ENUM column
+--echo #
+
+CREATE TABLE t1 (a ENUM('a') CHARACTER SET latin1 PRIMARY KEY);
+INSERT INTO t1 VALUES ('a');
+CREATE TABLE t2 (a ENUM('a','A','b','B','c','C','d','D','e','E') CHARACTER SET latin1 COLLATE latin1_bin);
+INSERT INTO t2 VALUES ('a'),('A');
+# without the following insert the bug doesn't show, was fixed in MDEV-6978
+INSERT INTO t2 VALUES ('b'),('B'),('c'),('C'),('d'),('D'),('e'),('E');
+ALTER TABLE t2 ADD PRIMARY KEY(a);
+SELECT t1.a res FROM t1 JOIN t2 ON t1.a COLLATE latin1_swedish_ci=t2.a;
+SELECT t1.a res FROM t1 LEFT JOIN t2 ON t1.a COLLATE latin1_swedish_ci=t2.a;
+DROP TABLE IF EXISTS t1,t2;
+
+
+--echo #
+--echo # End of 10.2. tests
+--echo #
+
+--echo #
--echo # Start of 10.3 tests
--echo #
diff --git a/mysql-test/main/view.result b/mysql-test/main/view.result
index 34dd8f3c8dc..a410ab741f5 100644
--- a/mysql-test/main/view.result
+++ b/mysql-test/main/view.result
@@ -6777,49 +6777,6 @@ sum(z)
DROP TABLE t1;
DROP VIEW v1;
#
-# MDEV-24454: Crash at change_item_tree
-#
-CREATE TABLE t1(f0 INT);
-CREATE VIEW v1 AS
-SELECT
-f0 AS f1
-FROM t1;
-CREATE VIEW v2 AS
-SELECT
-(SELECT GROUP_CONCAT(v1.f1 SEPARATOR ', ')
-FROM v1 n) AS f2,
-GROUP_CONCAT('' SEPARATOR ', ') AS f3
-FROM v1;
-CREATE VIEW v3 AS
-SELECT 1 as f4 FROM v2;
-CREATE PROCEDURE p1()
-SELECT * FROM v3;
-CALL p1();
-f4
-1
-CALL p1();
-f4
-1
-drop procedure p1;
-drop view v1,v2,v3;
-drop table t1;
-#
-# MDEV-25631: Crash in st_select_lex::mark_as_dependent with
-# VIEW, aggregate and subquery
-#
-CREATE TABLE t1 (i1 int);
-insert into t1 values (1),(2),(3);
-CREATE VIEW v1 AS
-SELECT t1.i1 FROM (t1 a JOIN t1 ON (t1.i1 = (SELECT t1.i1 FROM t1 b)));
-SELECT 1 FROM (SELECT count(((SELECT i1 FROM v1))) FROM v1) dt ;
-ERROR 21000: Subquery returns more than 1 row
-delete from t1 where i1 > 1;
-SELECT 1 FROM (SELECT count(((SELECT i1 FROM v1))) FROM v1) dt ;
-1
-1
-drop view v1;
-drop table t1;
-#
# MDEV-26299: Some views force server (and mysqldump) to generate
# invalid SQL for their definitions
#
@@ -6831,6 +6788,24 @@ drop view v1;
CREATE VIEW v1 AS select `t1`.`12345678901234567890123456789012345678901234567890123456789012345` AS `Name_exp_1` from (select '12345678901234567890123456789012345678901234567890123456789012345') `t1`;
drop view v1;
#
+# MDEV-25631: view with outer reference in select used
+# as argument of set function
+#
+create table t1 (c int);
+insert into t1 values (1);
+create view v1 as select c from t1 where (select t1.c from t1 t) = 1;
+select * from (select sum((select * from v1)) as r) dt;
+r
+1
+with cte as (select c from t1 where (select t1.c from t1 t) = 1)
+select * from (select sum((select * from cte)) as r) dt1
+union
+select * from (select sum((select * from cte)) as r) dt2;
+r
+1
+drop view v1;
+drop table t1;
+#
# End of 10.2 tests
#
#
diff --git a/mysql-test/main/view.test b/mysql-test/main/view.test
index 7dd5f63396e..431dfdb86f6 100644
--- a/mysql-test/main/view.test
+++ b/mysql-test/main/view.test
@@ -6500,56 +6500,6 @@ DROP TABLE t1;
DROP VIEW v1;
--echo #
---echo # MDEV-24454: Crash at change_item_tree
---echo #
-
-CREATE TABLE t1(f0 INT);
-
-CREATE VIEW v1 AS
-SELECT
- f0 AS f1
-FROM t1;
-
-CREATE VIEW v2 AS
-SELECT
- (SELECT GROUP_CONCAT(v1.f1 SEPARATOR ', ')
- FROM v1 n) AS f2,
- GROUP_CONCAT('' SEPARATOR ', ') AS f3
-FROM v1;
-
-CREATE VIEW v3 AS
-SELECT 1 as f4 FROM v2;
-
-CREATE PROCEDURE p1()
- SELECT * FROM v3;
-
-CALL p1();
-CALL p1();
-
-drop procedure p1;
-drop view v1,v2,v3;
-drop table t1;
-
---echo #
---echo # MDEV-25631: Crash in st_select_lex::mark_as_dependent with
---echo # VIEW, aggregate and subquery
---echo #
-
-CREATE TABLE t1 (i1 int);
-insert into t1 values (1),(2),(3); #not important
-CREATE VIEW v1 AS
- SELECT t1.i1 FROM (t1 a JOIN t1 ON (t1.i1 = (SELECT t1.i1 FROM t1 b)));
-
---error ER_SUBQUERY_NO_1_ROW
-SELECT 1 FROM (SELECT count(((SELECT i1 FROM v1))) FROM v1) dt ;
-delete from t1 where i1 > 1;
-SELECT 1 FROM (SELECT count(((SELECT i1 FROM v1))) FROM v1) dt ;
-
-drop view v1;
-drop table t1;
-
-
---echo #
--echo # MDEV-26299: Some views force server (and mysqldump) to generate
--echo # invalid SQL for their definitions
--echo #
@@ -6565,9 +6515,29 @@ drop view v1;
eval CREATE VIEW v1 AS $definition;
+
drop view v1;
--echo #
+--echo # MDEV-25631: view with outer reference in select used
+--echo # as argument of set function
+--echo #
+
+create table t1 (c int);
+insert into t1 values (1);
+create view v1 as select c from t1 where (select t1.c from t1 t) = 1;
+
+select * from (select sum((select * from v1)) as r) dt;
+
+with cte as (select c from t1 where (select t1.c from t1 t) = 1)
+select * from (select sum((select * from cte)) as r) dt1
+union
+select * from (select sum((select * from cte)) as r) dt2;
+
+drop view v1;
+drop table t1;
+
+--echo #
--echo # End of 10.2 tests
--echo #
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index b7d33b39cd7..1a4cb7aedf4 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -1975,7 +1975,7 @@ sub executable_setup () {
$exe_mysql= mtr_exe_exists("$path_client_bindir/mysql");
$exe_mysql_plugin= mtr_exe_exists("$path_client_bindir/mysql_plugin");
- $exe_mysql_embedded= mtr_exe_maybe_exists("$basedir/libmysqld/examples/mysql_embedded");
+ $exe_mysql_embedded= mtr_exe_maybe_exists("$bindir/libmysqld/examples/mysql_embedded");
# Look for mysqltest executable
if ( $opt_embedded_server )
diff --git a/mysql-test/suite/binlog/include/mysqlbinlog_row_engine.inc b/mysql-test/suite/binlog/include/mysqlbinlog_row_engine.inc
index ce919550b51..874be1dac61 100644
--- a/mysql-test/suite/binlog/include/mysqlbinlog_row_engine.inc
+++ b/mysql-test/suite/binlog/include/mysqlbinlog_row_engine.inc
@@ -1921,3 +1921,28 @@ let $MYSQLD_DATADIR= `select @@datadir`;
DROP TABLE t1;
+--echo #
+--echo # Beginning of 10.2 test
+--echo #
+--echo # MDEV-25460: Assertion `!is_set() || (m_status == DA_OK_BULK &&
+--echo # is_bulk_op())' failed in Diagnostics_area::set_ok_status in my_ok
+--echo # from mysql_sql_stmt_prepare
+--echo #
+
+CREATE TEMPORARY TABLE a (c INT) ENGINE=InnoDB;
+CREATE TABLE b (c INT) ENGINE=InnoDB;
+
+--error ER_TEMP_TABLE_PREVENTS_SWITCH_OUT_OF_RBR
+PREPARE s FROM 'SET STATEMENT binlog_format=ROW FOR SELECT * FROM b';
+
+DROP TABLE b;
+DROP TEMPORARY TABLE a;
+
+CREATE TEMPORARY TABLE t (c INT);
+--error ER_TEMP_TABLE_PREVENTS_SWITCH_OUT_OF_RBR
+PREPARE s FROM 'SET STATEMENT binlog_format=ROW FOR SELECT 1';
+DROP TEMPORARY TABLE t;
+
+--echo #
+--echo # End of 10.2 test
+--echo #
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 d8a5864ba3d..a1d3adb7c02 100644
--- a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_innodb.result
+++ b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_innodb.result
@@ -6372,3 +6372,23 @@ ROLLBACK /* added by mysqlbinlog */;
# Cleanup.
#
DROP TABLE t1;
+#
+# Beginning of 10.2 test
+#
+# MDEV-25460: Assertion `!is_set() || (m_status == DA_OK_BULK &&
+# is_bulk_op())' failed in Diagnostics_area::set_ok_status in my_ok
+# from mysql_sql_stmt_prepare
+#
+CREATE TEMPORARY TABLE a (c INT) ENGINE=InnoDB;
+CREATE TABLE b (c INT) ENGINE=InnoDB;
+PREPARE s FROM 'SET STATEMENT binlog_format=ROW FOR SELECT * FROM b';
+ERROR HY000: Cannot switch out of the row-based binary log format when the session has open temporary tables
+DROP TABLE b;
+DROP TEMPORARY TABLE a;
+CREATE TEMPORARY TABLE t (c INT);
+PREPARE s FROM 'SET STATEMENT binlog_format=ROW FOR SELECT 1';
+ERROR HY000: Cannot switch out of the row-based binary log format when the session has open temporary tables
+DROP TEMPORARY TABLE t;
+#
+# End of 10.2 test
+#
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 a75593055d7..00756368e45 100644
--- a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_myisam.result
+++ b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_myisam.result
@@ -6413,3 +6413,29 @@ ROLLBACK /* added by mysqlbinlog */;
# Cleanup.
#
DROP TABLE t1;
+#
+# Beginning of 10.2 test
+#
+# MDEV-25460: Assertion `!is_set() || (m_status == DA_OK_BULK &&
+# is_bulk_op())' failed in Diagnostics_area::set_ok_status in my_ok
+# from mysql_sql_stmt_prepare
+#
+CREATE TEMPORARY TABLE a (c INT) ENGINE=InnoDB;
+Warnings:
+Warning 1286 Unknown storage engine 'InnoDB'
+Warning 1266 Using storage engine MyISAM for table 'a'
+CREATE TABLE b (c INT) ENGINE=InnoDB;
+Warnings:
+Warning 1286 Unknown storage engine 'InnoDB'
+Warning 1266 Using storage engine MyISAM for table 'b'
+PREPARE s FROM 'SET STATEMENT binlog_format=ROW FOR SELECT * FROM b';
+ERROR HY000: Cannot switch out of the row-based binary log format when the session has open temporary tables
+DROP TABLE b;
+DROP TEMPORARY TABLE a;
+CREATE TEMPORARY TABLE t (c INT);
+PREPARE s FROM 'SET STATEMENT binlog_format=ROW FOR SELECT 1';
+ERROR HY000: Cannot switch out of the row-based binary log format when the session has open temporary tables
+DROP TEMPORARY TABLE t;
+#
+# End of 10.2 test
+#
diff --git a/mysql-test/suite/binlog/r/binlog_xa_handling.result b/mysql-test/suite/binlog/r/binlog_xa_handling.result
new file mode 100644
index 00000000000..7a60fb59b9a
--- /dev/null
+++ b/mysql-test/suite/binlog/r/binlog_xa_handling.result
@@ -0,0 +1,11 @@
+connection default;
+CREATE TABLE t1(f1 int) ENGINE=Innodb;
+XA START 'xa';
+INSERT INTO t1 VALUES(10);
+BINLOG '
+SOgWTg8BAAAAbgAAAHIAAAAAAAQANS42LjMtbTUtZGVidWctbG9nAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAABI6BZOEzgNAAgAEgAEBAQEEgAAVgAEGggAAAAICAgCAAAAAAVAYI8=';
+XA END 'xa';
+XA PREPARE 'xa';
+XA ROLLBACK 'xa';
+DROP TABLE t1;
diff --git a/mysql-test/suite/binlog/t/binlog_xa_handling.test b/mysql-test/suite/binlog/t/binlog_xa_handling.test
new file mode 100644
index 00000000000..c454e83169e
--- /dev/null
+++ b/mysql-test/suite/binlog/t/binlog_xa_handling.test
@@ -0,0 +1,28 @@
+###############################################################################
+# Bug#19928622: ASSERTION `! IS_SET()' FAILED. | ABORT IN
+# DIAGNOSTICS_AREA::SET_OK_STATUS
+#
+# MDEV-27536 Invalid BINLOG_BASE64_EVENT and assertion Diagnostics_area:: !is_set()
+#
+# Test:
+# =====
+# Begin an XA transaction and execte a DML statement so that XA state becomes
+# XA_ACTIVE. Execute the BINLOG command it should not cause any assert.
+# Execution should be successful.
+###############################################################################
+--source include/have_log_bin.inc
+--source include/have_innodb.inc
+
+--connection default
+CREATE TABLE t1(f1 int) ENGINE=Innodb;
+
+XA START 'xa';
+INSERT INTO t1 VALUES(10);
+BINLOG '
+SOgWTg8BAAAAbgAAAHIAAAAAAAQANS42LjMtbTUtZGVidWctbG9nAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAABI6BZOEzgNAAgAEgAEBAQEEgAAVgAEGggAAAAICAgCAAAAAAVAYI8=';
+XA END 'xa';
+XA PREPARE 'xa';
+XA ROLLBACK 'xa';
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/encryption/t/innodb-first-page-read.test b/mysql-test/suite/encryption/t/innodb-first-page-read.test
index 4e6eeb25080..600a41cf5ec 100644
--- a/mysql-test/suite/encryption/t/innodb-first-page-read.test
+++ b/mysql-test/suite/encryption/t/innodb-first-page-read.test
@@ -1,6 +1,7 @@
-- source include/have_innodb.inc
-- source include/have_file_key_management_plugin.inc
-- source include/not_embedded.inc
+-- source include/have_symlink.inc
FLUSH STATUS;
diff --git a/mysql-test/suite/federated/rpl.result b/mysql-test/suite/federated/rpl.result
new file mode 100644
index 00000000000..71821411c91
--- /dev/null
+++ b/mysql-test/suite/federated/rpl.result
@@ -0,0 +1,18 @@
+include/master-slave.inc
+[connection master]
+create table t1 (a int primary key, b int);
+connection slave;
+rename table t1 to t2;
+create table t1 (a int primary key, b int) engine=federated connection='mysql://root@127.0.0.1:$SLAVE_MYPORT/test/t2';
+connection master;
+insert t1 values (1,1),(2,2),(3,1);
+delete from t1 where a=2;
+connection slave;
+select * from t1;
+a b
+1 1
+3 1
+drop table t2;
+connection master;
+drop table t1;
+include/rpl_end.inc
diff --git a/mysql-test/suite/federated/rpl.test b/mysql-test/suite/federated/rpl.test
new file mode 100644
index 00000000000..6ec4bec5a1a
--- /dev/null
+++ b/mysql-test/suite/federated/rpl.test
@@ -0,0 +1,19 @@
+source include/have_binlog_format_row.inc;
+source include/master-slave.inc;
+
+create table t1 (a int primary key, b int);
+
+sync_slave_with_master;
+rename table t1 to t2;
+evalp create table t1 (a int primary key, b int) engine=federated connection='mysql://root@127.0.0.1:$SLAVE_MYPORT/test/t2';
+connection master;
+
+insert t1 values (1,1),(2,2),(3,1);
+delete from t1 where a=2;
+sync_slave_with_master;
+select * from t1;
+drop table t2;
+
+connection master;
+drop table t1;
+source include/rpl_end.inc;
diff --git a/mysql-test/suite/funcs_1/datadict/columns.inc b/mysql-test/suite/funcs_1/datadict/columns.inc
index 64318492b00..a03fef9c0dd 100644
--- a/mysql-test/suite/funcs_1/datadict/columns.inc
+++ b/mysql-test/suite/funcs_1/datadict/columns.inc
@@ -25,6 +25,10 @@
#
--source suite/funcs_1/datadict/datadict_bug_12777.inc
+
+# The following is needed as embedded server can be compiled with and without
+# privlege tables
+
eval
SELECT * FROM information_schema.columns
$my_where
diff --git a/mysql-test/suite/funcs_1/t/is_columns_is_embedded.test b/mysql-test/suite/funcs_1/t/is_columns_is_embedded.test
index 9db247fd6fd..bb9cc2a6ffb 100644
--- a/mysql-test/suite/funcs_1/t/is_columns_is_embedded.test
+++ b/mysql-test/suite/funcs_1/t/is_columns_is_embedded.test
@@ -14,7 +14,7 @@
#
--source include/have_innodb.inc
---source include/is_embedded.inc
+--source include/is_embedded_no_privileges.inc
let $my_where = WHERE table_schema = 'information_schema'
AND table_name <> 'profiling' AND table_name not like 'innodb_%';
diff --git a/mysql-test/suite/funcs_1/t/is_columns_myisam_embedded.test b/mysql-test/suite/funcs_1/t/is_columns_myisam_embedded.test
index 3d0cca24474..bb2200604f3 100644
--- a/mysql-test/suite/funcs_1/t/is_columns_myisam_embedded.test
+++ b/mysql-test/suite/funcs_1/t/is_columns_myisam_embedded.test
@@ -10,10 +10,8 @@
# 2008-06-06 mleich Create this this variant for the embedded server.
#
-if (`SELECT VERSION() NOT LIKE '%embedded%'`)
-{
- --skip Test requires: embedded server
-}
+--source include/is_embedded_no_privileges.inc
+
let $engine_type= MyISAM;
SET @@session.sql_mode = 'NO_ENGINE_SUBSTITUTION';
--source suite/funcs_1/datadict/datadict_load.inc
diff --git a/mysql-test/suite/funcs_1/t/is_columns_mysql_embedded.test b/mysql-test/suite/funcs_1/t/is_columns_mysql_embedded.test
index d1ed45425ec..9ef1b6d869a 100644
--- a/mysql-test/suite/funcs_1/t/is_columns_mysql_embedded.test
+++ b/mysql-test/suite/funcs_1/t/is_columns_mysql_embedded.test
@@ -10,10 +10,7 @@
# 2008-06-06 mleich Create this variant for the embedded server
#
-if (`SELECT VERSION() NOT LIKE '%embedded%'`)
-{
- --skip Test requires: embedded server
-}
+--source include/is_embedded_no_privileges.inc
let $my_where = WHERE table_schema = 'mysql';
--source suite/funcs_1/datadict/columns.inc
diff --git a/mysql-test/suite/galera/r/enforce_storage_engine2.result b/mysql-test/suite/galera/r/enforce_storage_engine2.result
index 128994ed221..4b80d335bb0 100644
--- a/mysql-test/suite/galera/r/enforce_storage_engine2.result
+++ b/mysql-test/suite/galera/r/enforce_storage_engine2.result
@@ -7,6 +7,7 @@ CREATE TABLE t1(i INT) ENGINE=INNODB;
CREATE TABLE t2(i INT) ENGINE=MYISAM;
Warnings:
Note 1266 Using storage engine InnoDB for table 't2'
+Note 1266 Using storage engine InnoDB for table 't2'
connection node_2;
SHOW TABLES;
Tables_in_test
diff --git a/mysql-test/suite/galera/r/galera_create_table_like.result b/mysql-test/suite/galera/r/galera_create_table_like.result
index 131ac311bca..128931381d4 100644
--- a/mysql-test/suite/galera/r/galera_create_table_like.result
+++ b/mysql-test/suite/galera/r/galera_create_table_like.result
@@ -47,3 +47,8 @@ DROP TABLE schema2.real_table2;
DROP TABLE schema2.real_table3;
DROP SCHEMA schema1;
DROP SCHEMA schema2;
+use test;
+CREATE TEMPORARY TABLE t (c INT) ENGINE=mrg_myisam UNION=(t,t2) insert_method=FIRST;
+CREATE TABLE t2 LIKE t;
+ERROR HY000: Table 't' is differently defined or of non-MyISAM type or doesn't exist
+DROP TABLE t;
diff --git a/mysql-test/suite/galera/r/galera_myisam_transactions.result b/mysql-test/suite/galera/r/galera_myisam_transactions.result
index 25796c309d1..3905e874d12 100644
--- a/mysql-test/suite/galera/r/galera_myisam_transactions.result
+++ b/mysql-test/suite/galera/r/galera_myisam_transactions.result
@@ -35,3 +35,14 @@ SELECT COUNT(*) = 0 FROM t2;
COUNT(*) = 0
1
DROP TABLE t1, t2, t3;
+SET SESSION lock_wait_timeout=2;
+SET GLOBAL wsrep_replicate_myisam= ON;
+CREATE TEMPORARY TABLE t1 (i INT, PRIMARY KEY pk (i)) ENGINE=MyISAM;
+Warnings:
+Warning 1280 Name 'pk' ignored for PRIMARY key.
+PREPARE stmt FROM "INSERT INTO t1 (id) SELECT * FROM (SELECT 4 AS i) AS y";
+INSERT INTO t1 VALUES(4);
+DEALLOCATE PREPARE stmt;
+COMMIT;
+DROP TABLE t1;
+SET GLOBAL wsrep_replicate_myisam=OFF;
diff --git a/mysql-test/suite/sys_vars/r/wsrep_slave_threads_basic.result b/mysql-test/suite/galera/r/wsrep_slave_threads_basic.result
index 62be5a42416..62be5a42416 100644
--- a/mysql-test/suite/sys_vars/r/wsrep_slave_threads_basic.result
+++ b/mysql-test/suite/galera/r/wsrep_slave_threads_basic.result
diff --git a/mysql-test/suite/galera/t/galera_create_table_like.test b/mysql-test/suite/galera/t/galera_create_table_like.test
index 0e0e8b0ffcf..3cf51521be1 100644
--- a/mysql-test/suite/galera/t/galera_create_table_like.test
+++ b/mysql-test/suite/galera/t/galera_create_table_like.test
@@ -48,3 +48,12 @@ DROP TABLE schema2.real_table3;
DROP SCHEMA schema1;
DROP SCHEMA schema2;
+
+#
+# MDEV-25856: SIGSEGV in ha_myisammrg::append_create_info
+#
+use test;
+CREATE TEMPORARY TABLE t (c INT) ENGINE=mrg_myisam UNION=(t,t2) insert_method=FIRST;
+--error 1472
+CREATE TABLE t2 LIKE t;
+DROP TABLE t;
diff --git a/mysql-test/suite/galera/t/galera_myisam_transactions.test b/mysql-test/suite/galera/t/galera_myisam_transactions.test
index 00e0bf3fdca..30677ddbe4d 100644
--- a/mysql-test/suite/galera/t/galera_myisam_transactions.test
+++ b/mysql-test/suite/galera/t/galera_myisam_transactions.test
@@ -34,3 +34,16 @@ SELECT COUNT(*) = 0 FROM t2;
SELECT COUNT(*) = 0 FROM t2;
DROP TABLE t1, t2, t3;
+
+#
+# MDEV-25201 : Assertion `thd->wsrep_trx_meta.gtid.seqno == (-1)' failed in int wsrep_to_isolation_begin(THD*, const char*, const char*, const TABLE_LIST*, Alter_info*)
+#
+SET SESSION lock_wait_timeout=2;
+SET GLOBAL wsrep_replicate_myisam= ON;
+CREATE TEMPORARY TABLE t1 (i INT, PRIMARY KEY pk (i)) ENGINE=MyISAM;
+PREPARE stmt FROM "INSERT INTO t1 (id) SELECT * FROM (SELECT 4 AS i) AS y";
+INSERT INTO t1 VALUES(4);
+DEALLOCATE PREPARE stmt;
+COMMIT;
+DROP TABLE t1;
+SET GLOBAL wsrep_replicate_myisam=OFF;
diff --git a/mysql-test/suite/sys_vars/t/wsrep_slave_threads_basic.test b/mysql-test/suite/galera/t/wsrep_slave_threads_basic.test
index 80b4648982d..ecf159f8365 100644
--- a/mysql-test/suite/sys_vars/t/wsrep_slave_threads_basic.test
+++ b/mysql-test/suite/galera/t/wsrep_slave_threads_basic.test
@@ -1,4 +1,4 @@
---source include/have_wsrep.inc
+--source include/galera_cluster.inc
--echo #
--echo # wsrep_slave_threads
diff --git a/mysql-test/suite/innodb/r/innodb-wl5522.result b/mysql-test/suite/innodb/r/innodb-wl5522.result
index 27a93922fbf..3097a7660ef 100644
--- a/mysql-test/suite/innodb/r/innodb-wl5522.result
+++ b/mysql-test/suite/innodb/r/innodb-wl5522.result
@@ -331,7 +331,7 @@ SELECT * FROM t1;
ERROR HY000: Tablespace has been discarded for table `t1`
restore: t1 .ibd and .cfg files
ALTER TABLE t1 IMPORT TABLESPACE;
-ERROR HY000: Schema mismatch (Number of columns don't match, table has 6 columns but the tablespace meta-data file has 5 columns)
+ERROR HY000: Schema mismatch (Column c3 not found in tablespace.)
unlink: t1.ibd
unlink: t1.cfg
DROP TABLE t1;
@@ -916,6 +916,22 @@ c1 c2
15 1
16 1
DROP TABLE t1;
+CREATE TABLE t1 ( id INT NOT NULL, i1 INT, i2 INT, i3 INT, PRIMARY KEY (id)) engine=innodb;
+CREATE TABLE t2 ( id INT NOT NULL, i1 INT, i2 INT, PRIMARY KEY (id)) engine=innodb;
+ALTER TABLE t2 DISCARD TABLESPACE;
+FLUSH TABLES t1 FOR EXPORT;
+UNLOCK TABLES;
+ALTER TABLE t2 IMPORT TABLESPACE;
+ERROR HY000: Schema mismatch (Column DB_ROW_ID ordinal value mismatch, it's at 3 in the table and 4 in the tablespace meta-data file)
+DROP TABLE t1, t2;
+CREATE TABLE t1 ( id INT NOT NULL, i1 INT, i2 INT, PRIMARY KEY (id)) engine=innodb;
+CREATE TABLE t2 ( id INT NOT NULL, i1 INT, i2 INT, i3 INT, PRIMARY KEY (id)) engine=innodb;
+ALTER TABLE t2 DISCARD TABLESPACE;
+FLUSH TABLES t1 FOR EXPORT;
+UNLOCK TABLES;
+ALTER TABLE t2 IMPORT TABLESPACE;
+ERROR HY000: Schema mismatch (Column i3 not found in tablespace.)
+DROP TABLE t1, t2;
call mtr.add_suppression("Got error -1 when reading table '.*'");
call mtr.add_suppression("InnoDB: Error: tablespace id and flags in file '.*'");
call mtr.add_suppression("InnoDB: The table .* doesn't have a corresponding tablespace, it was discarded");
diff --git a/mysql-test/suite/innodb/r/innodb_buffer_pool_resize_with_chunks.result b/mysql-test/suite/innodb/r/innodb_buffer_pool_resize_with_chunks.result
index 4bf244c9588..efb652091bf 100644
--- a/mysql-test/suite/innodb/r/innodb_buffer_pool_resize_with_chunks.result
+++ b/mysql-test/suite/innodb/r/innodb_buffer_pool_resize_with_chunks.result
@@ -1,6 +1,6 @@
select @@innodb_buffer_pool_chunk_size;
@@innodb_buffer_pool_chunk_size
-2097152
+4194304
create table t1 (id int not null, val int not null default '0', primary key (id)) ENGINE=InnoDB ROW_FORMAT=COMPRESSED;
create or replace view view0 as select 1 union all select 1;
set @`v_id` := 0;
@@ -18,9 +18,9 @@ count(val)
262144
drop table t1;
drop view view0;
-set global innodb_buffer_pool_size = 1048576;
+set global innodb_buffer_pool_size = 2*1048576;
Warnings:
-Warning 1292 Truncated incorrect innodb_buffer_pool_size value: '1048576'
+Warning 1292 Truncated incorrect innodb_buffer_pool_size value: '2097152'
select @@innodb_buffer_pool_size;
@@innodb_buffer_pool_size
-6291456
+4194304
diff --git a/mysql-test/suite/innodb/r/innodb_information_schema.result b/mysql-test/suite/innodb/r/innodb_information_schema.result
index 8b4186a0fbe..8fa779e8e11 100644
--- a/mysql-test/suite/innodb/r/innodb_information_schema.result
+++ b/mysql-test/suite/innodb/r/innodb_information_schema.result
@@ -1,18 +1,18 @@
lock_mode lock_type lock_table lock_index lock_rec lock_data
-X RECORD `test`.```t'\"_str` PRIMARY 2 '1', 'abc', '''abc', 'abc''', 'a''bc', 'a''bc''', '''abc'''''
-X RECORD `test`.```t'\"_str` PRIMARY 2 '1', 'abc', '''abc', 'abc''', 'a''bc', 'a''bc''', '''abc'''''
-X RECORD `test`.```t'\"_str` PRIMARY 3 '2', 'abc', '"abc', 'abc"', 'a"bc', 'a"bc"', '"abc""'
-X RECORD `test`.```t'\"_str` PRIMARY 3 '2', 'abc', '"abc', 'abc"', 'a"bc', 'a"bc"', '"abc""'
-X RECORD `test`.```t'\"_str` PRIMARY 4 '3', 'abc', '\\abc', 'abc\\', 'a\\bc', 'a\\bc\\', '\\abc\\\\'
-X RECORD `test`.```t'\"_str` PRIMARY 4 '3', 'abc', '\\abc', 'abc\\', 'a\\bc', 'a\\bc\\', '\\abc\\\\'
-X RECORD `test`.```t'\"_str` PRIMARY 5 '4', 'abc', '\0abc', 'abc\0', 'a\0bc', 'a\0bc\0', 'a\0bc\0\0'
-X RECORD `test`.```t'\"_str` PRIMARY 5 '4', 'abc', '\0abc', 'abc\0', 'a\0bc', 'a\0bc\0', 'a\0bc\0\0'
-X RECORD `test`.`t_min` PRIMARY 2 -128, 0, -32768, 0, -8388608, 0, -2147483648, 0, -9223372036854775808, 0
-X RECORD `test`.`t_min` PRIMARY 2 -128, 0, -32768, 0, -8388608, 0, -2147483648, 0, -9223372036854775808, 0
-X RECORD `test`.`t_max` PRIMARY 2 127, 255, 32767, 65535, 8388607, 16777215, 2147483647, 4294967295, 9223372036854775807, 18446744073709551615
-X RECORD `test`.`t_max` PRIMARY 2 127, 255, 32767, 65535, 8388607, 16777215, 2147483647, 4294967295, 9223372036854775807, 18446744073709551615
-X RECORD `test`.```t'\"_str` PRIMARY 1 supremum pseudo-record
-X RECORD `test`.```t'\"_str` PRIMARY 1 supremum pseudo-record
+X RECORD `test`.```t'\"_str` PRIMARY 1 #
+X RECORD `test`.```t'\"_str` PRIMARY 1 #
+X RECORD `test`.```t'\"_str` PRIMARY 2 #
+X RECORD `test`.```t'\"_str` PRIMARY 2 #
+X RECORD `test`.```t'\"_str` PRIMARY 3 #
+X RECORD `test`.```t'\"_str` PRIMARY 3 #
+X RECORD `test`.```t'\"_str` PRIMARY 4 #
+X RECORD `test`.```t'\"_str` PRIMARY 4 #
+X RECORD `test`.```t'\"_str` PRIMARY 5 #
+X RECORD `test`.```t'\"_str` PRIMARY 5 #
+X RECORD `test`.`t_max` PRIMARY 2 #
+X RECORD `test`.`t_max` PRIMARY 2 #
+X RECORD `test`.`t_min` PRIMARY 2 #
+X RECORD `test`.`t_min` PRIMARY 2 #
lock_table COUNT(*)
`test`.`t_max` 2
`test`.`t_min` 2
diff --git a/mysql-test/suite/innodb/r/restart,16k,innodb.rdiff b/mysql-test/suite/innodb/r/restart,16k,innodb.rdiff
new file mode 100644
index 00000000000..b36ed067913
--- /dev/null
+++ b/mysql-test/suite/innodb/r/restart,16k,innodb.rdiff
@@ -0,0 +1,16 @@
+--- ./suite/innodb/r/restart.result 2022-01-18 20:36:56.054653376 +1100
++++ suite/innodb/r/restart.reject 2022-01-19 08:12:28.602794678 +1100
+@@ -32,10 +32,10 @@
+ SELECT @@innodb_buffer_pool_size INTO @innodb_buffer_pool_size_orig;
+ SELECT CEILING((256 + 64) * @@innodb_page_size / 1048576) * 1048576 INTO @min_pool_size;
+ EXECUTE IMMEDIATE 'SET GLOBAL innodb_buffer_pool_size = ?' USING (@min_pool_size -1);
+-ERROR 42000: Variable 'innodb_buffer_pool_size' can't be set to the value of 'WRONG_VALUE'
++ERROR 42000: Variable 'innodb_buffer_pool_size' can't be set to the value of '5242879'
+ SHOW WARNINGS;
+ Level Code Message
+-Warning 1210 innodb_buffer_pool_size must be at least MIN_VAL for innodb_page_size=PAGE_SIZE
+-Error 1231 Variable 'innodb_buffer_pool_size' can't be set to the value of 'WRONG_VALUE'
++Warning 1210 innodb_buffer_pool_size must be at least 5242880 for innodb_page_size=16384
++Error 1231 Variable 'innodb_buffer_pool_size' can't be set to the value of '5242879'
+ EXECUTE IMMEDIATE 'SET GLOBAL innodb_buffer_pool_size = ?' USING (@min_pool_size);
+ SET GLOBAL innodb_buffer_pool_size = @innodb_buffer_pool_size_orig;
diff --git a/mysql-test/suite/innodb/r/restart,32k,innodb.rdiff b/mysql-test/suite/innodb/r/restart,32k,innodb.rdiff
new file mode 100644
index 00000000000..8fa057814c4
--- /dev/null
+++ b/mysql-test/suite/innodb/r/restart,32k,innodb.rdiff
@@ -0,0 +1,16 @@
+--- ./suite/innodb/r/restart.result 2022-01-18 20:36:56.054653376 +1100
++++ suite/innodb/r/restart.reject 2022-01-19 08:07:57.402230887 +1100
+@@ -32,10 +32,10 @@
+ SELECT @@innodb_buffer_pool_size INTO @innodb_buffer_pool_size_orig;
+ SELECT CEILING((256 + 64) * @@innodb_page_size / 1048576) * 1048576 INTO @min_pool_size;
+ EXECUTE IMMEDIATE 'SET GLOBAL innodb_buffer_pool_size = ?' USING (@min_pool_size -1);
+-ERROR 42000: Variable 'innodb_buffer_pool_size' can't be set to the value of 'WRONG_VALUE'
++ERROR 42000: Variable 'innodb_buffer_pool_size' can't be set to the value of '10485759'
+ SHOW WARNINGS;
+ Level Code Message
+-Warning 1210 innodb_buffer_pool_size must be at least MIN_VAL for innodb_page_size=PAGE_SIZE
+-Error 1231 Variable 'innodb_buffer_pool_size' can't be set to the value of 'WRONG_VALUE'
++Warning 1210 innodb_buffer_pool_size must be at least 10485760 for innodb_page_size=32768
++Error 1231 Variable 'innodb_buffer_pool_size' can't be set to the value of '10485759'
+ EXECUTE IMMEDIATE 'SET GLOBAL innodb_buffer_pool_size = ?' USING (@min_pool_size);
+ SET GLOBAL innodb_buffer_pool_size = @innodb_buffer_pool_size_orig;
diff --git a/mysql-test/suite/innodb/r/restart,4k,innodb.rdiff b/mysql-test/suite/innodb/r/restart,4k,innodb.rdiff
new file mode 100644
index 00000000000..7d0846360e0
--- /dev/null
+++ b/mysql-test/suite/innodb/r/restart,4k,innodb.rdiff
@@ -0,0 +1,16 @@
+--- ./suite/innodb/r/restart.result 2022-01-18 20:36:56.054653376 +1100
++++ suite/innodb/r/restart.reject 2022-01-19 08:13:56.397475513 +1100
+@@ -32,10 +32,10 @@
+ SELECT @@innodb_buffer_pool_size INTO @innodb_buffer_pool_size_orig;
+ SELECT CEILING((256 + 64) * @@innodb_page_size / 1048576) * 1048576 INTO @min_pool_size;
+ EXECUTE IMMEDIATE 'SET GLOBAL innodb_buffer_pool_size = ?' USING (@min_pool_size -1);
+-ERROR 42000: Variable 'innodb_buffer_pool_size' can't be set to the value of 'WRONG_VALUE'
++ERROR 42000: Variable 'innodb_buffer_pool_size' can't be set to the value of '2097151'
+ SHOW WARNINGS;
+ Level Code Message
+-Warning 1210 innodb_buffer_pool_size must be at least MIN_VAL for innodb_page_size=PAGE_SIZE
+-Error 1231 Variable 'innodb_buffer_pool_size' can't be set to the value of 'WRONG_VALUE'
++Warning 1210 innodb_buffer_pool_size must be at least 2097152 for innodb_page_size=4096
++Error 1231 Variable 'innodb_buffer_pool_size' can't be set to the value of '2097151'
+ EXECUTE IMMEDIATE 'SET GLOBAL innodb_buffer_pool_size = ?' USING (@min_pool_size);
+ SET GLOBAL innodb_buffer_pool_size = @innodb_buffer_pool_size_orig;
diff --git a/mysql-test/suite/innodb/r/restart,64k,innodb.rdiff b/mysql-test/suite/innodb/r/restart,64k,innodb.rdiff
new file mode 100644
index 00000000000..3ac9f45b196
--- /dev/null
+++ b/mysql-test/suite/innodb/r/restart,64k,innodb.rdiff
@@ -0,0 +1,16 @@
+--- ./suite/innodb/r/restart.result 2022-01-18 20:36:56.054653376 +1100
++++ suite/innodb/r/restart.reject 2022-01-19 08:11:32.418759095 +1100
+@@ -32,10 +32,10 @@
+ SELECT @@innodb_buffer_pool_size INTO @innodb_buffer_pool_size_orig;
+ SELECT CEILING((256 + 64) * @@innodb_page_size / 1048576) * 1048576 INTO @min_pool_size;
+ EXECUTE IMMEDIATE 'SET GLOBAL innodb_buffer_pool_size = ?' USING (@min_pool_size -1);
+-ERROR 42000: Variable 'innodb_buffer_pool_size' can't be set to the value of 'WRONG_VALUE'
++ERROR 42000: Variable 'innodb_buffer_pool_size' can't be set to the value of '20971519'
+ SHOW WARNINGS;
+ Level Code Message
+-Warning 1210 innodb_buffer_pool_size must be at least MIN_VAL for innodb_page_size=PAGE_SIZE
+-Error 1231 Variable 'innodb_buffer_pool_size' can't be set to the value of 'WRONG_VALUE'
++Warning 1210 innodb_buffer_pool_size must be at least 20971520 for innodb_page_size=65536
++Error 1231 Variable 'innodb_buffer_pool_size' can't be set to the value of '20971519'
+ EXECUTE IMMEDIATE 'SET GLOBAL innodb_buffer_pool_size = ?' USING (@min_pool_size);
+ SET GLOBAL innodb_buffer_pool_size = @innodb_buffer_pool_size_orig;
diff --git a/mysql-test/suite/innodb/r/restart,8k,innodb.rdiff b/mysql-test/suite/innodb/r/restart,8k,innodb.rdiff
new file mode 100644
index 00000000000..4da55ebfcef
--- /dev/null
+++ b/mysql-test/suite/innodb/r/restart,8k,innodb.rdiff
@@ -0,0 +1,16 @@
+--- ./suite/innodb/r/restart.result 2022-01-18 20:36:56.054653376 +1100
++++ suite/innodb/r/restart.reject 2022-01-19 08:13:11.027788852 +1100
+@@ -32,10 +32,10 @@
+ SELECT @@innodb_buffer_pool_size INTO @innodb_buffer_pool_size_orig;
+ SELECT CEILING((256 + 64) * @@innodb_page_size / 1048576) * 1048576 INTO @min_pool_size;
+ EXECUTE IMMEDIATE 'SET GLOBAL innodb_buffer_pool_size = ?' USING (@min_pool_size -1);
+-ERROR 42000: Variable 'innodb_buffer_pool_size' can't be set to the value of 'WRONG_VALUE'
++ERROR 42000: Variable 'innodb_buffer_pool_size' can't be set to the value of '3145727'
+ SHOW WARNINGS;
+ Level Code Message
+-Warning 1210 innodb_buffer_pool_size must be at least MIN_VAL for innodb_page_size=PAGE_SIZE
+-Error 1231 Variable 'innodb_buffer_pool_size' can't be set to the value of 'WRONG_VALUE'
++Warning 1210 innodb_buffer_pool_size must be at least 3145728 for innodb_page_size=8192
++Error 1231 Variable 'innodb_buffer_pool_size' can't be set to the value of '3145727'
+ EXECUTE IMMEDIATE 'SET GLOBAL innodb_buffer_pool_size = ?' USING (@min_pool_size);
+ SET GLOBAL innodb_buffer_pool_size = @innodb_buffer_pool_size_orig;
diff --git a/mysql-test/suite/innodb/r/restart.result b/mysql-test/suite/innodb/r/restart.result
index 5e3315be204..606e94d81db 100644
--- a/mysql-test/suite/innodb/r/restart.result
+++ b/mysql-test/suite/innodb/r/restart.result
@@ -26,3 +26,16 @@ a
SELECT * FROM td;
a
DROP TABLE tr,tc,td;
+#
+# MDEV-27467 innodb to enfore the minimum innodb_buffer_pool_size in SET (resize) the same as startup
+#
+SELECT @@innodb_buffer_pool_size INTO @innodb_buffer_pool_size_orig;
+SELECT CEILING((256 + 64) * @@innodb_page_size / 1048576) * 1048576 INTO @min_pool_size;
+EXECUTE IMMEDIATE 'SET GLOBAL innodb_buffer_pool_size = ?' USING (@min_pool_size -1);
+ERROR 42000: Variable 'innodb_buffer_pool_size' can't be set to the value of 'WRONG_VALUE'
+SHOW WARNINGS;
+Level Code Message
+Warning 1210 innodb_buffer_pool_size must be at least MIN_VAL for innodb_page_size=PAGE_SIZE
+Error 1231 Variable 'innodb_buffer_pool_size' can't be set to the value of 'WRONG_VALUE'
+EXECUTE IMMEDIATE 'SET GLOBAL innodb_buffer_pool_size = ?' USING (@min_pool_size);
+SET GLOBAL innodb_buffer_pool_size = @innodb_buffer_pool_size_orig;
diff --git a/mysql-test/suite/innodb/r/skip_symbolic_links.result b/mysql-test/suite/innodb/r/skip_symbolic_links.result
new file mode 100644
index 00000000000..4dc036765a0
--- /dev/null
+++ b/mysql-test/suite/innodb/r/skip_symbolic_links.result
@@ -0,0 +1,54 @@
+SELECT @@have_symlink;
+@@have_symlink
+DISABLED
+CREATE TABLE t1(a INT) ENGINE=InnoDB DATA DIRECTORY 'MYSQL_TMP_DIR';
+Warnings:
+Warning 1618 <DATA DIRECTORY> option ignored
+DROP TABLE t1;
+CREATE TABLE t1(a INT) ENGINE=InnoDB;
+ALTER TABLE t1 DATA DIRECTORY 'MYSQL_TMP_DIR';
+Warnings:
+Warning 1618 <DATA DIRECTORY> option ignored
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+DROP TABLE t1;
+CREATE TABLE t1(a INT PRIMARY KEY, b INT) ENGINE=InnoDB
+DATA DIRECTORY 'MYSQL_TMP_DIR';
+CREATE TABLE t2(a INT PRIMARY KEY, b INT) ENGINE=InnoDB
+DATA DIRECTORY 'MYSQL_TMP_DIR';
+TRUNCATE TABLE t1;
+TRUNCATE TABLE t2;
+ALTER TABLE t1 FORCE, ALGORITHM=INPLACE;
+Warnings:
+Warning 1618 <DATA DIRECTORY> option ignored
+ALTER TABLE t2 FORCE, ALGORITHM=COPY;
+Warnings:
+Warning 1618 <DATA DIRECTORY> option ignored
+OPTIMIZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
+test.t1 optimize status OK
+Warnings:
+Warning 1618 <DATA DIRECTORY> option ignored
+t1.ibd
+DROP TABLE t2;
+RENAME TABLE t1 TO t2;
+ALTER TABLE t2 ADD UNIQUE INDEX(b), RENAME TO t3;
+Warnings:
+Warning 1618 <DATA DIRECTORY> option ignored
+ALTER TABLE t3 RENAME TO t2;
+ALTER TABLE t2 DROP INDEX b, RENAME TO t1;
+Warnings:
+Warning 1618 <DATA DIRECTORY> option ignored
+ALTER TABLE t1 CHANGE b c INT;
+Warnings:
+Warning 1618 <DATA DIRECTORY> option ignored
+ALTER TABLE t1 CHANGE c b INT NOT NULL;
+Warnings:
+Warning 1618 <DATA DIRECTORY> option ignored
+t1.ibd
+TRUNCATE TABLE t1;
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/t/101_compatibility.test b/mysql-test/suite/innodb/t/101_compatibility.test
index eb1ec3b26ac..878daad2756 100644
--- a/mysql-test/suite/innodb/t/101_compatibility.test
+++ b/mysql-test/suite/innodb/t/101_compatibility.test
@@ -1,5 +1,6 @@
--source include/innodb_page_size.inc
--source include/not_embedded.inc
+--source include/have_symlink.inc
-- echo #
-- echo # MDEV-11623 MariaDB 10.1 fails to start datadir created with
diff --git a/mysql-test/suite/innodb/t/create_isl_with_direct.test b/mysql-test/suite/innodb/t/create_isl_with_direct.test
index 1427264e13e..2092d03b72f 100644
--- a/mysql-test/suite/innodb/t/create_isl_with_direct.test
+++ b/mysql-test/suite/innodb/t/create_isl_with_direct.test
@@ -1,5 +1,6 @@
--source include/not_embedded.inc
--source include/have_innodb.inc
+--source include/have_symlink.inc
--disable_query_log
CALL mtr.add_suppression(".*Failed to set O_DIRECT on file.*");
diff --git a/mysql-test/suite/innodb/t/innodb-wl5522.test b/mysql-test/suite/innodb/t/innodb-wl5522.test
index 2b836bfc985..bebc6132d1b 100644
--- a/mysql-test/suite/innodb/t/innodb-wl5522.test
+++ b/mysql-test/suite/innodb/t/innodb-wl5522.test
@@ -1056,6 +1056,43 @@ SELECT * FROM t1;
DROP TABLE t1;
+
+CREATE TABLE t1 ( id INT NOT NULL, i1 INT, i2 INT, i3 INT, PRIMARY KEY (id)) engine=innodb;
+CREATE TABLE t2 ( id INT NOT NULL, i1 INT, i2 INT, PRIMARY KEY (id)) engine=innodb;
+
+ALTER TABLE t2 DISCARD TABLESPACE;
+FLUSH TABLES t1 FOR EXPORT;
+
+--copy_file $MYSQLD_DATADIR/test/t1.ibd $MYSQLD_DATADIR/test/t2.ibd
+--copy_file $MYSQLD_DATADIR/test/t1.cfg $MYSQLD_DATADIR/test/t2.cfg
+
+UNLOCK TABLES;
+--error ER_TABLE_SCHEMA_MISMATCH
+ALTER TABLE t2 IMPORT TABLESPACE;
+
+DROP TABLE t1, t2;
+
+
+CREATE TABLE t1 ( id INT NOT NULL, i1 INT, i2 INT, PRIMARY KEY (id)) engine=innodb;
+CREATE TABLE t2 ( id INT NOT NULL, i1 INT, i2 INT, i3 INT, PRIMARY KEY (id)) engine=innodb;
+
+ALTER TABLE t2 DISCARD TABLESPACE;
+FLUSH TABLES t1 FOR EXPORT;
+
+--copy_file $MYSQLD_DATADIR/test/t1.ibd $MYSQLD_DATADIR/test/t2.ibd
+--copy_file $MYSQLD_DATADIR/test/t1.cfg $MYSQLD_DATADIR/test/t2.cfg
+
+UNLOCK TABLES;
+--error ER_TABLE_SCHEMA_MISMATCH
+ALTER TABLE t2 IMPORT TABLESPACE;
+
+--remove_file $MYSQLD_DATADIR/test/t2.ibd
+--remove_file $MYSQLD_DATADIR/test/t2.cfg
+
+
+DROP TABLE t1, t2;
+
+
call mtr.add_suppression("Got error -1 when reading table '.*'");
call mtr.add_suppression("InnoDB: Error: tablespace id and flags in file '.*'");
call mtr.add_suppression("InnoDB: The table .* doesn't have a corresponding tablespace, it was discarded");
diff --git a/mysql-test/suite/innodb/t/innodb-wl5980-alter.test b/mysql-test/suite/innodb/t/innodb-wl5980-alter.test
index a0d80ea8374..9b51612854f 100644
--- a/mysql-test/suite/innodb/t/innodb-wl5980-alter.test
+++ b/mysql-test/suite/innodb/t/innodb-wl5980-alter.test
@@ -4,6 +4,7 @@
--echo #
--source include/have_innodb.inc
+--source include/have_symlink.inc
--disable_query_log
# These values can change during the test
diff --git a/mysql-test/suite/innodb/t/innodb-wl5980-debug.test b/mysql-test/suite/innodb/t/innodb-wl5980-debug.test
index 2c5e2b48870..dbb8ad33676 100644
--- a/mysql-test/suite/innodb/t/innodb-wl5980-debug.test
+++ b/mysql-test/suite/innodb/t/innodb-wl5980-debug.test
@@ -8,6 +8,7 @@
--source include/not_embedded.inc
--source include/have_debug.inc
--source include/have_innodb.inc
+--source include/have_symlink.inc
# These messages are expected in the log
call mtr.add_suppression("Cannot find space id [0-9]+ in the tablespace memory cache");
diff --git a/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_with_chunks.opt b/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_with_chunks.opt
index b97a3995457..ade197de338 100644
--- a/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_with_chunks.opt
+++ b/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_with_chunks.opt
@@ -1,3 +1,3 @@
--innodb-buffer-pool-size=16M
---innodb-buffer-pool-chunk-size=2M
+--innodb-buffer-pool-chunk-size=4M
--innodb-page-size=4k
diff --git a/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_with_chunks.test b/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_with_chunks.test
index b04b0306bf1..7a26db65d33 100644
--- a/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_with_chunks.test
+++ b/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_with_chunks.test
@@ -49,7 +49,7 @@ drop table t1;
drop view view0;
# Try to shrink buffer pool to smaller than chunk size
-set global innodb_buffer_pool_size = 1048576;
+set global innodb_buffer_pool_size = 2*1048576;
--source include/wait_condition.inc
select @@innodb_buffer_pool_size;
diff --git a/mysql-test/suite/innodb/t/innodb_information_schema.test b/mysql-test/suite/innodb/t/innodb_information_schema.test
index da7ee016f29..5bc1115c58e 100644
--- a/mysql-test/suite/innodb/t/innodb_information_schema.test
+++ b/mysql-test/suite/innodb/t/innodb_information_schema.test
@@ -148,6 +148,8 @@ if (!$success)
-- echo Timeout waiting for rows in INNODB_LOCKS to appear
}
+--replace_column 6 #
+--sorted_result
SELECT lock_mode, lock_type, lock_table, lock_index, lock_rec, lock_data
FROM INFORMATION_SCHEMA.INNODB_LOCKS ORDER BY lock_data;
diff --git a/mysql-test/suite/innodb/t/restart.opt b/mysql-test/suite/innodb/t/restart.opt
new file mode 100644
index 00000000000..ce43e89cb2b
--- /dev/null
+++ b/mysql-test/suite/innodb/t/restart.opt
@@ -0,0 +1,2 @@
+--loose-innodb_disable_resize_buffer_pool_debug=0
+--innodb-buffer-pool-chunk-size=1M
diff --git a/mysql-test/suite/innodb/t/restart.test b/mysql-test/suite/innodb/t/restart.test
index d7582306492..16c6d20f621 100644
--- a/mysql-test/suite/innodb/t/restart.test
+++ b/mysql-test/suite/innodb/t/restart.test
@@ -1,5 +1,6 @@
--source include/innodb_page_size.inc
--source include/not_embedded.inc
+--source include/have_symlink.inc
let datadir= `select @@datadir`;
let page_size= `select @@innodb_page_size`;
@@ -77,3 +78,26 @@ SELECT * FROM tr;
SELECT * FROM tc;
SELECT * FROM td;
DROP TABLE tr,tc,td;
+
+--echo #
+--echo # MDEV-27467 innodb to enfore the minimum innodb_buffer_pool_size in SET (resize) the same as startup
+--echo #
+
+let $wait_timeout = 180;
+let $wait_condition =
+ SELECT SUBSTR(variable_value, 1, 34) = 'Completed resizing buffer pool at '
+ FROM information_schema.global_status
+ WHERE LOWER(variable_name) = 'innodb_buffer_pool_resize_status';
+
+SELECT @@innodb_buffer_pool_size INTO @innodb_buffer_pool_size_orig;
+SELECT CEILING((256 + 64) * @@innodb_page_size / 1048576) * 1048576 INTO @min_pool_size;
+--error ER_WRONG_VALUE_FOR_VAR
+EXECUTE IMMEDIATE 'SET GLOBAL innodb_buffer_pool_size = ?' USING (@min_pool_size -1);
+
+SHOW WARNINGS;
+
+EXECUTE IMMEDIATE 'SET GLOBAL innodb_buffer_pool_size = ?' USING (@min_pool_size);
+
+--source include/wait_condition.inc
+
+SET GLOBAL innodb_buffer_pool_size = @innodb_buffer_pool_size_orig;
diff --git a/mysql-test/suite/innodb/t/skip_symbolic_links.opt b/mysql-test/suite/innodb/t/skip_symbolic_links.opt
new file mode 100644
index 00000000000..c7844699cdb
--- /dev/null
+++ b/mysql-test/suite/innodb/t/skip_symbolic_links.opt
@@ -0,0 +1 @@
+--skip-symbolic-links
diff --git a/mysql-test/suite/innodb/t/skip_symbolic_links.test b/mysql-test/suite/innodb/t/skip_symbolic_links.test
new file mode 100644
index 00000000000..b5274d220c8
--- /dev/null
+++ b/mysql-test/suite/innodb/t/skip_symbolic_links.test
@@ -0,0 +1,51 @@
+--source include/have_innodb.inc
+--source include/not_windows.inc
+
+SELECT @@have_symlink;
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
+eval CREATE TABLE t1(a INT) ENGINE=InnoDB DATA DIRECTORY '$MYSQL_TMP_DIR';
+DROP TABLE t1;
+CREATE TABLE t1(a INT) ENGINE=InnoDB;
+
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
+eval ALTER TABLE t1 DATA DIRECTORY '$MYSQL_TMP_DIR';
+SHOW CREATE TABLE t1;
+
+DROP TABLE t1;
+
+--let $restart_parameters=--symbolic-links
+--source include/restart_mysqld.inc
+
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
+eval CREATE TABLE t1(a INT PRIMARY KEY, b INT) ENGINE=InnoDB
+DATA DIRECTORY '$MYSQL_TMP_DIR';
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
+eval CREATE TABLE t2(a INT PRIMARY KEY, b INT) ENGINE=InnoDB
+DATA DIRECTORY '$MYSQL_TMP_DIR';
+
+TRUNCATE TABLE t1;
+TRUNCATE TABLE t2;
+
+--let $restart_parameters=
+--source include/restart_mysqld.inc
+
+# Native ALTER will retain DATA DIRECTORY
+ALTER TABLE t1 FORCE, ALGORITHM=INPLACE;
+ALTER TABLE t2 FORCE, ALGORITHM=COPY;
+OPTIMIZE TABLE t1;
+--list_files $MYSQL_TMP_DIR/test
+DROP TABLE t2;
+
+RENAME TABLE t1 TO t2;
+ALTER TABLE t2 ADD UNIQUE INDEX(b), RENAME TO t3;
+
+ALTER TABLE t3 RENAME TO t2;
+ALTER TABLE t2 DROP INDEX b, RENAME TO t1;
+ALTER TABLE t1 CHANGE b c INT;
+ALTER TABLE t1 CHANGE c b INT NOT NULL;
+
+--list_files $MYSQL_TMP_DIR/test
+# TRUNCATE TABLE will discard DATA DIRECTORY.
+TRUNCATE TABLE t1;
+--list_files $MYSQL_TMP_DIR/test
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb_fts/r/innodb_fts_plugin.result b/mysql-test/suite/innodb_fts/r/innodb_fts_plugin.result
index dc71156b7a1..cec88f14b26 100644
--- a/mysql-test/suite/innodb_fts/r/innodb_fts_plugin.result
+++ b/mysql-test/suite/innodb_fts/r/innodb_fts_plugin.result
@@ -159,6 +159,7 @@ id title body
SELECT COUNT(*) FROM articles;
COUNT(*)
5
+INSERT INTO articles (title, body) VALUES ('111', '1234 1234 1234');
DROP TABLE articles;
# Test Part 5: Test Uninstall Plugin After Index is Built
CREATE TABLE articles (
diff --git a/mysql-test/suite/innodb_fts/t/innodb_fts_plugin.test b/mysql-test/suite/innodb_fts/t/innodb_fts_plugin.test
index cd31500b23f..b22ac456668 100644
--- a/mysql-test/suite/innodb_fts/t/innodb_fts_plugin.test
+++ b/mysql-test/suite/innodb_fts/t/innodb_fts_plugin.test
@@ -158,6 +158,8 @@ SELECT * FROM articles WHERE
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('full text search');
SELECT COUNT(*) FROM articles;
+
+INSERT INTO articles (title, body) VALUES ('111', '1234 1234 1234');
DROP TABLE articles;
-- echo # Test Part 5: Test Uninstall Plugin After Index is Built
diff --git a/mysql-test/suite/innodb_gis/r/rtree_split.result b/mysql-test/suite/innodb_gis/r/rtree_split.result
index df88960ba3d..2d6e8a1dfbe 100644
--- a/mysql-test/suite/innodb_gis/r/rtree_split.result
+++ b/mysql-test/suite/innodb_gis/r/rtree_split.result
@@ -61,3 +61,10 @@ select count(*) from t1 where MBRWithin(t1.c2, @g1);
count(*)
57344
drop table t1;
+#
+# MDEV-27417 Spatial index tries to update
+# change buffer bookkeeping page
+#
+CREATE TEMPORARY TABLE t1 (c POINT NOT NULL, SPATIAL(c)) ENGINE=InnoDB;
+INSERT INTO t1 SELECT PointFromText('POINT(0 0)') FROM seq_1_to_366;
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb_gis/t/rtree_split.test b/mysql-test/suite/innodb_gis/t/rtree_split.test
index af626dba6b7..dd46d1ecc4d 100644
--- a/mysql-test/suite/innodb_gis/t/rtree_split.test
+++ b/mysql-test/suite/innodb_gis/t/rtree_split.test
@@ -72,3 +72,11 @@ select count(*) from t1 where MBRWithin(t1.c2, @g1);
# Clean up.
drop table t1;
+
+--echo #
+--echo # MDEV-27417 Spatial index tries to update
+--echo # change buffer bookkeeping page
+--echo #
+CREATE TEMPORARY TABLE t1 (c POINT NOT NULL, SPATIAL(c)) ENGINE=InnoDB;
+INSERT INTO t1 SELECT PointFromText('POINT(0 0)') FROM seq_1_to_366;
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb_zip/r/wl5522_zip.result b/mysql-test/suite/innodb_zip/r/wl5522_zip.result
index 40b357e1b7f..e85223574d7 100644
--- a/mysql-test/suite/innodb_zip/r/wl5522_zip.result
+++ b/mysql-test/suite/innodb_zip/r/wl5522_zip.result
@@ -317,7 +317,7 @@ SELECT * FROM t1;
ERROR HY000: Tablespace has been discarded for table `t1`
restore: t1 .ibd and .cfg files
ALTER TABLE t1 IMPORT TABLESPACE;
-ERROR HY000: Schema mismatch (Number of columns don't match, table has 6 columns but the tablespace meta-data file has 5 columns)
+ERROR HY000: Schema mismatch (Column c3 not found in tablespace.)
unlink: t1.ibd
unlink: t1.cfg
DROP TABLE t1;
diff --git a/mysql-test/suite/innodb_zip/t/restart.test b/mysql-test/suite/innodb_zip/t/restart.test
index 05ac8274278..1c4af461dfc 100644
--- a/mysql-test/suite/innodb_zip/t/restart.test
+++ b/mysql-test/suite/innodb_zip/t/restart.test
@@ -4,6 +4,7 @@
--source include/innodb_page_size_small.inc
--source include/have_partition.inc
--source include/not_embedded.inc
+--source include/have_symlink.inc
SET default_storage_engine=InnoDB;
LET $MYSQLD_DATADIR = `select @@datadir`;
LET $INNODB_PAGE_SIZE = `select @@innodb_page_size`;
diff --git a/mysql-test/suite/maria/fulltext2.result b/mysql-test/suite/maria/fulltext2.result
index 1e4e6636ef6..6cffc5cf404 100644
--- a/mysql-test/suite/maria/fulltext2.result
+++ b/mysql-test/suite/maria/fulltext2.result
@@ -84,3 +84,10 @@ select count(*) from t1 where match a against ('aaayyy' in boolean mode);
count(*)
0
drop table t1;
+set names utf8mb4;
+create table t1 (a int, b text, fulltext (b)) charset=utf8mb4 collate=utf8mb4_unicode_ci engine=aria;
+insert t1 values (1000, 'C͓̙̯͔̩ͅͅi̩̘̜̲a̯̲̬̳̜̖̤o͕͓̜͓̺̖̗,̠̬͚ ̺T͇̲h͈̱e ̬̜D̖o̦̖͔̗͖̩̘c̣̼t̝͉̫̮̗o͉̫̭r̙͎̗.͓̪̥');
+select a from t1 where match(b) against ('ciao' in boolean mode);
+a
+1000
+drop table t1;
diff --git a/mysql-test/suite/maria/fulltext2.test b/mysql-test/suite/maria/fulltext2.test
index 060b748eb4f..7bfbe600ff7 100644
--- a/mysql-test/suite/maria/fulltext2.test
+++ b/mysql-test/suite/maria/fulltext2.test
@@ -75,3 +75,12 @@ select count(*) from t1 where match a against ('aaaxxx' in boolean mode);
select count(*) from t1 where match a against ('aaayyy' in boolean mode);
drop table t1;
+
+#
+# MDEV-11241 Certain combining marks cause MariaDB to crash when doing Full-Text searches
+#
+set names utf8mb4;
+create table t1 (a int, b text, fulltext (b)) charset=utf8mb4 collate=utf8mb4_unicode_ci engine=aria;
+insert t1 values (1000, 'C͓̙̯͔̩ͅͅi̩̘̜̲a̯̲̬̳̜̖̤o͕͓̜͓̺̖̗,̠̬͚ ̺T͇̲h͈̱e ̬̜D̖o̦̖͔̗͖̩̘c̣̼t̝͉̫̮̗o͉̫̭r̙͎̗.͓̪̥');
+select a from t1 where match(b) against ('ciao' in boolean mode);
+drop table t1;
diff --git a/mysql-test/suite/mariabackup/create_with_data_directory_during_backup.test b/mysql-test/suite/mariabackup/create_with_data_directory_during_backup.test
index d0cb83d069f..f01028b6494 100644
--- a/mysql-test/suite/mariabackup/create_with_data_directory_during_backup.test
+++ b/mysql-test/suite/mariabackup/create_with_data_directory_during_backup.test
@@ -1,4 +1,5 @@
--source include/have_debug.inc
+--source include/have_symlink.inc
let $table_data_dir=$MYSQLTEST_VARDIR/tmp/ddir;
let $targetdir=$MYSQLTEST_VARDIR/tmp/backup;
mkdir $table_data_dir;
diff --git a/mysql-test/suite/mariabackup/data_directory.test b/mysql-test/suite/mariabackup/data_directory.test
index 50789a34c78..a89b7bdccc4 100644
--- a/mysql-test/suite/mariabackup/data_directory.test
+++ b/mysql-test/suite/mariabackup/data_directory.test
@@ -1,3 +1,4 @@
+--source include/have_symlink.inc
let $table_data_dir=$MYSQLTEST_VARDIR/ddir;
mkdir $table_data_dir;
--replace_result $table_data_dir table_data_dir
diff --git a/mysql-test/suite/mariabackup/partition_datadir.test b/mysql-test/suite/mariabackup/partition_datadir.test
index c525d34a02c..36520d331bf 100644
--- a/mysql-test/suite/mariabackup/partition_datadir.test
+++ b/mysql-test/suite/mariabackup/partition_datadir.test
@@ -1,4 +1,5 @@
--source include/have_partition.inc
+--source include/have_symlink.inc
let $targetdir=$MYSQLTEST_VARDIR/backup;
mkdir $targetdir;
mkdir $MYSQLTEST_VARDIR/partitdata;
diff --git a/mysql-test/suite/parts/t/alter_data_directory_innodb.test b/mysql-test/suite/parts/t/alter_data_directory_innodb.test
index ac15e9bec6c..def04e14173 100644
--- a/mysql-test/suite/parts/t/alter_data_directory_innodb.test
+++ b/mysql-test/suite/parts/t/alter_data_directory_innodb.test
@@ -1,5 +1,6 @@
--source include/have_innodb.inc
--source include/have_partition.inc
+--source include/have_symlink.inc
--echo #
--echo # MDEV-15953 Alter InnoDB Partitioned Table Moves Files (which were originally not in the datadir) to the datadir
diff --git a/mysql-test/suite/parts/t/reorganize_partition_innodb.test b/mysql-test/suite/parts/t/reorganize_partition_innodb.test
index db73650c54b..77109c38c96 100644
--- a/mysql-test/suite/parts/t/reorganize_partition_innodb.test
+++ b/mysql-test/suite/parts/t/reorganize_partition_innodb.test
@@ -1,5 +1,6 @@
--source include/have_innodb.inc
--source include/have_partition.inc
+--source include/have_symlink.inc
--echo #
--echo # MDEV-15953 Alter InnoDB Partitioned Table Moves Files (which were originally not in the datadir) to the datadir
diff --git a/mysql-test/suite/plugins/r/locales.result b/mysql-test/suite/plugins/r/locales.result
index 106bf22923c..2ea88493705 100644
--- a/mysql-test/suite/plugins/r/locales.result
+++ b/mysql-test/suite/plugins/r/locales.result
@@ -17,7 +17,7 @@ ID NAME DESCRIPTION MAX_MONTH_NAME_LENGTH MAX_DAY_NAME_LENGTH DECIMAL_POINT THOU
14 cs_CZ Czech - Czech Republic 8 7 , czech
15 da_DK Danish - Denmark 9 7 , . danish
16 de_AT German - Austria 9 10 , german
-17 es_ES Spanish - Spain 10 9 , spanish
+17 es_ES Spanish - Spain 10 9 , . spanish
18 et_EE Estonian - Estonia 9 9 , estonian
19 eu_ES Basque - Basque 9 10 , english
20 fi_FI Finnish - Finland 9 11 , english
@@ -82,24 +82,24 @@ ID NAME DESCRIPTION MAX_MONTH_NAME_LENGTH MAX_DAY_NAME_LENGTH DECIMAL_POINT THOU
79 en_ZA English - South Africa 9 9 . , english
80 en_ZW English - Zimbabwe 9 9 . , english
81 es_AR Spanish - Argentina 10 9 , . spanish
-82 es_BO Spanish - Bolivia 10 9 , spanish
-83 es_CL Spanish - Chile 10 9 , spanish
-84 es_CO Spanish - Columbia 10 9 , spanish
-85 es_CR Spanish - Costa Rica 10 9 . spanish
-86 es_DO Spanish - Dominican Republic 10 9 . spanish
-87 es_EC Spanish - Ecuador 10 9 , spanish
-88 es_GT Spanish - Guatemala 10 9 . spanish
-89 es_HN Spanish - Honduras 10 9 . spanish
-90 es_MX Spanish - Mexico 10 9 . spanish
-91 es_NI Spanish - Nicaragua 10 9 . spanish
-92 es_PA Spanish - Panama 10 9 . spanish
-93 es_PE Spanish - Peru 10 9 . spanish
-94 es_PR Spanish - Puerto Rico 10 9 . spanish
-95 es_PY Spanish - Paraguay 10 9 , spanish
-96 es_SV Spanish - El Salvador 10 9 . spanish
+82 es_BO Spanish - Bolivia 10 9 , . spanish
+83 es_CL Spanish - Chile 10 9 , . spanish
+84 es_CO Spanish - Columbia 10 9 , . spanish
+85 es_CR Spanish - Costa Rica 10 9 , spanish
+86 es_DO Spanish - Dominican Republic 10 9 . , spanish
+87 es_EC Spanish - Ecuador 10 9 , . spanish
+88 es_GT Spanish - Guatemala 10 9 . , spanish
+89 es_HN Spanish - Honduras 10 9 . , spanish
+90 es_MX Spanish - Mexico 10 9 . , spanish
+91 es_NI Spanish - Nicaragua 10 9 . , spanish
+92 es_PA Spanish - Panama 10 9 . , spanish
+93 es_PE Spanish - Peru 10 9 . , spanish
+94 es_PR Spanish - Puerto Rico 10 9 . , spanish
+95 es_PY Spanish - Paraguay 10 9 , . spanish
+96 es_SV Spanish - El Salvador 10 9 . , spanish
97 es_US Spanish - United States 10 9 . , spanish
-98 es_UY Spanish - Uruguay 10 9 , spanish
-99 es_VE Spanish - Venezuela 10 9 , spanish
+98 es_UY Spanish - Uruguay 10 9 , . spanish
+99 es_VE Spanish - Venezuela 10 9 , . spanish
100 fr_BE French - Belgium 9 8 , . french
101 fr_CA French - Canada 9 8 , french
102 fr_CH French - Switzerland 9 8 , french
diff --git a/mysql-test/suite/rpl/r/rpl_seconds_behind_master_spike.result b/mysql-test/suite/rpl/r/rpl_seconds_behind_master_spike.result
new file mode 100644
index 00000000000..be18f95c2c0
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_seconds_behind_master_spike.result
@@ -0,0 +1,40 @@
+include/master-slave.inc
+[connection master]
+connection slave;
+include/stop_slave.inc
+SET @save_dbug= @@GLOBAL.debug_dbug;
+SET @@global.debug_dbug="+d,pause_sql_thread_on_fde";
+include/start_slave.inc
+# Future events must be logged at least 2 seconds after
+# the slave starts
+connection master;
+# Write events to ensure slave will be consistent with master
+create table t1 (a int);
+insert into t1 values (1);
+# Flush logs on master forces slave to generate a Format description
+# event in its relay log
+flush logs;
+connection slave;
+# Ignore FDEs that happen before the CREATE/INSERT commands
+SET DEBUG_SYNC='now WAIT_FOR paused_on_fde';
+SET DEBUG_SYNC='now SIGNAL sql_thread_continue';
+SET DEBUG_SYNC='now WAIT_FOR paused_on_fde';
+SET DEBUG_SYNC='now SIGNAL sql_thread_continue';
+# On the next FDE, the slave should have the master CREATE/INSERT events
+SET DEBUG_SYNC='now WAIT_FOR paused_on_fde';
+select count(*)=1 from t1;
+count(*)=1
+1
+# The relay log FDE has been processed - here we check to ensure it was
+# not considered in Seconds_Behind_Master calculation
+connection slave1;
+# Safely resume slave SQL thread
+SET @@global.debug_dbug='';
+SET DEBUG_SYNC='pause_sql_thread_on_fde CLEAR';
+SET DEBUG_SYNC='now SIGNAL sql_thread_continue';
+SET DEBUG_SYNC='RESET';
+connection master;
+DROP TABLE t1;
+connection slave;
+SET @@global.debug_dbug=$save_dbug;
+include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_seconds_behind_master_spike.test b/mysql-test/suite/rpl/t/rpl_seconds_behind_master_spike.test
new file mode 100644
index 00000000000..029625a09ad
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_seconds_behind_master_spike.test
@@ -0,0 +1,88 @@
+#
+# Purpose:
+# This test validates that a slave's relay log format description event is
+# not used to calculate the Seconds_Behind_Master time displayed by
+# SHOW SLAVE STATUS.
+#
+# Methodology:
+# Ensure that a slave's reported Seconds_Behind_Master does not point before
+# a time in which we can prove that it has progressed beyond. The slave's
+# relay log events are created using the timestamp at which the IO thread was
+# created. Therefore, after starting the slave's IO thread, we sleep so any
+# proceeding events are forced to have later timestamps. After sleeping, we run
+# MDL statements on the master and save the time at which they are binlogged.
+# Once the slave executes these MDL commands, we have proven that the slave has
+# caught up to this saved timestamp. At this point, if the value of
+# Seconds_Behind_Master points before the time in which the MDL events were
+# logged, it is invalid.
+#
+# References:
+# MDEV-16091: Seconds_Behind_Master spikes to millions of seconds
+#
+--source include/have_debug.inc
+--source include/have_innodb.inc
+--source include/master-slave.inc
+
+--connection slave
+--source include/stop_slave.inc
+SET @save_dbug= @@GLOBAL.debug_dbug;
+SET @@global.debug_dbug="+d,pause_sql_thread_on_fde";
+--source include/start_slave.inc
+
+--let $sleep_time=2
+--echo # Future events must be logged at least $sleep_time seconds after
+--echo # the slave starts
+--sleep $sleep_time
+
+--connection master
+--echo # Write events to ensure slave will be consistent with master
+create table t1 (a int);
+insert into t1 values (1);
+--let $t_master_events_logged= `SELECT UNIX_TIMESTAMP()`
+
+--echo # Flush logs on master forces slave to generate a Format description
+--echo # event in its relay log
+flush logs;
+
+--connection slave
+--echo # Ignore FDEs that happen before the CREATE/INSERT commands
+SET DEBUG_SYNC='now WAIT_FOR paused_on_fde';
+SET DEBUG_SYNC='now SIGNAL sql_thread_continue';
+SET DEBUG_SYNC='now WAIT_FOR paused_on_fde';
+SET DEBUG_SYNC='now SIGNAL sql_thread_continue';
+
+--echo # On the next FDE, the slave should have the master CREATE/INSERT events
+SET DEBUG_SYNC='now WAIT_FOR paused_on_fde';
+select count(*)=1 from t1;
+
+--echo # The relay log FDE has been processed - here we check to ensure it was
+--echo # not considered in Seconds_Behind_Master calculation
+--connection slave1
+let $sbm= query_get_value(SHOW SLAVE STATUS, Seconds_Behind_Master, 1);
+--let $t_now= `SELECT UNIX_TIMESTAMP()`
+
+# Ensure Seconds_Behind_Master does not point beyond when we have proven the
+# events we have proven to have executed. The extra second is needed as a
+# buffer because the recorded times are not exact with when the events were
+# recorded on the master.
+if(`select $sbm > $t_now - $t_master_events_logged + 1`)
+{
+ die "A relay log event was incorrectly used to set Seconds_Behind_Master";
+}
+
+--echo # Safely resume slave SQL thread
+SET @@global.debug_dbug='';
+SET DEBUG_SYNC='pause_sql_thread_on_fde CLEAR';
+SET DEBUG_SYNC='now SIGNAL sql_thread_continue';
+
+# Reset last sql_thread_continue signal
+SET DEBUG_SYNC='RESET';
+
+# Cleanup
+--connection master
+DROP TABLE t1;
+
+--connection slave
+SET @@global.debug_dbug=$save_dbug;
+
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb.result b/mysql-test/suite/sys_vars/r/sysvars_innodb.result
index 5b794166cc7..d44b8fbf470 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_innodb.result
+++ b/mysql-test/suite/sys_vars/r/sysvars_innodb.result
@@ -279,7 +279,7 @@ DEFAULT_VALUE 134217728
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT The size of the memory buffer InnoDB uses to cache data and indexes of its tables.
-NUMERIC_MIN_VALUE 5242880
+NUMERIC_MIN_VALUE 2097152
NUMERIC_MAX_VALUE 9223372036854775807
NUMERIC_BLOCK_SIZE 1048576
ENUM_VALUE_LIST NULL
diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_embedded,32bit.rdiff b/mysql-test/suite/sys_vars/r/sysvars_server_embedded,32bit.rdiff
index 685c45162ac..5e2d984663c 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_server_embedded,32bit.rdiff
+++ b/mysql-test/suite/sys_vars/r/sysvars_server_embedded,32bit.rdiff
@@ -1,7 +1,7 @@
---- sysvars_server_embedded.result 2019-09-02 17:28:33.630863762 +0300
-+++ sysvars_server_embedded,32bit.reject 2019-09-02 17:50:30.619590080 +0300
-@@ -25,7 +25,7 @@
- COMMAND_LINE_ARGUMENT OPTIONAL
+--- ../../mysql-test/suite/sys_vars/r/sysvars_server_embedded.result 2022-01-27 20:42:19.039084441 +0200
++++ ../../mysql-test/suite/sys_vars/r/sysvars_server_embedded,32bit.result~ 2022-01-28 16:12:40.038627481 +0200
+@@ -14,7 +14,7 @@
+ order by variable_name;
VARIABLE_NAME ARIA_BLOCK_SIZE
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
@@ -555,7 +555,7 @@
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT The number of bytes to use when sorting BLOB or TEXT values (only the first max_sort_length bytes of each value are used; the rest are ignored)
- NUMERIC_MIN_VALUE 4
+ NUMERIC_MIN_VALUE 64
NUMERIC_MAX_VALUE 8388608
@@ -1895,7 +1895,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
@@ -779,8 +779,8 @@
+VARIABLE_TYPE INT
VARIABLE_COMMENT Size of the statement digest. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
- NUMERIC_MAX_VALUE 200
-@@ -2265,7 +2265,7 @@
+ NUMERIC_MAX_VALUE 1048576
+@@ -2144,7 +2144,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_EVENTS_STAGES_HISTORY_LONG_SIZE
VARIABLE_SCOPE GLOBAL
diff --git a/mysql-test/suite/vcol/r/not_supported.result b/mysql-test/suite/vcol/r/not_supported.result
index c804cf220d2..d8703f755da 100644
--- a/mysql-test/suite/vcol/r/not_supported.result
+++ b/mysql-test/suite/vcol/r/not_supported.result
@@ -34,3 +34,11 @@ select * from t8;
a b v
1234567890 2 2009-02-14 00:31:30
drop table t1, t3_ok, t8;
+#
+# Bug#33141966 - INCONSISTENT BEHAVIOR IF A COLUMN OF TYPE SERIAL IS SET AS GENERATED
+#
+create table t1 (a int, b serial as (a+1));
+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 'as (a+1))' at line 1
+#
+# End of 10.2 tests
+#
diff --git a/mysql-test/suite/vcol/t/not_supported.test b/mysql-test/suite/vcol/t/not_supported.test
index 1ea7970523a..2b5baf4ff4b 100644
--- a/mysql-test/suite/vcol/t/not_supported.test
+++ b/mysql-test/suite/vcol/t/not_supported.test
@@ -39,3 +39,13 @@ select * from t1;
select * from t8;
drop table t1, t3_ok, t8;
+
+--echo #
+--echo # Bug#33141966 - INCONSISTENT BEHAVIOR IF A COLUMN OF TYPE SERIAL IS SET AS GENERATED
+--echo #
+--error ER_PARSE_ERROR
+create table t1 (a int, b serial as (a+1));
+
+--echo #
+--echo # End of 10.2 tests
+--echo #