summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorAleksey Midenkov <midenok@gmail.com>2017-12-11 15:43:41 +0300
committerAleksey Midenkov <midenok@gmail.com>2017-12-11 15:43:41 +0300
commit79dd77e6aebc861b82e4895941224bbbad441650 (patch)
tree8c22b54de7964a89358415b5380c2bc734f162a1 /mysql-test
parentb7cd18289639b30fafc7f623c1187e442608727c (diff)
parent8f581e8bf1d400be08995b1cf8c11e3b0f7ae283 (diff)
downloadmariadb-git-79dd77e6aebc861b82e4895941224bbbad441650.tar.gz
System Versioning 1.0 pre3
Merge branch '10.3' into trunk
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/extra/rpl_tests/rpl_log.test2
-rw-r--r--mysql-test/include/default_mysqld.cnf2
-rw-r--r--mysql-test/include/filter_file.inc11
-rw-r--r--mysql-test/include/have_debug.inc5
-rw-r--r--mysql-test/include/have_example_plugin.inc14
-rw-r--r--mysql-test/include/have_innodb.inc6
-rw-r--r--mysql-test/include/have_plugin_auth.opt2
-rw-r--r--mysql-test/include/mtr_warnings.sql6
-rw-r--r--mysql-test/include/not_embedded.inc6
-rw-r--r--mysql-test/include/not_windows.inc8
-rw-r--r--mysql-test/include/show_binlog_events.inc8
-rw-r--r--mysql-test/include/show_events.inc7
-rw-r--r--mysql-test/include/show_gtid_list.inc15
-rwxr-xr-xmysql-test/mysql-test-run.pl4
-rw-r--r--mysql-test/r/analyze_stmt_privileges2.result6
-rw-r--r--mysql-test/r/cast.result109
-rw-r--r--mysql-test/r/commit_1innodb.result2
-rw-r--r--mysql-test/r/create_drop_binlog.result2
-rw-r--r--mysql-test/r/create_drop_function.result4
-rw-r--r--mysql-test/r/create_drop_view.result2
-rw-r--r--mysql-test/r/cte_grant.result58
-rw-r--r--mysql-test/r/custom_aggregate_functions.result938
-rw-r--r--mysql-test/r/derived.result56
-rw-r--r--mysql-test/r/derived_view.result4
-rw-r--r--mysql-test/r/drop.result8
-rw-r--r--mysql-test/r/explain.result8
-rw-r--r--mysql-test/r/explain_json.result2
-rw-r--r--mysql-test/r/func_gconcat.result126
-rw-r--r--mysql-test/r/func_group.result2
-rw-r--r--mysql-test/r/func_group_innodb.result4
-rw-r--r--mysql-test/r/func_hybrid_type.result4
-rw-r--r--mysql-test/r/func_json.result6
-rw-r--r--mysql-test/r/func_str.result4
-rw-r--r--mysql-test/r/get_diagnostics.result2
-rw-r--r--mysql-test/r/gis-json.result15
-rw-r--r--mysql-test/r/gis.result6
-rw-r--r--mysql-test/r/grant.result2
-rw-r--r--mysql-test/r/information_schema.result3
-rw-r--r--mysql-test/r/intersect.result13
-rw-r--r--mysql-test/r/join_nested.result2
-rw-r--r--mysql-test/r/join_nested_jcl6.result2
-rw-r--r--mysql-test/r/limit_rows_examined.result6
-rw-r--r--mysql-test/r/myisam_explain_non_select_all.result22
-rw-r--r--mysql-test/r/mysqlbinlog.result1
-rw-r--r--mysql-test/r/mysqld--help.result22
-rw-r--r--mysql-test/r/not_windows.require2
-rw-r--r--mysql-test/r/order_by.result50
-rw-r--r--mysql-test/r/order_by_innodb.result73
-rw-r--r--mysql-test/r/outfile.resultbin2323 -> 2323 bytes
-rw-r--r--mysql-test/r/partition.result3
-rw-r--r--mysql-test/r/partition_innodb.result4
-rw-r--r--mysql-test/r/partition_pruning.result88
-rw-r--r--mysql-test/r/partition_range.result4
-rw-r--r--mysql-test/r/profiling.result2
-rw-r--r--mysql-test/r/ps.result184
-rw-r--r--mysql-test/r/query_cache.result2
-rw-r--r--mysql-test/r/range.result2
-rw-r--r--mysql-test/r/range_mrr_icp.result2
-rw-r--r--mysql-test/r/select.result10
-rw-r--r--mysql-test/r/select_found.result2
-rw-r--r--mysql-test/r/select_jcl6.result10
-rw-r--r--mysql-test/r/select_pkeycache.result10
-rw-r--r--mysql-test/r/selectivity.result4
-rw-r--r--mysql-test/r/selectivity_innodb.result4
-rw-r--r--mysql-test/r/signal.result34
-rw-r--r--mysql-test/r/signal_demo3.result42
-rw-r--r--mysql-test/r/sp-code.result303
-rw-r--r--mysql-test/r/sp-cursor.result131
-rw-r--r--mysql-test/r/sp-destruct.result12
-rw-r--r--mysql-test/r/sp-error.result6
-rw-r--r--mysql-test/r/sp-for-loop.result208
-rw-r--r--mysql-test/r/sp-group.result2
-rw-r--r--mysql-test/r/sp.result18
-rw-r--r--mysql-test/r/subselect.result28
-rw-r--r--mysql-test/r/subselect4.result20
-rw-r--r--mysql-test/r/subselect_mat.result4
-rw-r--r--mysql-test/r/subselect_mat_cost_bugs.result2
-rw-r--r--mysql-test/r/subselect_no_exists_to_in.result28
-rw-r--r--mysql-test/r/subselect_no_mat.result28
-rw-r--r--mysql-test/r/subselect_no_opts.result28
-rw-r--r--mysql-test/r/subselect_no_scache.result28
-rw-r--r--mysql-test/r/subselect_no_semijoin.result28
-rw-r--r--mysql-test/r/system_mysql_db.result1
-rw-r--r--mysql-test/r/system_mysql_db_fix40123.result1
-rw-r--r--mysql-test/r/trigger.result17
-rw-r--r--mysql-test/r/type_set.result6
-rw-r--r--mysql-test/r/union.result4
-rw-r--r--mysql-test/r/view.result14
-rw-r--r--mysql-test/r/view_grant.result16
-rw-r--r--mysql-test/r/warnings.result2
-rw-r--r--mysql-test/r/win.result16
-rw-r--r--mysql-test/suite/binlog/r/binlog_flush_binlogs_delete_domain.result78
-rw-r--r--mysql-test/suite/binlog/r/binlog_gtid_delete_domain_debug.result6
-rw-r--r--mysql-test/suite/binlog/r/binlog_killed.result91
-rw-r--r--mysql-test/suite/binlog/r/binlog_stm_ps.result43
-rw-r--r--mysql-test/suite/binlog/r/load_data_stm_view.result1
-rw-r--r--mysql-test/suite/binlog/t/binlog_flush_binlogs_delete_domain.test137
-rw-r--r--mysql-test/suite/binlog/t/binlog_gtid_delete_domain_debug.test11
-rw-r--r--mysql-test/suite/binlog/t/binlog_killed.test81
-rw-r--r--mysql-test/suite/binlog/t/binlog_stm_ps.test16
-rw-r--r--mysql-test/suite/binlog/t/load_data_stm_view.test4
-rw-r--r--mysql-test/suite/compat/oracle/r/ps.result15
-rw-r--r--mysql-test/suite/compat/oracle/r/sp-cursor-rowtype.result33
-rw-r--r--mysql-test/suite/compat/oracle/r/sp.result28
-rw-r--r--mysql-test/suite/compat/oracle/t/ps.test24
-rw-r--r--mysql-test/suite/compat/oracle/t/sp-cursor-rowtype.test36
-rw-r--r--mysql-test/suite/compat/oracle/t/sp.test27
-rw-r--r--mysql-test/suite/encryption/include/have_example_key_management_plugin.opt1
-rw-r--r--mysql-test/suite/federated/federated_partition.result5
-rw-r--r--mysql-test/suite/federated/federated_partition.test1
-rw-r--r--mysql-test/suite/funcs_1/r/innodb_views.result6
-rw-r--r--mysql-test/suite/funcs_1/r/is_columns_mysql.result6
-rw-r--r--mysql-test/suite/funcs_1/r/is_columns_mysql_embedded.result2
-rw-r--r--mysql-test/suite/funcs_1/r/memory_views.result6
-rw-r--r--mysql-test/suite/funcs_1/r/myisam_views-big.result6
-rw-r--r--mysql-test/suite/funcs_1/r/storedproc.result52
-rw-r--r--mysql-test/suite/galera/galera_2nodes.cnf1
-rw-r--r--mysql-test/suite/galera/r/MW-388.result46
-rw-r--r--mysql-test/suite/galera/r/sql_log_bin.result1
-rw-r--r--mysql-test/suite/galera/suite.opt1
-rw-r--r--mysql-test/suite/galera/suite.pm6
-rw-r--r--mysql-test/suite/galera/t/MW-388.test76
-rw-r--r--mysql-test/suite/galera/t/galera_ftwrl.test7
-rw-r--r--mysql-test/suite/galera/t/galera_suspend_slave.test4
-rw-r--r--mysql-test/suite/galera/t/sql_log_bin.test12
-rw-r--r--mysql-test/suite/galera_3nodes/galera_3nodes.cnf1
-rw-r--r--mysql-test/suite/galera_3nodes/suite.pm6
-rw-r--r--mysql-test/suite/gcol/r/innodb_virtual_stats.result127
-rw-r--r--mysql-test/suite/gcol/t/innodb_virtual_stats.test52
-rw-r--r--mysql-test/suite/innodb/include/innodb_bulk_create_index.inc185
-rw-r--r--mysql-test/suite/innodb/include/innodb_bulk_create_index_debug.inc221
-rw-r--r--mysql-test/suite/innodb/r/ddl_purge.result25
-rw-r--r--mysql-test/suite/innodb/r/innodb-on-duplicate-update.result60
-rw-r--r--mysql-test/suite/innodb/r/innodb-replace-debug.result13
-rw-r--r--mysql-test/suite/innodb/r/innodb_bulk_create_index.result1037
-rw-r--r--mysql-test/suite/innodb/r/innodb_bulk_create_index_debug.result485
-rw-r--r--mysql-test/suite/innodb/r/innodb_bulk_create_index_flush.result54
-rw-r--r--mysql-test/suite/innodb/r/innodb_bulk_create_index_replication.result222
-rw-r--r--mysql-test/suite/innodb/r/innodb_bulk_create_index_small.result139
-rw-r--r--mysql-test/suite/innodb/r/innodb_mysql.result6
-rw-r--r--mysql-test/suite/innodb/r/innodb_stats_debug.result12
-rw-r--r--mysql-test/suite/innodb/r/instant_alter,4k.rdiff52
-rw-r--r--mysql-test/suite/innodb/r/instant_alter,8k.rdiff54
-rw-r--r--mysql-test/suite/innodb/r/instant_alter_debug.result2
-rw-r--r--mysql-test/suite/innodb/r/truncate_restart.result12
-rw-r--r--mysql-test/suite/innodb/r/update_time.result54
-rw-r--r--mysql-test/suite/innodb/suite.opt1
-rw-r--r--mysql-test/suite/innodb/t/ddl_purge.test36
-rw-r--r--mysql-test/suite/innodb/t/innodb-on-duplicate-update.test63
-rw-r--r--mysql-test/suite/innodb/t/innodb-replace-debug.test15
-rw-r--r--mysql-test/suite/innodb/t/innodb_bulk_create_index.test46
-rw-r--r--mysql-test/suite/innodb/t/innodb_bulk_create_index_debug.test23
-rw-r--r--mysql-test/suite/innodb/t/innodb_bulk_create_index_flush.test75
-rw-r--r--mysql-test/suite/innodb/t/innodb_bulk_create_index_replication.test182
-rw-r--r--mysql-test/suite/innodb/t/innodb_bulk_create_index_small.test148
-rw-r--r--mysql-test/suite/innodb/t/innodb_default_row_format.combinations4
-rw-r--r--mysql-test/suite/innodb/t/innodb_default_row_format.inc2
-rw-r--r--mysql-test/suite/innodb/t/innodb_stats_debug.test13
-rw-r--r--mysql-test/suite/innodb/t/innodb_stats_drop_locked.test2
-rw-r--r--mysql-test/suite/innodb/t/truncate_restart.test16
-rw-r--r--mysql-test/suite/innodb/t/update_time-master.opt1
-rw-r--r--mysql-test/suite/innodb/t/update_time.test78
-rw-r--r--mysql-test/suite/mariabackup/log_checksum_mismatch.result14
-rw-r--r--mysql-test/suite/mariabackup/log_checksum_mismatch.test32
-rw-r--r--mysql-test/suite/mariabackup/mdev-14447.opt1
-rw-r--r--mysql-test/suite/mariabackup/mdev-14447.result19
-rw-r--r--mysql-test/suite/mariabackup/mdev-14447.test46
-rw-r--r--mysql-test/suite/parts/r/optimizer.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_create_drop_view.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_gtid_delete_domain.result82
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_log.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_log_innodb.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_sp.result36
-rw-r--r--mysql-test/suite/rpl/r/rpl_stm_log.result2
-rw-r--r--mysql-test/suite/rpl/suite.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_gtid_delete_domain.test98
-rw-r--r--mysql-test/suite/sql_sequence/alter.result2
-rw-r--r--mysql-test/suite/sql_sequence/create.result14
-rw-r--r--mysql-test/suite/sys_vars/inc/sysvars_server.inc1
-rw-r--r--mysql-test/suite/sys_vars/r/slave_transaction_retry_errors.result21
-rw-r--r--mysql-test/suite/sys_vars/r/slave_transaction_retry_interval_basic.result126
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_server_embedded.result17
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_server_notembedded,32bit.rdiff43
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result47
-rw-r--r--mysql-test/suite/sys_vars/t/slave_transaction_retry_errors-master.opt1
-rw-r--r--mysql-test/suite/sys_vars/t/slave_transaction_retry_errors.test19
-rw-r--r--mysql-test/suite/sys_vars/t/slave_transaction_retry_interval_basic.test190
-rw-r--r--mysql-test/suite/versioning/r/optimized.result46
-rw-r--r--mysql-test/suite/versioning/r/partition.result12
-rw-r--r--mysql-test/suite/wsrep/suite.pm6
-rw-r--r--mysql-test/t/bootstrap.test2
-rw-r--r--mysql-test/t/cast.test137
-rw-r--r--mysql-test/t/cte_grant.test53
-rw-r--r--mysql-test/t/custom_aggregate_functions.test773
-rw-r--r--mysql-test/t/func_gconcat.test73
-rw-r--r--mysql-test/t/func_json.test6
-rw-r--r--mysql-test/t/gis-json.test4
-rw-r--r--mysql-test/t/information_schema.test2
-rw-r--r--mysql-test/t/intersect.test15
-rw-r--r--mysql-test/t/mysqlbinlog.test6
-rw-r--r--mysql-test/t/mysqld--help.test2
-rw-r--r--mysql-test/t/order_by.test43
-rw-r--r--mysql-test/t/order_by_innodb.test47
-rw-r--r--mysql-test/t/partition.test2
-rw-r--r--mysql-test/t/ps.test91
-rw-r--r--mysql-test/t/sp-code.test169
-rw-r--r--mysql-test/t/sp-cursor.test133
-rw-r--r--mysql-test/t/sp-destruct.test2
-rw-r--r--mysql-test/t/sp-error.test2
-rw-r--r--mysql-test/t/sp-for-loop.test212
-rw-r--r--mysql-test/t/sp.test19
-rw-r--r--mysql-test/t/trigger.test27
-rw-r--r--mysql-test/t/type_set.test8
-rw-r--r--mysql-test/t/win.test21
214 files changed, 9539 insertions, 610 deletions
diff --git a/mysql-test/extra/rpl_tests/rpl_log.test b/mysql-test/extra/rpl_tests/rpl_log.test
index d2f605e0f96..f885602eaad 100644
--- a/mysql-test/extra/rpl_tests/rpl_log.test
+++ b/mysql-test/extra/rpl_tests/rpl_log.test
@@ -65,6 +65,8 @@ flush logs;
# To make it predictable, we do a useless update now, but which has the
# interest of making the slave catch both rotate events.
+let $skip_checkpoint_events=1;
+
eval create table t3 (a int)ENGINE=$engine_type;
# Sync slave and force it to start on another binary log
diff --git a/mysql-test/include/default_mysqld.cnf b/mysql-test/include/default_mysqld.cnf
index 44a7fd12d27..69a2b58288b 100644
--- a/mysql-test/include/default_mysqld.cnf
+++ b/mysql-test/include/default_mysqld.cnf
@@ -17,7 +17,7 @@
# Default values that applies to all MySQL Servers
[mysqld]
disable-getopt-prefix-matching
-
+plugin-maturity=unknown
open-files-limit= 1024
local-infile
character-set-server= latin1
diff --git a/mysql-test/include/filter_file.inc b/mysql-test/include/filter_file.inc
index 17c7c1985d7..bfe53896710 100644
--- a/mysql-test/include/filter_file.inc
+++ b/mysql-test/include/filter_file.inc
@@ -53,6 +53,9 @@
#
# $rpl_debug
# If set, verbose debug info is printed.
+#
+# $filter_script
+# If set, rows matching this regexp will be filtered out
--let $include_filename= filter_file.inc
--source include/begin_include_file.inc
@@ -67,10 +70,12 @@ if ($rpl_debug)
--let _FF_PRE_SCRIPT= $pre_script
--let _FF_SCRIPT= $script
+--let _FF_FILTER_SCRIPT= $filter_script
--let _FF_INPUT_FILE= $input_file
--let _FF_OUTPUT_FILE= $output_file
--let _FF_SELECT_COLUMNS= $select_columns
--let _FF_DEBUG= $rpl_debug
+
if (!$output_file)
{
--let _FF_OUTPUT_FILE= $input_file
@@ -79,6 +84,7 @@ perl;
my $pre_script = $ENV{'_FF_PRE_SCRIPT'};
$pre_script =~ s/DOLLAR/\$/g;
my $script = $ENV{'_FF_SCRIPT'};
+ my $filter_script = $ENV{'_FF_FILTER_SCRIPT'};
$script =~ s/DOLLAR/\$/g;
my $input_file = $ENV{'_FF_INPUT_FILE'};
my $output_file = $ENV{'_FF_OUTPUT_FILE'};
@@ -123,7 +129,10 @@ perl;
{
' . $script . '
}
- $filtered_contents .= $_."\n";
+ if (!$filter_script || ! m/$filter_script/)
+ {
+ $filtered_contents .= $_."\n";
+ }
}
close FILE or die "Error closing $input_file: $!";
open FILE, "> $output_file" or die "Error opening $output_file: $!";
diff --git a/mysql-test/include/have_debug.inc b/mysql-test/include/have_debug.inc
index 5df3080a6ed..a035031e49a 100644
--- a/mysql-test/include/have_debug.inc
+++ b/mysql-test/include/have_debug.inc
@@ -2,8 +2,3 @@
# suite.pm will make sure that all tests including this file
# will be skipped unless this is a debug build.
#
-# The test below is redundant
-
-if (`select version() not like '%debug%'`) {
- --skip Needs a debug build
-}
diff --git a/mysql-test/include/have_example_plugin.inc b/mysql-test/include/have_example_plugin.inc
index 5571c345850..c0da490dde0 100644
--- a/mysql-test/include/have_example_plugin.inc
+++ b/mysql-test/include/have_example_plugin.inc
@@ -1,14 +1,4 @@
#
-# Check if server has support for loading plugins
+# suite.pm will make sure that all tests including this file
+# will be skipped unless dynamic ha_example plugin is available
#
-if (`SELECT @@have_dynamic_loading != 'YES'`) {
- --skip Example plugin requires dynamic loading
-}
-
-#
-# Check if the variable EXAMPLE_PLUGIN is set
-#
-if (!$HA_EXAMPLE_SO) {
- --skip Need example plugin
-}
-
diff --git a/mysql-test/include/have_innodb.inc b/mysql-test/include/have_innodb.inc
index 5447d935f3c..69ffdb5b284 100644
--- a/mysql-test/include/have_innodb.inc
+++ b/mysql-test/include/have_innodb.inc
@@ -2,9 +2,3 @@
# suite.pm will make sure that all tests including this file
# will be skipped unless innodb is enabled
#
-# The test below is redundant
-
-if (`SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.ENGINES WHERE engine = 'innodb' AND support IN ('YES', 'DEFAULT', 'ENABLED')`)
-{
- --skip Test requires InnoDB.
-}
diff --git a/mysql-test/include/have_plugin_auth.opt b/mysql-test/include/have_plugin_auth.opt
index 0204e148656..12a9334fa22 100644
--- a/mysql-test/include/have_plugin_auth.opt
+++ b/mysql-test/include/have_plugin_auth.opt
@@ -1 +1 @@
---plugin-load-add=$AUTH_TEST_PLUGIN_SO
+--plugin-load-add=$AUTH_TEST_PLUGIN_SO --plugin-maturity=unknown
diff --git a/mysql-test/include/mtr_warnings.sql b/mysql-test/include/mtr_warnings.sql
index 71c693961c1..b7b2a316dfb 100644
--- a/mysql-test/include/mtr_warnings.sql
+++ b/mysql-test/include/mtr_warnings.sql
@@ -224,6 +224,12 @@ INSERT INTO global_suppressions VALUES
("Slave I/O: Setting @slave_gtid_ignore_duplicates failed with error.*"),
("Slave I/O: Setting @slave_until_gtid failed with error.*"),
("Slave I/O: Get master GTID position failed with error.*"),
+
+ /*
+ MDEV-12501 -- set --maturity-level by default
+ */
+ ("Plugin .* is of maturity level .* while the server is .*"),
+
("THE_LAST_SUPPRESSION")||
diff --git a/mysql-test/include/not_embedded.inc b/mysql-test/include/not_embedded.inc
index 88185af3b15..4c168f71979 100644
--- a/mysql-test/include/not_embedded.inc
+++ b/mysql-test/include/not_embedded.inc
@@ -2,9 +2,3 @@
# suite.pm will make sure that all tests including this file
# will be skipped unless this is an embedded test run
#
-# The test below is redundant
-
-if (`select version() like '%embedded%'`) {
- This should never happen;
-}
-
diff --git a/mysql-test/include/not_windows.inc b/mysql-test/include/not_windows.inc
index 9240271077a..08373095438 100644
--- a/mysql-test/include/not_windows.inc
+++ b/mysql-test/include/not_windows.inc
@@ -1,4 +1,4 @@
---require r/not_windows.require
-disable_query_log;
-select convert(@@version_compile_os using latin1) NOT IN ("Win32","Win64","Windows") as "TRUE";
-enable_query_log;
+#
+# suite.pm will make sure that all tests including this file
+# will be skipped unless this is on Windows
+#
diff --git a/mysql-test/include/show_binlog_events.inc b/mysql-test/include/show_binlog_events.inc
index b2462e0d1b1..57fe1ffe0e3 100644
--- a/mysql-test/include/show_binlog_events.inc
+++ b/mysql-test/include/show_binlog_events.inc
@@ -7,7 +7,7 @@
# [--let $binlog_file= [<FILENAME> | LAST]]
# [--let $binlog_start= <POSITION> ]
# [--let $binlog_limit= 1, 3 ]
-# [--let $keep_gtid_events= 1]
+# [--let $skip_checkpoint_events= 1]
# --source include/show_binlog_events.inc
#
# Parameters:
@@ -26,12 +26,6 @@
# Limit for the 'LIMIT' clause of SHOW BINLOG EVENTS, i.e.:
# $binlog_limit= 3 -- print three events
# $binlog_limit= 4, 3 -- skip four events, print the three next events
-#
-# $keep_gtid_events
-# By default, Gtid_log_event and Previous_gtid_log_event are
-# filtered out, so that the output is independent of whether GTIDs
-# are enabled or not. If this flag is set, events are kept but
-# the actual GTID values are masked out.
--let $include_filename= show_binlog_events.inc
--source include/begin_include_file.inc
diff --git a/mysql-test/include/show_events.inc b/mysql-test/include/show_events.inc
index 368cfc9e3a7..9ee01f73999 100644
--- a/mysql-test/include/show_events.inc
+++ b/mysql-test/include/show_events.inc
@@ -104,8 +104,15 @@ let $script=
s{DOLLARmysqltest_vardir}{MYSQLTEST_VARDIR}g;
||
--let $pre_script= my DOLLARmysqltest_vardir = DOLLARENV{'MYSQLTEST_VARDIR'};
+
--delimiter ;
+if ($skip_checkpoint_events)
+{
+ let $filter_script=Binlog_checkpoint;
+}
+
+
#--let $select_columns= 1 3 6
--let $input_file= $output_file
--source include/filter_file.inc
diff --git a/mysql-test/include/show_gtid_list.inc b/mysql-test/include/show_gtid_list.inc
new file mode 100644
index 00000000000..96f813f180c
--- /dev/null
+++ b/mysql-test/include/show_gtid_list.inc
@@ -0,0 +1,15 @@
+# ==== Purpose ====
+#
+# Extract Gtid_list info from SHOW BINLOG EVENTS output masking
+# non-deterministic fields.
+#
+# ==== Usage ====
+#
+# [--let $binlog_file=filename
+#
+if ($binlog_file)
+{
+ --let $_in_binlog_file=in '$binlog_file'
+}
+--replace_column 2 # 5 #
+--eval show binlog events $_in_binlog_file limit 1,1
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index 760a96587f0..8922a4b8c06 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -2794,7 +2794,7 @@ sub mysql_server_start($) {
# Some InnoDB options are incompatible with the default bootstrap.
# If they are used, re-bootstrap
if ( $extra_opts and
- "@$extra_opts" =~ /--innodb[-_](?:page[-_]size|checksum[-_]algorithm|undo[-_]tablespaces|log[-_]group[-_]home[-_]dir|data[-_]home[-_]dir)/ )
+ "@$extra_opts" =~ /--innodb[-_](?:page[-_]size|checksum[-_]algorithm|undo[-_]tablespaces|log[-_]group[-_]home[-_]dir|data[-_]home[-_]dir)|data[-_]file[-_]path/ )
{
mysql_install_db($mysqld, undef, $extra_opts);
}
@@ -4439,7 +4439,7 @@ sub extract_warning_lines ($$) {
qr|feedback plugin: failed to retrieve the MAC address|,
qr|Plugin 'FEEDBACK' init function returned error|,
qr|Plugin 'FEEDBACK' registration as a INFORMATION SCHEMA failed|,
- qr|'log-bin-use-v1-row-events' is MySQL 5.6 compatible option|,
+ qr|'log-bin-use-v1-row-events' is MySQL .* compatible option|,
qr|InnoDB: Setting thread \d+ nice to \d+ failed, current nice \d+, errno 13|, # setpriority() fails under valgrind
qr|Failed to setup SSL|,
qr|SSL error: Failed to set ciphers to use|,
diff --git a/mysql-test/r/analyze_stmt_privileges2.result b/mysql-test/r/analyze_stmt_privileges2.result
index 892791dd8f8..cf38810b598 100644
--- a/mysql-test/r/analyze_stmt_privileges2.result
+++ b/mysql-test/r/analyze_stmt_privileges2.result
@@ -1452,7 +1452,7 @@ id select_type table type possible_keys key key_len ref rows r_rows filtered r_f
DELETE FROM t1 USING t1, t2;
EXPLAIN DELETE FROM t1 USING t1, t2;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 system NULL NULL NULL NULL 0 const row not found
+1 SIMPLE t1 system NULL NULL NULL NULL 0 Const row not found
1 SIMPLE t2 ALL NULL NULL NULL NULL 3
ANALYZE DELETE FROM t1 USING t1, t2;
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
@@ -1797,7 +1797,7 @@ id select_type table type possible_keys key key_len ref rows r_rows filtered r_f
DELETE FROM t1 USING t1, t2;
EXPLAIN DELETE FROM t1 USING t1, t2;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 system NULL NULL NULL NULL 0 const row not found
+1 SIMPLE t1 system NULL NULL NULL NULL 0 Const row not found
1 SIMPLE t2 ALL NULL NULL NULL NULL 3
ANALYZE DELETE FROM t1 USING t1, t2;
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
@@ -1813,7 +1813,7 @@ SELECT * FROM t1;
a b
EXPLAIN SELECT * FROM t1;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 system NULL NULL NULL NULL 0 const row not found
+1 SIMPLE t1 system NULL NULL NULL NULL 0 Const row not found
ANALYZE SELECT * FROM t1;
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table
diff --git a/mysql-test/r/cast.result b/mysql-test/r/cast.result
index 3c9cbb18bcb..ca314573581 100644
--- a/mysql-test/r/cast.result
+++ b/mysql-test/r/cast.result
@@ -1168,3 +1168,112 @@ CAST('-1' AS UNSIGNED)
18446744073709551615
DROP TABLE t1;
SET sql_mode=DEFAULT;
+#
+# MDEV-14376 Explicit CAST(CHAR(N)) erroneously escalates warnings to errors in STRICT_ALL_TABLES
+#
+SET sql_mode=STRICT_ALL_TABLES;
+SELECT CAST('xxx' AS CHAR(1));
+CAST('xxx' AS CHAR(1))
+x
+Warnings:
+Warning 1292 Truncated incorrect CHAR(1) value: 'xxx'
+CREATE OR REPLACE TABLE t1 (a VARCHAR(1));
+INSERT INTO t1 VALUES (CAST('xxx' AS CHAR(1)));
+Warnings:
+Warning 1292 Truncated incorrect CHAR(1) value: 'xxx'
+DROP TABLE t1;
+CREATE OR REPLACE TABLE t1 (a VARCHAR(3));
+INSERT INTO t1 VALUES ('xxx');
+UPDATE t1 SET a=CAST(a AS CHAR(1));
+Warnings:
+Warning 1292 Truncated incorrect CHAR(1) value: 'xxx'
+DROP TABLE t1;
+BEGIN NOT ATOMIC
+DECLARE a VARCHAR(30) CHARACTER SET latin1;
+SET a=CAST('xxx' AS CHAR(1));
+END;
+$$
+Warnings:
+Warning 1292 Truncated incorrect CHAR(1) value: 'xxx'
+BEGIN NOT ATOMIC
+DECLARE a VARCHAR(30) CHARACTER SET latin1;
+SET a=CAST(_latin1'xxx' AS CHAR(1) CHARACTER SET latin1);
+END;
+$$
+Warnings:
+Warning 1292 Truncated incorrect CHAR(1) value: 'xxx'
+BEGIN NOT ATOMIC
+DECLARE a VARCHAR(30) CHARACTER SET latin1;
+SET a=CAST(_latin1'xxx' AS CHAR(1) CHARACTER SET utf8);
+END;
+$$
+Warnings:
+Warning 1292 Truncated incorrect CHAR(1) value: 'xxx'
+BEGIN NOT ATOMIC
+DECLARE a VARCHAR(30) CHARACTER SET utf8;
+SET a=CAST('xxx' AS CHAR(1));
+END;
+$$
+Warnings:
+Warning 1292 Truncated incorrect CHAR(1) value: 'xxx'
+BEGIN NOT ATOMIC
+DECLARE a VARCHAR(30) CHARACTER SET utf8;
+SET a=CAST(_latin1'xxx' AS CHAR(1) CHARACTER SET latin1);
+END;
+$$
+Warnings:
+Warning 1292 Truncated incorrect CHAR(1) value: 'xxx'
+BEGIN NOT ATOMIC
+DECLARE a VARCHAR(30) CHARACTER SET utf8;
+SET a=CAST(_latin1'xxx' AS CHAR(1) CHARACTER SET utf8);
+END;
+$$
+Warnings:
+Warning 1292 Truncated incorrect CHAR(1) value: 'xxx'
+# Conversion problems still escalate warnings to errors (without right truncation)
+BEGIN NOT ATOMIC
+DECLARE a VARCHAR(30) CHARACTER SET utf8;
+SET a=CAST(_utf8 0xD18F AS CHAR(1) CHARACTER SET latin1);
+END;
+$$
+ERROR HY000: Cannot convert 'utf8' character 0xD18F to 'latin1'
+# Conversion problems still escalate warnings to errors (with right truncation)
+BEGIN NOT ATOMIC
+DECLARE a VARCHAR(30) CHARACTER SET utf8;
+SET a=CAST(_utf8 0xD18FD18F AS CHAR(1) CHARACTER SET latin1);
+END;
+$$
+ERROR HY000: Cannot convert 'utf8' character 0xD18F to 'latin1'
+# CAST(number AS CHAR) escalates warnings to errors on truncation
+CREATE OR REPLACE TABLE t1 (a VARCHAR(10));
+INSERT INTO t1 VALUES (CAST(123 AS CHAR(1)));
+ERROR 22007: Truncated incorrect CHAR(1) value: '123'
+DROP TABLE t1;
+CREATE OR REPLACE TABLE t1 (a VARCHAR(10));
+INSERT INTO t1 VALUES ('1');
+UPDATE t1 SET a=CAST(123 AS CHAR(1));
+ERROR 22007: Truncated incorrect CHAR(1) value: '123'
+DROP TABLE t1;
+BEGIN NOT ATOMIC
+DECLARE a VARCHAR(10);
+SET a=CAST(123 AS CHAR(1));
+END;
+$$
+ERROR 22007: Truncated incorrect CHAR(1) value: '123'
+# CAST(temporal AS CHAR) escalates warnings to errors on truncation
+CREATE OR REPLACE TABLE t1 (a VARCHAR(10));
+INSERT INTO t1 VALUES (CAST(TIME'10:20:30' AS CHAR(1)));
+ERROR 22007: Truncated incorrect CHAR(1) value: '10:20:30'
+DROP TABLE t1;
+CREATE OR REPLACE TABLE t1 (a VARCHAR(10));
+INSERT INTO t1 VALUES ('1');
+UPDATE t1 SET a=CAST(TIME'10:20:30' AS CHAR(1));
+ERROR 22007: Truncated incorrect CHAR(1) value: '10:20:30'
+DROP TABLE t1;
+BEGIN NOT ATOMIC
+DECLARE a VARCHAR(10);
+SET a=CAST(TIME'10:20:30' AS CHAR(1));
+END;
+$$
+ERROR 22007: Truncated incorrect CHAR(1) value: '10:20:30'
+SET sql_mode=DEFAULT;
diff --git a/mysql-test/r/commit_1innodb.result b/mysql-test/r/commit_1innodb.result
index ade8a4f7549..e57d2ef1dcf 100644
--- a/mysql-test/r/commit_1innodb.result
+++ b/mysql-test/r/commit_1innodb.result
@@ -230,7 +230,7 @@ insert into t2 (a) values (1023);
do (f2(23));
Warnings:
Error 1062 Duplicate entry '23' for key 'a'
-Note 4092 At line 4 in test.f2
+Note 4093 At line 4 in test.f2
select * from t2;
a
1023
diff --git a/mysql-test/r/create_drop_binlog.result b/mysql-test/r/create_drop_binlog.result
index 79e0bdf5e20..c880df7b39f 100644
--- a/mysql-test/r/create_drop_binlog.result
+++ b/mysql-test/r/create_drop_binlog.result
@@ -160,7 +160,7 @@ Note 1050 Table 'v1' already exists
DROP VIEW IF EXISTS v1;
DROP VIEW IF EXISTS v1;
Warnings:
-Note 4090 Unknown VIEW: 'test.v1'
+Note 4091 Unknown VIEW: 'test.v1'
SHOW BINLOG EVENTS;
Log_name Pos Event_type Server_id End_log_pos Info
# # Format_desc 1 # VER
diff --git a/mysql-test/r/create_drop_function.result b/mysql-test/r/create_drop_function.result
index 8e529a587fa..3ba6581d61b 100644
--- a/mysql-test/r/create_drop_function.result
+++ b/mysql-test/r/create_drop_function.result
@@ -3,8 +3,8 @@ CREATE FUNCTION f1(str char(20))
RETURNS CHAR(100)
RETURN CONCAT('Hello, ', str, '!');
SELECT * FROM mysql.proc WHERE name like 'f1';
-db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8
-test f1 FUNCTION f1 SQL CONTAINS_SQL NO DEFINER str char(20) char(100) CHARSET latin1 RETURN CONCAT('Hello, ', str, '!') root@localhost 2014-09-30 08:00:00 2014-09-30 08:00:00 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION latin1 latin1_swedish_ci latin1_swedish_ci RETURN CONCAT('Hello, ', str, '!')
+db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 aggregate
+test f1 FUNCTION f1 SQL CONTAINS_SQL NO DEFINER str char(20) char(100) CHARSET latin1 RETURN CONCAT('Hello, ', str, '!') root@localhost 2014-09-30 08:00:00 2014-09-30 08:00:00 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION latin1 latin1_swedish_ci latin1_swedish_ci RETURN CONCAT('Hello, ', str, '!') NONE
SELECT f1('world');
f1('world')
Hello, world!
diff --git a/mysql-test/r/create_drop_view.result b/mysql-test/r/create_drop_view.result
index d23b9b713ad..8dc10297bdb 100644
--- a/mysql-test/r/create_drop_view.result
+++ b/mysql-test/r/create_drop_view.result
@@ -55,5 +55,5 @@ id
DROP VIEW IF EXISTS v1;
DROP VIEW IF EXISTS v1;
Warnings:
-Note 4090 Unknown VIEW: 'test.v1'
+Note 4091 Unknown VIEW: 'test.v1'
DROP TABLE t1;
diff --git a/mysql-test/r/cte_grant.result b/mysql-test/r/cte_grant.result
index 1282a98fdef..2ee31be3435 100644
--- a/mysql-test/r/cte_grant.result
+++ b/mysql-test/r/cte_grant.result
@@ -63,3 +63,61 @@ connection root;
revoke all privileges on mysqltest.v1 from mysqltest_1@localhost;
drop user mysqltest_1@localhost;
drop database mysqltest;
+#
+# MDEV-13453: privileges checking for CTE
+#
+create database db;
+use db;
+create table t1 (i int);
+insert into t1
+values (3), (7), (1), (4), (2), (3), (1);
+create table t2 (a int, b int);
+insert into t2
+values (3,10), (7,11), (1,17), (4,15), (2,11), (3,10), (1,15);
+create user foo@localhost;
+grant SELECT on db.t1 to foo@localhost;
+grant SELECT(a) on db.t2 to foo@localhost;
+connect con1,localhost,foo,,;
+use db;
+with cte as (select * from t1 where i < 4)
+select * from cte;
+i
+3
+1
+2
+3
+1
+with cte as (select * from t1 where i < 4 group by i)
+select * from cte;
+i
+1
+2
+3
+with cte as (select * from t1 where i < 4)
+select * from cte cte1 where i < 2 union select * from cte cte2 where i > 2;
+i
+1
+3
+with cte as (select * from t1 where i < 4 group by i)
+select * from cte cte1 where i < 2 union select * from cte cte2 where i > 2;
+i
+1
+3
+with cte as (select b from t2 where a < 4)
+select * from cte cte1 where b < 15 union select * from cte cte2 where b > 15;
+ERROR 42000: SELECT command denied to user 'foo'@'localhost' for column 'b' in table 't2'
+with cte as (select a from t2 where a < 4)
+select * from cte cte1 where a < 2 union select * from cte cte2 where a > 2;
+a
+1
+3
+connection default;
+revoke SELECT on db.t1 from foo@localhost;
+connection con1;
+with cte as (select * from t1 where i < 4)
+select * from cte;
+ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 't1'
+disconnect con1;
+connection default;
+drop database db;
+drop user foo@localhost;
diff --git a/mysql-test/r/custom_aggregate_functions.result b/mysql-test/r/custom_aggregate_functions.result
new file mode 100644
index 00000000000..ca8612ba652
--- /dev/null
+++ b/mysql-test/r/custom_aggregate_functions.result
@@ -0,0 +1,938 @@
+create table t2 (sal int(10));
+create aggregate function f1(x INT) returns int
+begin
+declare continue handler for not found return 0;
+loop
+fetch group next row;
+insert into t2 (sal) values (x);
+end loop;
+end|
+create table t1 (sal int(10),id int(10));
+INSERT INTO t1 (sal,id) VALUES (5000,1);
+INSERT INTO t1 (sal,id) VALUES (2000,1);
+INSERT INTO t1 (sal,id) VALUES (1000,1);
+select f1(sal) from t1 where id>= 1;
+f1(sal)
+0
+Warnings:
+Note 4093 At line 5 in test.f1
+Note 4093 At line 5 in test.f1
+Note 4093 At line 5 in test.f1
+select * from t2;
+sal
+5000
+2000
+1000
+drop table t2;
+drop function f1;
+create aggregate function f1(x INT) returns INT
+begin
+insert into t1(sal) values (x);
+return x;
+end|
+ERROR HY000: Aggregate specific instruction(FETCH GROUP NEXT ROW) missing from the aggregate function
+create function f1(x INT) returns INT
+begin
+set x=5;
+fetch group next row;
+return x+1;
+end |
+ERROR HY000: Non-aggregate function contains aggregate specific instructions: (FETCH GROUP NEXT ROW)
+create aggregate function f1(x INT) returns INT
+begin
+declare continue handler for not found return x;
+loop
+fetch group next row;
+end loop;
+end |
+select f1(1);
+f1(1)
+1
+show create function f1;
+Function sql_mode Create Function character_set_client collation_connection Database Collation
+f1 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` AGGREGATE FUNCTION `f1`(x INT) RETURNS int(11)
+begin
+declare continue handler for not found return x;
+loop
+fetch group next row;
+end loop;
+end latin1 latin1_swedish_ci latin1_swedish_ci
+alter function f1 aggregate none;
+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 'aggregate none' at line 1
+show create function f1;
+Function sql_mode Create Function character_set_client collation_connection Database Collation
+f1 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` AGGREGATE FUNCTION `f1`(x INT) RETURNS int(11)
+begin
+declare continue handler for not found return x;
+loop
+fetch group next row;
+end loop;
+end latin1 latin1_swedish_ci latin1_swedish_ci
+select f1(1);
+f1(1)
+1
+drop function f1;
+create aggregate function f2(i int) returns int
+begin
+FEtCH GROUP NEXT ROW;
+if i <= 0 then
+return 0;
+elseif i = 1 then
+return (select count(*) from t1 where id = i);
+else
+return (select count(*) + f2( i - 1) from t1 where id = i);
+end if;
+end|
+select f2(1)|
+f2(1)
+3
+select f2(2)|
+ERROR HY000: Recursive stored functions and triggers are not allowed
+select f2(3)|
+ERROR HY000: Recursive stored functions and triggers are not allowed
+drop function f2|
+create aggregate function f1(x int) returns int
+begin
+declare mini int default 0;
+declare continue handler for not found return mini;
+loop
+fetch group next row;
+set mini= mini+x;
+fetch group next row;
+end loop;
+end|
+select f1(10);
+f1(10)
+10
+select f1(sal) from t1;
+f1(sal)
+6000
+select f1(sal) from t1 where 1=0;
+f1(sal)
+NULL
+drop function f1;
+create aggregate function f1(x int) returns int
+begin
+declare mini int default 0;
+LOOP
+FETCH GROUP NEXT ROW;
+set mini = mini + x;
+END LOOP;
+end|
+ERROR 42000: No RETURN found in FUNCTION test.f1
+create aggregate function f1(x int) returns int
+begin
+declare mini int default 0;
+LOOP
+FETCH GROUP NEXT ROW;
+set mini = mini + x;
+END LOOP;
+return -1;
+end|
+select f1(sal) from t1|
+ERROR 02000: No data - zero rows fetched, selected, or processed
+drop function f1|
+create aggregate function f1(x int) returns int
+begin
+declare mini int default 0;
+declare continue handler for not found return mini;
+FETCH GROUP NEXT ROW;
+set mini = mini + x;
+end|
+select f1(sal) from t1|
+ERROR 2F005: FUNCTION f1 ended without RETURN
+drop function f1|
+create aggregate function f1(x int) returns int
+begin
+declare mini int default 0;
+declare continue handler for not found set mini=-1;
+LOOP
+FETCH GROUP NEXT ROW;
+set mini = mini + x;
+END LOOP;
+return 0;
+end|
+select f1(sal) from t1|
+ERROR 2F005: FUNCTION f1 ended without RETURN
+drop function f1|
+drop table t1|
+create table t1 (sal int, id int, val int, counter int, primary key(id));
+INSERT INTO t1 (sal, id, val, counter) VALUES (1000, 1, 10, 2);
+INSERT INTO t1 (sal, id, val, counter) VALUES (2000, 2, 16, 2);
+INSERT INTO t1 (sal, id, val, counter) VALUES (6000, 3, 18, 1);
+INSERT INTO t1 (sal, id, val, counter) VALUES (5000, 4, 15, 3);
+INSERT INTO t1 (sal, id, val, counter) VALUES (3000, 5, 11, 5);
+create aggregate function f1(x INT) returns double
+begin
+declare z double default 0;
+declare continue handler for not found return z;
+loop
+fetch group next row;
+set z= z+x;
+end loop;
+end|
+select id, f1(sal) from t1 where id>= 1 group by counter order by val;
+id f1(sal)
+1 3000
+3 6000
+4 5000
+5 3000
+select id, f1(sal) from t1;
+id f1(sal)
+1 17000
+select id, f1(sal) from t1 where id>= 1;
+id f1(sal)
+1 17000
+select id, f1(sal) from t1 where id>= 1 group by counter;
+id f1(sal)
+1 3000
+3 6000
+4 5000
+5 3000
+select id, f1(sal) from t1 where id>= 1 group by id;
+id f1(sal)
+1 1000
+2 2000
+3 6000
+4 5000
+5 3000
+select id, f1(sal) from t1 where id>= 1 group by val;
+id f1(sal)
+1 1000
+2 2000
+3 6000
+4 5000
+5 3000
+select id, f1(sal) from t1 where id>= 1 group by counter order by counter;
+id f1(sal)
+1 3000
+3 6000
+4 5000
+5 3000
+select id, f1(sal) from t1 where id>= 1 group by counter order by val;
+id f1(sal)
+1 3000
+3 6000
+4 5000
+5 3000
+select id, f1(sal) from t1 where id>= 1 group by counter order by id;
+id f1(sal)
+1 3000
+3 6000
+4 5000
+5 3000
+select id, f1(sal) from t1 where id>= 1 group by val order by counter;
+id f1(sal)
+1 1000
+2 2000
+3 6000
+4 5000
+5 3000
+select id, f1(sal) from t1 where id>= 1 group by val order by id;
+id f1(sal)
+1 1000
+2 2000
+3 6000
+4 5000
+5 3000
+select id, f1(sal) from t1 where id>= 1 group by val order by val;
+id f1(sal)
+1 1000
+2 2000
+3 6000
+4 5000
+5 3000
+drop table t1;
+create table t1 (sal int, id int, val int, counter int, primary key(id), unique key(val));
+INSERT INTO t1 (sal, id, val, counter) VALUES (1000, 1, 10, 2);
+INSERT INTO t1 (sal, id, val, counter) VALUES (2000, 2, NULL, 2);
+INSERT INTO t1 (sal, id, val, counter) VALUES (6000, 3, 18, 1);
+INSERT INTO t1 (sal, id, val, counter) VALUES (5000, 4, 15, 3);
+INSERT INTO t1 (sal, id, val, counter) VALUES (3000, 5, 11, 5);
+select id, f1(sal) from t1;
+id f1(sal)
+1 17000
+select id, f1(sal) from t1 where id>= 1;
+id f1(sal)
+1 17000
+select id, f1(sal) from t1 where id>= 1 group by counter;
+id f1(sal)
+1 3000
+3 6000
+4 5000
+5 3000
+select id, f1(sal) from t1 where id>= 1 group by id;
+id f1(sal)
+1 1000
+2 2000
+3 6000
+4 5000
+5 3000
+select id, f1(sal) from t1 where id>= 1 group by val;
+id f1(sal)
+1 1000
+2 2000
+3 6000
+4 5000
+5 3000
+select id, f1(sal) from t1 where id>= 1 group by counter order by counter;
+id f1(sal)
+1 3000
+3 6000
+4 5000
+5 3000
+select id, f1(sal) from t1 where id>= 1 group by counter order by val;
+id f1(sal)
+1 3000
+3 6000
+4 5000
+5 3000
+select id, f1(sal) from t1 where id>= 1 group by counter order by id;
+id f1(sal)
+1 3000
+3 6000
+4 5000
+5 3000
+select id, f1(sal) from t1 where id>= 1 group by val order by counter;
+id f1(sal)
+1 1000
+2 2000
+3 6000
+4 5000
+5 3000
+select id, f1(sal) from t1 where id>= 1 group by val order by id;
+id f1(sal)
+1 1000
+2 2000
+3 6000
+4 5000
+5 3000
+select id, f1(sal) from t1 where id>= 1 group by val order by val;
+id f1(sal)
+1 1000
+2 2000
+3 6000
+4 5000
+5 3000
+drop table t1;
+create table t1 (sal int, id int, val int, counter int, primary key(id), INDEX name (val,counter));
+INSERT INTO t1 (sal, id, val, counter) VALUES (1000, 1, 10, 2);
+INSERT INTO t1 (sal, id, val, counter) VALUES (2000, 2, 10, 4);
+INSERT INTO t1 (sal, id, val, counter) VALUES (6000, 3, 18, 1);
+INSERT INTO t1 (sal, id, val, counter) VALUES (5000, 4, 11, 3);
+INSERT INTO t1 (sal, id, val, counter) VALUES (3000, 5, 11, 5);
+select id, f1(sal) from t1;
+id f1(sal)
+1 17000
+select id, f1(sal) from t1 where id>= 1;
+id f1(sal)
+1 17000
+select id, f1(sal) from t1 where id>= 1 group by counter;
+id f1(sal)
+1 1000
+2 2000
+3 6000
+4 5000
+5 3000
+select id, f1(sal) from t1 where id>= 1 group by id;
+id f1(sal)
+1 1000
+2 2000
+3 6000
+4 5000
+5 3000
+select id, f1(sal) from t1 where id>= 1 group by val;
+id f1(sal)
+1 3000
+3 6000
+4 8000
+select id, f1(sal) from t1 where id>= 1 group by counter order by counter;
+id f1(sal)
+1 1000
+2 2000
+3 6000
+4 5000
+5 3000
+select id, f1(sal) from t1 where id>= 1 group by counter order by val;
+id f1(sal)
+1 1000
+2 2000
+3 6000
+4 5000
+5 3000
+select id, f1(sal) from t1 where id>= 1 group by counter order by id;
+id f1(sal)
+1 1000
+2 2000
+3 6000
+4 5000
+5 3000
+select id, f1(sal) from t1 where id>= 1 group by val order by counter;
+id f1(sal)
+1 3000
+3 6000
+4 8000
+select id, f1(sal) from t1 where id>= 1 group by val order by id;
+id f1(sal)
+1 3000
+3 6000
+4 8000
+select id, f1(sal) from t1 where id>= 1 group by val order by val;
+id f1(sal)
+1 3000
+3 6000
+4 8000
+drop table t1;
+drop function f1;
+create aggregate function f1(x INT) returns double
+begin
+declare z double default 0;
+declare continue handler for not found return z;
+loop
+fetch group next row;
+set z= z+x;
+end loop;
+end|
+create aggregate function f2() returns double
+begin
+declare z int default 0;
+declare continue handler for not found return z;
+loop
+fetch group next row;
+set z = z+1;
+end loop;
+end|
+create table t1 (sal int, id int, val int, counter int);
+INSERT INTO t1 (sal, id, val, counter) VALUES (1000, 2, 10, 2);
+INSERT INTO t1 (sal, id, val, counter) VALUES (2000, 1, 16, 5);
+INSERT INTO t1 (sal, id, val, counter) VALUES (6000, 2, 18, 1);
+INSERT INTO t1 (sal, id, val, counter) VALUES (5000, 3, 15, 3);
+INSERT INTO t1 (sal, id, val, counter) VALUES (3000, 4, 11, 4);
+prepare test from "select f2() from t1 where id>= ?";
+set @param= 2;
+execute test using @param;
+f2()
+4
+execute test using @param;
+f2()
+4
+execute test using @param;
+f2()
+4
+execute test using @param;
+f2()
+4
+set @param= 1;
+execute test using @param;
+f2()
+5
+set @param= 3;
+execute test using @param;
+f2()
+2
+set @param= 4;
+execute test using @param;
+f2()
+1
+deallocate prepare test;
+prepare test from "select f1(sal) from t1 where id>= ?";
+set @param= 2;
+execute test using @param;
+f1(sal)
+15000
+execute test using @param;
+f1(sal)
+15000
+execute test using @param;
+f1(sal)
+15000
+execute test using @param;
+f1(sal)
+15000
+set @param= 1;
+execute test using @param;
+f1(sal)
+17000
+set @param= 3;
+execute test using @param;
+f1(sal)
+8000
+set @param= 4;
+execute test using @param;
+f1(sal)
+3000
+set @param= 5;
+execute test using @param;
+f1(sal)
+NULL
+deallocate prepare test;
+drop function f2;
+prepare test from "select f1(sal) from t1 where id>= ?";
+set @param= 2;
+execute test using @param;
+f1(sal)
+15000
+drop function f1;
+create function f1(x int) returns int
+return -1;
+execute test using @param;
+f1(sal)
+-1
+-1
+-1
+-1
+drop function f1;
+create aggregate function f1(x INT) returns double
+begin
+declare z double default 0;
+declare continue handler for not found return z;
+loop
+fetch group next row;
+set z= z+x;
+end loop;
+end|
+execute test using @param;
+f1(sal)
+15000
+deallocate prepare test;
+drop table t1;
+drop function f1;
+create table t1 (sal int, id int, val varchar(10), counter int);
+INSERT INTO t1 (sal, id, val, counter) VALUES (1000, 2, 'ab', 2);
+INSERT INTO t1 (sal, id, val, counter) VALUES (1000, 1, 'cd', 5);
+INSERT INTO t1 (sal, id, val, counter) VALUES (1000, 2, 'ef', 1);
+INSERT INTO t1 (sal, id, val, counter) VALUES (1000, 3, 'gh', 3);
+INSERT INTO t1 (sal, id, val, counter) VALUES (1000, 4, 'ij', 4);
+create table t2 (sal int, id int, val int, counter int);
+INSERT INTO t2 (sal, id, val, counter) VALUES (1000, 2, 10, 2);
+INSERT INTO t2 (sal, id, val, counter) VALUES (2000, 1, 16, 5);
+INSERT INTO t2 (sal, id, val, counter) VALUES (6000, 2, 18, 1);
+INSERT INTO t2 (sal, id, val, counter) VALUES (5000, 3, 15, 3);
+INSERT INTO t2 (sal, id, val, counter) VALUES (3000, 4, 11, 4);
+create aggregate function f1(x double) returns double
+begin
+declare z double default 0;
+declare continue handler for not found return z;
+loop
+fetch group next row;
+set z= z+x;
+end loop;
+end|
+create aggregate function f2(x INT) returns CHAR(10)
+begin
+declare mini INT default 0;
+declare continue handler for not found return mini;
+loop
+fetch group next row;
+set mini= mini + x;
+end loop;
+end|
+create aggregate function f3(x INT) returns CHAR(10)
+begin
+declare mini INT default 0;
+declare continue handler for not found return mini;
+loop
+fetch group next row;
+set mini= mini + x;
+fetch group next row;
+set mini= mini - x;
+end loop;
+end|
+create aggregate function f4(x INT, y varchar(10)) returns varchar(1000)
+begin
+declare str varchar(1000) default '';
+declare continue handler for not found return str;
+loop
+fetch group next row;
+set str= concat(str,y);
+end loop;
+end|
+create aggregate function f5(x INT) returns varchar(1000)
+begin
+declare z int default 0;
+DECLARE cur1 CURSOR FOR SELECT sal FROM test.t2;
+declare continue handler for not found return 0;
+loop
+fetch group next row;
+set z = z+x;
+end loop;
+end|
+create function f6(x int) returns int
+return (select f1(sal) from t1)|
+select f1(sal) from t1;
+f1(sal)
+5000
+select f1(sal) from t1 where id>= 1 group by counter;
+f1(sal)
+1000
+1000
+1000
+1000
+1000
+select f3(sal) from t1;
+f3(sal)
+1000
+select f2(val) from t1;
+ERROR 22007: Incorrect integer value: 'ab' for column 'x' at row 1
+select val, id, c from (select f1(sal) as c from t2) as t1, t2;
+val id c
+10 2 17000
+11 4 17000
+15 3 17000
+16 1 17000
+18 2 17000
+select f1(sal),f1(val), f1(id), f1(sal) from t2;
+f1(sal) f1(val) f1(id) f1(sal)
+17000 70 12 17000
+select f4(sal, val) from t1;
+f4(sal, val)
+abcdefghij
+select c from (select f1(sal) as c from t2) as t1;
+c
+17000
+select f1((select val from t2 where 0 > 1)) from t1;
+f1((select val from t2 where 0 > 1))
+NULL
+select f1((select val from t2 where id= 1)) from t1;
+f1((select val from t2 where id= 1))
+80
+select f5(sal) from t1;
+f5(sal)
+0
+SELECT f1(sal)*f1(sal) FROM t1;
+f1(sal)*f1(sal)
+25000000
+SELECT (SELECT f1(sal) FROM t1) FROM t2;
+(SELECT f1(sal) FROM t1)
+5000
+5000
+5000
+5000
+5000
+select id, f1(sal) from t1;
+id f1(sal)
+2 5000
+select id, f1(sal) from t1 where id>= 1;
+id f1(sal)
+2 5000
+select f1(sal), f1(sal) from t1 where id>= 1 group by counter;
+f1(sal) f1(sal)
+1000 1000
+1000 1000
+1000 1000
+1000 1000
+1000 1000
+select f1(sal), f1(sal) from t1 where id>= 1 group by id ;
+f1(sal) f1(sal)
+1000 1000
+1000 1000
+1000 1000
+2000 2000
+select f1(sal) from t1 where id>= 1 group by id ;
+f1(sal)
+1000
+1000
+1000
+2000
+select f1(sal) from t1 where id>= 1 order by counter;
+f1(sal)
+5000
+select f1(sal) from t1 where id>= 1 group by id order by counter;
+f1(sal)
+2000
+1000
+1000
+1000
+select counter, id, f1(sal) from t1 where id>= 1 group by id order by counter;
+counter id f1(sal)
+2 2 2000
+3 3 1000
+4 4 1000
+5 1 1000
+select id, f1(sal) from t1 where id>= 1 group by id order by counter;
+id f1(sal)
+2 2000
+3 1000
+4 1000
+1 1000
+drop table t1;
+drop table t2;
+drop function f1;
+drop function f2;
+drop function f3;
+drop function f4;
+drop function f5;
+drop function f6;
+create aggregate function f1(x INT) returns INT
+begin
+declare z double default 1000;
+declare continue handler for not found return z;
+loop
+fetch group next row;
+set z= (z&x);
+end loop;
+end|
+create table t1 (sal int, id int, val int, counter int);
+INSERT INTO t1 (sal, id, val, counter) VALUES (1000, 2, 10, 2);
+INSERT INTO t1 (sal, id, val, counter) VALUES (7000, 1, 16, 5);
+INSERT INTO t1 (sal, id, val, counter) VALUES (6000, 2, 18, 1);
+INSERT INTO t1 (sal, id, val, counter) VALUES (5000, 3, 15, 3);
+INSERT INTO t1 (sal, id, val, counter) VALUES (3000, 4, 11, 4);
+INSERT INTO t1 (sal, id, val, counter) VALUES (2000, 5, 10, 7);
+INSERT INTO t1 (sal, id, val, counter) VALUES (5000, 7, 13, 8);
+INSERT INTO t1 (sal, id, val, counter) VALUES (6000, 6, 19, 9);
+INSERT INTO t1 (sal, id, val, counter) VALUES (7000, 7, 12, 0);
+INSERT INTO t1 (sal, id, val, counter) VALUES (4000, 6, 14, 1);
+INSERT INTO t1 (sal, id, val, counter) VALUES (8000, 5, 19, 3);
+INSERT INTO t1 (sal, id, val, counter) VALUES (9000, 4, 11, 4);
+INSERT INTO t1 (sal, id, val, counter) VALUES (1000, 3, 11, 2);
+select f1(sal) from t1 where id>= 1;
+f1(sal)
+768
+drop function f1;
+create aggregate function f1(x INT) returns double
+begin
+declare z double default 0;
+declare count double default 0;
+declare continue handler for not found return z/count;
+loop
+fetch group next row;
+set z= z+x;
+set count= count+1;
+end loop;
+end|
+select f1(sal) from t1 where id>= 1;
+f1(sal)
+4923.076923076923
+drop function f1;
+create aggregate function f1(x INT) returns INT
+begin
+declare maxi INT default -1;
+declare continue handler for not found return maxi;
+loop
+fetch group next row;
+if maxi < x then
+set maxi= x;
+end if;
+end loop;
+end|
+select f1(sal) from t1 where id>= 1;
+f1(sal)
+9000
+drop function f1;
+create aggregate function f1(x INT) returns double
+begin
+declare mini INT default 100000;
+declare continue handler for not found return mini;
+loop
+fetch group next row;
+if mini > x then
+set mini = x;
+end if;
+end loop;
+end|
+select f1(sal) from t1 where id>= 1;
+f1(sal)
+1000
+drop function f1;
+create aggregate function f1(x INT) returns double
+begin
+declare z double default 0;
+declare continue handler for not found return z;
+loop
+fetch group next row;
+set z= z^x;
+end loop;
+end|
+select f1(sal) from t1 where id>= 1;
+f1(sal)
+16288
+drop function f1;
+create aggregate function f1(x INT) returns INT
+begin
+declare z int default 0;
+declare continue handler for not found return z;
+loop
+fetch group next row;
+set z= z+x;
+end loop;
+end|
+select f1(sal) from t1 where id>= 1;
+f1(sal)
+64000
+create aggregate function f2() returns INT
+begin
+declare z double default 0;
+declare continue handler for not found return z;
+loop
+fetch group next row;
+set z= z+1;
+end loop;
+end|
+select f2() from t1;
+f2()
+13
+create table t2 (sal int, id int);
+INSERT INTO t2 (sal, id) VALUES (NULL, 1);
+INSERT INTO t2 (sal, id) VALUES (2000, 1);
+INSERT INTO t2 (sal, id) VALUES (3000, 1);
+select f1(sal) from t2;
+f1(sal)
+NULL
+select f1(1);
+f1(1)
+1
+create function f3() returns int
+return (select f1(sal) from t1);
+select f3();
+f3()
+64000
+create function f4() returns INT
+return 1;
+create aggregate function f5() returns INT
+begin
+declare z double default 0;
+declare continue handler for not found return z;
+loop
+fetch group next row;
+set z= z+f3();
+end loop;
+end|
+select f5() from t2;
+f5()
+192000
+Warnings:
+Note 4093 At line 6 in test.f5
+Note 4093 At line 6 in test.f5
+Note 4093 At line 6 in test.f5
+create aggregate function f6(x INT) returns INT
+begin
+declare z int default 0;
+declare continue handler for not found return z;
+loop
+fetch group next row;
+if x then
+set z= z+(select f1(sal) from t1);
+end if;
+end loop;
+end|
+select f6(sal) from t2;
+f6(sal)
+128000
+Warnings:
+Note 4093 At line 6 in test.f6
+Note 4093 At line 6 in test.f6
+select id, f1(sal) from t1 where id>= 1 group by id;
+id f1(sal)
+1 7000
+2 7000
+3 6000
+4 12000
+5 10000
+6 10000
+7 12000
+select counter, f1(sal) from t1 where id>= 1 group by counter;
+counter f1(sal)
+0 7000
+1 10000
+2 2000
+3 13000
+4 12000
+5 7000
+7 2000
+8 5000
+9 6000
+select val, f1(sal) from t1 where id>= 1 group by val;
+val f1(sal)
+10 3000
+11 13000
+12 7000
+13 5000
+14 4000
+15 5000
+16 7000
+18 6000
+19 14000
+select counter, f1(sal) from t1 where id>= 1 group by id order by counter;
+counter f1(sal)
+0 12000
+2 6000
+2 7000
+4 12000
+5 7000
+7 10000
+9 10000
+select counter, id, f1(sal), f1(sal) from t1 where id>= 1 group by id order by counter;
+counter id f1(sal) f1(sal)
+0 7 12000 12000
+2 2 7000 7000
+2 3 6000 6000
+4 4 12000 12000
+5 1 7000 7000
+7 5 10000 10000
+9 6 10000 10000
+select counter, id, f1(sal), sum(distinct sal) from t1 where id>= 1 group by id order by counter desc;
+counter id f1(sal) sum(distinct sal)
+0 7 12000 12000
+2 2 7000 7000
+2 3 6000 6000
+4 4 12000 12000
+5 1 7000 7000
+7 5 10000 10000
+9 6 10000 10000
+create table t3 (i int);
+INSERT INTO t3 (i) select f1(sal) from t1;
+select * from t3;
+i
+64000
+create aggregate function f7(x INT) returns INT
+begin
+declare z int default 0;
+DECLARE done BOOLEAN DEFAULT FALSE;
+DECLARE a,b,c INT;
+DECLARE cur1 CURSOR FOR SELECT id FROM test.t2;
+declare continue handler for not found return z;
+outer_loop: LOOP
+FETCH GROUP NEXT ROW;
+set z= z+x;
+inner_block: begin
+DECLARE cur2 CURSOR FOR SELECT id FROM test.t2;
+DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
+OPEN cur2;
+read_loop: LOOP
+FETCH cur2 INTO a;
+IF done THEN
+CLOSE cur2;
+LEAVE read_loop;
+END IF;
+END LOOP read_loop;
+end inner_block;
+END LOOP outer_loop;
+end|
+select f7(sal) from t1;
+f7(sal)
+64000
+Warnings:
+Note 4093 At line 9 in test.f7
+Note 4093 At line 9 in test.f7
+Note 4093 At line 9 in test.f7
+Note 4093 At line 9 in test.f7
+Note 4093 At line 9 in test.f7
+Note 4093 At line 9 in test.f7
+Note 4093 At line 9 in test.f7
+Note 4093 At line 9 in test.f7
+Note 4093 At line 9 in test.f7
+Note 4093 At line 9 in test.f7
+Note 4093 At line 9 in test.f7
+Note 4093 At line 9 in test.f7
+Note 4093 At line 9 in test.f7
+drop table t1;
+drop table t2;
+drop table t3;
+drop function f1;
+drop function f2;
+drop function f3;
+drop function f4;
+drop function f5;
+drop function f6;
+drop function f7;
diff --git a/mysql-test/r/derived.result b/mysql-test/r/derived.result
index 220fd5a8c74..32184c5637b 100644
--- a/mysql-test/r/derived.result
+++ b/mysql-test/r/derived.result
@@ -896,34 +896,34 @@ WHERE REF IS NULL AND DIVISION="MIS" GROUP BY RECEIVABLE_GROUP,DIVISION,CLIENT_N
A.DIVISION=C1.DIVISION AND A.RECEIVABLE_GROUP=C1.RECEIVABLE_GROUP AND A.CREDIT_LIMIT=C1.CREDIT_LIMIT
ORDER BY TOTAL DESC;
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY <derived2> system NULL NULL NULL NULL 0 const row not found
-1 PRIMARY <derived3> system NULL NULL NULL NULL 0 const row not found
-1 PRIMARY <derived4> system NULL NULL NULL NULL 0 const row not found
-1 PRIMARY <derived5> system NULL NULL NULL NULL 0 const row not found
-1 PRIMARY <derived6> system NULL NULL NULL NULL 0 const row not found
-1 PRIMARY <derived7> system NULL NULL NULL NULL 0 const row not found
-1 PRIMARY <derived8> system NULL NULL NULL NULL 0 const row not found
-1 PRIMARY <derived9> system NULL NULL NULL NULL 0 const row not found
-1 PRIMARY <derived10> system NULL NULL NULL NULL 0 const row not found
-1 PRIMARY <derived11> system NULL NULL NULL NULL 0 const row not found
-1 PRIMARY <derived12> system NULL NULL NULL NULL 0 const row not found
-1 PRIMARY <derived13> system NULL NULL NULL NULL 0 const row not found
-1 PRIMARY <derived14> system NULL NULL NULL NULL 0 const row not found
-1 PRIMARY <derived15> system NULL NULL NULL NULL 0 const row not found
-1 PRIMARY <derived16> system NULL NULL NULL NULL 0 const row not found
-1 PRIMARY <derived17> system NULL NULL NULL NULL 0 const row not found
-1 PRIMARY <derived18> system NULL NULL NULL NULL 0 const row not found
-1 PRIMARY <derived19> system NULL NULL NULL NULL 0 const row not found
-1 PRIMARY <derived20> system NULL NULL NULL NULL 0 const row not found
-1 PRIMARY <derived21> system NULL NULL NULL NULL 0 const row not found
-1 PRIMARY <derived22> system NULL NULL NULL NULL 0 const row not found
-1 PRIMARY <derived23> system NULL NULL NULL NULL 0 const row not found
-1 PRIMARY <derived24> system NULL NULL NULL NULL 0 const row not found
-1 PRIMARY <derived25> system NULL NULL NULL NULL 0 const row not found
-1 PRIMARY <derived26> system NULL NULL NULL NULL 0 const row not found
-1 PRIMARY <derived27> system NULL NULL NULL NULL 0 const row not found
-1 PRIMARY <derived28> system NULL NULL NULL NULL 0 const row not found
-1 PRIMARY <derived29> system NULL NULL NULL NULL 0 const row not found
+1 PRIMARY <derived2> system NULL NULL NULL NULL 0 Const row not found
+1 PRIMARY <derived3> system NULL NULL NULL NULL 0 Const row not found
+1 PRIMARY <derived4> system NULL NULL NULL NULL 0 Const row not found
+1 PRIMARY <derived5> system NULL NULL NULL NULL 0 Const row not found
+1 PRIMARY <derived6> system NULL NULL NULL NULL 0 Const row not found
+1 PRIMARY <derived7> system NULL NULL NULL NULL 0 Const row not found
+1 PRIMARY <derived8> system NULL NULL NULL NULL 0 Const row not found
+1 PRIMARY <derived9> system NULL NULL NULL NULL 0 Const row not found
+1 PRIMARY <derived10> system NULL NULL NULL NULL 0 Const row not found
+1 PRIMARY <derived11> system NULL NULL NULL NULL 0 Const row not found
+1 PRIMARY <derived12> system NULL NULL NULL NULL 0 Const row not found
+1 PRIMARY <derived13> system NULL NULL NULL NULL 0 Const row not found
+1 PRIMARY <derived14> system NULL NULL NULL NULL 0 Const row not found
+1 PRIMARY <derived15> system NULL NULL NULL NULL 0 Const row not found
+1 PRIMARY <derived16> system NULL NULL NULL NULL 0 Const row not found
+1 PRIMARY <derived17> system NULL NULL NULL NULL 0 Const row not found
+1 PRIMARY <derived18> system NULL NULL NULL NULL 0 Const row not found
+1 PRIMARY <derived19> system NULL NULL NULL NULL 0 Const row not found
+1 PRIMARY <derived20> system NULL NULL NULL NULL 0 Const row not found
+1 PRIMARY <derived21> system NULL NULL NULL NULL 0 Const row not found
+1 PRIMARY <derived22> system NULL NULL NULL NULL 0 Const row not found
+1 PRIMARY <derived23> system NULL NULL NULL NULL 0 Const row not found
+1 PRIMARY <derived24> system NULL NULL NULL NULL 0 Const row not found
+1 PRIMARY <derived25> system NULL NULL NULL NULL 0 Const row not found
+1 PRIMARY <derived26> system NULL NULL NULL NULL 0 Const row not found
+1 PRIMARY <derived27> system NULL NULL NULL NULL 0 Const row not found
+1 PRIMARY <derived28> system NULL NULL NULL NULL 0 Const row not found
+1 PRIMARY <derived29> system NULL NULL NULL NULL 0 Const row not found
29 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table
28 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table
27 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table
diff --git a/mysql-test/r/derived_view.result b/mysql-test/r/derived_view.result
index 2b49ec901ba..730a02f6bfa 100644
--- a/mysql-test/r/derived_view.result
+++ b/mysql-test/r/derived_view.result
@@ -2014,7 +2014,7 @@ SELECT t.b, t.c, t1.a
FROM t1, (SELECT t2.b, t2.c FROM t3 RIGHT JOIN t2 ON t2.a = t3.b) AS t
WHERE t.b AND t.c = t1.a;
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE t3 system NULL NULL NULL NULL 0 0.00 const row not found
+1 SIMPLE t3 system NULL NULL NULL NULL 0 0.00 Const row not found
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00
1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
@@ -2029,7 +2029,7 @@ SELECT t.b, t.c, t1.a
FROM t1, (SELECT t2.b, t2.c FROM t3 RIGHT JOIN t2 ON t2.a = t3.b) AS t
WHERE t.b <> 0 AND t.c = t1.a;
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE t3 system NULL NULL NULL NULL 0 0.00 const row not found
+1 SIMPLE t3 system NULL NULL NULL NULL 0 0.00 Const row not found
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00
1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
diff --git a/mysql-test/r/drop.result b/mysql-test/r/drop.result
index 3fd5370f470..37005fb017e 100644
--- a/mysql-test/r/drop.result
+++ b/mysql-test/r/drop.result
@@ -209,10 +209,10 @@ Note 1051 Unknown table 'test.table1'
Note 1051 Unknown table 'test.table2'
DROP VIEW IF EXISTS view1,view2,view3,view4;
Warnings:
-Note 4090 Unknown VIEW: 'test.view1'
-Note 4090 Unknown VIEW: 'test.view2'
-Note 4090 Unknown VIEW: 'test.view3'
-Note 4090 Unknown VIEW: 'test.view4'
+Note 4091 Unknown VIEW: 'test.view1'
+Note 4091 Unknown VIEW: 'test.view2'
+Note 4091 Unknown VIEW: 'test.view3'
+Note 4091 Unknown VIEW: 'test.view4'
# Test error message when trigger does not find table
CREATE TABLE table1(a int);
diff --git a/mysql-test/r/explain.result b/mysql-test/r/explain.result
index 97e49af96d4..f593e0dfaba 100644
--- a/mysql-test/r/explain.result
+++ b/mysql-test/r/explain.result
@@ -2,7 +2,7 @@ drop table if exists t1;
create table t1 (id int not null, str char(10), unique(str));
explain select * from t1;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 system NULL NULL NULL NULL 0 const row not found
+1 SIMPLE t1 system NULL NULL NULL NULL 0 Const row not found
insert into t1 values (1, null),(2, null),(3, "foo"),(4, "bar");
select * from t1 where str is null;
id str
@@ -218,8 +218,8 @@ EXPLAIN EXTENDED SELECT 1 FROM t1
WHERE f1 > ALL( SELECT t.f1 FROM t1,t1 AS t );
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
-2 SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found
-2 SUBQUERY t system NULL NULL NULL NULL 0 0.00 const row not found
+2 SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 Const row not found
+2 SUBQUERY t system NULL NULL NULL NULL 0 0.00 Const row not found
Warnings:
Note 1003 /* select#1 */ select 1 AS `1` from `test`.`t1` where 0
SET SESSION sql_mode=@old_sql_mode;
@@ -387,7 +387,7 @@ set optimizer_switch='derived_merge=off,derived_with_keys=off';
EXPLAIN EXTENDED
SELECT * FROM ( SELECT t1.a FROM t1,t2 WHERE t2.a = t1.a ) AS t;
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY <derived2> system NULL NULL NULL NULL 0 0.00 const row not found
+1 PRIMARY <derived2> system NULL NULL NULL NULL 0 0.00 Const row not found
2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table
Warnings:
Note 1003 /* select#1 */ select NULL AS `a` from (/* select#2 */ select NULL AS `a` from `test`.`t1` where 0) `t`
diff --git a/mysql-test/r/explain_json.result b/mysql-test/r/explain_json.result
index d7cdeac499e..fd342606b3f 100644
--- a/mysql-test/r/explain_json.result
+++ b/mysql-test/r/explain_json.result
@@ -1204,7 +1204,7 @@ create table t1 (i int) engine=myisam;
explain
select * from t1;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 system NULL NULL NULL NULL 0 const row not found
+1 SIMPLE t1 system NULL NULL NULL NULL 0 Const row not found
explain format=json
select * from t1;
EXPLAIN
diff --git a/mysql-test/r/func_gconcat.result b/mysql-test/r/func_gconcat.result
index 097e07ac715..723a1952d79 100644
--- a/mysql-test/r/func_gconcat.result
+++ b/mysql-test/r/func_gconcat.result
@@ -1254,3 +1254,129 @@ DROP TABLE t1;
#
# End of 10.2 tests
#
+#
+# Start of 10.3 tests
+#
+drop table if exists t1, t2;
+create table t1 (grp int, a bigint unsigned, c char(10) , d char(10) not null);
+insert into t1 values (1,1,NULL,"a");
+insert into t1 values (1,10,"b","a");
+insert into t1 values (1,11,"c","a");
+insert into t1 values (2,2,"c","a");
+insert into t1 values (2,3,"b","b");
+insert into t1 values (3,4,"E","a");
+insert into t1 values (3,5,"C","b");
+insert into t1 values (3,6,"D","c");
+insert into t1 values (3,7,"E","c");
+select grp,group_concat(c) from t1 group by grp;
+grp group_concat(c)
+1 b,c
+2 c,b
+3 E,C,D,E
+select grp,group_concat(c limit 1 ) from t1 group by grp;
+grp group_concat(c limit 1 )
+1 b
+2 c
+3 E
+select grp,group_concat(c limit 1,1 ) from t1 group by grp;
+grp group_concat(c limit 1,1 )
+1 c
+2 b
+3 C
+select grp,group_concat(c limit 1,10 ) from t1 group by grp;
+grp group_concat(c limit 1,10 )
+1 c
+2 b
+3 C,D,E
+select grp,group_concat(c limit 1000) from t1 group by grp;
+grp group_concat(c limit 1000)
+1 b,c
+2 c,b
+3 E,C,D,E
+select group_concat(grp limit 0) from t1;
+group_concat(grp limit 0)
+
+select group_concat(grp limit "sdjadjs") from t1
+--error ER_PARSE_ERROR
+select grp,group_concat(c limit 5.5) from t1 group by grp ;
+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 '"sdjadjs") from t1
+--error ER_PARSE_ERROR
+select grp,group_concat(c limit 5.5) f' at line 1
+select grp,group_concat(distinct c limit 1,10 ) from t1 group by grp;
+grp group_concat(distinct c limit 1,10 )
+1 c
+2 b
+3 C,D
+select grp,group_concat(c order by a) from t1 group by grp;
+grp group_concat(c order by a)
+1 b,c
+2 c,b
+3 E,C,D,E
+select grp,group_concat(c order by a limit 2 ) from t1 group by grp;
+grp group_concat(c order by a limit 2 )
+1 b,c
+2 c,b
+3 E,C
+select grp,group_concat(c order by a limit 1,1 ) from t1 group by grp;
+grp group_concat(c order by a limit 1,1 )
+1 c
+2 b
+3 C
+select grp,group_concat(c order by c) from t1 group by grp;
+grp group_concat(c order by c)
+1 b,c
+2 b,c
+3 C,D,E,E
+select grp,group_concat(c order by c limit 2) from t1 group by grp;
+grp group_concat(c order by c limit 2)
+1 b,c
+2 b,c
+3 C,D
+select grp,group_concat(c order by c desc) from t1 group by grp;
+grp group_concat(c order by c desc)
+1 c,b
+2 c,b
+3 E,E,D,C
+select grp,group_concat(c order by c desc limit 2) from t1 group by grp;
+grp group_concat(c order by c desc limit 2)
+1 c,b
+2 c,b
+3 E,E
+drop table t1;
+create table t2 (a int, b varchar(10));
+insert into t2 values(1,'a'),(1,'b'),(NULL,'c'),(2,'x'),(2,'y');
+select group_concat(a,b limit 2) from t2;
+group_concat(a,b limit 2)
+1a,1b
+set @x=4;
+prepare STMT from 'select group_concat(b limit ?) from t2';
+execute STMT using @x;
+group_concat(b limit ?)
+a,b,c,x
+set @x=2;
+execute STMT using @x;
+group_concat(b limit ?)
+a,b
+set @x=1000;
+execute STMT using @x;
+group_concat(b limit ?)
+a,b,c,x,y
+set @x=0;
+execute STMT using @x;
+group_concat(b limit ?)
+
+set @x="adasfa";
+execute STMT using @x;
+ERROR HY000: Limit only accepts integer values
+set @x=-1;
+execute STMT using @x;
+ERROR HY000: Incorrect arguments to EXECUTE
+set @x=4;
+prepare STMT from 'select group_concat(a,b limit ?) from t2';
+execute STMT using @x;
+group_concat(a,b limit ?)
+1a,1b,2x,2y
+drop table t2;
+#
+# End of 10.3 tests
+#
diff --git a/mysql-test/r/func_group.result b/mysql-test/r/func_group.result
index 3340328cad6..9f3928615ec 100644
--- a/mysql-test/r/func_group.result
+++ b/mysql-test/r/func_group.result
@@ -2066,7 +2066,7 @@ HAVING ('m') IN (
SELECT v
FROM t2);
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY <derived2> system NULL NULL NULL NULL 0 const row not found
+1 PRIMARY <derived2> system NULL NULL NULL NULL 0 Const row not found
3 MATERIALIZED t2 ALL NULL NULL NULL NULL 2
2 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table
set optimizer_switch=@tmp_optimizer_switch;
diff --git a/mysql-test/r/func_group_innodb.result b/mysql-test/r/func_group_innodb.result
index e340c04107d..27493ae710b 100644
--- a/mysql-test/r/func_group_innodb.result
+++ b/mysql-test/r/func_group_innodb.result
@@ -125,14 +125,14 @@ select 1, max(1) from t1i where 1=99;
1 NULL
explain select count(*), min(7), max(7) from t1m, t1i;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1m system NULL NULL NULL NULL 0 const row not found
+1 SIMPLE t1m system NULL NULL NULL NULL 0 Const row not found
1 SIMPLE t1i ALL NULL NULL NULL NULL 1
select count(*), min(7), max(7) from t1m, t1i;
count(*) min(7) max(7)
0 NULL NULL
explain select count(*), min(7), max(7) from t1m, t2i;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1m system NULL NULL NULL NULL 0 const row not found
+1 SIMPLE t1m system NULL NULL NULL NULL 0 Const row not found
1 SIMPLE t2i ALL NULL NULL NULL NULL 1
select count(*), min(7), max(7) from t1m, t2i;
count(*) min(7) max(7)
diff --git a/mysql-test/r/func_hybrid_type.result b/mysql-test/r/func_hybrid_type.result
index fe45338b36f..1bf8231f4dd 100644
--- a/mysql-test/r/func_hybrid_type.result
+++ b/mysql-test/r/func_hybrid_type.result
@@ -3443,8 +3443,8 @@ EXECUTE stmt USING @a,@a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(21) DEFAULT NULL,
- `b` varchar(21) DEFAULT NULL
+ `a` varchar(20) DEFAULT NULL,
+ `b` varchar(20) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
#
diff --git a/mysql-test/r/func_json.result b/mysql-test/r/func_json.result
index 15e4fbec605..25d47574b59 100644
--- a/mysql-test/r/func_json.result
+++ b/mysql-test/r/func_json.result
@@ -28,6 +28,9 @@ NULL
select json_value('{"key1": [1,2,3], "key1":123}', '$.key1');
json_value('{"key1": [1,2,3], "key1":123}', '$.key1')
123
+select JSON_VALUE('{ "x": [0,1], "y": "[0,1]", "z": "Mon\\\"t\\\"y" }','$.z');
+JSON_VALUE('{ "x": [0,1], "y": "[0,1]", "z": "Mon\\\"t\\\"y" }','$.z')
+Mon"t"y
select json_query('{"key1":{"a":1, "b":[1,2]}}', '$.key2');
json_query('{"key1":{"a":1, "b":[1,2]}}', '$.key2')
NULL
@@ -725,6 +728,9 @@ json_contains_path('{"foo":"bar"}', 'one', '$[]')
NULL
Warnings:
Warning 4042 Syntax error in JSON path in argument 3 to function 'json_contains_path' at position 3
+select JSON_VALID(0x36f0c8dccd83c5eac156da);
+JSON_VALID(0x36f0c8dccd83c5eac156da)
+0
#
# Start of 10.3 tests
#
diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result
index b1862d46613..7389eeed5d7 100644
--- a/mysql-test/r/func_str.result
+++ b/mysql-test/r/func_str.result
@@ -1340,12 +1340,12 @@ DROP TABLE t1;
create table t1(f1 varchar(4));
explain extended select encode(f1,'zxcv') as 'enc' from t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 const row not found
+1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 Const row not found
Warnings:
Note 1003 select encode(NULL,'zxcv') AS `enc` from `test`.`t1`
explain extended select decode(f1,'zxcv') as 'enc' from t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 const row not found
+1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 Const row not found
Warnings:
Note 1003 select decode(NULL,'zxcv') AS `enc` from `test`.`t1`
drop table t1;
diff --git a/mysql-test/r/get_diagnostics.result b/mysql-test/r/get_diagnostics.result
index a75b775297c..63ed6867096 100644
--- a/mysql-test/r/get_diagnostics.result
+++ b/mysql-test/r/get_diagnostics.result
@@ -590,7 +590,7 @@ DROP PROCEDURE p1;
SHOW WARNINGS;
Level Code Message
Error 54321 MESSAGE_TEXT text
-Note 4092 At line 16 in test.p1
+Note 4093 At line 16 in test.p1
CREATE PROCEDURE p1()
BEGIN
DECLARE var INT;
diff --git a/mysql-test/r/gis-json.result b/mysql-test/r/gis-json.result
index d888b08351d..1d6e2193fc9 100644
--- a/mysql-test/r/gis-json.result
+++ b/mysql-test/r/gis-json.result
@@ -89,6 +89,21 @@ ST_AsGeoJSON(ST_GeomFromText("POINT(10 11)"), 100, 1)
SELECT ST_AsGeoJSON(ST_GeomFromText("POINT(10 11)"), 100, 5);
ST_AsGeoJSON(ST_GeomFromText("POINT(10 11)"), 100, 5)
{"bbox": [10, 11, 10, 11], "type": "Point", "coordinates": [10, 11]}
+SELECT st_astext(st_geomfromgeojson('{"type": "MultiLineString","coordinates": []}')) as a;
+a
+NULL
+Warnings:
+Warning 4076 Incorrect GeoJSON format - empty 'coordinates' array.
+SELECT st_astext(st_geomfromgeojson('{"type": "Polygon","coordinates": []}')) as a;
+a
+NULL
+Warnings:
+Warning 4076 Incorrect GeoJSON format - empty 'coordinates' array.
+SELECT st_astext(st_geomfromgeojson('{"type": "MultiPolygon","coordinates": []}')) as a;
+a
+NULL
+Warnings:
+Warning 4076 Incorrect GeoJSON format - empty 'coordinates' array.
#
# End of 10.2 tests
#
diff --git a/mysql-test/r/gis.result b/mysql-test/r/gis.result
index fe67da8001f..3f2e6d39db8 100644
--- a/mysql-test/r/gis.result
+++ b/mysql-test/r/gis.result
@@ -4390,7 +4390,7 @@ SELECT ST_BUFFER(Point(1,1), Point(1,1));
ERROR HY000: Illegal parameter data type geometry for operation 'st_buffer'
PREPARE stmt FROM 'CREATE TABLE t1 AS SELECT ST_ENVELOPE(?) AS g';
EXECUTE stmt USING 1;
-ERROR HY000: Illegal parameter data type bigint for operation 'st_envelope'
+ERROR HY000: Illegal parameter data type int for operation 'st_envelope'
EXECUTE stmt USING POINT(1,1);
SHOW CREATE TABLE t1;
Table Create Table
@@ -4404,7 +4404,7 @@ DROP TABLE t1;
DEALLOCATE PREPARE stmt;
PREPARE stmt FROM 'CREATE TABLE t1 AS SELECT ST_BUFFER(?,?) AS g';
EXECUTE stmt USING 1,1;
-ERROR HY000: Illegal parameter data type bigint for operation 'st_buffer'
+ERROR HY000: Illegal parameter data type int for operation 'st_buffer'
EXECUTE stmt USING POINT(1,1),POINT(1,1);
ERROR HY000: Illegal parameter data type geometry for operation 'st_buffer'
EXECUTE stmt USING POINT(1,1),0;
@@ -4455,7 +4455,7 @@ SELECT POINT(1,POINT(1,1));
ERROR HY000: Illegal parameter data type geometry for operation 'point'
PREPARE stmt FROM 'CREATE TABLE t1 AS SELECT ST_GEOMFROMTEXT(?,?) AS g';
EXECUTE stmt USING 1,1;
-ERROR HY000: Illegal parameter data type bigint for operation 'st_geometryfromtext'
+ERROR HY000: Illegal parameter data type int for operation 'st_geometryfromtext'
EXECUTE stmt USING POINT(1,1),POINT(1,1);
ERROR HY000: Illegal parameter data type geometry for operation 'st_geometryfromtext'
EXECUTE stmt USING 'POINT(1 1)',1;
diff --git a/mysql-test/r/grant.result b/mysql-test/r/grant.result
index c5a3d83557a..5d43c8287ad 100644
--- a/mysql-test/r/grant.result
+++ b/mysql-test/r/grant.result
@@ -1432,7 +1432,7 @@ Warnings:
Note 1305 FUNCTION test.test_function does not exist
drop view if exists v1;
Warnings:
-Note 4090 Unknown VIEW: 'test.v1'
+Note 4091 Unknown VIEW: 'test.v1'
create table test (col1 varchar(30));
create function test_function() returns varchar(30)
begin
diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result
index c2c2785c209..4f6318fd507 100644
--- a/mysql-test/r/information_schema.result
+++ b/mysql-test/r/information_schema.result
@@ -671,6 +671,7 @@ proc character_set_client char(32)
proc collation_connection char(32)
proc db_collation char(32)
proc body_utf8 longblob
+proc aggregate enum('NONE','GROUP')
drop table t115;
create procedure p108 () begin declare c cursor for select data_type
from information_schema.columns; open c; open c; end;//
@@ -1277,7 +1278,7 @@ drop table t1;
use mysql;
INSERT INTO `proc` VALUES ('test','','PROCEDURE','','SQL','CONTAINS_SQL',
'NO','DEFINER','','','BEGIN\r\n \r\nEND','root@%','2006-03-02 18:40:03',
-'2006-03-02 18:40:03','','','utf8','utf8_general_ci','utf8_general_ci','n/a');
+'2006-03-02 18:40:03','','','utf8','utf8_general_ci','utf8_general_ci','n/a', 'NONE');
select routine_name from information_schema.routines where ROUTINE_SCHEMA='test';
routine_name
diff --git a/mysql-test/r/intersect.result b/mysql-test/r/intersect.result
index 7a0301a23e6..05adaf160ed 100644
--- a/mysql-test/r/intersect.result
+++ b/mysql-test/r/intersect.result
@@ -689,4 +689,17 @@ View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS (select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1`) union select `__3`.`c` AS `c`,`__3`.`d` AS `d` from ((select `test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2`) intersect (select `test`.`t3`.`e` AS `e`,`test`.`t3`.`f` AS `f` from `test`.`t3`)) `__3` union (select 4 AS `4`,4 AS `4`) latin1 latin1_swedish_ci
drop view v1;
drop tables t1,t2,t3;
+#
+# MDEV-14346:incorrect result of intersect with ANY/ALL/IN subquery
+#
+CREATE TABLE t (i INT);
+INSERT INTO t VALUES (1),(2);
+SELECT * FROM t WHERE i != ANY ( SELECT 6 INTERSECT SELECT 3 );
+i
+select i from t where
+exists ((select 6 as r from dual having t.i <> 6)
+intersect
+(select 3 from dual having t.i <> 3));
+i
+drop table t;
# End of 10.3 tests
diff --git a/mysql-test/r/join_nested.result b/mysql-test/r/join_nested.result
index 917a31e2a79..708c72fffb5 100644
--- a/mysql-test/r/join_nested.result
+++ b/mysql-test/r/join_nested.result
@@ -1321,7 +1321,7 @@ c11 c21
5 NULL
EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON c11=c21;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 system NULL NULL NULL NULL 0 const row not found
+1 SIMPLE t2 system NULL NULL NULL NULL 0 Const row not found
1 SIMPLE t1 ALL NULL NULL NULL NULL 2
SELECT * FROM t1 LEFT JOIN (t2 LEFT JOIN t3 ON c21=c31) ON c11=c21;
c11 c21 c31
diff --git a/mysql-test/r/join_nested_jcl6.result b/mysql-test/r/join_nested_jcl6.result
index 1ffd94547cc..eb59531b7d2 100644
--- a/mysql-test/r/join_nested_jcl6.result
+++ b/mysql-test/r/join_nested_jcl6.result
@@ -1332,7 +1332,7 @@ c11 c21
5 NULL
EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON c11=c21;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 system NULL NULL NULL NULL 0 const row not found
+1 SIMPLE t2 system NULL NULL NULL NULL 0 Const row not found
1 SIMPLE t1 ALL NULL NULL NULL NULL 2
SELECT * FROM t1 LEFT JOIN (t2 LEFT JOIN t3 ON c21=c31) ON c11=c21;
c11 c21 c31
diff --git a/mysql-test/r/limit_rows_examined.result b/mysql-test/r/limit_rows_examined.result
index c94599235b1..7d1ca948c8b 100644
--- a/mysql-test/r/limit_rows_examined.result
+++ b/mysql-test/r/limit_rows_examined.result
@@ -98,11 +98,11 @@ create table t0 (c0 int);
explain
select * from t0 LIMIT ROWS EXAMINED 0;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t0 system NULL NULL NULL NULL 0 const row not found
+1 SIMPLE t0 system NULL NULL NULL NULL 0 Const row not found
explain
select * from t0 LIMIT ROWS EXAMINED 1;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t0 system NULL NULL NULL NULL 0 const row not found
+1 SIMPLE t0 system NULL NULL NULL NULL 0 Const row not found
select * from t0 LIMIT ROWS EXAMINED 1;
c0
drop table t0;
@@ -592,7 +592,7 @@ create table t3_empty like t3;
explain
select max(c1) from t3_empty LIMIT ROWS EXAMINED 0;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t3_empty system NULL NULL NULL NULL 0 const row not found
+1 SIMPLE t3_empty system NULL NULL NULL NULL 0 Const row not found
select max(c1) from t3_empty LIMIT ROWS EXAMINED 0;
max(c1)
NULL
diff --git a/mysql-test/r/myisam_explain_non_select_all.result b/mysql-test/r/myisam_explain_non_select_all.result
index 12c5e627f7a..09e662f5d6a 100644
--- a/mysql-test/r/myisam_explain_non_select_all.result
+++ b/mysql-test/r/myisam_explain_non_select_all.result
@@ -2184,13 +2184,13 @@ INSERT INTO t1 VALUES (1, 1, 10), (2, 2, 20);
#
EXPLAIN UPDATE t1 LEFT JOIN t2 ON t1.c1 = t2.c1 SET t2.c2 = 10;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 system NULL NULL NULL NULL 0 const row not found
+1 SIMPLE t2 system NULL NULL NULL NULL 0 Const row not found
1 SIMPLE t1 ALL NULL NULL NULL NULL 2
FLUSH STATUS;
FLUSH TABLES;
EXPLAIN EXTENDED UPDATE t1 LEFT JOIN t2 ON t1.c1 = t2.c1 SET t2.c2 = 10;
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE t2 system NULL NULL NULL NULL 0 0.00 const row not found
+1 SIMPLE t2 system NULL NULL NULL NULL 0 0.00 Const row not found
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00
# Status of EXPLAIN EXTENDED query
Variable_name Value
@@ -2199,7 +2199,7 @@ FLUSH STATUS;
FLUSH TABLES;
EXPLAIN EXTENDED SELECT * FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1;
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE t2 system NULL NULL NULL NULL 0 0.00 const row not found
+1 SIMPLE t2 system NULL NULL NULL NULL 0 0.00 Const row not found
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00
Warnings:
Note 1003 select `test`.`t1`.`c1` AS `c1`,`test`.`t1`.`c2` AS `c2`,`test`.`t1`.`c3` AS `c3`,NULL AS `c1`,NULL AS `c2` from `test`.`t1`
@@ -2219,13 +2219,13 @@ Handler_read_rnd_next 4
#
EXPLAIN UPDATE t1 LEFT JOIN t2 ON t1.c1 = t2.c1 SET t2.c2 = 10 WHERE t1.c3 = 10;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 system NULL NULL NULL NULL 0 const row not found
+1 SIMPLE t2 system NULL NULL NULL NULL 0 Const row not found
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where
FLUSH STATUS;
FLUSH TABLES;
EXPLAIN EXTENDED UPDATE t1 LEFT JOIN t2 ON t1.c1 = t2.c1 SET t2.c2 = 10 WHERE t1.c3 = 10;
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE t2 system NULL NULL NULL NULL 0 0.00 const row not found
+1 SIMPLE t2 system NULL NULL NULL NULL 0 0.00 Const row not found
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
# Status of EXPLAIN EXTENDED query
Variable_name Value
@@ -2234,7 +2234,7 @@ FLUSH STATUS;
FLUSH TABLES;
EXPLAIN EXTENDED SELECT * FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1 WHERE t1.c3 = 10;
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE t2 system NULL NULL NULL NULL 0 0.00 const row not found
+1 SIMPLE t2 system NULL NULL NULL NULL 0 0.00 Const row not found
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Note 1003 select `test`.`t1`.`c1` AS `c1`,`test`.`t1`.`c2` AS `c2`,`test`.`t1`.`c3` AS `c3`,NULL AS `c1`,NULL AS `c2` from `test`.`t1` where `test`.`t1`.`c3` = 10
@@ -2571,12 +2571,12 @@ CREATE VIEW v1 (x) AS SELECT b FROM t2;
#
EXPLAIN INSERT INTO v1 SELECT * FROM t1;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 system NULL NULL NULL NULL 0 const row not found
+1 SIMPLE t1 system NULL NULL NULL NULL 0 Const row not found
FLUSH STATUS;
FLUSH TABLES;
EXPLAIN EXTENDED INSERT INTO v1 SELECT * FROM t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 const row not found
+1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 Const row not found
# Status of EXPLAIN EXTENDED query
Variable_name Value
Handler_read_rnd_next 1
@@ -2584,7 +2584,7 @@ FLUSH STATUS;
FLUSH TABLES;
EXPLAIN EXTENDED SELECT * FROM t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 const row not found
+1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 Const row not found
Warnings:
Note 1003 select NULL AS `a` from `test`.`t1`
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
@@ -2781,7 +2781,7 @@ CREATE TABLE t2 (id INT);
INSERT INTO t1 VALUES (1), (2);
EXPLAIN SELECT * FROM t1 LEFT JOIN t2 USING(id) GROUP BY t1.id;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 system NULL NULL NULL NULL 0 const row not found; Using temporary; Using filesort
+1 SIMPLE t2 system NULL NULL NULL NULL 0 Const row not found; Using temporary; Using filesort
1 SIMPLE t1 ALL NULL NULL NULL NULL 2
DROP TABLE t1,t2;
#74
@@ -2879,7 +2879,7 @@ CALL p16();
DROP PROCEDURE p16;
CALL p15();
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 system NULL NULL NULL NULL 0 const row not found
+1 SIMPLE t1 system NULL NULL NULL NULL 0 Const row not found
DROP PROCEDURE p15;
CALL p14();
DROP PROCEDURE p14;
diff --git a/mysql-test/r/mysqlbinlog.result b/mysql-test/r/mysqlbinlog.result
index 5ee31bbe227..bac33753d4c 100644
--- a/mysql-test/r/mysqlbinlog.result
+++ b/mysql-test/r/mysqlbinlog.result
@@ -1258,3 +1258,4 @@ DELIMITER ;
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
+mysqlbinlog Ver VER for OS at ARCH
diff --git a/mysql-test/r/mysqld--help.result b/mysql-test/r/mysqld--help.result
index e31571e93a8..b56c1a26fb0 100644
--- a/mysql-test/r/mysqld--help.result
+++ b/mysql-test/r/mysqld--help.result
@@ -242,7 +242,7 @@ The following options may be given as the first argument:
This option causes CREATE TABLE to create all TIMESTAMP
columns as NULL with DEFAULT NULL attribute, Without this
option, TIMESTAMP columns are NOT NULL and have implicit
- DEFAULT clauses. The old behavior is deprecated.
+ DEFAULT clauses.
--external-locking Use system (external) locking (disabled by default).
With this option enabled you can run myisamchk to test
(not repair) tables while the MySQL server is running.
@@ -1118,8 +1118,19 @@ The following options may be given as the first argument:
(Defaults to on; use --skip-slave-sql-verify-checksum to disable.)
--slave-transaction-retries=#
Number of times the slave SQL thread will retry a
- transaction in case it failed with a deadlock or elapsed
- lock wait timeout, before giving up and stopping
+ transaction in case it failed with a deadlock, elapsed
+ lock wait timeout or listed in
+ slave_transaction_retry_errors, before giving up and
+ stopping
+ --slave-transaction-retry-errors=name
+ Tells the slave thread to retry transaction for
+ replication when a query event returns an error from the
+ provided list. Deadlock and elapsed lock wait timeout
+ errors are automatically added to this list
+ --slave-transaction-retry-interval=#
+ Interval of the slave SQL thread will retry a transaction
+ in case it failed with a deadlock or elapsed lock wait
+ timeout or listed in slave_transaction_retry_errors
--slave-type-conversions=name
Set of slave type conversions that are enabled. If the
variable is empty, no conversions are allowed and it is
@@ -1543,7 +1554,6 @@ performance-schema-session-connect-attrs-size -1
performance-schema-setup-actors-size 100
performance-schema-setup-objects-size 100
performance-schema-users-size -1
-plugin-maturity unknown
port 3306
port-open-timeout 0
preload-buffer-size 32768
@@ -1604,9 +1614,11 @@ slave-parallel-mode conservative
slave-parallel-threads 0
slave-parallel-workers 0
slave-run-triggers-for-rbr NO
-slave-skip-errors (No default value)
+slave-skip-errors OFF
slave-sql-verify-checksum TRUE
slave-transaction-retries 10
+slave-transaction-retry-errors 1213,1205
+slave-transaction-retry-interval 0
slave-type-conversions
slow-launch-time 2
slow-query-log FALSE
diff --git a/mysql-test/r/not_windows.require b/mysql-test/r/not_windows.require
deleted file mode 100644
index 09aae1ed1d0..00000000000
--- a/mysql-test/r/not_windows.require
+++ /dev/null
@@ -1,2 +0,0 @@
-TRUE
-1
diff --git a/mysql-test/r/order_by.result b/mysql-test/r/order_by.result
index f43e6ce18af..946ecb51426 100644
--- a/mysql-test/r/order_by.result
+++ b/mysql-test/r/order_by.result
@@ -2635,7 +2635,7 @@ SELECT t1.*, t2.* FROM t1 JOIN t2 ON t1.i1 = t2.i2
LEFT JOIN t3 ON t2.i2 = t3.i3
ORDER BY t1.i1 LIMIT 5;
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE t3 system NULL NULL NULL NULL 0 0.00 const row not found
+1 SIMPLE t3 system NULL NULL NULL NULL 0 0.00 Const row not found
1 SIMPLE t1 index PRIMARY PRIMARY 4 NULL 5 100.00 Using index
1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.i1 1 100.00 Using index
Warnings:
@@ -3159,3 +3159,51 @@ pk
2
3
DROP TABLE t1;
+#
+# MDEV-13994: Bad join results with orderby_uses_equalities=on
+#
+CREATE TABLE books (
+id int(16) NOT NULL AUTO_INCREMENT,
+library_id int(16) NOT NULL DEFAULT 0,
+wings_id int(12) NOT NULL DEFAULT 0,
+scheduled_for_removal int(1) DEFAULT 0,
+PRIMARY KEY (id),
+KEY library_idx (library_id)
+) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
+INSERT INTO books VALUES (32625,8663,707,0),(32624,8663,505,1);
+CREATE TABLE wings (
+id int(11) NOT NULL AUTO_INCREMENT,
+department_id int(11) DEFAULT NULL,
+PRIMARY KEY (id)
+) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
+INSERT INTO wings VALUES (505,11745),(707,11768);
+SET @save_optimizer_switch=@@optimizer_switch;
+SET optimizer_switch='orderby_uses_equalities=off';
+SELECT wings.id as wing_id, wings.department_id FROM wings
+WHERE wings.id IN ( SELECT books.wings_id FROM books
+WHERE books.library_id = 8663 AND
+books.scheduled_for_removal=0 )
+ORDER BY wings.id;
+wing_id department_id
+707 11768
+SET optimizer_switch='orderby_uses_equalities=on';
+SELECT wings.id as wing_id, wings.department_id FROM wings
+WHERE wings.id IN ( SELECT books.wings_id FROM books
+WHERE books.library_id = 8663 AND
+books.scheduled_for_removal=0 )
+ORDER BY wings.id;
+wing_id department_id
+707 11768
+explain extended SELECT wings.id as wing_id, wings.department_id FROM wings
+WHERE wings.id IN ( SELECT books.wings_id FROM books
+WHERE books.library_id = 8663 AND
+books.scheduled_for_removal=0 )
+ORDER BY wings.id;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 1 100.00 Using temporary; Using filesort
+1 PRIMARY wings eq_ref PRIMARY PRIMARY 4 test.books.wings_id 1 100.00
+2 MATERIALIZED books ref library_idx library_idx 4 const 1 100.00 Using where
+Warnings:
+Note 1003 select `test`.`wings`.`id` AS `wing_id`,`test`.`wings`.`department_id` AS `department_id` from `test`.`wings` semi join (`test`.`books`) where `test`.`books`.`library_id` = 8663 and `test`.`books`.`scheduled_for_removal` = 0 and `test`.`wings`.`id` = `test`.`books`.`wings_id` order by `test`.`wings`.`id`
+set optimizer_switch= @save_optimizer_switch;
+DROP TABLE books, wings;
diff --git a/mysql-test/r/order_by_innodb.result b/mysql-test/r/order_by_innodb.result
index 4f59a2f8c20..3ff1f92e94a 100644
--- a/mysql-test/r/order_by_innodb.result
+++ b/mysql-test/r/order_by_innodb.result
@@ -48,3 +48,76 @@ where key1<3 or key2<3;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index_merge key1,key2 key1,key2 5,5 NULL # Using sort_union(key1,key2); Using where
drop table t0, t1;
+#
+# MDEV-14071: wrong results with orderby_uses_equalities=on
+# (duplicate of MDEV-13994)
+#
+CREATE TABLE t1 (i int, j int, z int,PRIMARY KEY (i,j), KEY (z)) ENGINE=InnoDB;
+CREATE TABLE t2 (i int, j int, PRIMARY KEY (i,j)) ENGINE=InnoDB;
+CREATE TABLE t3 (j int, n varchar(5), PRIMARY KEY (j)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES
+(127,0,1),(188,0,1),(206,0,1),(218,0,1),(292,0,1),(338,0,1),(375,0,1),
+(381,0,1),(409,0,1),(466,0,1),(469,0,1),(498,0,1),(656,0,1);
+INSERT INTO t1 VALUES
+(77,4,0),(86,7,0),(96,6,0),(96,7,0),(99,9,0),(99,10,0),(99,11,0),(104,4,0),
+(106,5,0),(148,6,0),(177,6,0),(181,5,0),(188,8,0),(218,8,0),(253,7,0),
+(268,4,0),(338,4,0),(409,7,0),(466,8,0),(469,8,0),(498,8,0),(656,8,0);
+INSERT INTO t2 VALUES
+(127,7),(188,8),(188,9),(206,6),(218,8),(218,9),(292,7),(338,4),(338,5),
+(375,6),(381,5),(409,7),(409,8),(466,8),(466,9),(469,8),(469,9),(498,8),
+(498,9),(656,8),(656,9);
+INSERT INTO t3 VALUES
+(4,'four'),(5,'five'),(6,'six'),(7,'seven'),(8,'eight'),(9,'nine');
+SET @save_optimizer_switch=@@optimizer_switch;
+SET optimizer_switch='orderby_uses_equalities=off';
+SELECT i,n
+FROM t1 INNER JOIN t2 USING (i,j) LEFT JOIN t3 USING (j)
+WHERE i IN (SELECT i FROM t1 WHERE z=1) AND z=0 ORDER BY i;
+i n
+188 eight
+218 eight
+338 four
+409 seven
+466 eight
+469 eight
+498 eight
+656 eight
+SELECT i,n
+FROM t1 x INNER JOIN t2 USING (i,j) LEFT JOIN t3 USING (j)
+WHERE EXISTS (SELECT * FROM t1 WHERE i=x.i AND z=1) AND z=0 ORDER BY i;
+i n
+188 eight
+218 eight
+338 four
+409 seven
+466 eight
+469 eight
+498 eight
+656 eight
+SET optimizer_switch='orderby_uses_equalities=on';
+SELECT i,n
+FROM t1 INNER JOIN t2 USING (i,j) LEFT JOIN t3 USING (j)
+WHERE i IN (SELECT i FROM t1 WHERE z=1) AND z=0 ORDER BY i;
+i n
+188 eight
+218 eight
+338 four
+409 seven
+466 eight
+469 eight
+498 eight
+656 eight
+SELECT i,n
+FROM t1 x INNER JOIN t2 USING (i,j) LEFT JOIN t3 USING (j)
+WHERE EXISTS (SELECT * FROM t1 WHERE i=x.i AND z=1) AND z=0 ORDER BY i;
+i n
+188 eight
+218 eight
+338 four
+409 seven
+466 eight
+469 eight
+498 eight
+656 eight
+set optimizer_switch= @save_optimizer_switch;
+DROP TABLE t1,t2,t3;
diff --git a/mysql-test/r/outfile.result b/mysql-test/r/outfile.result
index cafa9d9db4d..4c439c37e4d 100644
--- a/mysql-test/r/outfile.result
+++ b/mysql-test/r/outfile.result
Binary files differ
diff --git a/mysql-test/r/partition.result b/mysql-test/r/partition.result
index f398ef07d56..7a614a146a1 100644
--- a/mysql-test/r/partition.result
+++ b/mysql-test/r/partition.result
@@ -513,6 +513,9 @@ COUNT(*)
SELECT SUM(c) FROM t1 WHERE b NOT IN ( 1,2,6,7,9,10,11 );
SUM(c)
400
+SELECT SUM(c+0.0) FROM t1 WHERE b NOT IN ( 1,2,6,7,9,10,11 );
+SUM(c+0.0)
+400.0
ALTER TABLE t1 DROP INDEX b;
SELECT COUNT(*) FROM t1 WHERE b NOT IN ( 1,2,6,7,9,10,11 );
COUNT(*)
diff --git a/mysql-test/r/partition_innodb.result b/mysql-test/r/partition_innodb.result
index 09d8728601f..961621af0f7 100644
--- a/mysql-test/r/partition_innodb.result
+++ b/mysql-test/r/partition_innodb.result
@@ -29,7 +29,7 @@ Table Op Msg_type Msg_text
test.t1 analyze status OK
EXPLAIN SELECT b FROM t1 WHERE b between 'L' and 'N' AND a > -100;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range PRIMARY,b b 67 NULL 18 Using where; Using index
+1 SIMPLE t1 range PRIMARY,b b 67 NULL 34 Using where; Using index
DROP TABLE t1;
#
# Bug#13007154: Crash in keys_to_use_for_scanning with ORDER BY
@@ -663,7 +663,7 @@ EXPLAIN SELECT * FROM t1 WHERE col1 = 1 AND col2 = 2
AND col3 BETWEEN '2013-03-08 00:00:00' AND '2013-03-12 12:00:00'
GROUP BY 1, 2, 3;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index_merge PRIMARY,col1,col2 col1,col2 8,8 NULL # Using intersect(col1,col2); Using where; Using index; Using filesort
+1 SIMPLE t1 range PRIMARY,col1,col2 PRIMARY 5 NULL # Using where; Using filesort
SELECT * FROM t1 USE INDEX () WHERE col1 = 1 AND col2 = 2
AND col3 BETWEEN '2013-03-08 00:00:00' AND '2013-03-12 12:00:00'
GROUP BY 1, 2, 3;
diff --git a/mysql-test/r/partition_pruning.result b/mysql-test/r/partition_pruning.result
index 0fb24b74218..422132dd1c3 100644
--- a/mysql-test/r/partition_pruning.result
+++ b/mysql-test/r/partition_pruning.result
@@ -18,7 +18,7 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
# # # # # # # # # 3 #
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < 7;
id select_type table partitions type possible_keys key key_len ref rows Extra
-# # # # # # # # # 10 #
+# # # # # # # # # 9 #
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 1;
id select_type table partitions type possible_keys key key_len ref rows Extra
# # # # # # # # # 3 #
@@ -105,7 +105,7 @@ a
6
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < 7;
id select_type table partitions type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 p0,p1,p2,p3,p4,p5,max index PRIMARY PRIMARY 4 NULL 10 Using where; Using index
+1 SIMPLE t1 p0,p1,p2,p3,p4,p5,max range PRIMARY PRIMARY 4 NULL 9 Using where; Using index
SELECT * FROM t1 WHERE a <= 1;
a
-1
@@ -168,7 +168,7 @@ a
6
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 6;
id select_type table partitions type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 p0,p1,p2,p3,p4,p5,max index PRIMARY PRIMARY 4 NULL 10 Using where; Using index
+1 SIMPLE t1 p0,p1,p2,p3,p4,p5,max range PRIMARY PRIMARY 4 NULL 9 Using where; Using index
SELECT * FROM t1 WHERE a <= 7;
a
-1
@@ -182,7 +182,7 @@ a
7
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 7;
id select_type table partitions type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 p0,p1,p2,p3,p4,p5,max index PRIMARY PRIMARY 4 NULL 10 Using where; Using index
+1 SIMPLE t1 p0,p1,p2,p3,p4,p5,max range PRIMARY PRIMARY 4 NULL 9 Using where; Using index
SELECT * FROM t1 WHERE a = 1;
a
1
@@ -424,7 +424,7 @@ a
5
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < 6;
id select_type table partitions type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 p0,p1,p2,p3,p4,max index PRIMARY PRIMARY 4 NULL 9 Using where; Using index
+1 SIMPLE t1 p0,p1,p2,p3,p4,max range PRIMARY PRIMARY 4 NULL 8 Using where; Using index
SELECT * FROM t1 WHERE a <= 1;
a
-1
@@ -474,7 +474,7 @@ a
5
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 5;
id select_type table partitions type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 p0,p1,p2,p3,p4,max index PRIMARY PRIMARY 4 NULL 9 Using where; Using index
+1 SIMPLE t1 p0,p1,p2,p3,p4,max range PRIMARY PRIMARY 4 NULL 8 Using where; Using index
SELECT * FROM t1 WHERE a <= 6;
a
-1
@@ -487,7 +487,7 @@ a
6
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 6;
id select_type table partitions type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 p0,p1,p2,p3,p4,max index PRIMARY PRIMARY 4 NULL 9 Using where; Using index
+1 SIMPLE t1 p0,p1,p2,p3,p4,max range PRIMARY PRIMARY 4 NULL 8 Using where; Using index
SELECT * FROM t1 WHERE a = 1;
a
1
@@ -744,13 +744,13 @@ a
1001-01-01
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < '1001-01-01';
id select_type table partitions type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01 index a a 4 NULL 6 Using where; Using index
+1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01 range a a 4 NULL 3 Using where; Using index
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= '1001-01-01';
id select_type table partitions type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01 index a a 4 NULL 6 Using where; Using index
+1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01 range a a 4 NULL 3 Using where; Using index
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= '1001-01-01';
id select_type table partitions type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 pNULL,p1001-01-01,p2001-01-01 range a a 4 NULL 3 Using where; Using index
+1 SIMPLE t1 pNULL,p1001-01-01,p2001-01-01 range a a 4 NULL 4 Using where; Using index
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > '1001-01-01';
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 pNULL,p2001-01-01 range a a 4 NULL 3 Using where; Using index
@@ -759,26 +759,26 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p1001-01-01 system a NULL NULL NULL 1
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < '1001-00-00';
id select_type table partitions type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01 index a a 4 NULL 6 Using where; Using index
+1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01 range a a 4 NULL 3 Using where; Using index
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= '1001-00-00';
id select_type table partitions type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01 index a a 4 NULL 6 Using where; Using index
+1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01 range a a 4 NULL 3 Using where; Using index
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= '1001-00-00';
id select_type table partitions type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 pNULL,p1001-01-01,p2001-01-01 range a a 4 NULL 3 Using where; Using index
+1 SIMPLE t1 pNULL,p1001-01-01,p2001-01-01 range a a 4 NULL 4 Using where; Using index
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > '1001-00-00';
id select_type table partitions type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 pNULL,p1001-01-01,p2001-01-01 range a a 4 NULL 3 Using where; Using index
+1 SIMPLE t1 pNULL,p1001-01-01,p2001-01-01 range a a 4 NULL 4 Using where; Using index
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = '1001-00-00';
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 pNULL ref a a 4 const 1 Using index
# Disabling warnings for the invalid date
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < '1999-02-31';
id select_type table partitions type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01,p2001-01-01 range a a 4 NULL 4 Using where; Using index
+1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01,p2001-01-01 range a a 4 NULL 5 Using where; Using index
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= '1999-02-31';
id select_type table partitions type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01,p2001-01-01 range a a 4 NULL 4 Using where; Using index
+1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01,p2001-01-01 range a a 4 NULL 5 Using where; Using index
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= '1999-02-31';
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 pNULL,p2001-01-01 index a a 4 NULL 4 Using where; Using index
@@ -790,16 +790,16 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 pNULL ref a a 4 const 1 Using index
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0000-00-00' AND '1002-00-00';
id select_type table partitions type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01,p2001-01-01 range a a 4 NULL 4 Using where; Using index
+1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01,p2001-01-01 range a a 4 NULL 5 Using where; Using index
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0000-00-00' AND '1001-01-01';
id select_type table partitions type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01 index a a 4 NULL 6 Using where; Using index
+1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01 range a a 4 NULL 3 Using where; Using index
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0001-01-02' AND '1002-00-00';
id select_type table partitions type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 pNULL,p1001-01-01,p2001-01-01 index a a 4 NULL 5 Using where; Using index
+1 SIMPLE t1 pNULL,p1001-01-01,p2001-01-01 range a a 4 NULL 3 Using where; Using index
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0001-01-01' AND '1001-01-01';
id select_type table partitions type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01 index a a 4 NULL 6 Using where; Using index
+1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01 range a a 4 NULL 3 Using where; Using index
# test without index
ALTER TABLE t1 DROP KEY a;
SELECT * FROM t1 WHERE a < '1001-01-01';
@@ -1076,7 +1076,7 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02 range a a 4 NULL 3 Using where; Using index
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= '1001-01-01';
id select_type table partitions type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 3 Using where; Using index
+1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 4 Using where; Using index
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= '1001-01-01';
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p2001-01-01,pNULL,p1001-01-01 range a a 4 NULL 4 Using where; Using index
@@ -1104,10 +1104,10 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
# Disabling warnings for the invalid date
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < '1999-02-31';
id select_type table partitions type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 4 Using where; Using index
+1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 5 Using where; Using index
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= '1999-02-31';
id select_type table partitions type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 4 Using where; Using index
+1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 5 Using where; Using index
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= '1999-02-31';
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p2001-01-01,pNULL index a a 4 NULL 4 Using where; Using index
@@ -1119,10 +1119,10 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 pNULL ref a a 4 const 1 Using index
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0000-00-00' AND '1002-00-00';
id select_type table partitions type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 4 Using where; Using index
+1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 5 Using where; Using index
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0000-00-00' AND '1001-01-01';
id select_type table partitions type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 3 Using where; Using index
+1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 4 Using where; Using index
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0001-01-02' AND '1002-00-00';
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 pNULL,p1001-01-01 index a a 4 NULL 4 Using where; Using index
@@ -1405,7 +1405,7 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02 range a a 4 NULL 3 Using where; Using index
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= '1001-01-01';
id select_type table partitions type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 3 Using where; Using index
+1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 4 Using where; Using index
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= '1001-01-01';
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p2001-01-01,pNULL,p1001-01-01 range a a 4 NULL 4 Using where; Using index
@@ -1433,10 +1433,10 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
# Disabling warnings for the invalid date
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < '1999-02-31';
id select_type table partitions type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 4 Using where; Using index
+1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 5 Using where; Using index
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= '1999-02-31';
id select_type table partitions type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 4 Using where; Using index
+1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 5 Using where; Using index
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= '1999-02-31';
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p2001-01-01,pNULL index a a 4 NULL 4 Using where; Using index
@@ -1448,10 +1448,10 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 pNULL ref a a 4 const 1 Using index
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0000-00-00' AND '1002-00-00';
id select_type table partitions type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 4 Using where; Using index
+1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 5 Using where; Using index
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0000-00-00' AND '1001-01-01';
id select_type table partitions type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 3 Using where; Using index
+1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 4 Using where; Using index
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0001-01-02' AND '1002-00-00';
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 pNULL,p1001-01-01 index a a 4 NULL 4 Using where; Using index
@@ -2867,18 +2867,18 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t2 p0,p1,p2 ALL NULL NULL NULL NULL 510 Using where
explain partitions select * from t2 where b = 4;
id select_type table partitions type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 p0,p1,p2,p3,p4 ref b b 5 const 96
+1 SIMPLE t2 p0,p1,p2,p3,p4 ref b b 5 const 76
explain extended select * from t2 where b = 6;
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE t2 ref b b 5 const 96 100.00
+1 SIMPLE t2 ref b b 5 const 76 100.00
Warnings:
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`b` = 6
explain partitions select * from t2 where b = 6;
id select_type table partitions type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 p0,p1,p2,p3,p4 ref b b 5 const 96
+1 SIMPLE t2 p0,p1,p2,p3,p4 ref b b 5 const 76
explain extended select * from t2 where b in (1,3,5);
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE t2 ALL b NULL NULL NULL 910 51.65 Using where
+1 SIMPLE t2 ALL b NULL NULL NULL 910 40.66 Using where
Warnings:
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`b` in (1,3,5)
explain partitions select * from t2 where b in (1,3,5);
@@ -2886,7 +2886,7 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t2 p0,p1,p2,p3,p4 ALL b NULL NULL NULL 910 Using where
explain extended select * from t2 where b in (2,4,6);
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE t2 ALL b NULL NULL NULL 910 31.65 Using where
+1 SIMPLE t2 ALL b NULL NULL NULL 910 25.05 Using where
Warnings:
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`b` in (2,4,6)
explain partitions select * from t2 where b in (2,4,6);
@@ -2894,7 +2894,7 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t2 p0,p1,p2,p3,p4 ALL b NULL NULL NULL 910 Using where
explain extended select * from t2 where b in (7,8,9);
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE t2 ALL b NULL NULL NULL 910 19.12 Using where
+1 SIMPLE t2 ALL b NULL NULL NULL 910 36.70 Using where
Warnings:
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`b` in (7,8,9)
explain partitions select * from t2 where b in (7,8,9);
@@ -2902,7 +2902,7 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t2 p0,p1,p2,p3,p4 ALL b NULL NULL NULL 910 Using where
explain extended select * from t2 where b > 5;
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE t2 ALL b NULL NULL NULL 910 29.23 Using where
+1 SIMPLE t2 ALL b NULL NULL NULL 910 44.84 Using where
Warnings:
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`b` > 5
explain partitions select * from t2 where b > 5;
@@ -2910,7 +2910,7 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t2 p0,p1,p2,p3,p4 ALL b NULL NULL NULL 910 Using where
explain extended select * from t2 where b > 5 and b < 8;
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE t2 ALL b NULL NULL NULL 910 28.13 Using where
+1 SIMPLE t2 ALL b NULL NULL NULL 910 22.09 Using where
Warnings:
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`b` > 5 and `test`.`t2`.`b` < 8
explain partitions select * from t2 where b > 5 and b < 8;
@@ -2918,15 +2918,15 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t2 p0,p1,p2,p3,p4 ALL b NULL NULL NULL 910 Using where
explain extended select * from t2 where b > 5 and b < 7;
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE t2 range b b 5 NULL 96 100.00 Using where
+1 SIMPLE t2 range b b 5 NULL 76 100.00 Using where
Warnings:
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`b` > 5 and `test`.`t2`.`b` < 7
explain partitions select * from t2 where b > 5 and b < 7;
id select_type table partitions type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 p0,p1,p2,p3,p4 range b b 5 NULL 96 Using where
+1 SIMPLE t2 p0,p1,p2,p3,p4 range b b 5 NULL 76 Using where
explain extended select * from t2 where b > 0 and b < 5;
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE t2 ALL b NULL NULL NULL 910 53.19 Using where
+1 SIMPLE t2 ALL b NULL NULL NULL 910 41.65 Using where
Warnings:
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`b` > 0 and `test`.`t2`.`b` < 5
explain partitions select * from t2 where b > 0 and b < 5;
@@ -2960,10 +2960,10 @@ flush status;
delete from t2 where b = 7;
show status like 'Handler_read_rnd_next';
Variable_name Value
-Handler_read_rnd_next 915
+Handler_read_rnd_next 0
show status like 'Handler_read_key';
Variable_name Value
-Handler_read_key 0
+Handler_read_key 5
flush status;
delete from t2 where b > 5;
show status like 'Handler_read_rnd_next';
@@ -3136,7 +3136,7 @@ drop table t2;
create table t1 (s1 int);
explain partitions select 1 from t1 union all select 2;
id select_type table partitions type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 NULL system NULL NULL NULL NULL 0 const row not found
+1 PRIMARY t1 NULL system NULL NULL NULL NULL 0 Const row not found
2 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used
drop table t1;
create table t1 (a bigint unsigned not null) partition by range(a) (
diff --git a/mysql-test/r/partition_range.result b/mysql-test/r/partition_range.result
index dd9e074db0c..7ae029d488c 100644
--- a/mysql-test/r/partition_range.result
+++ b/mysql-test/r/partition_range.result
@@ -961,7 +961,7 @@ INSERT INTO t2 SELECT * FROM t1;
# plans should be identical
EXPLAIN SELECT a, MAX(b) FROM t1 WHERE a IN (10,100) GROUP BY a;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range a a 5 NULL 1 Using where; Using index for group-by
+1 SIMPLE t1 range a a 5 NULL 2 Using where; Using index
EXPLAIN SELECT a, MAX(b) FROM t2 WHERE a IN (10,100) GROUP BY a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 range a a 5 NULL 2 Using where; Using index for group-by
@@ -972,7 +972,7 @@ a MAX(b)
# Should be no more than 4 reads.
SHOW status LIKE 'handler_read_key';
Variable_name Value
-Handler_read_key 4
+Handler_read_key 2
FLUSH status;
SELECT a, MAX(b) FROM t2 WHERE a IN (10, 100) GROUP BY a;
a MAX(b)
diff --git a/mysql-test/r/profiling.result b/mysql-test/r/profiling.result
index 9644a8afe8d..bc8dd162481 100644
--- a/mysql-test/r/profiling.result
+++ b/mysql-test/r/profiling.result
@@ -415,7 +415,7 @@ select @@profiling;
drop table if exists t1, t2, t3;
drop view if exists v1;
Warnings:
-Note 4090 Unknown VIEW: 'test.v1'
+Note 4091 Unknown VIEW: 'test.v1'
drop function if exists f1;
set session profiling = OFF;
set global profiling_history_size= @start_value;
diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result
index 68139b62f95..2c44ce9aa93 100644
--- a/mysql-test/r/ps.result
+++ b/mysql-test/r/ps.result
@@ -3394,7 +3394,7 @@ CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
SHOW CREATE TABLE tmp1;
Table Create Table
tmp1 CREATE TEMPORARY TABLE `tmp1` (
- `c1` bigint(20) DEFAULT NULL
+ `c1` bigint(20) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT @a, @a = b'10100100101';
@a @a = b'10100100101'
@@ -3484,7 +3484,7 @@ CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
SHOW CREATE TABLE tmp1;
Table Create Table
tmp1 CREATE TEMPORARY TABLE `tmp1` (
- `c1` bigint(20) DEFAULT NULL
+ `c1` bigint(20) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT @a, @a = 2010;
@a @a = 2010
@@ -3556,7 +3556,7 @@ CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
SHOW CREATE TABLE tmp1;
Table Create Table
tmp1 CREATE TEMPORARY TABLE `tmp1` (
- `c1` longblob DEFAULT NULL
+ `c1` longtext DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT @a, @a = REPEAT('a', 16);
@a @a = REPEAT('a', 16)
@@ -3574,7 +3574,7 @@ CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
SHOW CREATE TABLE tmp1;
Table Create Table
tmp1 CREATE TEMPORARY TABLE `tmp1` (
- `c1` longblob DEFAULT NULL
+ `c1` longtext DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT @a, @a = REPEAT('b', 16);
@a @a = REPEAT('b', 16)
@@ -3592,7 +3592,7 @@ CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
SHOW CREATE TABLE tmp1;
Table Create Table
tmp1 CREATE TEMPORARY TABLE `tmp1` (
- `c1` longblob DEFAULT NULL
+ `c1` longtext DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT @a, @a = REPEAT('c', 16);
@a @a = REPEAT('c', 16)
@@ -3610,7 +3610,7 @@ CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
SHOW CREATE TABLE tmp1;
Table Create Table
tmp1 CREATE TEMPORARY TABLE `tmp1` (
- `c1` longblob DEFAULT NULL
+ `c1` longtext DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT @a, @a = REPEAT('d', 16);
@a @a = REPEAT('d', 16)
@@ -3628,7 +3628,7 @@ CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
SHOW CREATE TABLE tmp1;
Table Create Table
tmp1 CREATE TEMPORARY TABLE `tmp1` (
- `c1` longblob DEFAULT NULL
+ `c1` longtext DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT @a, @a = REPEAT('e', 16);
@a @a = REPEAT('e', 16)
@@ -3646,7 +3646,7 @@ CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
SHOW CREATE TABLE tmp1;
Table Create Table
tmp1 CREATE TEMPORARY TABLE `tmp1` (
- `c1` longblob DEFAULT NULL
+ `c1` longtext DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT @a, @a = REPEAT('f', 16);
@a @a = REPEAT('f', 16)
@@ -3772,7 +3772,7 @@ CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
SHOW CREATE TABLE tmp1;
Table Create Table
tmp1 CREATE TEMPORARY TABLE `tmp1` (
- `c1` longblob DEFAULT NULL
+ `c1` longtext DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT @a, @a = 'aaa';
@a @a = 'aaa'
@@ -3790,7 +3790,7 @@ CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
SHOW CREATE TABLE tmp1;
Table Create Table
tmp1 CREATE TEMPORARY TABLE `tmp1` (
- `c1` longblob DEFAULT NULL
+ `c1` longtext DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT @a, @a = 'aaa';
@a @a = 'aaa'
@@ -4413,7 +4413,7 @@ EXECUTE stmt USING 10;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` bigint(21) NOT NULL
+ `c1` int(2) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
EXECUTE stmt USING 10.123;
@@ -4620,10 +4620,10 @@ EXECUTE IMMEDIATE
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` bigint(21) NOT NULL,
+ `a` bigint(20) NOT NULL,
`b` decimal(3,1) DEFAULT NULL,
`c` double NOT NULL,
- `d` varchar(3) NOT NULL
+ `d` tinytext NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
EXECUTE IMMEDIATE
@@ -4632,7 +4632,7 @@ EXECUTE IMMEDIATE
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` bigint(21) NOT NULL,
+ `a` int(2) NOT NULL,
`b` decimal(3,1) DEFAULT NULL,
`c` double NOT NULL,
`d` varchar(3) NOT NULL
@@ -4998,3 +4998,159 @@ ERROR 42000: OUT or INOUT argument 1 for routine test.p1 is not a variable or NE
EXECUTE IMMEDIATE 'CALL p1(?)' USING IGNORE;
ERROR 42000: OUT or INOUT argument 1 for routine test.p1 is not a variable or NEW pseudo-variable in BEFORE trigger
DROP PROCEDURE p1;
+#
+# MDEV-14434 Wrong result for CHARSET(CONCAT(?,const))
+#
+SET NAMES utf8;
+EXECUTE IMMEDIATE "SELECT CHARSET(CONCAT(5,_latin1'a'))";
+CHARSET(CONCAT(5,_latin1'a'))
+latin1
+EXECUTE IMMEDIATE "SELECT CHARSET(CONCAT(?,_latin1'a'))" USING 5;
+CHARSET(CONCAT(?,_latin1'a'))
+latin1
+EXECUTE IMMEDIATE "SELECT CHARSET(CONCAT(?,_latin1'a'))" USING 5.5;
+CHARSET(CONCAT(?,_latin1'a'))
+latin1
+EXECUTE IMMEDIATE "SELECT CHARSET(CONCAT(?,_latin1'a'))" USING 5.5e0;
+CHARSET(CONCAT(?,_latin1'a'))
+latin1
+EXECUTE IMMEDIATE "SELECT CHARSET(CONCAT(?,_latin1'a'))" USING TIME'10:20:30';
+CHARSET(CONCAT(?,_latin1'a'))
+latin1
+EXECUTE IMMEDIATE "SELECT CHARSET(CONCAT(?,_latin1'a'))" USING TIMESTAMP'2001-01-01 10:20:30';
+CHARSET(CONCAT(?,_latin1'a'))
+latin1
+EXECUTE IMMEDIATE "SELECT COERCIBILITY(?)" USING 5;
+COERCIBILITY(?)
+5
+EXECUTE IMMEDIATE "SELECT COERCIBILITY(?)" USING 5.5;
+COERCIBILITY(?)
+5
+EXECUTE IMMEDIATE "SELECT COERCIBILITY(?)" USING 5.5e0;
+COERCIBILITY(?)
+5
+EXECUTE IMMEDIATE "SELECT COERCIBILITY(?)" USING TIME'10:20:30';
+COERCIBILITY(?)
+5
+EXECUTE IMMEDIATE "SELECT COERCIBILITY(?)" USING TIMESTAMP'2001-01-01 10:20:30';
+COERCIBILITY(?)
+5
+#
+# MDEV-14435 Different UNSIGNED flag of out user variable for YEAR parameter for direct vs prepared CALL
+#
+CREATE PROCEDURE p1(OUT v INT UNSIGNED) SET v = 2010;
+CALL p1(@a);
+PREPARE stmt FROM 'CALL p1(?)';
+EXECUTE stmt USING @b;
+DEALLOCATE PREPARE stmt;
+CREATE TABLE t1 AS SELECT @a AS a, @b AS b;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` bigint(20) unsigned DEFAULT NULL,
+ `b` bigint(20) unsigned DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+DROP PROCEDURE p1;
+CREATE PROCEDURE p1(OUT v YEAR) SET v = 2010;
+CALL p1(@a);
+PREPARE stmt FROM 'CALL p1(?)';
+EXECUTE stmt USING @b;
+DEALLOCATE PREPARE stmt;
+CREATE TABLE t1 AS SELECT @a AS a, @b AS b;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` bigint(20) unsigned DEFAULT NULL,
+ `b` bigint(20) unsigned DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+DROP PROCEDURE p1;
+CREATE PROCEDURE p1(OUT v BIT(16)) SET v = 2010;
+CALL p1(@a);
+PREPARE stmt FROM 'CALL p1(?)';
+EXECUTE stmt USING @b;
+DEALLOCATE PREPARE stmt;
+CREATE TABLE t1 AS SELECT @a AS a, @b AS b;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` bigint(20) unsigned DEFAULT NULL,
+ `b` bigint(20) unsigned DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+DROP PROCEDURE p1;
+#
+# MDEV-14454 Binary protocol returns wrong collation ID for SP OUT parameters
+#
+CREATE PROCEDURE p1(OUT v CHAR(32) CHARACTER SET utf8) SET v='aaa';
+PREPARE stmt1 FROM 'CALL p1(?)';
+EXECUTE stmt1 USING @a;
+CREATE TABLE t1 AS SELECT @a AS c1;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` longtext CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+DROP PROCEDURE p1;
+#
+# MDEV-14467 Item_param: replace {INT|DECIMAL|REAL|STRING|TIME}_VALUE with Type_handler
+#
+EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT 1 FROM DUAL LIMIT ?' USING 10;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Warnings:
+Note 1003 select 1 AS `1` limit 10
+EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT 1 FROM DUAL LIMIT ?' USING 10.1;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Warnings:
+Note 1003 select 1 AS `1` limit 10
+EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT 1 FROM DUAL LIMIT ?' USING 10.1e0;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Warnings:
+Note 1003 select 1 AS `1` limit 10
+EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT 1 FROM DUAL LIMIT ?' USING '10';
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Warnings:
+Note 1003 select 1 AS `1` limit 10
+EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT 1 FROM DUAL LIMIT ?' USING TIME'10:10:10';
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Warnings:
+Note 1003 select 1 AS `1` limit 101010
+EXECUTE IMMEDIATE 'CREATE OR REPLACE TABLE t1 AS SELECT 1 AS a,? AS b' USING 1;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(1) NOT NULL,
+ `b` int(1) NOT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+EXECUTE IMMEDIATE 'CREATE OR REPLACE TABLE t1 AS SELECT 10 AS a,? AS b' USING 10;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(2) NOT NULL,
+ `b` int(2) NOT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+EXECUTE IMMEDIATE 'CREATE OR REPLACE TABLE t1 AS SELECT 999999999 AS a,? AS b' USING 999999999;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(9) NOT NULL,
+ `b` int(9) NOT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+EXECUTE IMMEDIATE 'CREATE OR REPLACE TABLE t1 AS SELECT 2147483647 AS a,? AS b' USING 2147483647;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` bigint(10) NOT NULL,
+ `b` bigint(10) NOT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
diff --git a/mysql-test/r/query_cache.result b/mysql-test/r/query_cache.result
index eb9b1d16011..bb8703b4185 100644
--- a/mysql-test/r/query_cache.result
+++ b/mysql-test/r/query_cache.result
@@ -235,7 +235,7 @@ select benchmark(1,1) from t1;
benchmark(1,1)
explain extended select benchmark(1,1) from t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 const row not found
+1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 Const row not found
Warnings:
Note 1003 select benchmark(1,1) AS `benchmark(1,1)` from `test`.`t1`
show status like "Qcache_queries_in_cache";
diff --git a/mysql-test/r/range.result b/mysql-test/r/range.result
index 80aef096828..61886b2be98 100644
--- a/mysql-test/r/range.result
+++ b/mysql-test/r/range.result
@@ -2284,7 +2284,7 @@ explain extended select * from t2 where (b > 25 and b < 15) or (a>55 and a<44);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where 0
+Note 1003 select 44 AS `a`,15 AS `b`,NULL AS `c` from `test`.`t2` where 0
drop table t1,t2;
#
# Start of 10.1 tests
diff --git a/mysql-test/r/range_mrr_icp.result b/mysql-test/r/range_mrr_icp.result
index b0672eed54e..f6c523f9900 100644
--- a/mysql-test/r/range_mrr_icp.result
+++ b/mysql-test/r/range_mrr_icp.result
@@ -2286,7 +2286,7 @@ explain extended select * from t2 where (b > 25 and b < 15) or (a>55 and a<44);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where 0
+Note 1003 select 44 AS `a`,15 AS `b`,NULL AS `c` from `test`.`t2` where 0
drop table t1,t2;
#
# Start of 10.1 tests
diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result
index c7156ddae91..4b7aecd675d 100644
--- a/mysql-test/r/select.result
+++ b/mysql-test/r/select.result
@@ -2330,7 +2330,7 @@ insert into t4 values (1,1);
explain select * from t1 left join t2 on id1 = id2 left join t3 on id1 = id3
left join t4 on id3 = id4 where id2 = 1 or id4 = 1;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t3 system NULL NULL NULL NULL 0 const row not found
+1 SIMPLE t3 system NULL NULL NULL NULL 0 Const row not found
1 SIMPLE t4 const id4 NULL NULL NULL 1
1 SIMPLE t1 ALL NULL NULL NULL NULL 2
1 SIMPLE t2 ALL NULL NULL NULL NULL 1 Using where
@@ -4660,17 +4660,17 @@ DROP TABLE t1;
CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL, c INT NOT NULL);
EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a=a AND b=b AND c=c) OR b > 20;
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 const row not found
+1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 Const row not found
Warnings:
Note 1003 select NULL AS `a`,NULL AS `b`,NULL AS `c` from `test`.`t1` where 1
EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a=a AND a=a AND b=b) OR b > 20;
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 const row not found
+1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 Const row not found
Warnings:
Note 1003 select NULL AS `a`,NULL AS `b`,NULL AS `c` from `test`.`t1` where 1
EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a=a AND b=b AND a=a) OR b > 20;
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 const row not found
+1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 Const row not found
Warnings:
Note 1003 select NULL AS `a`,NULL AS `b`,NULL AS `c` from `test`.`t1` where 1
DROP TABLE t1;
@@ -5482,7 +5482,7 @@ WHERE i1 = i2 AND ( FALSE OR ( j1 > 27 AND j1 < 100 OR j1 <= 3 ) AND j1 = i2 );
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
Warnings:
-Note 1003 select 1 AS `i1`,8 AS `j1`,`test`.`t2`.`i2` AS `i2` from `test`.`t2` where 0
+Note 1003 select 1 AS `i1`,8 AS `j1`,NULL AS `i2` from `test`.`t2` where 0
SELECT * FROM t1, t2
WHERE i1 = i2 AND ( FALSE OR ( j1 > 27 AND j1 < 100 OR j1 <= 3 ) AND j1 = i2 );
i1 j1 i2
diff --git a/mysql-test/r/select_found.result b/mysql-test/r/select_found.result
index 8462e19fda8..2c37c2d28d8 100644
--- a/mysql-test/r/select_found.result
+++ b/mysql-test/r/select_found.result
@@ -83,7 +83,7 @@ UNIQUE KEY e_n (email,name)
);
EXPLAIN SELECT SQL_CALC_FOUND_ROWS DISTINCT email FROM t2 LEFT JOIN t1 ON kid = t2.id WHERE t1.id IS NULL LIMIT 10;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 system PRIMARY,kid NULL NULL NULL 0 const row not found; Using temporary
+1 SIMPLE t1 system PRIMARY,kid NULL NULL NULL 0 Const row not found; Using temporary
1 SIMPLE t2 ALL NULL NULL NULL NULL 200
SELECT SQL_CALC_FOUND_ROWS DISTINCT email FROM t2 LEFT JOIN t1 ON kid = t2.id WHERE t1.id IS NULL LIMIT 10;
email
diff --git a/mysql-test/r/select_jcl6.result b/mysql-test/r/select_jcl6.result
index 92be057c62c..e548da79774 100644
--- a/mysql-test/r/select_jcl6.result
+++ b/mysql-test/r/select_jcl6.result
@@ -2341,7 +2341,7 @@ insert into t4 values (1,1);
explain select * from t1 left join t2 on id1 = id2 left join t3 on id1 = id3
left join t4 on id3 = id4 where id2 = 1 or id4 = 1;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t3 system NULL NULL NULL NULL 0 const row not found
+1 SIMPLE t3 system NULL NULL NULL NULL 0 Const row not found
1 SIMPLE t4 const id4 NULL NULL NULL 1
1 SIMPLE t1 ALL NULL NULL NULL NULL 2
1 SIMPLE t2 hash_ALL NULL #hash#$hj 4 test.t1.id1 1 Using where; Using join buffer (flat, BNLH join)
@@ -4671,17 +4671,17 @@ DROP TABLE t1;
CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL, c INT NOT NULL);
EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a=a AND b=b AND c=c) OR b > 20;
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 const row not found
+1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 Const row not found
Warnings:
Note 1003 select NULL AS `a`,NULL AS `b`,NULL AS `c` from `test`.`t1` where 1
EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a=a AND a=a AND b=b) OR b > 20;
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 const row not found
+1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 Const row not found
Warnings:
Note 1003 select NULL AS `a`,NULL AS `b`,NULL AS `c` from `test`.`t1` where 1
EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a=a AND b=b AND a=a) OR b > 20;
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 const row not found
+1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 Const row not found
Warnings:
Note 1003 select NULL AS `a`,NULL AS `b`,NULL AS `c` from `test`.`t1` where 1
DROP TABLE t1;
@@ -5493,7 +5493,7 @@ WHERE i1 = i2 AND ( FALSE OR ( j1 > 27 AND j1 < 100 OR j1 <= 3 ) AND j1 = i2 );
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
Warnings:
-Note 1003 select 1 AS `i1`,8 AS `j1`,`test`.`t2`.`i2` AS `i2` from `test`.`t2` where 0
+Note 1003 select 1 AS `i1`,8 AS `j1`,NULL AS `i2` from `test`.`t2` where 0
SELECT * FROM t1, t2
WHERE i1 = i2 AND ( FALSE OR ( j1 > 27 AND j1 < 100 OR j1 <= 3 ) AND j1 = i2 );
i1 j1 i2
diff --git a/mysql-test/r/select_pkeycache.result b/mysql-test/r/select_pkeycache.result
index c7156ddae91..4b7aecd675d 100644
--- a/mysql-test/r/select_pkeycache.result
+++ b/mysql-test/r/select_pkeycache.result
@@ -2330,7 +2330,7 @@ insert into t4 values (1,1);
explain select * from t1 left join t2 on id1 = id2 left join t3 on id1 = id3
left join t4 on id3 = id4 where id2 = 1 or id4 = 1;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t3 system NULL NULL NULL NULL 0 const row not found
+1 SIMPLE t3 system NULL NULL NULL NULL 0 Const row not found
1 SIMPLE t4 const id4 NULL NULL NULL 1
1 SIMPLE t1 ALL NULL NULL NULL NULL 2
1 SIMPLE t2 ALL NULL NULL NULL NULL 1 Using where
@@ -4660,17 +4660,17 @@ DROP TABLE t1;
CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL, c INT NOT NULL);
EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a=a AND b=b AND c=c) OR b > 20;
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 const row not found
+1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 Const row not found
Warnings:
Note 1003 select NULL AS `a`,NULL AS `b`,NULL AS `c` from `test`.`t1` where 1
EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a=a AND a=a AND b=b) OR b > 20;
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 const row not found
+1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 Const row not found
Warnings:
Note 1003 select NULL AS `a`,NULL AS `b`,NULL AS `c` from `test`.`t1` where 1
EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a=a AND b=b AND a=a) OR b > 20;
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 const row not found
+1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 Const row not found
Warnings:
Note 1003 select NULL AS `a`,NULL AS `b`,NULL AS `c` from `test`.`t1` where 1
DROP TABLE t1;
@@ -5482,7 +5482,7 @@ WHERE i1 = i2 AND ( FALSE OR ( j1 > 27 AND j1 < 100 OR j1 <= 3 ) AND j1 = i2 );
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
Warnings:
-Note 1003 select 1 AS `i1`,8 AS `j1`,`test`.`t2`.`i2` AS `i2` from `test`.`t2` where 0
+Note 1003 select 1 AS `i1`,8 AS `j1`,NULL AS `i2` from `test`.`t2` where 0
SELECT * FROM t1, t2
WHERE i1 = i2 AND ( FALSE OR ( j1 > 27 AND j1 < 100 OR j1 <= 3 ) AND j1 = i2 );
i1 j1 i2
diff --git a/mysql-test/r/selectivity.result b/mysql-test/r/selectivity.result
index 7400dff3958..cdb210ae2d9 100644
--- a/mysql-test/r/selectivity.result
+++ b/mysql-test/r/selectivity.result
@@ -784,7 +784,7 @@ select * from t1 where a < 1 and a > 7;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 0
+Note 1003 select 7 AS `a` from `test`.`t1` where 0
select * from t1 where a < 1 and a > 7;
a
drop table t1;
@@ -1508,7 +1508,7 @@ select * from t2 where col1 < 'b' and col1 > 'd';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
Warnings:
-Note 1003 select `test`.`t2`.`col1` AS `col1` from `test`.`t2` where 0
+Note 1003 select 'd' AS `col1` from `test`.`t2` where 0
drop table t1,t2;
set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
set use_stat_tables=@save_use_stat_tables;
diff --git a/mysql-test/r/selectivity_innodb.result b/mysql-test/r/selectivity_innodb.result
index 960a873c854..47d2e6fd554 100644
--- a/mysql-test/r/selectivity_innodb.result
+++ b/mysql-test/r/selectivity_innodb.result
@@ -791,7 +791,7 @@ select * from t1 where a < 1 and a > 7;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 0
+Note 1003 select 7 AS `a` from `test`.`t1` where 0
select * from t1 where a < 1 and a > 7;
a
drop table t1;
@@ -1518,7 +1518,7 @@ select * from t2 where col1 < 'b' and col1 > 'd';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
Warnings:
-Note 1003 select `test`.`t2`.`col1` AS `col1` from `test`.`t2` where 0
+Note 1003 select 'd' AS `col1` from `test`.`t2` where 0
drop table t1,t2;
set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
set use_stat_tables=@save_use_stat_tables;
diff --git a/mysql-test/r/signal.result b/mysql-test/r/signal.result
index 671df4b7f17..09493f0da30 100644
--- a/mysql-test/r/signal.result
+++ b/mysql-test/r/signal.result
@@ -1715,7 +1715,7 @@ show warnings $$
Level Code Message
Warning 1012 Raising a warning
Error 5555 RESIGNAL to not found
-Note 4092 At line 9 in test.test_resignal
+Note 4093 At line 9 in test.test_resignal
drop procedure test_resignal $$
create procedure test_resignal()
begin
@@ -1740,7 +1740,7 @@ show warnings $$
Level Code Message
Warning 1012 Raising a warning
Error 5555 RESIGNAL to error
-Note 4092 At line 9 in test.test_resignal
+Note 4093 At line 9 in test.test_resignal
drop procedure test_resignal $$
create procedure test_resignal()
begin
@@ -1789,7 +1789,7 @@ show warnings $$
Level Code Message
Error 1012 Raising a not found
Error 5555 RESIGNAL to not found
-Note 4092 At line 9 in test.test_resignal
+Note 4093 At line 9 in test.test_resignal
drop procedure test_resignal $$
create procedure test_resignal()
begin
@@ -1814,7 +1814,7 @@ show warnings $$
Level Code Message
Error 1012 Raising a not found
Error 5555 RESIGNAL to error
-Note 4092 At line 9 in test.test_resignal
+Note 4093 At line 9 in test.test_resignal
drop procedure test_resignal $$
create procedure test_resignal()
begin
@@ -1863,7 +1863,7 @@ show warnings $$
Level Code Message
Error 1012 Raising an error
Error 5555 RESIGNAL to not found
-Note 4092 At line 9 in test.test_resignal
+Note 4093 At line 9 in test.test_resignal
drop procedure test_resignal $$
create procedure test_resignal()
begin
@@ -1888,7 +1888,7 @@ show warnings $$
Level Code Message
Error 1012 Raising an error
Error 5555 RESIGNAL to error
-Note 4092 At line 9 in test.test_resignal
+Note 4093 At line 9 in test.test_resignal
drop procedure test_resignal $$
create procedure test_resignal()
begin
@@ -1931,7 +1931,7 @@ show warnings $$
Level Code Message
Warning 1264 Out of range value for column 'a' at row 1
Error 5555 RESIGNAL to a not found
-Note 4092 At line 8 in test.test_resignal
+Note 4093 At line 8 in test.test_resignal
drop procedure test_resignal $$
create procedure test_resignal()
begin
@@ -1953,7 +1953,7 @@ show warnings $$
Level Code Message
Warning 1264 Out of range value for column 'a' at row 1
Error 5555 RESIGNAL to an error
-Note 4092 At line 8 in test.test_resignal
+Note 4093 At line 8 in test.test_resignal
drop procedure test_resignal $$
create procedure test_resignal()
begin
@@ -2004,7 +2004,7 @@ show warnings $$
Level Code Message
Error 1329 No data - zero rows fetched, selected, or processed
Error 5555 RESIGNAL to a not found
-Note 4092 At line 10 in test.test_resignal
+Note 4093 At line 10 in test.test_resignal
drop procedure test_resignal $$
create procedure test_resignal()
begin
@@ -2030,7 +2030,7 @@ show warnings $$
Level Code Message
Error 1329 No data - zero rows fetched, selected, or processed
Error 5555 RESIGNAL to an error
-Note 4092 At line 10 in test.test_resignal
+Note 4093 At line 10 in test.test_resignal
drop procedure test_resignal $$
create procedure test_resignal()
begin
@@ -2073,7 +2073,7 @@ show warnings $$
Level Code Message
Error 1051 Unknown table 'test.no_such_table'
Error 5555 RESIGNAL to a not found
-Note 4092 At line 8 in test.test_resignal
+Note 4093 At line 8 in test.test_resignal
drop procedure test_resignal $$
create procedure test_resignal()
begin
@@ -2095,7 +2095,7 @@ show warnings $$
Level Code Message
Error 1051 Unknown table 'test.no_such_table'
Error 5555 RESIGNAL to an error
-Note 4092 At line 8 in test.test_resignal
+Note 4093 At line 8 in test.test_resignal
drop procedure test_resignal $$
#
# More complex cases
@@ -2142,7 +2142,7 @@ ERROR 42000: Hi, I am a useless error message
show warnings $$
Level Code Message
Error 9999 Hi, I am a useless error message
-Note 4092 At line 7 in test.peter_p2
+Note 4093 At line 7 in test.peter_p2
drop procedure peter_p1 $$
drop procedure peter_p2 $$
CREATE PROCEDURE peter_p1 ()
@@ -2198,16 +2198,16 @@ Level Code Message
Error 1231 Variable 'sql_mode' can't be set to the value of 'NULL'
Error 1232 Variable 'sql_mode' can't be set to the value of 'NULL'
Error 9999 Variable 'sql_mode' can't be set to the value of 'NULL'
-Note 4092 At line 8 in test.peter_p1
+Note 4093 At line 8 in test.peter_p1
ERROR 42000: Hi, I am a useless error message
show warnings $$
Level Code Message
Error 1231 Variable 'sql_mode' can't be set to the value of 'NULL'
Error 1232 Variable 'sql_mode' can't be set to the value of 'NULL'
Error 9999 Variable 'sql_mode' can't be set to the value of 'NULL'
-Note 4092 At line 8 in test.peter_p1
+Note 4093 At line 8 in test.peter_p1
Error 9999 Hi, I am a useless error message
-Note 4092 At line 10 in test.peter_p2
+Note 4093 At line 10 in test.peter_p2
drop procedure peter_p1 $$
drop procedure peter_p2 $$
drop procedure if exists peter_p3 $$
@@ -2225,7 +2225,7 @@ show warnings $$
Level Code Message
Error 1 Original
Error 2 Original
-Note 4092 At line 4 in test.peter_p3
+Note 4093 At line 4 in test.peter_p3
drop procedure peter_p3 $$
drop table t_warn;
drop table t_cursor;
diff --git a/mysql-test/r/signal_demo3.result b/mysql-test/r/signal_demo3.result
index a98d587937c..1d597aaf71c 100644
--- a/mysql-test/r/signal_demo3.result
+++ b/mysql-test/r/signal_demo3.result
@@ -79,23 +79,23 @@ show warnings;
Level Code Message
Error 1051 Unknown table 'demo.oops_it_is_not_here'
Error 1644 Oops in proc_9
-Note 4092 At line 4 in demo.proc_9
+Note 4093 At line 4 in demo.proc_9
Error 1644 Oops in proc_8
-Note 4092 At line 4 in demo.proc_8
+Note 4093 At line 4 in demo.proc_8
Error 1644 Oops in proc_7
-Note 4092 At line 4 in demo.proc_7
+Note 4093 At line 4 in demo.proc_7
Error 1644 Oops in proc_6
-Note 4092 At line 4 in demo.proc_6
+Note 4093 At line 4 in demo.proc_6
Error 1644 Oops in proc_5
-Note 4092 At line 4 in demo.proc_5
+Note 4093 At line 4 in demo.proc_5
Error 1644 Oops in proc_4
-Note 4092 At line 4 in demo.proc_4
+Note 4093 At line 4 in demo.proc_4
Error 1644 Oops in proc_3
-Note 4092 At line 4 in demo.proc_3
+Note 4093 At line 4 in demo.proc_3
Error 1644 Oops in proc_2
-Note 4092 At line 4 in demo.proc_2
+Note 4093 At line 4 in demo.proc_2
Error 1644 Oops in proc_1
-Note 4092 At line 4 in demo.proc_1
+Note 4093 At line 4 in demo.proc_1
SET @@session.max_error_count = 5;
SELECT @@session.max_error_count;
@@session.max_error_count
@@ -104,11 +104,11 @@ call proc_1();
ERROR 45000: Oops in proc_1
show warnings;
Level Code Message
-Note 4092 At line 4 in demo.proc_3
+Note 4093 At line 4 in demo.proc_3
Error 1644 Oops in proc_2
-Note 4092 At line 4 in demo.proc_2
+Note 4093 At line 4 in demo.proc_2
Error 1644 Oops in proc_1
-Note 4092 At line 4 in demo.proc_1
+Note 4093 At line 4 in demo.proc_1
SET @@session.max_error_count = 7;
SELECT @@session.max_error_count;
@@session.max_error_count
@@ -117,13 +117,13 @@ call proc_1();
ERROR 45000: Oops in proc_1
show warnings;
Level Code Message
-Note 4092 At line 4 in demo.proc_4
+Note 4093 At line 4 in demo.proc_4
Error 1644 Oops in proc_3
-Note 4092 At line 4 in demo.proc_3
+Note 4093 At line 4 in demo.proc_3
Error 1644 Oops in proc_2
-Note 4092 At line 4 in demo.proc_2
+Note 4093 At line 4 in demo.proc_2
Error 1644 Oops in proc_1
-Note 4092 At line 4 in demo.proc_1
+Note 4093 At line 4 in demo.proc_1
SET @@session.max_error_count = 9;
SELECT @@session.max_error_count;
@@session.max_error_count
@@ -132,15 +132,15 @@ call proc_1();
ERROR 45000: Oops in proc_1
show warnings;
Level Code Message
-Note 4092 At line 4 in demo.proc_5
+Note 4093 At line 4 in demo.proc_5
Error 1644 Oops in proc_4
-Note 4092 At line 4 in demo.proc_4
+Note 4093 At line 4 in demo.proc_4
Error 1644 Oops in proc_3
-Note 4092 At line 4 in demo.proc_3
+Note 4093 At line 4 in demo.proc_3
Error 1644 Oops in proc_2
-Note 4092 At line 4 in demo.proc_2
+Note 4093 At line 4 in demo.proc_2
Error 1644 Oops in proc_1
-Note 4092 At line 4 in demo.proc_1
+Note 4093 At line 4 in demo.proc_1
drop database demo;
SET @@global.max_error_count = @start_global_value;
SELECT @@global.max_error_count;
diff --git a/mysql-test/r/sp-code.result b/mysql-test/r/sp-code.result
index ddb2901b8a4..3a4dc9db6f8 100644
--- a/mysql-test/r/sp-code.result
+++ b/mysql-test/r/sp-code.result
@@ -998,3 +998,306 @@ Pos Instruction
7 set b.a@1["a"] a.a@0["a"]
DROP PROCEDURE p1;
DROP TABLE t1;
+#
+# MDEV-14415 Add Oracle-style FOR loop to sql_mode=DEFAULT
+#
+# Integer range FOR loop
+CREATE PROCEDURE p1()
+BEGIN
+FOR i IN 1..3
+DO
+SELECT i;
+END FOR;
+END;
+$$
+CALL p1;
+i
+1
+i
+2
+i
+3
+SHOW PROCEDURE CODE p1;
+Pos Instruction
+0 set i@0 1
+1 set [upper_bound]@1 3
+2 jump_if_not 6(6) i@0 <= [upper_bound]@1
+3 stmt 0 "SELECT i"
+4 set i@0 i@0 + 1
+5 jump 2
+DROP PROCEDURE p1;
+# Nested integer range FOR loops
+CREATE PROCEDURE p1()
+BEGIN
+fori:
+FOR i IN 1..3
+DO
+forj:
+FOR j IN 1..3
+DO
+IF i = 3 THEN
+LEAVE fori;
+END IF;
+IF j = 3 THEN
+LEAVE forj;
+END IF;
+SELECT i,j;
+END FOR;
+END FOR;
+END;
+$$
+CALL p1;
+i j
+1 1
+i j
+1 2
+i j
+2 1
+i j
+2 2
+SHOW PROCEDURE CODE p1;
+Pos Instruction
+0 set i@0 1
+1 set [upper_bound]@1 3
+2 jump_if_not 17(17) i@0 <= [upper_bound]@1
+3 set j@2 1
+4 set [upper_bound]@3 3
+5 jump_if_not 13(13) j@2 <= [upper_bound]@3
+6 jump_if_not 8(8) i@0 = 3
+7 jump 17
+8 jump_if_not 10(10) j@2 = 3
+9 jump 13
+10 stmt 0 "SELECT i,j"
+11 set j@2 j@2 + 1
+12 jump 5
+13 set i@0 i@0 + 1
+14 jump 2
+DROP PROCEDURE p1;
+# Explicit cursor FOR loops
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE cur0 CURSOR FOR SELECT 10 AS a, 'b0' AS b;
+DECLARE cur1 CURSOR FOR SELECT 10 AS a, 'b0' AS b;
+DECLARE cur2 CURSOR FOR SELECT 10 AS a, 'b0' AS b;
+FOR rec1 IN cur1
+DO
+SELECT rec1.a, rec1.b;
+SET rec1.a= 11;
+SET rec1.b= 'b1';
+SELECT rec1.a, rec1.b;
+END FOR;
+FOR rec0 IN cur0
+DO
+SET rec0.a= 10;
+SET rec0.b='b0';
+END FOR;
+FOR rec2 IN cur2
+DO
+SET rec2.a= 10;
+SET rec2.b='b0';
+END FOR;
+END;
+$$
+SHOW PROCEDURE CODE p1;
+Pos Instruction
+0 cpush cur0@0
+1 cpush cur1@1
+2 cpush cur2@2
+3 cursor_copy_struct cur1 rec1@0
+4 copen cur1@1
+5 cfetch cur1@1 rec1@0
+6 jump_if_not 13(13) `cur1`%FOUND
+7 stmt 0 "SELECT rec1.a, rec1.b"
+8 set rec1.a@0["a"] 11
+9 set rec1.b@0["b"] 'b1'
+10 stmt 0 "SELECT rec1.a, rec1.b"
+11 cfetch cur1@1 rec1@0
+12 jump 6
+13 cursor_copy_struct cur0 rec0@1
+14 copen cur0@0
+15 cfetch cur0@0 rec0@1
+16 jump_if_not 21(21) `cur0`%FOUND
+17 set rec0.a@1["a"] 10
+18 set rec0.b@1["b"] 'b0'
+19 cfetch cur0@0 rec0@1
+20 jump 16
+21 cursor_copy_struct cur2 rec2@2
+22 copen cur2@2
+23 cfetch cur2@2 rec2@2
+24 jump_if_not 29(29) `cur2`%FOUND
+25 set rec2.a@2["a"] 10
+26 set rec2.b@2["b"] 'b0'
+27 cfetch cur2@2 rec2@2
+28 jump 24
+29 cpop 3
+DROP PROCEDURE p1;
+# Nested explicit cursor FOR loops
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE cur0 CURSOR FOR SELECT 10 AS a, 'b0' AS b;
+FOR rec0 IN cur0
+DO
+BEGIN
+DECLARE cur1 CURSOR FOR SELECT 11 AS a, 'b1' AS b;
+SET rec0.a= 11;
+SET rec0.b= 'b0';
+FOR rec1 IN cur1
+DO
+SET rec1.a= 11;
+SET rec1.b= 'b1';
+BEGIN
+DECLARE cur2 CURSOR FOR SELECT 12 AS a, 'b2' AS b;
+FOR rec2 IN cur2
+DO
+SET rec2.a=12;
+SET rec2.b='b2';
+END FOR;
+END;
+END FOR;
+END;
+END FOR;
+END;
+$$
+SHOW PROCEDURE CODE p1;
+Pos Instruction
+0 cpush cur0@0
+1 cursor_copy_struct cur0 rec0@0
+2 copen cur0@0
+3 cfetch cur0@0 rec0@0
+4 jump_if_not 29(29) `cur0`%FOUND
+5 cpush cur1@1
+6 set rec0.a@0["a"] 11
+7 set rec0.b@0["b"] 'b0'
+8 cursor_copy_struct cur1 rec1@1
+9 copen cur1@1
+10 cfetch cur1@1 rec1@1
+11 jump_if_not 26(26) `cur1`%FOUND
+12 set rec1.a@1["a"] 11
+13 set rec1.b@1["b"] 'b1'
+14 cpush cur2@2
+15 cursor_copy_struct cur2 rec2@2
+16 copen cur2@2
+17 cfetch cur2@2 rec2@2
+18 jump_if_not 23(23) `cur2`%FOUND
+19 set rec2.a@2["a"] 12
+20 set rec2.b@2["b"] 'b2'
+21 cfetch cur2@2 rec2@2
+22 jump 18
+23 cpop 1
+24 cfetch cur1@1 rec1@1
+25 jump 11
+26 cpop 1
+27 cfetch cur0@0 rec0@0
+28 jump 4
+29 cpop 1
+DROP PROCEDURE p1;
+# Implicit cursor FOR loops
+CREATE PROCEDURE p1()
+BEGIN
+FOR rec1 IN (SELECT 11 AS a, 'b1' AS b)
+DO
+SELECT rec1.a, rec1.b;
+SET rec1.a= 11;
+SET rec1.b= 'b1';
+SELECT rec1.a, rec1.b;
+END FOR;
+FOR rec0 IN (SELECT 10 AS a, 'b0' AS b)
+DO
+SET rec0.a= 10;
+SET rec0.b='b0';
+END FOR;
+FOR rec2 IN (SELECT 12 AS a, 'b2' AS b)
+DO
+SET rec2.a= 10;
+SET rec2.b='b0';
+END FOR;
+END;
+$$
+SHOW PROCEDURE CODE p1;
+Pos Instruction
+0 cpush [implicit_cursor]@0
+1 cursor_copy_struct [implicit_cursor] rec1@0
+2 copen [implicit_cursor]@0
+3 cfetch [implicit_cursor]@0 rec1@0
+4 jump_if_not 11(11) `[implicit_cursor]`%FOUND
+5 stmt 0 "SELECT rec1.a, rec1.b"
+6 set rec1.a@0["a"] 11
+7 set rec1.b@0["b"] 'b1'
+8 stmt 0 "SELECT rec1.a, rec1.b"
+9 cfetch [implicit_cursor]@0 rec1@0
+10 jump 4
+11 cpop 1
+12 cpush [implicit_cursor]@0
+13 cursor_copy_struct [implicit_cursor] rec0@1
+14 copen [implicit_cursor]@0
+15 cfetch [implicit_cursor]@0 rec0@1
+16 jump_if_not 21(21) `[implicit_cursor]`%FOUND
+17 set rec0.a@1["a"] 10
+18 set rec0.b@1["b"] 'b0'
+19 cfetch [implicit_cursor]@0 rec0@1
+20 jump 16
+21 cpop 1
+22 cpush [implicit_cursor]@0
+23 cursor_copy_struct [implicit_cursor] rec2@2
+24 copen [implicit_cursor]@0
+25 cfetch [implicit_cursor]@0 rec2@2
+26 jump_if_not 31(31) `[implicit_cursor]`%FOUND
+27 set rec2.a@2["a"] 10
+28 set rec2.b@2["b"] 'b0'
+29 cfetch [implicit_cursor]@0 rec2@2
+30 jump 26
+31 cpop 1
+DROP PROCEDURE p1;
+# Nested implicit cursor FOR loops
+CREATE PROCEDURE p1()
+BEGIN
+FOR rec0 IN (SELECT 10 AS a, 'b0' AS b)
+DO
+SET rec0.a= 11;
+SET rec0.b= 'b0';
+FOR rec1 IN (SELECT 11 AS a, 'b1' AS b)
+DO
+SET rec1.a= 11;
+SET rec1.b= 'b1';
+FOR rec2 IN (SELECT 12 AS a, 'b2' AS b)
+DO
+SET rec2.a=12;
+SET rec2.b='b2';
+END FOR;
+END FOR;
+END FOR;
+END;
+$$
+SHOW PROCEDURE CODE p1;
+Pos Instruction
+0 cpush [implicit_cursor]@0
+1 cursor_copy_struct [implicit_cursor] rec0@0
+2 copen [implicit_cursor]@0
+3 cfetch [implicit_cursor]@0 rec0@0
+4 jump_if_not 29(29) `[implicit_cursor]`%FOUND
+5 set rec0.a@0["a"] 11
+6 set rec0.b@0["b"] 'b0'
+7 cpush [implicit_cursor]@1
+8 cursor_copy_struct [implicit_cursor] rec1@1
+9 copen [implicit_cursor]@1
+10 cfetch [implicit_cursor]@1 rec1@1
+11 jump_if_not 26(26) `[implicit_cursor]`%FOUND
+12 set rec1.a@1["a"] 11
+13 set rec1.b@1["b"] 'b1'
+14 cpush [implicit_cursor]@2
+15 cursor_copy_struct [implicit_cursor] rec2@2
+16 copen [implicit_cursor]@2
+17 cfetch [implicit_cursor]@2 rec2@2
+18 jump_if_not 23(23) `[implicit_cursor]`%FOUND
+19 set rec2.a@2["a"] 12
+20 set rec2.b@2["b"] 'b2'
+21 cfetch [implicit_cursor]@2 rec2@2
+22 jump 18
+23 cpop 1
+24 cfetch [implicit_cursor]@1 rec1@1
+25 jump 11
+26 cpop 1
+27 cfetch [implicit_cursor]@0 rec0@0
+28 jump 4
+29 cpop 1
+DROP PROCEDURE p1;
diff --git a/mysql-test/r/sp-cursor.result b/mysql-test/r/sp-cursor.result
index d068c19b22b..1f8cb7f0635 100644
--- a/mysql-test/r/sp-cursor.result
+++ b/mysql-test/r/sp-cursor.result
@@ -480,3 +480,134 @@ DROP PROCEDURE p1;
#
# End of MDEV-12457 Cursors with parameters
#
+#
+# MDEV-14415 Add Oracle-style FOR loop to sql_mode=DEFAULT
+#
+# Explicit cursor
+CREATE TABLE t1 (a INT, b VARCHAR(10));
+INSERT INTO t1 VALUES (1,'b1'), (2,'b2'), (3,'b3');
+BEGIN NOT ATOMIC
+DECLARE cur CURSOR FOR SELECT * FROM t1;
+FOR rec IN cur
+DO
+SELECT rec.a AS a, rec.b AS b;
+END FOR;
+END;
+$$
+a b
+1 b1
+a b
+2 b2
+a b
+3 b3
+DROP TABLE t1;
+# Explicit cursor with parameters
+CREATE TABLE t1 (a INT, b VARCHAR(10));
+INSERT INTO t1 VALUES (1,'b1'), (2,'b2'), (3,'b3');
+BEGIN NOT ATOMIC
+DECLARE cur CURSOR(pa INT) FOR SELECT * FROM t1 WHERE a>=pa;
+FOR rec IN cur(2)
+DO
+SELECT rec.a AS a, rec.b AS b;
+END FOR;
+END;
+$$
+a b
+2 b2
+a b
+3 b3
+DROP TABLE t1;
+# Explicit cursor + label
+CREATE TABLE t1 (a INT, b VARCHAR(10));
+INSERT INTO t1 VALUES ('1','b1'), ('2','b2');
+BEGIN NOT ATOMIC
+DECLARE cur CURSOR FOR SELECT * FROM t1;
+forrec:
+FOR rec IN cur
+DO
+SELECT rec.a AS a, rec.b AS b;
+IF rec.a = 2 THEN
+LEAVE forrec;
+END IF;
+END FOR forrec;
+END;
+$$
+a b
+1 b1
+a b
+2 b2
+DROP TABLE t1;
+# Explicit cursor + FETCH inside the loop body produce an error on "NOT FOUND"
+BEGIN NOT ATOMIC
+DECLARE x INT;
+DECLARE cur CURSOR FOR SELECT 1 AS x;
+FOR rec IN cur
+DO
+FETCH cur INTO x;
+END FOR;
+END;
+$$
+ERROR 02000: No data - zero rows fetched, selected, or processed
+# Explicit cursor + FETCH inside the loop body are normally handled by "HANDLER FOR NOT FOUND"
+BEGIN NOT ATOMIC
+DECLARE done INT DEFAULT 0;
+DECLARE cur CURSOR FOR SELECT 1 AS x, 'y1' AS y UNION
+SELECT 2,'y2' UNION
+SELECT 3,'y3';
+DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
+forrec:
+FOR rec IN cur
+DO
+SELECT CONCAT(rec.x, ' ', rec.y) AS 'Implicit FETCH';
+FETCH cur INTO rec;
+IF done THEN
+SELECT 'NO DATA' AS `Explicit FETCH`;
+LEAVE forrec;
+ELSE
+SELECT CONCAT(rec.x, ' ', rec.y) AS 'Explicit FETCH';
+END IF;
+END FOR;
+END;
+$$
+Implicit FETCH
+1 y1
+Explicit FETCH
+2 y2
+Implicit FETCH
+3 y3
+Explicit FETCH
+NO DATA
+# Implicit cursor
+CREATE TABLE t1 (a INT, b VARCHAR(10));
+INSERT INTO t1 VALUES ('1','b1'), ('2','b2');
+BEGIN NOT ATOMIC
+FOR rec IN (SELECT * FROM t1)
+DO
+SELECT rec.a AS a, rec.b AS b;
+END FOR;
+END;
+$$
+a b
+1 b1
+a b
+2 b2
+DROP TABLE t1;
+# Implicit cursor + label
+CREATE TABLE t1 (a INT, b VARCHAR(10));
+INSERT INTO t1 VALUES ('1','b1'), ('2','b2');
+BEGIN NOT ATOMIC
+forrec:
+FOR rec IN (SELECT * FROM t1)
+DO
+SELECT rec.a AS a, rec.b AS b;
+IF rec.a = 2 THEN
+LEAVE forrec;
+END IF;
+END FOR;
+END;
+$$
+a b
+1 b1
+a b
+2 b2
+DROP TABLE t1;
diff --git a/mysql-test/r/sp-destruct.result b/mysql-test/r/sp-destruct.result
index 5bb3b17d4b8..112fdb3978d 100644
--- a/mysql-test/r/sp-destruct.result
+++ b/mysql-test/r/sp-destruct.result
@@ -1,4 +1,4 @@
-call mtr.add_suppression("Column count of mysql.proc is wrong. Expected 20, found 19. The table is probably corrupted");
+call mtr.add_suppression("Column count of mysql.proc is wrong. Expected 21, found 20. The table is probably corrupted");
call mtr.add_suppression("Stored routine .test...bug14233_[123].: invalid value in column mysql.proc");
flush table mysql.proc;
use test;
@@ -14,13 +14,13 @@ create table t1 (id int);
create trigger t1_ai after insert on t1 for each row call bug14233();
alter table mysql.proc drop security_type;
call bug14233();
-ERROR HY000: Column count of mysql.proc is wrong. Expected 20, found 19. The table is probably corrupted
+ERROR HY000: Column count of mysql.proc is wrong. Expected 21, found 20. The table is probably corrupted
create view v1 as select bug14233_f();
-ERROR HY000: Column count of mysql.proc is wrong. Expected 20, found 19. The table is probably corrupted
+ERROR HY000: Column count of mysql.proc is wrong. Expected 21, found 20. The table is probably corrupted
insert into t1 values (0);
-ERROR HY000: Column count of mysql.proc is wrong. Expected 20, found 19. The table is probably corrupted
+ERROR HY000: Column count of mysql.proc is wrong. Expected 21, found 20. The table is probably corrupted
show procedure status;
-ERROR HY000: Column count of mysql.proc is wrong. Expected 20, found 19. The table is probably corrupted
+ERROR HY000: Column count of mysql.proc is wrong. Expected 21, found 20. The table is probably corrupted
flush table mysql.proc;
call bug14233();
ERROR HY000: Incorrect information in file: './mysql/proc.frm'
@@ -146,7 +146,7 @@ alter table mysql.proc drop column security_type;
# The below statement should not cause assertion failure.
drop database mysqltest;
Warnings:
-Error 1805 Column count of mysql.proc is wrong. Expected 20, found 19. The table is probably corrupted
+Error 1805 Column count of mysql.proc is wrong. Expected 21, found 20. The table is probably corrupted
# Restore mysql.proc.
drop table mysql.proc;
#
diff --git a/mysql-test/r/sp-error.result b/mysql-test/r/sp-error.result
index f0bc1874850..ad4b18fc37a 100644
--- a/mysql-test/r/sp-error.result
+++ b/mysql-test/r/sp-error.result
@@ -1212,7 +1212,7 @@ ERROR 42S02: Unknown table 'c' in field list
drop procedure bug15091;
drop function if exists bug16896;
create aggregate function bug16896() returns int return 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 '() returns int return 1' at line 1
+ERROR HY000: Aggregate specific instruction(FETCH GROUP NEXT ROW) missing from the aggregate function
DROP PROCEDURE IF EXISTS bug14702;
CREATE IF NOT EXISTS PROCEDURE bug14702()
BEGIN
@@ -1990,8 +1990,8 @@ Warning 1264 Out of range value for column 'a' at row 1
Note 1292 Truncated incorrect INTEGER value: '222222 '
Warning 1264 Out of range value for column 'b' at row 1
Error 1048 Column 'c' cannot be null
-Note 4092 At line 6 in test.t1_bi
-Note 4092 At line 2 in test.p1
+Note 4093 At line 6 in test.t1_bi
+Note 4093 At line 2 in test.p1
DROP TABLE t1;
DROP TABLE t2;
diff --git a/mysql-test/r/sp-for-loop.result b/mysql-test/r/sp-for-loop.result
new file mode 100644
index 00000000000..0da09586df5
--- /dev/null
+++ b/mysql-test/r/sp-for-loop.result
@@ -0,0 +1,208 @@
+#
+# MDEV-14415 Add Oracle-style FOR loop to sql_mode=DEFAULT
+#
+CREATE TABLE t1 (a INT);
+FOR i IN 1..3
+DO
+INSERT INTO t1 VALUES (i);
+END FOR;
+/
+SELECT * FROM t1;
+a
+1
+2
+3
+DROP TABLE t1;
+CREATE FUNCTION f1 (lower_bound INT, upper_bound INT, lim INT) RETURNS INT
+BEGIN
+DECLARE total INT DEFAULT 0;
+FOR i IN lower_bound . . upper_bound
+DO
+NULL
+END FOR;
+RETURN total;
+END;
+/
+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 '. upper_bound
+DO
+NULL
+END FOR;
+RETURN total;
+END' at line 4
+CREATE FUNCTION f1 (lower_bound INT, upper_bound INT, lim INT) RETURNS INT
+BEGIN
+DECLARE total INT DEFAULT 0;
+lab:
+FOR i IN lower_bound .. upper_bound
+DO
+SET total= total + i;
+IF i = lim THEN
+LEAVE lab;
+END IF;
+-- Bounds are calculated only once.
+-- The below assignments have no effect on the loop condition
+SET lower_bound= 900;
+SET upper_bound= 1000;
+END FOR;
+RETURN total;
+END;
+/
+SELECT f1(1, 3, 100) FROM DUAL;
+f1(1, 3, 100)
+6
+SELECT f1(1, 3, 2) FROM DUAL;
+f1(1, 3, 2)
+3
+DROP FUNCTION f1;
+CREATE FUNCTION f1() RETURNS INT
+BEGIN
+DECLARE total INT DEFAULT 0;
+FOR i IN 1 .. 5
+DO
+SET total= total + 1000;
+forj:
+FOR j IN 1 .. 5
+DO
+SET total= total + 1;
+IF j = 3 THEN
+LEAVE forj; -- End the internal loop
+END IF;
+END FOR;
+END FOR;
+RETURN total;
+END;
+/
+SELECT f1() FROM DUAL;
+f1()
+5015
+DROP FUNCTION f1;
+CREATE FUNCTION f1 (a INT, b INT) RETURNS INT
+BEGIN
+DECLARE total INT DEFAULT 0;
+fori:
+FOR i IN REVERSE a..1
+DO
+SET total= total + i;
+IF i = b THEN
+LEAVE fori;
+END IF;
+END FOR;
+RETURN total;
+END
+/
+SELECT f1(3, 100) FROM DUAL;
+f1(3, 100)
+6
+SELECT f1(3, 2) FROM DUAL;
+f1(3, 2)
+5
+DROP FUNCTION f1;
+# Testing labeled FOR LOOP statement
+CREATE FUNCTION f1 (a INT, limita INT, b INT, limitb INT) RETURNS INT
+BEGIN
+DECLARE total INT DEFAULT 0;
+la:
+FOR ia IN 1 .. a
+DO
+SET total= total + 1000;
+lb:
+FOR ib IN 1 .. b
+DO
+SET total= total + 1;
+IF ib = limitb THEN
+LEAVE lb;
+END IF;
+IF ia = limita THEN
+LEAVE la;
+END IF;
+END FOR lb;
+END FOR la;
+RETURN total;
+END;
+/
+SELECT f1(1, 1, 1, 1) FROM DUAL;
+f1(1, 1, 1, 1)
+1001
+SELECT f1(1, 2, 1, 2) FROM DUAL;
+f1(1, 2, 1, 2)
+1001
+SELECT f1(2, 1, 2, 1) FROM DUAL;
+f1(2, 1, 2, 1)
+2002
+SELECT f1(2, 1, 2, 2) FROM DUAL;
+f1(2, 1, 2, 2)
+1001
+SELECT f1(2, 2, 2, 2) FROM DUAL;
+f1(2, 2, 2, 2)
+2003
+SELECT f1(2, 3, 2, 3) FROM DUAL;
+f1(2, 3, 2, 3)
+2004
+DROP FUNCTION f1;
+# Testing labeled ITERATE in a labeled FOR LOOP statement
+CREATE FUNCTION f1 (a INT, b INT, blim INT) RETURNS INT
+BEGIN
+DECLARE total INT DEFAULT 0;
+la:
+FOR ia IN 1 .. a
+DO
+SET total= total + 1000;
+BEGIN
+DECLARE ib INT DEFAULT 1;
+WHILE ib <= b
+DO
+IF ib > blim THEN
+ITERATE la;
+END IF;
+SET ib= ib + 1;
+SET total= total + 1;
+END WHILE;
+END;
+END FOR la;
+RETURN total;
+END;
+/
+SELECT f1(3,3,0), f1(3,3,1), f1(3,3,2), f1(3,3,3), f1(3,3,4) FROM DUAL;
+f1(3,3,0) f1(3,3,1) f1(3,3,2) f1(3,3,3) f1(3,3,4)
+3000 3003 3006 3009 3009
+DROP FUNCTION f1;
+# Testing INTERATE statement
+CREATE FUNCTION f1(a INT) RETURNS INT
+BEGIN
+DECLARE total INT DEFAULT 0;
+fori:
+FOR i IN 1 .. a
+DO
+IF i=5 THEN
+ITERATE fori;
+END IF;
+SET total= total + 1;
+END FOR;
+RETURN total;
+END;
+/
+SELECT f1(3), f1(4), f1(5), f1(6) FROM DUAL;
+f1(3) f1(4) f1(5) f1(6)
+3 4 4 5
+DROP FUNCTION f1;
+CREATE FUNCTION f1(a INT) RETURNS INT
+BEGIN
+DECLARE total INT DEFAULT 0;
+lj:
+FOR j IN 1 .. 2
+DO
+FOR i IN 1 .. a
+DO
+IF i=5 THEN
+ITERATE lj;
+END IF;
+SET total= total + 1;
+END FOR;
+END FOR;
+RETURN total;
+END;
+/
+SELECT f1(3), f1(4), f1(5) FROM DUAL;
+f1(3) f1(4) f1(5)
+6 8 8
+DROP FUNCTION f1;
diff --git a/mysql-test/r/sp-group.result b/mysql-test/r/sp-group.result
index 535e67046d8..800d83f1f74 100644
--- a/mysql-test/r/sp-group.result
+++ b/mysql-test/r/sp-group.result
@@ -3,7 +3,7 @@ Warnings:
Note 1051 Unknown table 'test.t1'
drop view if exists view_t1;
Warnings:
-Note 4090 Unknown VIEW: 'test.view_t1'
+Note 4091 Unknown VIEW: 'test.view_t1'
SET sql_mode=ONLY_FULL_GROUP_BY;
CREATE TABLE t1 (
pk INT,
diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result
index b66faec260f..3b8f35e0c79 100644
--- a/mysql-test/r/sp.result
+++ b/mysql-test/r/sp.result
@@ -3211,7 +3211,7 @@ drop procedure bug10961|
DROP PROCEDURE IF EXISTS bug6866|
DROP VIEW IF EXISTS tv|
Warnings:
-Note 4090 Unknown VIEW: 'test.tv'
+Note 4091 Unknown VIEW: 'test.tv'
DROP TABLE IF EXISTS tt1,tt2,tt3|
Warnings:
Note 1051 Unknown table 'test.tt1'
@@ -5324,7 +5324,7 @@ DROP PROCEDURE bug21414|
set names utf8|
drop database if exists това_е_дълго_име_за_база_данни_нали|
create database това_е_дълго_име_за_база_данни_нали|
-INSERT INTO mysql.proc VALUES ('това_е_дълго_име_за_база_данни_нали','това_е_процедура_с_доста_дълго_име_нали_и_още_по_дълго','PROCEDURE','това_е_процедура_с_доста_дълго_име_нали_и_още_по_дълго','SQL','CONTAINS_SQL','NO','DEFINER','','','bad_body','root@localhost',now(), now(),'','', 'utf8', 'utf8_general_ci', 'utf8_general_ci', 'n/a')|
+INSERT INTO mysql.proc VALUES ('това_е_дълго_име_за_база_данни_нали','това_е_процедура_с_доста_дълго_име_нали_и_още_по_дълго','PROCEDURE','това_е_процедура_с_доста_дълго_име_нали_и_още_по_дълго','SQL','CONTAINS_SQL','NO','DEFINER','','','bad_body','root@localhost',now(), now(),'','', 'utf8', 'utf8_general_ci', 'utf8_general_ci', 'n/a', 'NONE')|
call това_е_дълго_име_за_база_данни_нали.това_е_процедура_с_доста_дълго_име_нали_и_още_по_дълго()|
ERROR HY000: Failed to load routine това_е_дълго_име_за_база_данни_нали.това_е_процедура_с_доста_дълго_име_нали_и_още_по_дълго. The table mysql.proc is missing, corrupt, or contains bad data (internal code -6)
drop database това_е_дълго_име_за_база_данни_нали|
@@ -7823,7 +7823,7 @@ ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
show warnings;
Level Code Message
Error 1062 Duplicate entry '2' for key 'PRIMARY'
-Note 4092 At line 5 in test.p1
+Note 4093 At line 5 in test.p1
select * from t1;
id
1
@@ -8116,6 +8116,18 @@ CALL p();
drop procedure p;
drop view v;
drop table t, tmp_t;
+#
+# MDEV-13936: Server crashes in Time_and_counter_tracker::incr_loops
+#
+CREATE TABLE t1 (i INT);
+CREATE VIEW v1 AS SELECT * FROM t1 WHERE RAND() > 0.5;
+CREATE FUNCTION f1() RETURNS INT RETURN ( SELECT MAX(i) FROM v1 );
+REPLACE INTO v1 VALUES (f1());
+ERROR HY000: The target table v1 of the INSERT is not insertable-into
+SET @aux = f1();
+DROP FUNCTION f1;
+DROP VIEW v1;
+DROP TABLE t1;
#End of 10.1 tests
#
# MDEV-11081: CURSOR for query with GROUP BY
diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result
index 7ba8b545e6a..8e46fa91c2c 100644
--- a/mysql-test/r/subselect.result
+++ b/mysql-test/r/subselect.result
@@ -1161,20 +1161,20 @@ drop table t1;
CREATE TABLE t1 (a int(1));
EXPLAIN EXTENDED SELECT (SELECT RAND() FROM t1) FROM t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 const row not found
-2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found
+1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 Const row not found
+2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 Const row not found
Warnings:
Note 1003 /* select#1 */ select (/* select#2 */ select rand() from `test`.`t1`) AS `(SELECT RAND() FROM t1)` from `test`.`t1`
EXPLAIN EXTENDED SELECT (SELECT ENCRYPT('test') FROM t1) FROM t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 const row not found
-2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found
+1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 Const row not found
+2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 Const row not found
Warnings:
Note 1003 /* select#1 */ select (/* select#2 */ select encrypt('test') from `test`.`t1`) AS `(SELECT ENCRYPT('test') FROM t1)` from `test`.`t1`
EXPLAIN EXTENDED SELECT (SELECT BENCHMARK(1,1) FROM t1) FROM t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 const row not found
-2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found
+1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 Const row not found
+2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 Const row not found
Warnings:
Note 1003 /* select#1 */ select (/* select#2 */ select benchmark(1,1) from `test`.`t1`) AS `(SELECT BENCHMARK(1,1) FROM t1)` from `test`.`t1`
drop table t1;
@@ -1644,7 +1644,7 @@ a
explain extended select * from t3 where a >= all (select b from t2);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
-2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
+2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found
Warnings:
Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,(/* select#2 */ select max(NULL) from `test`.`t2`) > <cache>(`test`.`t3`.`a`)))
select * from t3 where a >= some (select b from t2);
@@ -1652,7 +1652,7 @@ a
explain extended select * from t3 where a >= some (select b from t2);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
-2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
+2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found
Warnings:
Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,(/* select#2 */ select min(NULL) from `test`.`t2`) <= <cache>(`test`.`t3`.`a`)))
select * from t3 where a >= all (select b from t2 group by 1);
@@ -1663,7 +1663,7 @@ a
explain extended select * from t3 where a >= all (select b from t2 group by 1);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
-2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
+2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found
Warnings:
Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,(/* select#2 */ select max(NULL) from `test`.`t2`) > <cache>(`test`.`t3`.`a`)))
select * from t3 where a >= some (select b from t2 group by 1);
@@ -1671,7 +1671,7 @@ a
explain extended select * from t3 where a >= some (select b from t2 group by 1);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
-2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
+2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found
Warnings:
Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,(/* select#2 */ select min(NULL) from `test`.`t2`) <= <cache>(`test`.`t3`.`a`)))
select * from t3 where NULL >= any (select b from t2);
@@ -3734,7 +3734,7 @@ from t1' at line 1
explain select * from t1 where not exists
((select t11.i from t1 t11) union (select t12.i from t1 t12));
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 system NULL NULL NULL NULL 0 const row not found
+1 PRIMARY t1 system NULL NULL NULL NULL 0 Const row not found
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table
3 UNION NULL NULL NULL NULL NULL NULL NULL no matching row in const table
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
@@ -6120,7 +6120,7 @@ FROM t1 AS sq4_alias1
WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
sq4_alias1.col_varchar_key = @var3;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE sq4_alias1 system NULL NULL NULL NULL 0 const row not found
+1 SIMPLE sq4_alias1 system NULL NULL NULL NULL 0 Const row not found
SELECT @var3:=12, sq4_alias1.*
FROM t1 AS sq4_alias1
WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
@@ -6134,7 +6134,7 @@ FROM t1 AS sq4_alias1
WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
sq4_alias1.col_varchar_key = @var3 ) AS alias3;
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY <derived2> system NULL NULL NULL NULL 0 const row not found
+1 PRIMARY <derived2> system NULL NULL NULL NULL 0 Const row not found
2 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table
SELECT * FROM ( SELECT @var3:=12, sq4_alias1.*
FROM t1 AS sq4_alias1
@@ -6720,7 +6720,7 @@ CREATE TABLE t2 (b INT);
EXPLAIN
SELECT SUM(a) AS f1, a AS f2 FROM (t1, t2) HAVING f2 >= ALL (SELECT 4 UNION SELECT 5) AND f1 = 7;
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t2 system NULL NULL NULL NULL 0 const row not found
+1 PRIMARY t2 system NULL NULL NULL NULL 0 Const row not found
1 PRIMARY t1 ALL NULL NULL NULL NULL 2
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used
3 UNION NULL NULL NULL NULL NULL NULL NULL No tables used
diff --git a/mysql-test/r/subselect4.result b/mysql-test/r/subselect4.result
index 6126a7ed3f5..d3f46429cf7 100644
--- a/mysql-test/r/subselect4.result
+++ b/mysql-test/r/subselect4.result
@@ -21,7 +21,7 @@ ORDER BY count(*);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 index NULL a 5 NULL 2 Using index
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
-3 DEPENDENT SUBQUERY t3 system NULL NULL NULL NULL 0 const row not found
+3 DEPENDENT SUBQUERY t3 system NULL NULL NULL NULL 0 Const row not found
# should not crash the next statement
SELECT 1 FROM t1
WHERE NOT EXISTS (SELECT 1 FROM t2 WHERE 1 = (SELECT MIN(t2.b) FROM t3))
@@ -1261,7 +1261,7 @@ SET optimizer_switch='materialization=off';
EXPLAIN
SELECT * FROM t1 RIGHT JOIN t2 ON t1.c1 WHERE 's' IN (SELECT c1 FROM t2);
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 system NULL NULL NULL NULL 0 const row not found
+1 PRIMARY t1 system NULL NULL NULL NULL 0 Const row not found
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where; FirstMatch(t1)
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join)
SELECT * FROM t1 RIGHT JOIN t2 ON t1.c1 WHERE 's' IN (SELECT c1 FROM t2);
@@ -1269,7 +1269,7 @@ c1 c1
EXPLAIN
SELECT * FROM t2 LEFT JOIN t1 ON t1.c1 WHERE 's' IN (SELECT c1 FROM t2);
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 system NULL NULL NULL NULL 0 const row not found
+1 PRIMARY t1 system NULL NULL NULL NULL 0 Const row not found
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where; FirstMatch(t1)
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join)
SELECT * FROM t2 LEFT JOIN t1 ON t1.c1 WHERE 's' IN (SELECT c1 FROM t2);
@@ -1278,7 +1278,7 @@ SET optimizer_switch='materialization=on';
EXPLAIN
SELECT * FROM (t2 LEFT JOIN t1 ON t1.c1) LEFT JOIN t3 on t3.c1 WHERE 's' IN (SELECT c1 FROM t2);
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 system NULL NULL NULL NULL 0 const row not found
+1 PRIMARY t1 system NULL NULL NULL NULL 0 Const row not found
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join)
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 Using where
@@ -2191,7 +2191,7 @@ INSERT INTO t2 VALUES (1);
EXPLAIN
SELECT MAX(a), ( SELECT 1 FROM t2 ) AS bb FROM t1;
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 system NULL NULL NULL NULL 0 const row not found
+1 PRIMARY t1 system NULL NULL NULL NULL 0 Const row not found
2 SUBQUERY t2 system NULL NULL NULL NULL 1
SELECT MAX(a), ( SELECT 1 FROM t2 ) AS bb FROM t1;
MAX(a) bb
@@ -2199,7 +2199,7 @@ NULL 1
EXPLAIN
SELECT MAX(a), 1 in ( SELECT b FROM t2 ) AS bb FROM t1;
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 system NULL NULL NULL NULL 0 const row not found
+1 PRIMARY t1 system NULL NULL NULL NULL 0 Const row not found
2 SUBQUERY t2 system NULL NULL NULL NULL 1
SELECT MAX(a), 1 in ( SELECT b FROM t2 ) AS bb FROM t1;
MAX(a) bb
@@ -2207,7 +2207,7 @@ NULL 1
EXPLAIN
SELECT MAX(a), 1 >= ALL ( SELECT b FROM t2 ) AS bb FROM t1;
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 system NULL NULL NULL NULL 0 const row not found
+1 PRIMARY t1 system NULL NULL NULL NULL 0 Const row not found
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
SELECT MAX(a), 1 >= ALL ( SELECT b FROM t2 ) AS bb FROM t1;
MAX(a) bb
@@ -2215,7 +2215,7 @@ NULL 1
EXPLAIN
SELECT MAX(a), ( SELECT 1 FROM t2 where b = a) AS bb FROM t1;
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 system NULL NULL NULL NULL 0 const row not found
+1 PRIMARY t1 system NULL NULL NULL NULL 0 Const row not found
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
SELECT MAX(a), ( SELECT 1 FROM t2 where b = a) AS bb FROM t1;
MAX(a) bb
@@ -2223,7 +2223,7 @@ NULL NULL
EXPLAIN
SELECT MAX(a), a in ( SELECT b FROM t2 ) AS bb FROM t1;
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 system NULL NULL NULL NULL 0 const row not found
+1 PRIMARY t1 system NULL NULL NULL NULL 0 Const row not found
2 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 1
SELECT MAX(a), a in ( SELECT b FROM t2 ) AS bb FROM t1;
MAX(a) bb
@@ -2231,7 +2231,7 @@ NULL NULL
EXPLAIN
SELECT MAX(a), a >= ALL ( SELECT b FROM t2 ) AS bb FROM t1;
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 system NULL NULL NULL NULL 0 const row not found
+1 PRIMARY t1 system NULL NULL NULL NULL 0 Const row not found
2 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 1
SELECT MAX(a), a >= ALL ( SELECT b FROM t2 ) AS bb FROM t1;
MAX(a) bb
diff --git a/mysql-test/r/subselect_mat.result b/mysql-test/r/subselect_mat.result
index 350275d2463..6b5db62093e 100644
--- a/mysql-test/r/subselect_mat.result
+++ b/mysql-test/r/subselect_mat.result
@@ -2544,7 +2544,7 @@ SELECT i FROM t1 LEFT JOIN t2 ON (j) IN (SELECT k FROM t3);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 system NULL NULL NULL NULL 1
1 PRIMARY t2 ALL NULL NULL NULL NULL 1 Using where
-2 MATERIALIZED t3 system NULL NULL NULL NULL 0 const row not found
+2 MATERIALIZED t3 system NULL NULL NULL NULL 0 Const row not found
SELECT i FROM t1 LEFT JOIN t2 ON (j) IN (SELECT k FROM t3);
i
10
@@ -2553,7 +2553,7 @@ SELECT i FROM t1 LEFT JOIN t2 ON (j) IN (SELECT max(k) FROM t3);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 system NULL NULL NULL NULL 1
1 PRIMARY t2 ALL NULL NULL NULL NULL 1 Using where
-2 MATERIALIZED t3 system NULL NULL NULL NULL 0 const row not found
+2 MATERIALIZED t3 system NULL NULL NULL NULL 0 Const row not found
SELECT i FROM t1 LEFT JOIN t2 ON (j) IN (SELECT max(k) FROM t3);
i
10
diff --git a/mysql-test/r/subselect_mat_cost_bugs.result b/mysql-test/r/subselect_mat_cost_bugs.result
index b4feb8de200..125da8da517 100644
--- a/mysql-test/r/subselect_mat_cost_bugs.result
+++ b/mysql-test/r/subselect_mat_cost_bugs.result
@@ -162,7 +162,7 @@ EXPLAIN
SELECT * FROM (SELECT * FROM t2) AS a2
WHERE (SELECT distinct SUM(distinct f3 ) FROM t1);
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY <derived2> system NULL NULL NULL NULL 0 const row not found
+1 PRIMARY <derived2> system NULL NULL NULL NULL 0 Const row not found
3 SUBQUERY t1 index NULL f3 5 NULL 2 Using index
2 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table
insert into t2 values (1),(2);
diff --git a/mysql-test/r/subselect_no_exists_to_in.result b/mysql-test/r/subselect_no_exists_to_in.result
index c09f3c94710..51fe0aa80df 100644
--- a/mysql-test/r/subselect_no_exists_to_in.result
+++ b/mysql-test/r/subselect_no_exists_to_in.result
@@ -1165,20 +1165,20 @@ drop table t1;
CREATE TABLE t1 (a int(1));
EXPLAIN EXTENDED SELECT (SELECT RAND() FROM t1) FROM t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 const row not found
-2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found
+1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 Const row not found
+2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 Const row not found
Warnings:
Note 1003 /* select#1 */ select (/* select#2 */ select rand() from `test`.`t1`) AS `(SELECT RAND() FROM t1)` from `test`.`t1`
EXPLAIN EXTENDED SELECT (SELECT ENCRYPT('test') FROM t1) FROM t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 const row not found
-2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found
+1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 Const row not found
+2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 Const row not found
Warnings:
Note 1003 /* select#1 */ select (/* select#2 */ select encrypt('test') from `test`.`t1`) AS `(SELECT ENCRYPT('test') FROM t1)` from `test`.`t1`
EXPLAIN EXTENDED SELECT (SELECT BENCHMARK(1,1) FROM t1) FROM t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 const row not found
-2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found
+1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 Const row not found
+2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 Const row not found
Warnings:
Note 1003 /* select#1 */ select (/* select#2 */ select benchmark(1,1) from `test`.`t1`) AS `(SELECT BENCHMARK(1,1) FROM t1)` from `test`.`t1`
drop table t1;
@@ -1648,7 +1648,7 @@ a
explain extended select * from t3 where a >= all (select b from t2);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
-2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
+2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found
Warnings:
Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,(/* select#2 */ select max(NULL) from `test`.`t2`) > <cache>(`test`.`t3`.`a`)))
select * from t3 where a >= some (select b from t2);
@@ -1656,7 +1656,7 @@ a
explain extended select * from t3 where a >= some (select b from t2);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
-2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
+2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found
Warnings:
Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,(/* select#2 */ select min(NULL) from `test`.`t2`) <= <cache>(`test`.`t3`.`a`)))
select * from t3 where a >= all (select b from t2 group by 1);
@@ -1667,7 +1667,7 @@ a
explain extended select * from t3 where a >= all (select b from t2 group by 1);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
-2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
+2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found
Warnings:
Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,(/* select#2 */ select max(NULL) from `test`.`t2`) > <cache>(`test`.`t3`.`a`)))
select * from t3 where a >= some (select b from t2 group by 1);
@@ -1675,7 +1675,7 @@ a
explain extended select * from t3 where a >= some (select b from t2 group by 1);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
-2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
+2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found
Warnings:
Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,(/* select#2 */ select min(NULL) from `test`.`t2`) <= <cache>(`test`.`t3`.`a`)))
select * from t3 where NULL >= any (select b from t2);
@@ -3737,7 +3737,7 @@ from t1' at line 1
explain select * from t1 where not exists
((select t11.i from t1 t11) union (select t12.i from t1 t12));
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 system NULL NULL NULL NULL 0 const row not found
+1 PRIMARY t1 system NULL NULL NULL NULL 0 Const row not found
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table
3 UNION NULL NULL NULL NULL NULL NULL NULL no matching row in const table
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
@@ -6120,7 +6120,7 @@ FROM t1 AS sq4_alias1
WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
sq4_alias1.col_varchar_key = @var3;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE sq4_alias1 system NULL NULL NULL NULL 0 const row not found
+1 SIMPLE sq4_alias1 system NULL NULL NULL NULL 0 Const row not found
SELECT @var3:=12, sq4_alias1.*
FROM t1 AS sq4_alias1
WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
@@ -6134,7 +6134,7 @@ FROM t1 AS sq4_alias1
WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
sq4_alias1.col_varchar_key = @var3 ) AS alias3;
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY <derived2> system NULL NULL NULL NULL 0 const row not found
+1 PRIMARY <derived2> system NULL NULL NULL NULL 0 Const row not found
2 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table
SELECT * FROM ( SELECT @var3:=12, sq4_alias1.*
FROM t1 AS sq4_alias1
@@ -6720,7 +6720,7 @@ CREATE TABLE t2 (b INT);
EXPLAIN
SELECT SUM(a) AS f1, a AS f2 FROM (t1, t2) HAVING f2 >= ALL (SELECT 4 UNION SELECT 5) AND f1 = 7;
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t2 system NULL NULL NULL NULL 0 const row not found
+1 PRIMARY t2 system NULL NULL NULL NULL 0 Const row not found
1 PRIMARY t1 ALL NULL NULL NULL NULL 2
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used
3 UNION NULL NULL NULL NULL NULL NULL NULL No tables used
diff --git a/mysql-test/r/subselect_no_mat.result b/mysql-test/r/subselect_no_mat.result
index 0aefeaf44d9..6381e1939db 100644
--- a/mysql-test/r/subselect_no_mat.result
+++ b/mysql-test/r/subselect_no_mat.result
@@ -1168,20 +1168,20 @@ drop table t1;
CREATE TABLE t1 (a int(1));
EXPLAIN EXTENDED SELECT (SELECT RAND() FROM t1) FROM t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 const row not found
-2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found
+1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 Const row not found
+2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 Const row not found
Warnings:
Note 1003 /* select#1 */ select (/* select#2 */ select rand() from `test`.`t1`) AS `(SELECT RAND() FROM t1)` from `test`.`t1`
EXPLAIN EXTENDED SELECT (SELECT ENCRYPT('test') FROM t1) FROM t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 const row not found
-2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found
+1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 Const row not found
+2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 Const row not found
Warnings:
Note 1003 /* select#1 */ select (/* select#2 */ select encrypt('test') from `test`.`t1`) AS `(SELECT ENCRYPT('test') FROM t1)` from `test`.`t1`
EXPLAIN EXTENDED SELECT (SELECT BENCHMARK(1,1) FROM t1) FROM t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 const row not found
-2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found
+1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 Const row not found
+2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 Const row not found
Warnings:
Note 1003 /* select#1 */ select (/* select#2 */ select benchmark(1,1) from `test`.`t1`) AS `(SELECT BENCHMARK(1,1) FROM t1)` from `test`.`t1`
drop table t1;
@@ -1651,7 +1651,7 @@ a
explain extended select * from t3 where a >= all (select b from t2);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
-2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
+2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found
Warnings:
Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,(/* select#2 */ select max(NULL) from `test`.`t2`) > <cache>(`test`.`t3`.`a`)))
select * from t3 where a >= some (select b from t2);
@@ -1659,7 +1659,7 @@ a
explain extended select * from t3 where a >= some (select b from t2);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
-2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
+2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found
Warnings:
Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,(/* select#2 */ select min(NULL) from `test`.`t2`) <= <cache>(`test`.`t3`.`a`)))
select * from t3 where a >= all (select b from t2 group by 1);
@@ -1670,7 +1670,7 @@ a
explain extended select * from t3 where a >= all (select b from t2 group by 1);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
-2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
+2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found
Warnings:
Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,(/* select#2 */ select max(NULL) from `test`.`t2`) > <cache>(`test`.`t3`.`a`)))
select * from t3 where a >= some (select b from t2 group by 1);
@@ -1678,7 +1678,7 @@ a
explain extended select * from t3 where a >= some (select b from t2 group by 1);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
-2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
+2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found
Warnings:
Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,(/* select#2 */ select min(NULL) from `test`.`t2`) <= <cache>(`test`.`t3`.`a`)))
select * from t3 where NULL >= any (select b from t2);
@@ -3737,7 +3737,7 @@ from t1' at line 1
explain select * from t1 where not exists
((select t11.i from t1 t11) union (select t12.i from t1 t12));
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 system NULL NULL NULL NULL 0 const row not found
+1 PRIMARY t1 system NULL NULL NULL NULL 0 Const row not found
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table
3 UNION NULL NULL NULL NULL NULL NULL NULL no matching row in const table
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
@@ -6115,7 +6115,7 @@ FROM t1 AS sq4_alias1
WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
sq4_alias1.col_varchar_key = @var3;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE sq4_alias1 system NULL NULL NULL NULL 0 const row not found
+1 SIMPLE sq4_alias1 system NULL NULL NULL NULL 0 Const row not found
SELECT @var3:=12, sq4_alias1.*
FROM t1 AS sq4_alias1
WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
@@ -6129,7 +6129,7 @@ FROM t1 AS sq4_alias1
WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
sq4_alias1.col_varchar_key = @var3 ) AS alias3;
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY <derived2> system NULL NULL NULL NULL 0 const row not found
+1 PRIMARY <derived2> system NULL NULL NULL NULL 0 Const row not found
2 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table
SELECT * FROM ( SELECT @var3:=12, sq4_alias1.*
FROM t1 AS sq4_alias1
@@ -6715,7 +6715,7 @@ CREATE TABLE t2 (b INT);
EXPLAIN
SELECT SUM(a) AS f1, a AS f2 FROM (t1, t2) HAVING f2 >= ALL (SELECT 4 UNION SELECT 5) AND f1 = 7;
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t2 system NULL NULL NULL NULL 0 const row not found
+1 PRIMARY t2 system NULL NULL NULL NULL 0 Const row not found
1 PRIMARY t1 ALL NULL NULL NULL NULL 2
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used
3 UNION NULL NULL NULL NULL NULL NULL NULL No tables used
diff --git a/mysql-test/r/subselect_no_opts.result b/mysql-test/r/subselect_no_opts.result
index 92defb3c36d..1a56c333887 100644
--- a/mysql-test/r/subselect_no_opts.result
+++ b/mysql-test/r/subselect_no_opts.result
@@ -1164,20 +1164,20 @@ drop table t1;
CREATE TABLE t1 (a int(1));
EXPLAIN EXTENDED SELECT (SELECT RAND() FROM t1) FROM t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 const row not found
-2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found
+1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 Const row not found
+2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 Const row not found
Warnings:
Note 1003 /* select#1 */ select (/* select#2 */ select rand() from `test`.`t1`) AS `(SELECT RAND() FROM t1)` from `test`.`t1`
EXPLAIN EXTENDED SELECT (SELECT ENCRYPT('test') FROM t1) FROM t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 const row not found
-2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found
+1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 Const row not found
+2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 Const row not found
Warnings:
Note 1003 /* select#1 */ select (/* select#2 */ select encrypt('test') from `test`.`t1`) AS `(SELECT ENCRYPT('test') FROM t1)` from `test`.`t1`
EXPLAIN EXTENDED SELECT (SELECT BENCHMARK(1,1) FROM t1) FROM t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 const row not found
-2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found
+1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 Const row not found
+2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 Const row not found
Warnings:
Note 1003 /* select#1 */ select (/* select#2 */ select benchmark(1,1) from `test`.`t1`) AS `(SELECT BENCHMARK(1,1) FROM t1)` from `test`.`t1`
drop table t1;
@@ -1647,7 +1647,7 @@ a
explain extended select * from t3 where a >= all (select b from t2);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
-2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
+2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found
Warnings:
Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,(/* select#2 */ select max(NULL) from `test`.`t2`) > <cache>(`test`.`t3`.`a`)))
select * from t3 where a >= some (select b from t2);
@@ -1655,7 +1655,7 @@ a
explain extended select * from t3 where a >= some (select b from t2);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
-2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
+2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found
Warnings:
Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,(/* select#2 */ select min(NULL) from `test`.`t2`) <= <cache>(`test`.`t3`.`a`)))
select * from t3 where a >= all (select b from t2 group by 1);
@@ -1666,7 +1666,7 @@ a
explain extended select * from t3 where a >= all (select b from t2 group by 1);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
-2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
+2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found
Warnings:
Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,(/* select#2 */ select max(NULL) from `test`.`t2`) > <cache>(`test`.`t3`.`a`)))
select * from t3 where a >= some (select b from t2 group by 1);
@@ -1674,7 +1674,7 @@ a
explain extended select * from t3 where a >= some (select b from t2 group by 1);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
-2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
+2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found
Warnings:
Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,(/* select#2 */ select min(NULL) from `test`.`t2`) <= <cache>(`test`.`t3`.`a`)))
select * from t3 where NULL >= any (select b from t2);
@@ -3733,7 +3733,7 @@ from t1' at line 1
explain select * from t1 where not exists
((select t11.i from t1 t11) union (select t12.i from t1 t12));
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 system NULL NULL NULL NULL 0 const row not found
+1 PRIMARY t1 system NULL NULL NULL NULL 0 Const row not found
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table
3 UNION NULL NULL NULL NULL NULL NULL NULL no matching row in const table
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
@@ -6111,7 +6111,7 @@ FROM t1 AS sq4_alias1
WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
sq4_alias1.col_varchar_key = @var3;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE sq4_alias1 system NULL NULL NULL NULL 0 const row not found
+1 SIMPLE sq4_alias1 system NULL NULL NULL NULL 0 Const row not found
SELECT @var3:=12, sq4_alias1.*
FROM t1 AS sq4_alias1
WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
@@ -6125,7 +6125,7 @@ FROM t1 AS sq4_alias1
WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
sq4_alias1.col_varchar_key = @var3 ) AS alias3;
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY <derived2> system NULL NULL NULL NULL 0 const row not found
+1 PRIMARY <derived2> system NULL NULL NULL NULL 0 Const row not found
2 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table
SELECT * FROM ( SELECT @var3:=12, sq4_alias1.*
FROM t1 AS sq4_alias1
@@ -6711,7 +6711,7 @@ CREATE TABLE t2 (b INT);
EXPLAIN
SELECT SUM(a) AS f1, a AS f2 FROM (t1, t2) HAVING f2 >= ALL (SELECT 4 UNION SELECT 5) AND f1 = 7;
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t2 system NULL NULL NULL NULL 0 const row not found
+1 PRIMARY t2 system NULL NULL NULL NULL 0 Const row not found
1 PRIMARY t1 ALL NULL NULL NULL NULL 2
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used
3 UNION NULL NULL NULL NULL NULL NULL NULL No tables used
diff --git a/mysql-test/r/subselect_no_scache.result b/mysql-test/r/subselect_no_scache.result
index b47dab2e79e..26aee4269b6 100644
--- a/mysql-test/r/subselect_no_scache.result
+++ b/mysql-test/r/subselect_no_scache.result
@@ -1167,20 +1167,20 @@ drop table t1;
CREATE TABLE t1 (a int(1));
EXPLAIN EXTENDED SELECT (SELECT RAND() FROM t1) FROM t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 const row not found
-2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found
+1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 Const row not found
+2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 Const row not found
Warnings:
Note 1003 /* select#1 */ select (/* select#2 */ select rand() from `test`.`t1`) AS `(SELECT RAND() FROM t1)` from `test`.`t1`
EXPLAIN EXTENDED SELECT (SELECT ENCRYPT('test') FROM t1) FROM t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 const row not found
-2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found
+1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 Const row not found
+2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 Const row not found
Warnings:
Note 1003 /* select#1 */ select (/* select#2 */ select encrypt('test') from `test`.`t1`) AS `(SELECT ENCRYPT('test') FROM t1)` from `test`.`t1`
EXPLAIN EXTENDED SELECT (SELECT BENCHMARK(1,1) FROM t1) FROM t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 const row not found
-2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found
+1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 Const row not found
+2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 Const row not found
Warnings:
Note 1003 /* select#1 */ select (/* select#2 */ select benchmark(1,1) from `test`.`t1`) AS `(SELECT BENCHMARK(1,1) FROM t1)` from `test`.`t1`
drop table t1;
@@ -1650,7 +1650,7 @@ a
explain extended select * from t3 where a >= all (select b from t2);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
-2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
+2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found
Warnings:
Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,(/* select#2 */ select max(NULL) from `test`.`t2`) > <cache>(`test`.`t3`.`a`)))
select * from t3 where a >= some (select b from t2);
@@ -1658,7 +1658,7 @@ a
explain extended select * from t3 where a >= some (select b from t2);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
-2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
+2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found
Warnings:
Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,(/* select#2 */ select min(NULL) from `test`.`t2`) <= <cache>(`test`.`t3`.`a`)))
select * from t3 where a >= all (select b from t2 group by 1);
@@ -1669,7 +1669,7 @@ a
explain extended select * from t3 where a >= all (select b from t2 group by 1);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
-2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
+2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found
Warnings:
Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,(/* select#2 */ select max(NULL) from `test`.`t2`) > <cache>(`test`.`t3`.`a`)))
select * from t3 where a >= some (select b from t2 group by 1);
@@ -1677,7 +1677,7 @@ a
explain extended select * from t3 where a >= some (select b from t2 group by 1);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
-2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
+2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found
Warnings:
Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,(/* select#2 */ select min(NULL) from `test`.`t2`) <= <cache>(`test`.`t3`.`a`)))
select * from t3 where NULL >= any (select b from t2);
@@ -3740,7 +3740,7 @@ from t1' at line 1
explain select * from t1 where not exists
((select t11.i from t1 t11) union (select t12.i from t1 t12));
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 system NULL NULL NULL NULL 0 const row not found
+1 PRIMARY t1 system NULL NULL NULL NULL 0 Const row not found
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table
3 UNION NULL NULL NULL NULL NULL NULL NULL no matching row in const table
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
@@ -6126,7 +6126,7 @@ FROM t1 AS sq4_alias1
WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
sq4_alias1.col_varchar_key = @var3;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE sq4_alias1 system NULL NULL NULL NULL 0 const row not found
+1 SIMPLE sq4_alias1 system NULL NULL NULL NULL 0 Const row not found
SELECT @var3:=12, sq4_alias1.*
FROM t1 AS sq4_alias1
WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
@@ -6140,7 +6140,7 @@ FROM t1 AS sq4_alias1
WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
sq4_alias1.col_varchar_key = @var3 ) AS alias3;
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY <derived2> system NULL NULL NULL NULL 0 const row not found
+1 PRIMARY <derived2> system NULL NULL NULL NULL 0 Const row not found
2 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table
SELECT * FROM ( SELECT @var3:=12, sq4_alias1.*
FROM t1 AS sq4_alias1
@@ -6726,7 +6726,7 @@ CREATE TABLE t2 (b INT);
EXPLAIN
SELECT SUM(a) AS f1, a AS f2 FROM (t1, t2) HAVING f2 >= ALL (SELECT 4 UNION SELECT 5) AND f1 = 7;
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t2 system NULL NULL NULL NULL 0 const row not found
+1 PRIMARY t2 system NULL NULL NULL NULL 0 Const row not found
1 PRIMARY t1 ALL NULL NULL NULL NULL 2
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used
3 UNION NULL NULL NULL NULL NULL NULL NULL No tables used
diff --git a/mysql-test/r/subselect_no_semijoin.result b/mysql-test/r/subselect_no_semijoin.result
index 9d04ddd9829..e962add85c8 100644
--- a/mysql-test/r/subselect_no_semijoin.result
+++ b/mysql-test/r/subselect_no_semijoin.result
@@ -1164,20 +1164,20 @@ drop table t1;
CREATE TABLE t1 (a int(1));
EXPLAIN EXTENDED SELECT (SELECT RAND() FROM t1) FROM t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 const row not found
-2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found
+1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 Const row not found
+2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 Const row not found
Warnings:
Note 1003 /* select#1 */ select (/* select#2 */ select rand() from `test`.`t1`) AS `(SELECT RAND() FROM t1)` from `test`.`t1`
EXPLAIN EXTENDED SELECT (SELECT ENCRYPT('test') FROM t1) FROM t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 const row not found
-2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found
+1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 Const row not found
+2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 Const row not found
Warnings:
Note 1003 /* select#1 */ select (/* select#2 */ select encrypt('test') from `test`.`t1`) AS `(SELECT ENCRYPT('test') FROM t1)` from `test`.`t1`
EXPLAIN EXTENDED SELECT (SELECT BENCHMARK(1,1) FROM t1) FROM t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 const row not found
-2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found
+1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 Const row not found
+2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 Const row not found
Warnings:
Note 1003 /* select#1 */ select (/* select#2 */ select benchmark(1,1) from `test`.`t1`) AS `(SELECT BENCHMARK(1,1) FROM t1)` from `test`.`t1`
drop table t1;
@@ -1647,7 +1647,7 @@ a
explain extended select * from t3 where a >= all (select b from t2);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
-2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
+2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found
Warnings:
Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,(/* select#2 */ select max(NULL) from `test`.`t2`) > <cache>(`test`.`t3`.`a`)))
select * from t3 where a >= some (select b from t2);
@@ -1655,7 +1655,7 @@ a
explain extended select * from t3 where a >= some (select b from t2);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
-2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
+2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found
Warnings:
Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,(/* select#2 */ select min(NULL) from `test`.`t2`) <= <cache>(`test`.`t3`.`a`)))
select * from t3 where a >= all (select b from t2 group by 1);
@@ -1666,7 +1666,7 @@ a
explain extended select * from t3 where a >= all (select b from t2 group by 1);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
-2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
+2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found
Warnings:
Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,(/* select#2 */ select max(NULL) from `test`.`t2`) > <cache>(`test`.`t3`.`a`)))
select * from t3 where a >= some (select b from t2 group by 1);
@@ -1674,7 +1674,7 @@ a
explain extended select * from t3 where a >= some (select b from t2 group by 1);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
-2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
+2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found
Warnings:
Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,(/* select#2 */ select min(NULL) from `test`.`t2`) <= <cache>(`test`.`t3`.`a`)))
select * from t3 where NULL >= any (select b from t2);
@@ -3733,7 +3733,7 @@ from t1' at line 1
explain select * from t1 where not exists
((select t11.i from t1 t11) union (select t12.i from t1 t12));
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 system NULL NULL NULL NULL 0 const row not found
+1 PRIMARY t1 system NULL NULL NULL NULL 0 Const row not found
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table
3 UNION NULL NULL NULL NULL NULL NULL NULL no matching row in const table
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
@@ -6111,7 +6111,7 @@ FROM t1 AS sq4_alias1
WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
sq4_alias1.col_varchar_key = @var3;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE sq4_alias1 system NULL NULL NULL NULL 0 const row not found
+1 SIMPLE sq4_alias1 system NULL NULL NULL NULL 0 Const row not found
SELECT @var3:=12, sq4_alias1.*
FROM t1 AS sq4_alias1
WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
@@ -6125,7 +6125,7 @@ FROM t1 AS sq4_alias1
WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
sq4_alias1.col_varchar_key = @var3 ) AS alias3;
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY <derived2> system NULL NULL NULL NULL 0 const row not found
+1 PRIMARY <derived2> system NULL NULL NULL NULL 0 Const row not found
2 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table
SELECT * FROM ( SELECT @var3:=12, sq4_alias1.*
FROM t1 AS sq4_alias1
@@ -6711,7 +6711,7 @@ CREATE TABLE t2 (b INT);
EXPLAIN
SELECT SUM(a) AS f1, a AS f2 FROM (t1, t2) HAVING f2 >= ALL (SELECT 4 UNION SELECT 5) AND f1 = 7;
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t2 system NULL NULL NULL NULL 0 const row not found
+1 PRIMARY t2 system NULL NULL NULL NULL 0 Const row not found
1 PRIMARY t1 ALL NULL NULL NULL NULL 2
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used
3 UNION NULL NULL NULL NULL NULL NULL NULL No tables used
diff --git a/mysql-test/r/system_mysql_db.result b/mysql-test/r/system_mysql_db.result
index a1880162487..54fb47f2a93 100644
--- a/mysql-test/r/system_mysql_db.result
+++ b/mysql-test/r/system_mysql_db.result
@@ -224,6 +224,7 @@ proc CREATE TABLE `proc` (
`collation_connection` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
`db_collation` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
`body_utf8` longblob DEFAULT NULL,
+ `aggregate` enum('NONE','GROUP') NOT NULL DEFAULT 'NONE',
PRIMARY KEY (`db`,`name`,`type`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Stored Procedures'
show create table event;
diff --git a/mysql-test/r/system_mysql_db_fix40123.result b/mysql-test/r/system_mysql_db_fix40123.result
index 9141c6cb479..df81b8d81c9 100644
--- a/mysql-test/r/system_mysql_db_fix40123.result
+++ b/mysql-test/r/system_mysql_db_fix40123.result
@@ -224,6 +224,7 @@ proc CREATE TABLE `proc` (
`collation_connection` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
`db_collation` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
`body_utf8` longblob DEFAULT NULL,
+ `aggregate` enum('NONE','GROUP') NOT NULL DEFAULT 'NONE',
PRIMARY KEY (`db`,`name`,`type`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Stored Procedures'
show create table event;
diff --git a/mysql-test/r/trigger.result b/mysql-test/r/trigger.result
index b751632307a..8473b3bb90d 100644
--- a/mysql-test/r/trigger.result
+++ b/mysql-test/r/trigger.result
@@ -2329,6 +2329,23 @@ DROP TRIGGER t1_bi;
DROP TABLE t1;
SET TIMESTAMP=DEFAULT;
set time_zone= @@global.time_zone;
+#
+# MDEV-13936: Server crashes in Time_and_counter_tracker::incr_loops
+#
+CREATE TABLE t1 (i INT);
+CREATE VIEW v1 AS SELECT * FROM t1 WHERE RAND() > 0.5;
+CREATE TABLE t2 (a int);
+CREATE TABLE t3 (a int);
+create trigger trg after insert on t2 for each row
+INSERT INTO t3 SELECT MAX(i) FROM v1 UNION SELECT MAX(i) FROM v1;
+drop table t1;
+insert into t2 value (2);
+ERROR 42S02: Table 'test.t1' doesn't exist
+CREATE TABLE t1 (i INT);
+insert into t2 value (2);
+DROP VIEW v1;
+DROP TABLE t1,t2,t3;
+End of 10.1 tests.
create table t1 (i int);
create trigger tr1 after insert on t1 for each row set @a=@a+1;
create trigger tr2 after insert on t1 for each row set @a=@a+1;
diff --git a/mysql-test/r/type_set.result b/mysql-test/r/type_set.result
index 1258de317ec..ae72619b5ae 100644
--- a/mysql-test/r/type_set.result
+++ b/mysql-test/r/type_set.result
@@ -352,3 +352,9 @@ EXPLAIN SELECT * FROM t1 WHERE a='1.1';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
DROP TABLE t1;
+#
+# MDEV-11155 Bad error message when creating a SET column with comma and non-ASCII characters
+#
+SET NAMES utf8;
+CREATE TABLE t1 (a SET('a,bü'));
+ERROR 22007: Illegal set 'a,bü' value found during parsing
diff --git a/mysql-test/r/union.result b/mysql-test/r/union.result
index b193f032146..9ec3b1056fd 100644
--- a/mysql-test/r/union.result
+++ b/mysql-test/r/union.result
@@ -1634,8 +1634,8 @@ UNION
SELECT a FROM t1
ORDER BY a;
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 const row not found
-2 UNION t1 system NULL NULL NULL NULL 0 0.00 const row not found
+1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 Const row not found
+2 UNION t1 system NULL NULL NULL NULL 0 0.00 Const row not found
NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL NULL Using filesort
Warnings:
Note 1003 /* select#1 */ select NULL AS `a` from `test`.`t1` union /* select#2 */ select NULL AS `a` from `test`.`t1` order by `a`
diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result
index 635323a5867..120a13254a0 100644
--- a/mysql-test/r/view.result
+++ b/mysql-test/r/view.result
@@ -2934,10 +2934,10 @@ CREATE TABLE t1 (s1 int);
CREATE VIEW v1 AS SELECT * FROM t1;
EXPLAIN SELECT * FROM t1;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 system NULL NULL NULL NULL 0 const row not found
+1 SIMPLE t1 system NULL NULL NULL NULL 0 Const row not found
EXPLAIN SELECT * FROM v1;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 system NULL NULL NULL NULL 0 const row not found
+1 SIMPLE t1 system NULL NULL NULL NULL 0 Const row not found
INSERT INTO t1 VALUES (1), (3), (2);
EXPLAIN SELECT * FROM t1 t WHERE t.s1+1 < (SELECT MAX(t1.s1) FROM t1);
id select_type table type possible_keys key key_len ref rows Extra
@@ -4609,7 +4609,7 @@ WHERE t4.a >= t1.a);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 system NULL NULL NULL NULL 1 100.00
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 Using where
-2 DEPENDENT SUBQUERY t3 system NULL NULL NULL NULL 0 0.00 const row not found
+2 DEPENDENT SUBQUERY t3 system NULL NULL NULL NULL 0 0.00 Const row not found
2 DEPENDENT SUBQUERY t4 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
@@ -4625,7 +4625,7 @@ WHERE t4.a >= v1.a);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 system NULL NULL NULL NULL 1 100.00
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 Using where
-2 DEPENDENT SUBQUERY t3 system NULL NULL NULL NULL 0 0.00 const row not found
+2 DEPENDENT SUBQUERY t3 system NULL NULL NULL NULL 0 0.00 Const row not found
2 DEPENDENT SUBQUERY t4 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Note 1276 Field or reference 'v1.a' of SELECT #2 was resolved in SELECT #1
@@ -4657,7 +4657,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 system NULL NULL NULL NULL 1 100.00
1 PRIMARY t4 ALL NULL NULL NULL NULL 2 100.00 Using where
2 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 1 100.00
-2 DEPENDENT SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found
+2 DEPENDENT SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 Const row not found
Warnings:
Note 1276 Field or reference 'test.t4.b' of SELECT #2 was resolved in SELECT #1
Note 1003 /* select#1 */ select 0 AS `c`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t4`.`c` AS `c` from `test`.`t4` where `test`.`t4`.`c` <= <expr_cache><`test`.`t4`.`b`>((/* select#2 */ select 0 from dual where 7 > `test`.`t4`.`b`))
@@ -4674,7 +4674,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 system NULL NULL NULL NULL 1 100.00
1 PRIMARY t4 ALL NULL NULL NULL NULL 2 100.00 Using where
2 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 1 100.00
-2 DEPENDENT SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found
+2 DEPENDENT SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 Const row not found
Warnings:
Note 1276 Field or reference 'v4.b' of SELECT #2 was resolved in SELECT #1
Note 1003 /* select#1 */ select 0 AS `c`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t4`.`c` AS `c` from `test`.`t4` where `test`.`t4`.`c` <= <expr_cache><`test`.`t4`.`b`>((/* select#2 */ select 0 from dual where 7 > `test`.`t4`.`b`))
@@ -5166,7 +5166,7 @@ CREATE TABLE t4 (i4 INT);
INSERT INTO t4 VALUES (1),(2);
DROP VIEW IF EXISTS v1;
Warnings:
-Note 4090 Unknown VIEW: 'test.v1'
+Note 4091 Unknown VIEW: 'test.v1'
CREATE VIEW v1 AS select coalesce(j1,i3) AS v1_field1 from t2 join t3 left join t1 on ( i1 = i2 );
CREATE VIEW v2 AS select v1_field1 from t4 join v1;
prepare my_stmt from "select v1_field1 from v2";
diff --git a/mysql-test/r/view_grant.result b/mysql-test/r/view_grant.result
index 04ad19c5ddc..82594128d85 100644
--- a/mysql-test/r/view_grant.result
+++ b/mysql-test/r/view_grant.result
@@ -144,7 +144,7 @@ revoke select on mysqltest.v5 from mysqltest_1@localhost;
connection user1;
explain select c from mysqltest.v1;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 system NULL NULL NULL NULL 0 const row not found
+1 SIMPLE t1 system NULL NULL NULL NULL 0 Const row not found
show create view mysqltest.v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest`.`v1` AS select `mysqltest`.`t1`.`a` + 1 AS `c`,`mysqltest`.`t1`.`b` + 1 AS `d` from `mysqltest`.`t1` latin1 latin1_swedish_ci
@@ -167,13 +167,13 @@ grant show view on mysqltest.* to mysqltest_1@localhost;
connection user1;
explain select c from mysqltest.v1;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 system NULL NULL NULL NULL 0 const row not found
+1 SIMPLE t1 system NULL NULL NULL NULL 0 Const row not found
show create view mysqltest.v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest`.`v1` AS select `mysqltest`.`t1`.`a` + 1 AS `c`,`mysqltest`.`t1`.`b` + 1 AS `d` from `mysqltest`.`t1` latin1 latin1_swedish_ci
explain select c from mysqltest.v2;
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY <derived2> system NULL NULL NULL NULL 0 const row not found
+1 PRIMARY <derived2> system NULL NULL NULL NULL 0 Const row not found
2 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table
show create view mysqltest.v2;
View Create View character_set_client collation_connection
@@ -1190,7 +1190,7 @@ select * from v1;
i
explain select * from v1;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 system NULL NULL NULL NULL 0 const row not found
+1 SIMPLE t1 system NULL NULL NULL NULL 0 Const row not found
disconnect test11765687;
... as eugene
connect test11765687,localhost,eugene,,mysqltest1;
@@ -1238,12 +1238,12 @@ select k from t3;
k
explain select k from t3;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t3 system NULL NULL NULL NULL 0 const row not found
+1 SIMPLE t3 system NULL NULL NULL NULL 0 Const row not found
select * from v3;
k
explain select * from v3;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t3 system NULL NULL NULL NULL 0 const row not found
+1 SIMPLE t3 system NULL NULL NULL NULL 0 Const row not found
disconnect test11765687;
... as inga
connect test11765687,localhost,inga,,mysqltest1;
@@ -1284,8 +1284,8 @@ select * from v2;
i j
explain select * from v2;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 system NULL NULL NULL NULL 0 const row not found
-1 SIMPLE t2 system NULL NULL NULL NULL 0 const row not found
+1 SIMPLE t1 system NULL NULL NULL NULL 0 Const row not found
+1 SIMPLE t2 system NULL NULL NULL NULL 0 Const row not found
disconnect test11765687;
... as noam
connect test11765687,localhost,noam,,mysqltest1;
diff --git a/mysql-test/r/warnings.result b/mysql-test/r/warnings.result
index 5d805ac572a..d808479e8ef 100644
--- a/mysql-test/r/warnings.result
+++ b/mysql-test/r/warnings.result
@@ -353,7 +353,7 @@ ERROR 23000: Duplicate entry '11' for key 'a'
SHOW WARNINGS;
Level Code Message
-Note 4092 At line 4 in test.f1
+Note 4093 At line 4 in test.f1
Error 1062 Duplicate entry '11' for key 'a'
DROP TABLE t1;
diff --git a/mysql-test/r/win.result b/mysql-test/r/win.result
index 6434b26dba1..6309ab090b5 100644
--- a/mysql-test/r/win.result
+++ b/mysql-test/r/win.result
@@ -3274,5 +3274,21 @@ row_number() over (partition by i order by i) i
1 2
DROP TABLE t1;
#
+# MDEV-13384: "window" seems like a reserved column name but it's not listed as one
+#
+# Currently we allow window as an identifier, except for table aliases.
+#
+CREATE TABLE door (id INT, window VARCHAR(10));
+SELECT id
+FROM door as window;
+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 'window' at line 2
+SELECT id, window
+FROM door;
+id window
+SELECT id, window
+FROM door as window;
+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 'window' at line 2
+DROP TABLE door;
+#
# Start of 10.3 tests
#
diff --git a/mysql-test/suite/binlog/r/binlog_flush_binlogs_delete_domain.result b/mysql-test/suite/binlog/r/binlog_flush_binlogs_delete_domain.result
new file mode 100644
index 00000000000..99f2a57835f
--- /dev/null
+++ b/mysql-test/suite/binlog/r/binlog_flush_binlogs_delete_domain.result
@@ -0,0 +1,78 @@
+RESET MASTER;
+FLUSH BINARY LOGS DELETE_DOMAIN_ID = ();
+and the command execution is effective thence rotates binlog as usual
+show binary logs;
+Log_name File_size
+master-bin.000001 #
+master-bin.000002 #
+Non-existed domain is warned, the command completes without rotation
+but with a warning
+FLUSH BINARY LOGS DELETE_DOMAIN_ID = (99);
+Warnings:
+Warning 1076 The gtid domain being deleted ('99') is not in the current binlog state
+show binary logs;
+Log_name File_size
+master-bin.000001 #
+master-bin.000002 #
+SET @@SESSION.gtid_domain_id=1;
+SET @@SESSION.server_id=1;
+CREATE TABLE t (a int);
+FLUSH BINARY LOGS DELETE_DOMAIN_ID = (1);
+ERROR HY000: Could not delete gtid domain. Reason: binlog files may contain gtids from the domain ('1') being deleted. Make sure to first purge those files.
+FLUSH BINARY LOGS;
+FLUSH BINARY LOGS DELETE_DOMAIN_ID = (1);
+ERROR HY000: Could not delete gtid domain. Reason: binlog files may contain gtids from the domain ('1') being deleted. Make sure to first purge those files.
+PURGE BINARY LOGS TO 'master-bin.000003';;
+FLUSH BINARY LOGS DELETE_DOMAIN_ID = (1);
+Gtid_list of the current binlog does not contain '1':
+show binlog events in 'master-bin.000004' limit 1,1;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000004 # Gtid_list 1 # []
+But the previous log's Gtid_list may have it which explains a warning from the following command
+show binlog events in 'master-bin.000003' limit 1,1;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000003 # Gtid_list 1 # [1-1-1]
+Already deleted domain in Gtid_list of the earliest log is benign
+but may cause a warning
+FLUSH BINARY LOGS DELETE_DOMAIN_ID = (1);
+Warnings:
+Warning 1076 The current gtid binlog state is incompatible with a former one missing gtids from the '1-1' domain-server pair which is referred to in the gtid list describing an earlier state. Ignore if the domain ('1') was already explicitly deleted.
+Warning 1076 The gtid domain being deleted ('1') is not in the current binlog state
+FLUSH BINARY LOGS DELETE_DOMAIN_ID = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0);
+ERROR HY000: Could not delete gtid domain. Reason: binlog files may contain gtids from the domain ('1') being deleted. Make sure to first purge those files.
+FLUSH BINARY LOGS;
+PURGE BINARY LOGS TO 'master-bin.000005';
+FLUSH BINARY LOGS DELETE_DOMAIN_ID = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0);
+Warnings:
+Warning 1076 The gtid domain being deleted ('0') is not in the current binlog state
+Gtid_list of the current binlog does not contain 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0:
+show binlog events in 'master-bin.000006' limit 1,1;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000006 # Gtid_list 1 # []
+SET @@SESSION.gtid_domain_id=1;;
+SET @@SESSION.server_id=1;
+SET @@SESSION.gtid_seq_no=1;
+INSERT INTO t SET a=1;
+SET @@SESSION.server_id=2;
+SET @@SESSION.gtid_seq_no=2;
+INSERT INTO t SET a=2;
+SET @@SESSION.gtid_domain_id=11;
+SET @@SESSION.server_id=11;
+SET @@SESSION.gtid_seq_no=11;
+INSERT INTO t SET a=11;
+SET @gtid_binlog_state_saved=@@GLOBAL.gtid_binlog_state;
+FLUSH BINARY LOGS;
+SET @@SESSION.gtid_domain_id=11;
+SET @@SESSION.server_id=11;
+SET @@SESSION.gtid_seq_no=1;
+INSERT INTO t SET a=1;
+SELECT @gtid_binlog_state_saved "as original state", @@GLOBAL.gtid_binlog_state as "out of order for 11 domain state";
+as original state out of order for 11 domain state
+1-1-1,1-2-2,11-11-11 1-1-1,1-2-2,11-11-1
+PURGE BINARY LOGS TO 'master-bin.000007';
+the following command succeeds with warnings
+FLUSH BINARY LOGS DELETE_DOMAIN_ID = (1);
+Warnings:
+Warning 1076 The current gtid binlog state is incompatible with a former one having a gtid '11-11-1' which is less than the '11-11-11' of the gtid list describing an earlier state. The state may have been affected by manually injecting a lower sequence number gtid or via replication.
+DROP TABLE t;
+RESET MASTER;
diff --git a/mysql-test/suite/binlog/r/binlog_gtid_delete_domain_debug.result b/mysql-test/suite/binlog/r/binlog_gtid_delete_domain_debug.result
new file mode 100644
index 00000000000..b4627caceb2
--- /dev/null
+++ b/mysql-test/suite/binlog/r/binlog_gtid_delete_domain_debug.result
@@ -0,0 +1,6 @@
+SET @@SESSION.debug_dbug='+d,inject_binlog_delete_domain_init_error';
+FLUSH BINARY LOGS DELETE_DOMAIN_ID = (99);
+ERROR HY000: Could not delete gtid domain. Reason: injected error.
+SHOW WARNINGS;
+Level Code Message
+Error 1076 Could not delete gtid domain. Reason: injected error.
diff --git a/mysql-test/suite/binlog/r/binlog_killed.result b/mysql-test/suite/binlog/r/binlog_killed.result
index cda4e8ad6f4..d751b1f9002 100644
--- a/mysql-test/suite/binlog/r/binlog_killed.result
+++ b/mysql-test/suite/binlog/r/binlog_killed.result
@@ -179,6 +179,97 @@ RELEASE_LOCK("a")
1
drop table t4;
drop function bug27563;
+FLUSH LOGS;
+connect con3, localhost, root,,;
+connection con3;
+MI: MyISAM, INNODB
+BEGIN;
+INSERT INTO t2 VALUES (NULL, 1);
+INSERT INTO t1 VALUES (NULL, 1);
+connection con1;
+KILL ID;
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000002 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
+master-bin.000002 # Gtid_list # # [#-#-#]
+master-bin.000002 # Binlog_checkpoint # # master-bin.000001
+master-bin.000002 # Binlog_checkpoint # # master-bin.000002
+master-bin.000002 # Gtid # # BEGIN GTID #-#-#
+master-bin.000002 # Intvar # # INSERT_ID=3
+master-bin.000002 # Query # # use `test`; INSERT INTO t2 VALUES (NULL, 1)
+master-bin.000002 # Query # # COMMIT
+master-bin.000002 # Gtid # # BEGIN GTID #-#-#
+master-bin.000002 # Intvar # # INSERT_ID=4
+master-bin.000002 # Query # # use `test`; INSERT INTO t1 VALUES (NULL, 1)
+master-bin.000002 # Query # # ROLLBACK
+disconnect con3;
+connect con3, localhost, root,,;
+connection con3;
+IM: INNODB, MyISAM
+BEGIN;
+INSERT INTO t1 VALUES (NULL, 1);
+INSERT INTO t2 VALUES (NULL, 1);
+connection con1;
+KILL ID;
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000002 # Gtid # # BEGIN GTID #-#-#
+master-bin.000002 # Intvar # # INSERT_ID=4
+master-bin.000002 # Query # # use `test`; INSERT INTO t2 VALUES (NULL, 1)
+master-bin.000002 # Query # # COMMIT
+master-bin.000002 # Gtid # # BEGIN GTID #-#-#
+master-bin.000002 # Intvar # # INSERT_ID=5
+master-bin.000002 # Query # # use `test`; INSERT INTO t1 VALUES (NULL, 1)
+master-bin.000002 # Query # # ROLLBACK
+disconnect con3;
+connect con3, localhost, root,,;
+connection con3;
+IMI: INNODB, MyISAM, INNODB
+BEGIN;
+INSERT INTO t1 VALUES (NULL, 1);
+INSERT INTO t2 VALUES (NULL, 1);
+INSERT INTO t1 VALUES (NULL, 1);
+connection con1;
+KILL ID;
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000002 # Gtid # # BEGIN GTID #-#-#
+master-bin.000002 # Intvar # # INSERT_ID=5
+master-bin.000002 # Query # # use `test`; INSERT INTO t2 VALUES (NULL, 1)
+master-bin.000002 # Query # # COMMIT
+master-bin.000002 # Gtid # # BEGIN GTID #-#-#
+master-bin.000002 # Intvar # # INSERT_ID=6
+master-bin.000002 # Query # # use `test`; INSERT INTO t1 VALUES (NULL, 1)
+master-bin.000002 # Intvar # # INSERT_ID=7
+master-bin.000002 # Query # # use `test`; INSERT INTO t1 VALUES (NULL, 1)
+master-bin.000002 # Query # # ROLLBACK
+disconnect con3;
+connect con3, localhost, root,,;
+connection con3;
+MI2: MyISAM, INNODB, MyISAM, INNODB
+BEGIN;
+INSERT INTO t2 VALUES (NULL, 1);
+INSERT INTO t1 VALUES (NULL, 1);
+INSERT INTO t2 VALUES (NULL, 1);
+INSERT INTO t1 VALUES (NULL, 1);
+connection con1;
+KILL ID;
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000002 # Gtid # # BEGIN GTID #-#-#
+master-bin.000002 # Intvar # # INSERT_ID=6
+master-bin.000002 # Query # # use `test`; INSERT INTO t2 VALUES (NULL, 1)
+master-bin.000002 # Query # # COMMIT
+master-bin.000002 # Gtid # # BEGIN GTID #-#-#
+master-bin.000002 # Intvar # # INSERT_ID=7
+master-bin.000002 # Query # # use `test`; INSERT INTO t2 VALUES (NULL, 1)
+master-bin.000002 # Query # # COMMIT
+master-bin.000002 # Gtid # # BEGIN GTID #-#-#
+master-bin.000002 # Intvar # # INSERT_ID=8
+master-bin.000002 # Query # # use `test`; INSERT INTO t1 VALUES (NULL, 1)
+master-bin.000002 # Intvar # # INSERT_ID=9
+master-bin.000002 # Query # # use `test`; INSERT INTO t1 VALUES (NULL, 1)
+master-bin.000002 # Query # # ROLLBACK
connection default;
disconnect con1;
disconnect con2;
diff --git a/mysql-test/suite/binlog/r/binlog_stm_ps.result b/mysql-test/suite/binlog/r/binlog_stm_ps.result
index 0b7491e4364..75f64500878 100644
--- a/mysql-test/suite/binlog/r/binlog_stm_ps.result
+++ b/mysql-test/suite/binlog/r/binlog_stm_ps.result
@@ -185,3 +185,46 @@ master-bin.000004 # Gtid # # GTID #-#-#
master-bin.000004 # Query # # use `test`; DROP PROCEDURE p1
master-bin.000004 # Gtid # # GTID #-#-#
master-bin.000004 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
+#
+#MDEV-14467 Item_param: replace {INT|DECIMAL|REAL|STRING|TIME}_VALUE with Type_handler
+#
+FLUSH LOGS;
+CREATE TABLE t1 (a INT);
+EXECUTE IMMEDIATE 'INSERT INTO t1 SELECT 1 LIMIT ?' USING 10;
+Warnings:
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted
+EXECUTE IMMEDIATE 'INSERT INTO t1 SELECT 1 LIMIT ?' USING 10.1;
+Warnings:
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted
+EXECUTE IMMEDIATE 'INSERT INTO t1 SELECT 1 LIMIT ?' USING 10.1e0;
+Warnings:
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted
+EXECUTE IMMEDIATE 'INSERT INTO t1 SELECT 1 LIMIT ?' USING '10';
+Warnings:
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted
+EXECUTE IMMEDIATE 'INSERT INTO t1 SELECT 1 LIMIT ?' USING TIME'10:10:10';
+Warnings:
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted
+DROP TABLE t1;
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000005 # Binlog_checkpoint # # master-bin.000005
+master-bin.000005 # Gtid # # GTID #-#-#
+master-bin.000005 # Query # # use `test`; CREATE TABLE t1 (a INT)
+master-bin.000005 # Gtid # # BEGIN GTID #-#-#
+master-bin.000005 # Query # # use `test`; INSERT INTO t1 SELECT 1 LIMIT 10
+master-bin.000005 # Query # # COMMIT
+master-bin.000005 # Gtid # # BEGIN GTID #-#-#
+master-bin.000005 # Query # # use `test`; INSERT INTO t1 SELECT 1 LIMIT 10
+master-bin.000005 # Query # # COMMIT
+master-bin.000005 # Gtid # # BEGIN GTID #-#-#
+master-bin.000005 # Query # # use `test`; INSERT INTO t1 SELECT 1 LIMIT 10
+master-bin.000005 # Query # # COMMIT
+master-bin.000005 # Gtid # # BEGIN GTID #-#-#
+master-bin.000005 # Query # # use `test`; INSERT INTO t1 SELECT 1 LIMIT 10
+master-bin.000005 # Query # # COMMIT
+master-bin.000005 # Gtid # # BEGIN GTID #-#-#
+master-bin.000005 # Query # # use `test`; INSERT INTO t1 SELECT 1 LIMIT 101010
+master-bin.000005 # Query # # COMMIT
+master-bin.000005 # Gtid # # GTID #-#-#
+master-bin.000005 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
diff --git a/mysql-test/suite/binlog/r/load_data_stm_view.result b/mysql-test/suite/binlog/r/load_data_stm_view.result
index ddbdb71983f..c21ffb7dcc6 100644
--- a/mysql-test/suite/binlog/r/load_data_stm_view.result
+++ b/mysql-test/suite/binlog/r/load_data_stm_view.result
@@ -1,3 +1,4 @@
+reset master;
create table t1 (i int, j int);
create view v1 as select i from t1;
LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/3940.data' INTO TABLE v1 (i);
diff --git a/mysql-test/suite/binlog/t/binlog_flush_binlogs_delete_domain.test b/mysql-test/suite/binlog/t/binlog_flush_binlogs_delete_domain.test
new file mode 100644
index 00000000000..0faafa35a1b
--- /dev/null
+++ b/mysql-test/suite/binlog/t/binlog_flush_binlogs_delete_domain.test
@@ -0,0 +1,137 @@
+# Prove basic properties of
+#
+# FLUSH BINARY LOGS DELETE_DOMAIN_ID = (...)
+#
+# The command removes the supplied list of domains from the current
+# @@global.gtid_binlog_state provided the binlog files do not contain
+# events from such domains.
+
+# The test is not format specific. One format is chosen to run it.
+--source include/have_binlog_format_mixed.inc
+
+# Reset binlog state
+RESET MASTER;
+
+# Empty list is accepted
+FLUSH BINARY LOGS DELETE_DOMAIN_ID = ();
+--echo and the command execution is effective thence rotates binlog as usual
+--source include/show_binary_logs.inc
+
+--echo Non-existed domain is warned, the command completes without rotation
+--echo but with a warning
+--let $binlog_pre_flush=query_get_value(SHOW MASTER STATUS, Position, 1)
+FLUSH BINARY LOGS DELETE_DOMAIN_ID = (99);
+--let $binlog_start=$binlog_pre_flush
+--source include/show_binary_logs.inc
+
+# Log one event in a specified domain and try to delete the domain
+SET @@SESSION.gtid_domain_id=1;
+SET @@SESSION.server_id=1;
+CREATE TABLE t (a int);
+
+--error ER_BINLOG_CANT_DELETE_GTID_DOMAIN
+FLUSH BINARY LOGS DELETE_DOMAIN_ID = (1);
+
+# the same error after log rotation
+FLUSH BINARY LOGS;
+--error ER_BINLOG_CANT_DELETE_GTID_DOMAIN
+FLUSH BINARY LOGS DELETE_DOMAIN_ID = (1);
+
+# the latest binlog does not really contain any events incl ones from 1-domain
+--let $purge_to_binlog= query_get_value(SHOW MASTER STATUS, File, 1)
+--eval PURGE BINARY LOGS TO '$purge_to_binlog';
+# So now it's safe to delete
+--error 0
+FLUSH BINARY LOGS DELETE_DOMAIN_ID = (1);
+--echo Gtid_list of the current binlog does not contain '1':
+--let $binlog_file=query_get_value(SHOW MASTER STATUS, File, 1)
+--source include/show_gtid_list.inc
+--echo But the previous log's Gtid_list may have it which explains a warning from the following command
+--let $binlog_file=$purge_to_binlog
+--source include/show_gtid_list.inc
+
+--echo Already deleted domain in Gtid_list of the earliest log is benign
+--echo but may cause a warning
+--error 0
+FLUSH BINARY LOGS DELETE_DOMAIN_ID = (1);
+
+# Few domains delete. The chosen number verifies among others how
+# expected overrun of the static buffers of underlying dynamic arrays is doing.
+--let $domain_cnt=17
+--let $server_in_domain_cnt=3
+--let $domain_list=
+--disable_query_log
+while ($domain_cnt)
+{
+ --let servers=$server_in_domain_cnt
+ --eval SET @@SESSION.gtid_domain_id=$domain_cnt
+ while ($servers)
+ {
+ --eval SET @@SESSION.server_id=10*$domain_cnt + $servers
+ --eval INSERT INTO t SET a=@@SESSION.server_id
+
+ --dec $servers
+ }
+ --let $domain_list= $domain_cnt, $domain_list
+
+ --dec $domain_cnt
+}
+--enable_query_log
+--let $zero=0
+--let $domain_list= $domain_list$zero
+
+--error ER_BINLOG_CANT_DELETE_GTID_DOMAIN
+--eval FLUSH BINARY LOGS DELETE_DOMAIN_ID = ($domain_list)
+
+# Now satisfy the safety condtion to purge log files containing $domain list
+FLUSH BINARY LOGS;
+--let $purge_to_binlog= query_get_value(SHOW MASTER STATUS, File, 1)
+--eval PURGE BINARY LOGS TO '$purge_to_binlog'
+--error 0
+--eval FLUSH BINARY LOGS DELETE_DOMAIN_ID = ($domain_list)
+--echo Gtid_list of the current binlog does not contain $domain_list:
+--let $binlog_file=query_get_value(SHOW MASTER STATUS, File, 1)
+--source include/show_gtid_list.inc
+
+# Show reaction on @@global.gtid_binlog_state not succeeding
+# earlier state as described by the 1st binlog' Gtid_list.
+# Now let it be out-order gtid logged to a domain unrelated to deletion.
+
+--let $del_d_id=1
+--eval SET @@SESSION.gtid_domain_id=$del_d_id;
+SET @@SESSION.server_id=1;
+SET @@SESSION.gtid_seq_no=1;
+INSERT INTO t SET a=1;
+SET @@SESSION.server_id=2;
+SET @@SESSION.gtid_seq_no=2;
+INSERT INTO t SET a=2;
+
+SET @@SESSION.gtid_domain_id=11;
+SET @@SESSION.server_id=11;
+SET @@SESSION.gtid_seq_no=11;
+INSERT INTO t SET a=11;
+
+SET @gtid_binlog_state_saved=@@GLOBAL.gtid_binlog_state;
+FLUSH BINARY LOGS;
+
+# Inject out of order for domain '11' before
+SET @@SESSION.gtid_domain_id=11;
+SET @@SESSION.server_id=11;
+SET @@SESSION.gtid_seq_no=1;
+INSERT INTO t SET a=1;
+
+SELECT @gtid_binlog_state_saved "as original state", @@GLOBAL.gtid_binlog_state as "out of order for 11 domain state";
+
+# to delete '1', first to purge logs containing its events
+--let $purge_to_binlog= query_get_value(SHOW MASTER STATUS, File, 1)
+--eval PURGE BINARY LOGS TO '$purge_to_binlog'
+
+--echo the following command succeeds with warnings
+--eval FLUSH BINARY LOGS DELETE_DOMAIN_ID = ($del_d_id)
+
+#
+# Cleanup
+#
+
+DROP TABLE t;
+RESET MASTER;
diff --git a/mysql-test/suite/binlog/t/binlog_gtid_delete_domain_debug.test b/mysql-test/suite/binlog/t/binlog_gtid_delete_domain_debug.test
new file mode 100644
index 00000000000..5de549c45bb
--- /dev/null
+++ b/mysql-test/suite/binlog/t/binlog_gtid_delete_domain_debug.test
@@ -0,0 +1,11 @@
+# Check "internal" error branches of
+# FLUSH BINARY LOGS DELETE_DOMAIN_ID = (...)
+# handler.
+--source include/have_debug.inc
+--source include/have_binlog_format_mixed.inc
+
+SET @@SESSION.debug_dbug='+d,inject_binlog_delete_domain_init_error';
+--error ER_BINLOG_CANT_DELETE_GTID_DOMAIN
+FLUSH BINARY LOGS DELETE_DOMAIN_ID = (99);
+
+SHOW WARNINGS;
diff --git a/mysql-test/suite/binlog/t/binlog_killed.test b/mysql-test/suite/binlog/t/binlog_killed.test
index 73759ee5aa5..8ac223603a3 100644
--- a/mysql-test/suite/binlog/t/binlog_killed.test
+++ b/mysql-test/suite/binlog/t/binlog_killed.test
@@ -349,6 +349,87 @@ drop table t4;
drop function bug27563;
+# Prove that killing connection in the middle
+# of mixed engine transactions affect binlogging
+# as specified.
+
+# keep binlogging for this piece of test in a new file
+FLUSH LOGS;
+
+# Connection con3 as transaction generator thoughout the test
+connect (con3, localhost, root,,);
+
+connection con3;
+let $ID= `select connection_id()`;
+
+--echo MI: MyISAM, INNODB
+BEGIN;
+INSERT INTO t2 VALUES (NULL, 1);
+INSERT INTO t1 VALUES (NULL, 1);
+
+#Connection con1 as killer throughout the test
+connection con1;
+--replace_result $ID ID
+--eval KILL $ID
+let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1);
+--let $binlog_start= 4
+--source include/show_binlog_events.inc
+--let $binlog_killed_pos=query_get_value(SHOW MASTER STATUS, Position, 1)
+
+disconnect con3;
+connect (con3, localhost, root,,);
+connection con3;
+let $ID= `select connection_id()`;
+
+--echo IM: INNODB, MyISAM
+BEGIN;
+INSERT INTO t1 VALUES (NULL, 1);
+INSERT INTO t2 VALUES (NULL, 1);
+
+connection con1;
+--replace_result $ID ID
+--eval KILL $ID
+--let $binlog_start= $binlog_killed_pos
+--source include/show_binlog_events.inc
+--let $binlog_killed_pos=query_get_value(SHOW MASTER STATUS, Position, 1)
+
+disconnect con3;
+connect (con3, localhost, root,,);
+connection con3;
+let $ID= `select connection_id()`;
+
+--echo IMI: INNODB, MyISAM, INNODB
+BEGIN;
+INSERT INTO t1 VALUES (NULL, 1);
+INSERT INTO t2 VALUES (NULL, 1);
+INSERT INTO t1 VALUES (NULL, 1);
+
+connection con1;
+--replace_result $ID ID
+--eval KILL $ID
+--let $binlog_start= $binlog_killed_pos
+--source include/show_binlog_events.inc
+--let $binlog_killed_pos=query_get_value(SHOW MASTER STATUS, Position, 1)
+
+disconnect con3;
+connect (con3, localhost, root,,);
+connection con3;
+let $ID= `select connection_id()`;
+
+--echo MI2: MyISAM, INNODB, MyISAM, INNODB
+BEGIN;
+INSERT INTO t2 VALUES (NULL, 1);
+INSERT INTO t1 VALUES (NULL, 1);
+INSERT INTO t2 VALUES (NULL, 1);
+INSERT INTO t1 VALUES (NULL, 1);
+
+connection con1;
+--replace_result $ID ID
+--eval KILL $ID
+--let $binlog_start= $binlog_killed_pos
+--source include/show_binlog_events.inc
+
+
#
# common cleanup
#
diff --git a/mysql-test/suite/binlog/t/binlog_stm_ps.test b/mysql-test/suite/binlog/t/binlog_stm_ps.test
index e6e54985f6f..b83991b1356 100644
--- a/mysql-test/suite/binlog/t/binlog_stm_ps.test
+++ b/mysql-test/suite/binlog/t/binlog_stm_ps.test
@@ -99,3 +99,19 @@ DROP TABLE t1;
--let $binlog_file = LAST
source include/show_binlog_events.inc;
+
+--echo #
+--echo #MDEV-14467 Item_param: replace {INT|DECIMAL|REAL|STRING|TIME}_VALUE with Type_handler
+--echo #
+
+FLUSH LOGS;
+CREATE TABLE t1 (a INT);
+EXECUTE IMMEDIATE 'INSERT INTO t1 SELECT 1 LIMIT ?' USING 10;
+EXECUTE IMMEDIATE 'INSERT INTO t1 SELECT 1 LIMIT ?' USING 10.1;
+EXECUTE IMMEDIATE 'INSERT INTO t1 SELECT 1 LIMIT ?' USING 10.1e0;
+EXECUTE IMMEDIATE 'INSERT INTO t1 SELECT 1 LIMIT ?' USING '10';
+EXECUTE IMMEDIATE 'INSERT INTO t1 SELECT 1 LIMIT ?' USING TIME'10:10:10';
+DROP TABLE t1;
+
+--let $binlog_file = LAST
+source include/show_binlog_events.inc;
diff --git a/mysql-test/suite/binlog/t/load_data_stm_view.test b/mysql-test/suite/binlog/t/load_data_stm_view.test
index b70651b4e2d..9f64b813eec 100644
--- a/mysql-test/suite/binlog/t/load_data_stm_view.test
+++ b/mysql-test/suite/binlog/t/load_data_stm_view.test
@@ -8,6 +8,8 @@
1
EOF
+reset master;
+
create table t1 (i int, j int);
create view v1 as select i from t1;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
@@ -15,6 +17,8 @@ create view v1 as select i from t1;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--eval LOAD DATA LOCAL INFILE '$MYSQLTEST_VARDIR/3940.data' INTO TABLE v1
select * from v1;
+--let $binlog_file = LAST
--source include/show_binlog_events.inc
drop view v1;
drop table t1;
+--remove_file $MYSQLTEST_VARDIR/3940.data
diff --git a/mysql-test/suite/compat/oracle/r/ps.result b/mysql-test/suite/compat/oracle/r/ps.result
index ed7cb4c51d5..158d15e9f90 100644
--- a/mysql-test/suite/compat/oracle/r/ps.result
+++ b/mysql-test/suite/compat/oracle/r/ps.result
@@ -247,3 +247,18 @@ DROP PROCEDURE p1;
#
# End of MDEV-10866 Extend PREPARE and EXECUTE IMMEDIATE to understand expressions
#
+#
+# MDEV-12846 sql_mode=ORACLE: using Oracle-style placeholders in direct query execution makes the server crash
+#
+SELECT ? FROM DUAL;
+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 '? FROM DUAL' at line 1
+SELECT :a FROM DUAL;
+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 ':a FROM DUAL' at line 1
+SELECT :1 FROM DUAL;
+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 ':1 FROM DUAL' at line 1
+SELECT 1+? FROM DUAL;
+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 '? FROM DUAL' at line 1
+SELECT 1+:a FROM DUAL;
+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 ':a FROM DUAL' at line 1
+SELECT 1+:1 FROM DUAL;
+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 ':1 FROM DUAL' at line 1
diff --git a/mysql-test/suite/compat/oracle/r/sp-cursor-rowtype.result b/mysql-test/suite/compat/oracle/r/sp-cursor-rowtype.result
index 3030a3dc658..a46daf30a8f 100644
--- a/mysql-test/suite/compat/oracle/r/sp-cursor-rowtype.result
+++ b/mysql-test/suite/compat/oracle/r/sp-cursor-rowtype.result
@@ -1359,3 +1359,36 @@ t2 CREATE TABLE "t2" (
"b" varchar(3) DEFAULT NULL,
"c" time DEFAULT NULL
)
+#
+# MDEV-14388 Server crashes in handle_select / val_uint in ORACLE mode
+#
+CREATE TABLE t1 (id INT);
+INSERT INTO t1 VALUES (0),(1),(2),(3);
+CREATE FUNCTION f1() RETURN INT is
+BEGIN
+FOR v1 in (SELECT id FROM t1)
+LOOP
+NULL;
+END LOOP;
+RETURN 1;
+END;
+$$
+SELECT f1();
+f1()
+1
+DROP FUNCTION f1;
+DROP TABLE t1;
+CREATE TABLE t1 (id INT);
+INSERT INTO t1 VALUES (1),(2),(3),(4);
+CREATE FUNCTION f1() RETURN INT IS
+CURSOR cur IS SELECT id FROM t1;
+rec cur%ROWTYPE;
+BEGIN
+RETURN 1;
+END;
+$$
+SELECT f1();
+f1()
+1
+DROP FUNCTION f1;
+DROP TABLE t1;
diff --git a/mysql-test/suite/compat/oracle/r/sp.result b/mysql-test/suite/compat/oracle/r/sp.result
index 53411e80251..2bf4f50e6d5 100644
--- a/mysql-test/suite/compat/oracle/r/sp.result
+++ b/mysql-test/suite/compat/oracle/r/sp.result
@@ -2404,3 +2404,31 @@ t1 CREATE TABLE "t1" (
"aa_timestamp5" timestamp(5) NULL DEFAULT NULL,
"aa_date0" datetime DEFAULT NULL
)
+#
+# MDEV-11160 "Incorrect column name" when "CREATE TABLE t1 AS SELECT spvar"
+#
+CREATE TABLE t1 (x INT);
+INSERT INTO t1 VALUES (10);
+CREATE VIEW v1 AS SELECT x+1 AS a,x+1 AS b FROM t1;
+CREATE PROCEDURE p1
+AS
+a INT := 1;
+b INT := 2;
+BEGIN
+CREATE TABLE t2 AS SELECT a,b FROM v1;
+SHOW CREATE TABLE t2;
+SELECT * FROM t2;
+DROP TABLE t2;
+END;
+$$
+CALL p1();
+Table Create Table
+t2 CREATE TABLE "t2" (
+ "a" int(11) DEFAULT NULL,
+ "b" int(11) DEFAULT NULL
+)
+a b
+1 2
+DROP PROCEDURE p1;
+DROP VIEW v1;
+DROP TABLE t1;
diff --git a/mysql-test/suite/compat/oracle/t/ps.test b/mysql-test/suite/compat/oracle/t/ps.test
index 08bb957c33f..357b50e0eab 100644
--- a/mysql-test/suite/compat/oracle/t/ps.test
+++ b/mysql-test/suite/compat/oracle/t/ps.test
@@ -264,3 +264,27 @@ DROP PROCEDURE p1;
--echo #
--echo # End of MDEV-10866 Extend PREPARE and EXECUTE IMMEDIATE to understand expressions
--echo #
+
+
+--echo #
+--echo # MDEV-12846 sql_mode=ORACLE: using Oracle-style placeholders in direct query execution makes the server crash
+--echo #
+
+# When running with --ps, the below queries return
+# CR_PARAMS_NOT_BOUND instead of ER_PARSE_ERROR
+
+--disable_ps_protocol
+--error ER_PARSE_ERROR
+SELECT ? FROM DUAL;
+--error ER_PARSE_ERROR
+SELECT :a FROM DUAL;
+--error ER_PARSE_ERROR
+SELECT :1 FROM DUAL;
+
+--error ER_PARSE_ERROR
+SELECT 1+? FROM DUAL;
+--error ER_PARSE_ERROR
+SELECT 1+:a FROM DUAL;
+--error ER_PARSE_ERROR
+SELECT 1+:1 FROM DUAL;
+--enable_ps_protocol
diff --git a/mysql-test/suite/compat/oracle/t/sp-cursor-rowtype.test b/mysql-test/suite/compat/oracle/t/sp-cursor-rowtype.test
index 19a50eacca1..fd148d1f261 100644
--- a/mysql-test/suite/compat/oracle/t/sp-cursor-rowtype.test
+++ b/mysql-test/suite/compat/oracle/t/sp-cursor-rowtype.test
@@ -1444,3 +1444,39 @@ BEGIN
END;
$$
DELIMITER ;$$
+
+--echo #
+--echo # MDEV-14388 Server crashes in handle_select / val_uint in ORACLE mode
+--echo #
+
+CREATE TABLE t1 (id INT);
+INSERT INTO t1 VALUES (0),(1),(2),(3);
+DELIMITER $$;
+CREATE FUNCTION f1() RETURN INT is
+BEGIN
+ FOR v1 in (SELECT id FROM t1)
+ LOOP
+ NULL;
+ END LOOP;
+ RETURN 1;
+END;
+$$
+DELIMITER ;$$
+SELECT f1();
+DROP FUNCTION f1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (id INT);
+INSERT INTO t1 VALUES (1),(2),(3),(4);
+DELIMITER $$;
+CREATE FUNCTION f1() RETURN INT IS
+ CURSOR cur IS SELECT id FROM t1;
+ rec cur%ROWTYPE;
+BEGIN
+ RETURN 1;
+END;
+$$
+DELIMITER ;$$
+SELECT f1();
+DROP FUNCTION f1;
+DROP TABLE t1;
diff --git a/mysql-test/suite/compat/oracle/t/sp.test b/mysql-test/suite/compat/oracle/t/sp.test
index 61a37459483..e7adbb5403a 100644
--- a/mysql-test/suite/compat/oracle/t/sp.test
+++ b/mysql-test/suite/compat/oracle/t/sp.test
@@ -2233,3 +2233,30 @@ BEGIN
END;
$$
DELIMITER ;$$
+
+
+--echo #
+--echo # MDEV-11160 "Incorrect column name" when "CREATE TABLE t1 AS SELECT spvar"
+--echo #
+
+
+CREATE TABLE t1 (x INT);
+INSERT INTO t1 VALUES (10);
+CREATE VIEW v1 AS SELECT x+1 AS a,x+1 AS b FROM t1;
+DELIMITER $$;
+CREATE PROCEDURE p1
+AS
+ a INT := 1;
+ b INT := 2;
+BEGIN
+ CREATE TABLE t2 AS SELECT a,b FROM v1;
+ SHOW CREATE TABLE t2;
+ SELECT * FROM t2;
+ DROP TABLE t2;
+END;
+$$
+DELIMITER ;$$
+CALL p1();
+DROP PROCEDURE p1;
+DROP VIEW v1;
+DROP TABLE t1;
diff --git a/mysql-test/suite/encryption/include/have_example_key_management_plugin.opt b/mysql-test/suite/encryption/include/have_example_key_management_plugin.opt
index ce7f1ddef7e..66aaef98c54 100644
--- a/mysql-test/suite/encryption/include/have_example_key_management_plugin.opt
+++ b/mysql-test/suite/encryption/include/have_example_key_management_plugin.opt
@@ -1,2 +1,3 @@
--plugin-load-add=$EXAMPLE_KEY_MANAGEMENT_SO
--loose-example-key-management
+--plugin-maturity=unknown
diff --git a/mysql-test/suite/federated/federated_partition.result b/mysql-test/suite/federated/federated_partition.result
index a2d5fcffd9b..c8a61d825b6 100644
--- a/mysql-test/suite/federated/federated_partition.result
+++ b/mysql-test/suite/federated/federated_partition.result
@@ -10,7 +10,8 @@ create table federated.t1_1 (s1 int primary key) engine=myisam;
create table federated.t1_2 (s1 int primary key) engine=innodb;
connection master;
create table t1 (s1 int primary key) engine=federated
-partition by list (s1)
+CONNECTION="remember_this"
+ partition by list (s1)
(partition p1 values in (1,3)
connection='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1_1',
partition p2 values in (2,4)
@@ -20,7 +21,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`s1` int(11) NOT NULL,
PRIMARY KEY (`s1`)
-) ENGINE=FEDERATED DEFAULT CHARSET=latin1
+) ENGINE=FEDERATED DEFAULT CHARSET=latin1 CONNECTION='remember_this'
PARTITION BY LIST (`s1`)
(PARTITION `p1` VALUES IN (1,3) CONNECTION = 'mysql://root@127.0.0.1:SLAVE_PORT/federated/t1_1' ENGINE = FEDERATED,
PARTITION `p2` VALUES IN (2,4) CONNECTION = 'mysql://root@127.0.0.1:SLAVE_PORT/federated/t1_2' ENGINE = FEDERATED)
diff --git a/mysql-test/suite/federated/federated_partition.test b/mysql-test/suite/federated/federated_partition.test
index ef1e27ec505..47110b5eebf 100644
--- a/mysql-test/suite/federated/federated_partition.test
+++ b/mysql-test/suite/federated/federated_partition.test
@@ -25,6 +25,7 @@ create table federated.t1_2 (s1 int primary key) engine=innodb;
connection master;
--replace_result $SLAVE_MYPORT SLAVE_PORT
eval create table t1 (s1 int primary key) engine=federated
+ CONNECTION="remember_this"
partition by list (s1)
(partition p1 values in (1,3)
connection='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1_1',
diff --git a/mysql-test/suite/funcs_1/r/innodb_views.result b/mysql-test/suite/funcs_1/r/innodb_views.result
index 7468d5db0be..50b4073a839 100644
--- a/mysql-test/suite/funcs_1/r/innodb_views.result
+++ b/mysql-test/suite/funcs_1/r/innodb_views.result
@@ -4314,7 +4314,7 @@ CREATE VIEW v2 AS Select * from test.v1;
ERROR 42S02: Table 'test.v1' doesn't exist
DROP VIEW IF EXISTS v2;
Warnings:
-Note 4090 Unknown VIEW: 'test.v2'
+Note 4091 Unknown VIEW: 'test.v2'
Testcase 3.3.1.25
--------------------------------------------------------------------------------
@@ -7566,7 +7566,7 @@ Call sp1() ;
ERROR 42000: PROCEDURE test.sp1 does not exist
Drop view if exists test.v1 ;
Warnings:
-Note 4090 Unknown VIEW: 'test.v1'
+Note 4091 Unknown VIEW: 'test.v1'
Drop procedure sp1 ;
ERROR 42000: PROCEDURE test.sp1 does not exist
@@ -21312,7 +21312,7 @@ CREATE VIEW v1 AS SELECT f1 FROM t1;
DROP VIEW IF EXISTS v1;
DROP VIEW IF EXISTS v1;
Warnings:
-Note 4090 Unknown VIEW: 'test.v1'
+Note 4091 Unknown VIEW: 'test.v1'
Testcase 3.3.1.68
--------------------------------------------------------------------------------
diff --git a/mysql-test/suite/funcs_1/r/is_columns_mysql.result b/mysql-test/suite/funcs_1/r/is_columns_mysql.result
index d1eba03b180..00cd4e666e5 100644
--- a/mysql-test/suite/funcs_1/r/is_columns_mysql.result
+++ b/mysql-test/suite/funcs_1/r/is_columns_mysql.result
@@ -28,7 +28,6 @@ def mysql db Create_tmp_table_priv 14 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_g
def mysql db Create_view_priv 16 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL
def mysql db Db 2 '' NO char 64 192 NULL NULL NULL utf8 utf8_bin char(64) PRI select,insert,update,references NEVER NULL
def mysql db Delete_priv 7 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL
-def mysql db Truncate_versioning_priv 23 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL
def mysql db Drop_priv 9 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL
def mysql db Event_priv 21 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL
def mysql db Execute_priv 20 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL
@@ -41,6 +40,7 @@ def mysql db References_priv 11 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general
def mysql db Select_priv 4 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL
def mysql db Show_view_priv 17 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL
def mysql db Trigger_priv 22 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL
+def mysql db Truncate_versioning_priv 23 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL
def mysql db Update_priv 6 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL
def mysql db User 3 '' NO char 80 240 NULL NULL NULL utf8 utf8_bin char(80) PRI select,insert,update,references NEVER NULL
def mysql event body 3 NULL NO longblob 4294967295 4294967295 NULL NULL NULL NULL NULL longblob select,insert,update,references NEVER NULL
@@ -134,6 +134,7 @@ def mysql innodb_table_stats sum_of_other_index_sizes 6 NULL NO bigint NULL NULL
def mysql innodb_table_stats table_name 2 NULL NO varchar 64 192 NULL NULL NULL utf8 utf8_bin varchar(64) PRI select,insert,update,references NEVER NULL
def mysql plugin dl 2 '' NO varchar 128 384 NULL NULL NULL utf8 utf8_general_ci varchar(128) select,insert,update,references NEVER NULL
def mysql plugin name 1 '' NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) PRI select,insert,update,references NEVER NULL
+def mysql proc aggregate 21 'NONE' NO enum 5 15 NULL NULL NULL utf8 utf8_general_ci enum('NONE','GROUP') select,insert,update,references NEVER NULL
def mysql proc body 11 NULL NO longblob 4294967295 4294967295 NULL NULL NULL NULL NULL longblob select,insert,update,references NEVER NULL
def mysql proc body_utf8 20 NULL YES longblob 4294967295 4294967295 NULL NULL NULL NULL NULL longblob select,insert,update,references NEVER NULL
def mysql proc character_set_client 17 NULL YES char 32 96 NULL NULL NULL utf8 utf8_bin char(32) select,insert,update,references NEVER NULL
@@ -236,7 +237,6 @@ def mysql user Create_user_priv 29 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_gene
def mysql user Create_view_priv 25 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL
def mysql user default_role 46 '' NO char 80 240 NULL NULL NULL utf8 utf8_bin char(80) select,insert,update,references NEVER NULL
def mysql user Delete_priv 7 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL
-def mysql user Truncate_versioning_priv 33 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL
def mysql user Drop_priv 9 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL
def mysql user Event_priv 30 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL
def mysql user Execute_priv 22 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL
@@ -268,6 +268,7 @@ def mysql user ssl_cipher 35 NULL NO blob 65535 65535 NULL NULL NULL NULL NULL b
def mysql user ssl_type 34 '' NO enum 9 27 NULL NULL NULL utf8 utf8_general_ci enum('','ANY','X509','SPECIFIED') select,insert,update,references NEVER NULL
def mysql user Super_priv 19 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL
def mysql user Trigger_priv 31 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL
+def mysql user Truncate_versioning_priv 33 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL
def mysql user Update_priv 6 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL
def mysql user User 2 '' NO char 80 240 NULL NULL NULL utf8 utf8_bin char(80) PRI select,insert,update,references NEVER NULL
def mysql user x509_issuer 36 NULL NO blob 65535 65535 NULL NULL NULL NULL NULL blob select,insert,update,references NEVER NULL
@@ -501,6 +502,7 @@ NULL mysql proc modified timestamp NULL NULL NULL NULL timestamp
3.0000 mysql proc collation_connection char 32 96 utf8 utf8_bin char(32)
3.0000 mysql proc db_collation char 32 96 utf8 utf8_bin char(32)
1.0000 mysql proc body_utf8 longblob 4294967295 4294967295 NULL NULL longblob
+3.0000 mysql proc aggregate enum 5 15 utf8 utf8_general_ci enum('NONE','GROUP')
3.0000 mysql procs_priv Host char 60 180 utf8 utf8_bin char(60)
3.0000 mysql procs_priv Db char 64 192 utf8 utf8_bin char(64)
3.0000 mysql procs_priv User char 80 240 utf8 utf8_bin char(80)
diff --git a/mysql-test/suite/funcs_1/r/is_columns_mysql_embedded.result b/mysql-test/suite/funcs_1/r/is_columns_mysql_embedded.result
index c4370b768c6..c167a9584e5 100644
--- a/mysql-test/suite/funcs_1/r/is_columns_mysql_embedded.result
+++ b/mysql-test/suite/funcs_1/r/is_columns_mysql_embedded.result
@@ -120,6 +120,7 @@ def mysql index_stats prefix_arity 4 NULL NO int NULL NULL 10 0 NULL NULL NULL i
def mysql index_stats table_name 2 NULL NO varchar 64 192 NULL NULL NULL utf8 utf8_bin varchar(64) PRI NEVER NULL
def mysql plugin dl 2 '' NO varchar 128 384 NULL NULL NULL utf8 utf8_general_ci varchar(128) NEVER NULL
def mysql plugin name 1 '' NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) PRI NEVER NULL
+def mysql proc aggregate 21 'NONE' NO enum 5 15 NULL NULL NULL utf8 utf8_general_ci enum('NONE','GROUP') NEVER NULL
def mysql proc body 11 NULL NO longblob 4294967295 4294967295 NULL NULL NULL NULL NULL longblob NEVER NULL
def mysql proc body_utf8 20 NULL YES longblob 4294967295 4294967295 NULL NULL NULL NULL NULL longblob NEVER NULL
def mysql proc character_set_client 17 NULL YES char 32 96 NULL NULL NULL utf8 utf8_bin char(32) NEVER NULL
@@ -483,6 +484,7 @@ NULL mysql proc modified timestamp NULL NULL NULL NULL timestamp
3.0000 mysql proc collation_connection char 32 96 utf8 utf8_bin char(32)
3.0000 mysql proc db_collation char 32 96 utf8 utf8_bin char(32)
1.0000 mysql proc body_utf8 longblob 4294967295 4294967295 NULL NULL longblob
+3.0000 mysql proc aggregate enum 5 15 utf8 utf8_general_ci enum('NONE','GROUP')
3.0000 mysql procs_priv Host char 60 180 utf8 utf8_bin char(60)
3.0000 mysql procs_priv Db char 64 192 utf8 utf8_bin char(64)
3.0000 mysql procs_priv User char 80 240 utf8 utf8_bin char(80)
diff --git a/mysql-test/suite/funcs_1/r/memory_views.result b/mysql-test/suite/funcs_1/r/memory_views.result
index 4c422d600bf..df658deded0 100644
--- a/mysql-test/suite/funcs_1/r/memory_views.result
+++ b/mysql-test/suite/funcs_1/r/memory_views.result
@@ -4315,7 +4315,7 @@ CREATE VIEW v2 AS Select * from test.v1;
ERROR 42S02: Table 'test.v1' doesn't exist
DROP VIEW IF EXISTS v2;
Warnings:
-Note 4090 Unknown VIEW: 'test.v2'
+Note 4091 Unknown VIEW: 'test.v2'
Testcase 3.3.1.25
--------------------------------------------------------------------------------
@@ -7567,7 +7567,7 @@ Call sp1() ;
ERROR 42000: PROCEDURE test.sp1 does not exist
Drop view if exists test.v1 ;
Warnings:
-Note 4090 Unknown VIEW: 'test.v1'
+Note 4091 Unknown VIEW: 'test.v1'
Drop procedure sp1 ;
ERROR 42000: PROCEDURE test.sp1 does not exist
@@ -21314,7 +21314,7 @@ CREATE VIEW v1 AS SELECT f1 FROM t1;
DROP VIEW IF EXISTS v1;
DROP VIEW IF EXISTS v1;
Warnings:
-Note 4090 Unknown VIEW: 'test.v1'
+Note 4091 Unknown VIEW: 'test.v1'
Testcase 3.3.1.68
--------------------------------------------------------------------------------
diff --git a/mysql-test/suite/funcs_1/r/myisam_views-big.result b/mysql-test/suite/funcs_1/r/myisam_views-big.result
index 36c99148020..5f23c45f594 100644
--- a/mysql-test/suite/funcs_1/r/myisam_views-big.result
+++ b/mysql-test/suite/funcs_1/r/myisam_views-big.result
@@ -4784,7 +4784,7 @@ CREATE VIEW v2 AS Select * from test.v1;
ERROR 42S02: Table 'test.v1' doesn't exist
DROP VIEW IF EXISTS v2;
Warnings:
-Note 4090 Unknown VIEW: 'test.v2'
+Note 4091 Unknown VIEW: 'test.v2'
Testcase 3.3.1.25
--------------------------------------------------------------------------------
@@ -8387,7 +8387,7 @@ Call sp1() ;
ERROR 42000: PROCEDURE test.sp1 does not exist
Drop view if exists test.v1 ;
Warnings:
-Note 4090 Unknown VIEW: 'test.v1'
+Note 4091 Unknown VIEW: 'test.v1'
Drop procedure sp1 ;
ERROR 42000: PROCEDURE test.sp1 does not exist
@@ -22989,7 +22989,7 @@ CREATE VIEW v1 AS SELECT f1 FROM t1;
DROP VIEW IF EXISTS v1;
DROP VIEW IF EXISTS v1;
Warnings:
-Note 4090 Unknown VIEW: 'test.v1'
+Note 4091 Unknown VIEW: 'test.v1'
Testcase 3.3.1.68
--------------------------------------------------------------------------------
diff --git a/mysql-test/suite/funcs_1/r/storedproc.result b/mysql-test/suite/funcs_1/r/storedproc.result
index af3faf707d8..e5e009a86de 100644
--- a/mysql-test/suite/funcs_1/r/storedproc.result
+++ b/mysql-test/suite/funcs_1/r/storedproc.result
@@ -1771,48 +1771,48 @@ Testcase 4.1.9:
drop procedure
--------------------------------------------------------------------------------
SELECT * from mysql.proc where specific_name='sp9';
-db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8
+db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 aggregate
DROP PROCEDURE IF EXISTS sp9;
SELECT * from mysql.proc where specific_name='sp9';
-db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8
+db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 aggregate
CREATE PROCEDURE sp9()SELECT * from t1;
SELECT * from mysql.proc where specific_name='sp9';
-db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8
-db_storedproc sp9 PROCEDURE sp9 SQL CONTAINS_SQL NO DEFINER SELECT * from t1 root@localhost created modified latin1 latin1_swedish_ci latin1_swedish_ci SELECT * from t1
+db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 aggregate
+db_storedproc sp9 PROCEDURE sp9 SQL CONTAINS_SQL NO DEFINER SELECT * from t1 root@localhost created modified latin1 latin1_swedish_ci latin1_swedish_ci SELECT * from t1 NONE
DROP PROCEDURE sp9;
SELECT * from mysql.proc where specific_name='sp9';
-db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8
+db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 aggregate
CREATE PROCEDURE sp9()SELECT * from t1;
SELECT * from mysql.proc where specific_name='sp9';
-db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8
-db_storedproc sp9 PROCEDURE sp9 SQL CONTAINS_SQL NO DEFINER SELECT * from t1 root@localhost created modified latin1 latin1_swedish_ci latin1_swedish_ci SELECT * from t1
+db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 aggregate
+db_storedproc sp9 PROCEDURE sp9 SQL CONTAINS_SQL NO DEFINER SELECT * from t1 root@localhost created modified latin1 latin1_swedish_ci latin1_swedish_ci SELECT * from t1 NONE
DROP PROCEDURE IF EXISTS sp9;
SELECT * from mysql.proc where specific_name='sp9';
-db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8
+db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 aggregate
Testcase 4.1.10:
----------------
DROP FUNCTION
--------------------------------------------------------------------------------
SELECT * from mysql.proc where specific_name='fn10' and type='function';
-db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8
+db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 aggregate
DROP FUNCTION IF EXISTS fn10;
SELECT * from mysql.proc where specific_name='fn10' and type='function';
-db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8
+db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 aggregate
CREATE FUNCTION fn10() returns int return 100;
SELECT * from mysql.proc where specific_name='fn10' and type='function';
-db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8
-db_storedproc fn10 FUNCTION fn10 SQL CONTAINS_SQL NO DEFINER int(11) return 100 root@localhost created modified latin1 latin1_swedish_ci latin1_swedish_ci return 100
+db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 aggregate
+db_storedproc fn10 FUNCTION fn10 SQL CONTAINS_SQL NO DEFINER int(11) return 100 root@localhost created modified latin1 latin1_swedish_ci latin1_swedish_ci return 100 NONE
DROP FUNCTION fn10;
SELECT * from mysql.proc where specific_name='fn10' and type='function';
-db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8
+db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 aggregate
CREATE FUNCTION fn10() returns int return 100;
SELECT * from mysql.proc where specific_name='fn10' and type='function';
-db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8
-db_storedproc fn10 FUNCTION fn10 SQL CONTAINS_SQL NO DEFINER int(11) return 100 root@localhost created modified latin1 latin1_swedish_ci latin1_swedish_ci return 100
+db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 aggregate
+db_storedproc fn10 FUNCTION fn10 SQL CONTAINS_SQL NO DEFINER int(11) return 100 root@localhost created modified latin1 latin1_swedish_ci latin1_swedish_ci return 100 NONE
DROP FUNCTION IF EXISTS fn10;
SELECT * from mysql.proc where specific_name='fn10' and type='function';
-db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8
+db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 aggregate
Testcase 4.1.11:
----------------
@@ -4477,7 +4477,7 @@ CREATE PROCEDURE sp1()
for:BEGIN
SELECT @x;
END//
-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 'for:BEGIN
+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 ':BEGIN
SELECT @x;
END' at line 2
DROP PROCEDURE IF EXISTS sp1;
@@ -16170,15 +16170,15 @@ insert into t43 values('abcde', 'a!@#$%^&*(');
CREATE PROCEDURE d1.sp4()
SELECT * from d1.t43;
SELECT * from mysql.proc where specific_name = 'sp4';
-db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8
-d1 sp4 PROCEDURE sp4 SQL CONTAINS_SQL NO DEFINER SELECT * from d1.t43 root@localhost modified created latin1 latin1_swedish_ci latin1_swedish_ci SELECT * from d1.t43
+db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 aggregate
+d1 sp4 PROCEDURE sp4 SQL CONTAINS_SQL NO DEFINER SELECT * from d1.t43 root@localhost modified created latin1 latin1_swedish_ci latin1_swedish_ci SELECT * from d1.t43 NONE
USE db_storedproc;
DROP DATABASE d1;
CREATE DATABASE d1;
USE d1;
create table t44(a char(5), b char(10));
SELECT * from mysql.proc where specific_name = 'sp4';
-db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8
+db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 aggregate
USE db_storedproc;
DROP DATABASE d1;
@@ -16220,8 +16220,8 @@ CREATE PROCEDURE sp8 ( n char(20) ) sql security DEFINER comment 'initial'
USE d2;
alter procedure d1.sp8 sql security DEFINER comment 'updated';
SELECT * from mysql.proc where specific_name='sp8' and db='d1';
-db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8
-d1 sp8 PROCEDURE sp8 SQL CONTAINS_SQL NO DEFINER n char(20) SELECT * from t1 where t1.f1 = n root@localhost modified created updated latin1 latin1_swedish_ci latin1_swedish_ci SELECT * from t1 where t1.f1 = n
+db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 aggregate
+d1 sp8 PROCEDURE sp8 SQL CONTAINS_SQL NO DEFINER n char(20) SELECT * from t1 where t1.f1 = n root@localhost modified created updated latin1 latin1_swedish_ci latin1_swedish_ci SELECT * from t1 where t1.f1 = n NONE
Testcase 4.4.9:
--------------------------------------------------------------------------------
@@ -16237,7 +16237,7 @@ END//
USE d2;
alter function d1.fn2 sql security DEFINER comment 'updated';
SELECT * from mysql.proc where specific_name='fn2' and db='d1';
-db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8
+db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 aggregate
d1 fn2 FUNCTION fn2 SQL CONTAINS_SQL NO DEFINER n int int(11) BEGIN
declare a int;
set a = 0.9 * n;
@@ -16246,7 +16246,7 @@ END root@localhost modified created updated latin1 latin1_swedish_ci latin1_swe
declare a int;
set a = 0.9 * n;
return a;
-END
+END NONE
Testcase 4.4.10:
--------------------------------------------------------------------------------
@@ -16256,7 +16256,7 @@ SELECT * from t1 where t1.f1 = n;
USE d2;
DROP PROCEDURE d1.sp9;
SELECT * from mysql.proc where specific_name='sp9' and db='d1';
-db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8
+db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 aggregate
Testcase 4.4.11:
--------------------------------------------------------------------------------
@@ -16270,7 +16270,7 @@ END//
USE d2;
DROP FUNCTION d1.fn3;
SELECT * from mysql.proc where specific_name='fn3' and db='d1';
-db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8
+db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 aggregate
USE db_storedproc;
DROP DATABASE d1;
DROP DATABASE d2;
diff --git a/mysql-test/suite/galera/galera_2nodes.cnf b/mysql-test/suite/galera/galera_2nodes.cnf
index b24f3603894..8de704dbec8 100644
--- a/mysql-test/suite/galera/galera_2nodes.cnf
+++ b/mysql-test/suite/galera/galera_2nodes.cnf
@@ -4,6 +4,7 @@
[mysqld]
wsrep-on=1
binlog-format=row
+plugin-maturity=unknown
innodb-autoinc-lock-mode=2
default-storage-engine=innodb
wsrep-provider=@ENV.WSREP_PROVIDER
diff --git a/mysql-test/suite/galera/r/MW-388.result b/mysql-test/suite/galera/r/MW-388.result
new file mode 100644
index 00000000000..17d347a11fb
--- /dev/null
+++ b/mysql-test/suite/galera/r/MW-388.result
@@ -0,0 +1,46 @@
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(255)) Engine=InnoDB;
+CREATE PROCEDURE insert_proc ()
+BEGIN
+DECLARE CONTINUE HANDLER FOR SQLEXCEPTION
+BEGIN
+GET DIAGNOSTICS CONDITION 1 @errno = MYSQL_ERRNO;
+END;
+INSERT INTO t1 VALUES (1, 'node 1'),(2, 'node 1');
+INSERT INTO t1 VALUES (3, 'node 1');
+END|
+SET GLOBAL wsrep_slave_threads = 2;
+SET GLOBAL DEBUG = "d,sync.wsrep_apply_cb";
+Warnings:
+Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
+INSERT INTO t1 VALUES (1, 'node 2');;
+SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached";
+SET SESSION wsrep_sync_wait = 0;
+SET SESSION DEBUG_SYNC = 'wsrep_after_replication SIGNAL wsrep_after_replication_reached WAIT_FOR wsrep_after_replication_continue';
+CALL insert_proc ();;
+SET SESSION DEBUG_SYNC = "now WAIT_FOR wsrep_after_replication_reached";
+SET GLOBAL DEBUG = "";
+Warnings:
+Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
+SET DEBUG_SYNC = "now SIGNAL wsrep_after_replication_continue";
+SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
+SELECT @errno = 1213;
+@errno = 1213
+1
+SELECT * FROM t1;
+f1 f2
+1 node 2
+3 node 1
+SELECT * FROM t1;
+f1 f2
+1 node 2
+3 node 1
+SET GLOBAL wsrep_slave_threads = DEFAULT;
+DROP TABLE t1;
+DROP PROCEDURE insert_proc;
+SET GLOBAL debug = NULL;
+Warnings:
+Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
+SET debug_sync='RESET';
+SELECT @@debug_sync;
+@@debug_sync
+ON - current signal: ''
diff --git a/mysql-test/suite/galera/r/sql_log_bin.result b/mysql-test/suite/galera/r/sql_log_bin.result
index 8b208ff82d5..c175a0a0e7a 100644
--- a/mysql-test/suite/galera/r/sql_log_bin.result
+++ b/mysql-test/suite/galera/r/sql_log_bin.result
@@ -7,6 +7,7 @@ INSERT INTO t1 VALUES (1);
# Disable binary logging for current session
SET SQL_LOG_BIN=OFF;
INSERT INTO t1 VALUES (2);
+FLUSH BINARY LOGS;
CREATE TABLE t2(c1 INT PRIMARY KEY) ENGINE=INNODB;
INSERT INTO t2 VALUES (1);
CREATE TABLE test.t3 AS SELECT * from t1;
diff --git a/mysql-test/suite/galera/suite.opt b/mysql-test/suite/galera/suite.opt
new file mode 100644
index 00000000000..8374626febe
--- /dev/null
+++ b/mysql-test/suite/galera/suite.opt
@@ -0,0 +1 @@
+--plugin-maturity=unknown
diff --git a/mysql-test/suite/galera/suite.pm b/mysql-test/suite/galera/suite.pm
index 361743f1243..bad0484be16 100644
--- a/mysql-test/suite/galera/suite.pm
+++ b/mysql-test/suite/galera/suite.pm
@@ -9,8 +9,10 @@ return "Not run for embedded server" if $::opt_embedded_server;
return "WSREP is not compiled in" unless defined $::mysqld_variables{'wsrep-on'};
my ($provider) = grep { -f $_ } $ENV{WSREP_PROVIDER},
- "/usr/lib/galera/libgalera_smm.so",
- "/usr/lib64/galera/libgalera_smm.so";
+ "/usr/lib64/galera-3/libgalera_smm.so",
+ "/usr/lib64/galera/libgalera_smm.so",
+ "/usr/lib/galera-3/libgalera_smm.so",
+ "/usr/lib/galera/libgalera_smm.so";
return "No wsrep provider library" unless -f $provider;
diff --git a/mysql-test/suite/galera/t/MW-388.test b/mysql-test/suite/galera/t/MW-388.test
new file mode 100644
index 00000000000..209695dca80
--- /dev/null
+++ b/mysql-test/suite/galera/t/MW-388.test
@@ -0,0 +1,76 @@
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+--source include/have_debug.inc
+--source include/have_debug_sync.inc
+
+--connection node_1
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(255)) Engine=InnoDB;
+
+DELIMITER |;
+CREATE PROCEDURE insert_proc ()
+BEGIN
+ DECLARE CONTINUE HANDLER FOR SQLEXCEPTION
+ BEGIN
+ GET DIAGNOSTICS CONDITION 1 @errno = MYSQL_ERRNO;
+ END;
+ INSERT INTO t1 VALUES (1, 'node 1'),(2, 'node 1');
+ INSERT INTO t1 VALUES (3, 'node 1');
+END|
+DELIMITER ;|
+
+# We need two slave threads here to guarantee progress.
+# If we use only one thread the following could happen
+# in node_1:
+# We block the only slave thread in wsrep_apply_cb and we
+# issue an INSERT (by calling the stored procedure) that will
+# try to acquire galera's local monitor in pre_commit().
+# This usually works fine, except for when a commit cut event
+# sneaks in the slave queue and gets a local seqno smaller than
+# that of the INSERT. Because there is only one slave thread,
+# commit cut is not processed and therefore does not advance
+# local monitor, and our INSERT remains stuck there.
+SET GLOBAL wsrep_slave_threads = 2;
+SET GLOBAL DEBUG = "d,sync.wsrep_apply_cb";
+
+--connection node_2
+--send INSERT INTO t1 VALUES (1, 'node 2');
+
+--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
+--connection node_1a
+SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached";
+
+--connection node_1
+SET SESSION wsrep_sync_wait = 0;
+SET SESSION DEBUG_SYNC = 'wsrep_after_replication SIGNAL wsrep_after_replication_reached WAIT_FOR wsrep_after_replication_continue';
+--send CALL insert_proc ();
+
+--connection node_1a
+SET SESSION DEBUG_SYNC = "now WAIT_FOR wsrep_after_replication_reached";
+
+
+SET GLOBAL DEBUG = "";
+SET DEBUG_SYNC = "now SIGNAL wsrep_after_replication_continue";
+SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
+
+--connection node_2
+--reap
+
+--connection node_1
+# We expect no errors here, because the handler in insert_proc() caught the deadlock error
+--reap
+SELECT @errno = 1213;
+SELECT * FROM t1;
+
+--connection node_2
+SELECT * FROM t1;
+
+--connection node_1
+SET GLOBAL wsrep_slave_threads = DEFAULT;
+DROP TABLE t1;
+DROP PROCEDURE insert_proc;
+
+SET GLOBAL debug = NULL;
+SET debug_sync='RESET';
+
+# Make sure no pending signals are leftover to surprise subsequent tests.
+SELECT @@debug_sync;
diff --git a/mysql-test/suite/galera/t/galera_ftwrl.test b/mysql-test/suite/galera/t/galera_ftwrl.test
index de8310e52d2..739255609ee 100644
--- a/mysql-test/suite/galera/t/galera_ftwrl.test
+++ b/mysql-test/suite/galera/t/galera_ftwrl.test
@@ -29,12 +29,11 @@ SELECT * FROM t1;
UNLOCK TABLES;
-SHOW TABLES;
-SELECT COUNT(*) = 1 FROM t1;
-
--disable_query_log
--eval SET GLOBAL wsrep_provider_options = "$wsrep_provider_options_orig";
--enable_query_log
-DROP TABLE t1;
+SHOW TABLES;
+SELECT COUNT(*) = 1 FROM t1;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/t/galera_suspend_slave.test b/mysql-test/suite/galera/t/galera_suspend_slave.test
index dcc4a8d14c3..aa4543cf81c 100644
--- a/mysql-test/suite/galera/t/galera_suspend_slave.test
+++ b/mysql-test/suite/galera/t/galera_suspend_slave.test
@@ -25,7 +25,7 @@ CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
my $pid_filename = $ENV{'NODE_2_PIDFILE'};
my $mysqld_pid = `cat $pid_filename`;
chomp($mysqld_pid);
- system("kill -19 $mysqld_pid");
+ system("kill -SIGSTOP $mysqld_pid");
exit(0);
EOF
@@ -37,7 +37,7 @@ INSERT INTO t1 VALUES (1);
my $pid_filename = $ENV{'NODE_2_PIDFILE'};
my $mysqld_pid = `cat $pid_filename`;
chomp($mysqld_pid);
- system("kill -18 $mysqld_pid");
+ system("kill -SIGCONT $mysqld_pid");
exit(0);
EOF
diff --git a/mysql-test/suite/galera/t/sql_log_bin.test b/mysql-test/suite/galera/t/sql_log_bin.test
index 615bc4c30af..9f8f7c84486 100644
--- a/mysql-test/suite/galera/t/sql_log_bin.test
+++ b/mysql-test/suite/galera/t/sql_log_bin.test
@@ -1,5 +1,13 @@
# Test to check the behavior of galera cluster with sql_log_bin=ON|OFF & binary
# logging is disabled. sql_bin_log should not affect galera replication.
+#
+# The following bugfixes are tested:
+#
+# MDEV-9510: Segmentation fault in binlog thread.
+# A scenario otherwise causing a similar segfault is replayed.
+# The test must pass having no crashes.
+# The sequence of sql statements is provided by original
+# sql_log_bin.test augmented with a FLUSH BINLOG LOGS, below.
--source include/galera_cluster.inc
--source include/have_innodb.inc
@@ -15,6 +23,10 @@ INSERT INTO t1 VALUES (1);
--echo # Disable binary logging for current session
SET SQL_LOG_BIN=OFF;
INSERT INTO t1 VALUES (2);
+
+# MDEV-9510: the following binlog rotation due to FLUSH segfaults wo/ the fixes
+FLUSH BINARY LOGS;
+
CREATE TABLE t2(c1 INT PRIMARY KEY) ENGINE=INNODB;
INSERT INTO t2 VALUES (1);
CREATE TABLE test.t3 AS SELECT * from t1;
diff --git a/mysql-test/suite/galera_3nodes/galera_3nodes.cnf b/mysql-test/suite/galera_3nodes/galera_3nodes.cnf
index 91aa53ad7b1..48b3c002c04 100644
--- a/mysql-test/suite/galera_3nodes/galera_3nodes.cnf
+++ b/mysql-test/suite/galera_3nodes/galera_3nodes.cnf
@@ -3,6 +3,7 @@
[mysqld]
binlog-format=row
+plugin-maturity=unknown
innodb-autoinc-lock-mode=2
default-storage-engine=innodb
diff --git a/mysql-test/suite/galera_3nodes/suite.pm b/mysql-test/suite/galera_3nodes/suite.pm
index c91e6e07d76..3a1237ecf75 100644
--- a/mysql-test/suite/galera_3nodes/suite.pm
+++ b/mysql-test/suite/galera_3nodes/suite.pm
@@ -9,8 +9,10 @@ return "Not run for embedded server" if $::opt_embedded_server;
return "WSREP is not compiled in" unless defined $::mysqld_variables{'wsrep-on'};
my ($provider) = grep { -f $_ } $ENV{WSREP_PROVIDER},
- "/usr/lib/galera/libgalera_smm.so",
- "/usr/lib64/galera/libgalera_smm.so";
+ "/usr/lib64/galera-3/libgalera_smm.so",
+ "/usr/lib64/galera/libgalera_smm.so",
+ "/usr/lib/galera-3/libgalera_smm.so",
+ "/usr/lib/galera/libgalera_smm.so";
return "No wsrep provider library" unless -f $provider;
diff --git a/mysql-test/suite/gcol/r/innodb_virtual_stats.result b/mysql-test/suite/gcol/r/innodb_virtual_stats.result
new file mode 100644
index 00000000000..4ef499f932f
--- /dev/null
+++ b/mysql-test/suite/gcol/r/innodb_virtual_stats.result
@@ -0,0 +1,127 @@
+CREATE TABLE t (
+a INT,
+b INT,
+c INT GENERATED ALWAYS AS(a+b),
+d INT GENERATED ALWAYS AS(a+b+b),
+KEY idxa (a),
+KEY vidxcd (c, d)
+) ENGINE=INNODB STATS_PERSISTENT=1 STATS_AUTO_RECALC=1;
+INSERT INTO t (a,b) VALUES (1, 2);
+SELECT index_name, stat_name, stat_description
+FROM mysql.innodb_index_stats
+WHERE database_name = 'test' AND table_name = 't';
+index_name stat_name stat_description
+GEN_CLUST_INDEX n_diff_pfx01 DB_ROW_ID
+GEN_CLUST_INDEX n_leaf_pages Number of leaf pages in the index
+GEN_CLUST_INDEX size Number of pages in the index
+idxa n_diff_pfx01 a
+idxa n_diff_pfx02 a,DB_ROW_ID
+idxa n_leaf_pages Number of leaf pages in the index
+idxa size Number of pages in the index
+vidxcd n_diff_pfx01 c
+vidxcd n_diff_pfx02 c,d
+vidxcd n_diff_pfx03 c,d,DB_ROW_ID
+vidxcd n_leaf_pages Number of leaf pages in the index
+vidxcd size Number of pages in the index
+ALTER TABLE t ADD COLUMN e INT GENERATED ALWAYS AS(a+a+b), ADD INDEX idxb (b), ALGORITHM=INPLACE;
+SELECT index_name, stat_name, stat_description
+FROM mysql.innodb_index_stats
+WHERE database_name = 'test' AND table_name = 't';
+index_name stat_name stat_description
+GEN_CLUST_INDEX n_diff_pfx01 DB_ROW_ID
+GEN_CLUST_INDEX n_leaf_pages Number of leaf pages in the index
+GEN_CLUST_INDEX size Number of pages in the index
+idxa n_diff_pfx01 a
+idxa n_diff_pfx02 a,DB_ROW_ID
+idxa n_leaf_pages Number of leaf pages in the index
+idxa size Number of pages in the index
+idxb n_diff_pfx01 b
+idxb n_diff_pfx02 b,DB_ROW_ID
+idxb n_leaf_pages Number of leaf pages in the index
+idxb size Number of pages in the index
+vidxcd n_diff_pfx01 c
+vidxcd n_diff_pfx02 c,d
+vidxcd n_diff_pfx03 c,d,DB_ROW_ID
+vidxcd n_leaf_pages Number of leaf pages in the index
+vidxcd size Number of pages in the index
+ALTER TABLE t DROP COLUMN c, DROP INDEX idxa, ALGORITHM=INPLACE;
+SELECT index_name, stat_name, stat_description
+FROM mysql.innodb_index_stats
+WHERE database_name = 'test' AND table_name = 't';
+index_name stat_name stat_description
+GEN_CLUST_INDEX n_diff_pfx01 DB_ROW_ID
+GEN_CLUST_INDEX n_leaf_pages Number of leaf pages in the index
+GEN_CLUST_INDEX size Number of pages in the index
+idxb n_diff_pfx01 b
+idxb n_diff_pfx02 b,DB_ROW_ID
+idxb n_leaf_pages Number of leaf pages in the index
+idxb size Number of pages in the index
+vidxcd n_diff_pfx01 d
+vidxcd n_diff_pfx02 d,DB_ROW_ID
+vidxcd n_leaf_pages Number of leaf pages in the index
+vidxcd size Number of pages in the index
+ALTER TABLE t ADD INDEX vidxe (e), ALGORITHM=INPLACE;
+SELECT index_name, stat_name, stat_description
+FROM mysql.innodb_index_stats
+WHERE database_name = 'test' AND table_name = 't';
+index_name stat_name stat_description
+GEN_CLUST_INDEX n_diff_pfx01 DB_ROW_ID
+GEN_CLUST_INDEX n_leaf_pages Number of leaf pages in the index
+GEN_CLUST_INDEX size Number of pages in the index
+idxb n_diff_pfx01 b
+idxb n_diff_pfx02 b,DB_ROW_ID
+idxb n_leaf_pages Number of leaf pages in the index
+idxb size Number of pages in the index
+vidxcd n_diff_pfx01 d
+vidxcd n_diff_pfx02 d,DB_ROW_ID
+vidxcd n_leaf_pages Number of leaf pages in the index
+vidxcd size Number of pages in the index
+vidxe n_diff_pfx01 e
+vidxe n_diff_pfx02 e,DB_ROW_ID
+vidxe n_leaf_pages Number of leaf pages in the index
+vidxe size Number of pages in the index
+ALTER TABLE t ADD COLUMN f INT GENERATED ALWAYS AS(a + a), ADD INDEX vidxf (f), ALGORITHM=INPLACE;
+SELECT index_name, stat_name, stat_description
+FROM mysql.innodb_index_stats
+WHERE database_name = 'test' AND table_name = 't';
+index_name stat_name stat_description
+GEN_CLUST_INDEX n_diff_pfx01 DB_ROW_ID
+GEN_CLUST_INDEX n_leaf_pages Number of leaf pages in the index
+GEN_CLUST_INDEX size Number of pages in the index
+idxb n_diff_pfx01 b
+idxb n_diff_pfx02 b,DB_ROW_ID
+idxb n_leaf_pages Number of leaf pages in the index
+idxb size Number of pages in the index
+vidxcd n_diff_pfx01 d
+vidxcd n_diff_pfx02 d,DB_ROW_ID
+vidxcd n_leaf_pages Number of leaf pages in the index
+vidxcd size Number of pages in the index
+vidxe n_diff_pfx01 e
+vidxe n_diff_pfx02 e,DB_ROW_ID
+vidxe n_leaf_pages Number of leaf pages in the index
+vidxe size Number of pages in the index
+vidxf n_diff_pfx01 f
+vidxf n_diff_pfx02 f,DB_ROW_ID
+vidxf n_leaf_pages Number of leaf pages in the index
+vidxf size Number of pages in the index
+ALTER TABLE t DROP INDEX vidxcd;
+SELECT index_name, stat_name, stat_description
+FROM mysql.innodb_index_stats
+WHERE database_name = 'test' AND table_name = 't';
+index_name stat_name stat_description
+GEN_CLUST_INDEX n_diff_pfx01 DB_ROW_ID
+GEN_CLUST_INDEX n_leaf_pages Number of leaf pages in the index
+GEN_CLUST_INDEX size Number of pages in the index
+idxb n_diff_pfx01 b
+idxb n_diff_pfx02 b,DB_ROW_ID
+idxb n_leaf_pages Number of leaf pages in the index
+idxb size Number of pages in the index
+vidxe n_diff_pfx01 e
+vidxe n_diff_pfx02 e,DB_ROW_ID
+vidxe n_leaf_pages Number of leaf pages in the index
+vidxe size Number of pages in the index
+vidxf n_diff_pfx01 f
+vidxf n_diff_pfx02 f,DB_ROW_ID
+vidxf n_leaf_pages Number of leaf pages in the index
+vidxf size Number of pages in the index
+DROP TABLE t;
diff --git a/mysql-test/suite/gcol/t/innodb_virtual_stats.test b/mysql-test/suite/gcol/t/innodb_virtual_stats.test
new file mode 100644
index 00000000000..7e3c8f4e00e
--- /dev/null
+++ b/mysql-test/suite/gcol/t/innodb_virtual_stats.test
@@ -0,0 +1,52 @@
+--source include/have_innodb.inc
+
+#
+# BUG#22469660 INNODB DOESN'T UPDATE INDEX STATS WHEN ADDING OR DROPPING VIRTUAL COLUMN
+#
+
+CREATE TABLE t (
+ a INT,
+ b INT,
+ c INT GENERATED ALWAYS AS(a+b),
+ d INT GENERATED ALWAYS AS(a+b+b),
+ KEY idxa (a),
+ KEY vidxcd (c, d)
+) ENGINE=INNODB STATS_PERSISTENT=1 STATS_AUTO_RECALC=1;
+
+INSERT INTO t (a,b) VALUES (1, 2);
+
+SELECT index_name, stat_name, stat_description
+FROM mysql.innodb_index_stats
+WHERE database_name = 'test' AND table_name = 't';
+
+ALTER TABLE t ADD COLUMN e INT GENERATED ALWAYS AS(a+a+b), ADD INDEX idxb (b), ALGORITHM=INPLACE;
+
+SELECT index_name, stat_name, stat_description
+FROM mysql.innodb_index_stats
+WHERE database_name = 'test' AND table_name = 't';
+
+ALTER TABLE t DROP COLUMN c, DROP INDEX idxa, ALGORITHM=INPLACE;
+
+SELECT index_name, stat_name, stat_description
+FROM mysql.innodb_index_stats
+WHERE database_name = 'test' AND table_name = 't';
+
+ALTER TABLE t ADD INDEX vidxe (e), ALGORITHM=INPLACE;
+
+SELECT index_name, stat_name, stat_description
+FROM mysql.innodb_index_stats
+WHERE database_name = 'test' AND table_name = 't';
+
+ALTER TABLE t ADD COLUMN f INT GENERATED ALWAYS AS(a + a), ADD INDEX vidxf (f), ALGORITHM=INPLACE;
+
+SELECT index_name, stat_name, stat_description
+FROM mysql.innodb_index_stats
+WHERE database_name = 'test' AND table_name = 't';
+
+ALTER TABLE t DROP INDEX vidxcd;
+
+SELECT index_name, stat_name, stat_description
+FROM mysql.innodb_index_stats
+WHERE database_name = 'test' AND table_name = 't';
+
+DROP TABLE t;
diff --git a/mysql-test/suite/innodb/include/innodb_bulk_create_index.inc b/mysql-test/suite/innodb/include/innodb_bulk_create_index.inc
new file mode 100644
index 00000000000..3c10517933f
--- /dev/null
+++ b/mysql-test/suite/innodb/include/innodb_bulk_create_index.inc
@@ -0,0 +1,185 @@
+#
+# wl#7277: InnoDB: Bulk Load for Create Index
+#
+
+# Create Insert Procedure
+DELIMITER |;
+CREATE PROCEDURE populate_t1(load_even INT)
+BEGIN
+ DECLARE i int DEFAULT 1;
+
+ START TRANSACTION;
+ WHILE (i <= 10000) DO
+ IF i%2 = 0 AND load_even = 1 THEN
+ INSERT INTO t1 VALUES (i, i, CONCAT('a', i));
+ END IF;
+ IF i%2 != 0 AND load_even != 1 THEN
+ INSERT INTO t1 VALUES (i, i, CONCAT('a', i));
+ END IF;
+ SET i = i + 1;
+ END WHILE;
+ COMMIT;
+END|
+DELIMITER ;|
+
+SELECT @@innodb_fill_factor;
+
+if ($row_format != 'COMPRESSED')
+{
+ eval CREATE TABLE t1(
+ class INT,
+ id INT,
+ title VARCHAR(100)
+ ) ENGINE=InnoDB ROW_FORMAT=$row_format;
+}
+
+if ($row_format == 'COMPRESSED')
+{
+ SET GLOBAL innodb_file_per_table=1;
+
+ eval CREATE TABLE t1(
+ class INT,
+ id INT,
+ title VARCHAR(100)
+ ) ENGINE=InnoDB ROW_FORMAT=$row_format KEY_BLOCK_SIZE=4;
+}
+
+-- disable_query_log
+# Load half records
+CALL populate_t1(1);
+-- enable_query_log
+
+SELECT COUNT(*) FROM t1;
+
+/* Create index. */
+CREATE INDEX idx_id ON t1(id);
+
+CREATE INDEX idx_title ON t1(title);
+
+/* Check table. */
+CHECK TABLE t1;
+
+/* Select by index. */
+EXPLAIN SELECT * FROM t1 WHERE id = 10;
+EXPLAIN SELECT * FROM t1 WHERE title = 'a10';
+
+SELECT * FROM t1 WHERE id = 10;
+SELECT * FROM t1 WHERE title = 'a10';
+
+SELECT * FROM t1 WHERE id = 5000;
+SELECT * FROM t1 WHERE title = 'a5000';
+
+SELECT * FROM t1 WHERE id = 10000;
+SELECT * FROM t1 WHERE title = 'a10000';
+
+SELECT * FROM t1 WHERE id = 10010;
+SELECT * FROM t1 WHERE title = 'a10010';
+
+/*Insert/Update/Delete. */
+DELETE FROM t1 WHERE id < 4010 AND id > 3990;
+INSERT INTO t1 VALUES(4000, 4000, 'b4000');
+UPDATE t1 SET title = CONCAT('b', id) WHERE id < 3010 AND id > 2990;
+
+SELECT * FROM t1 WHERE id = 3000;
+SELECT * FROM t1 WHERE title = 'a3000';
+SELECT * FROM t1 WHERE title = 'b3000';
+
+SELECT * FROM t1 WHERE id = 4000;
+SELECT * FROM t1 WHERE title = 'a4000';
+SELECT * FROM t1 WHERE title = 'b4000';
+
+SELECT * FROM t1 WHERE id = 4001;
+SELECT * FROM t1 WHERE title = 'a4001';
+
+-- disable_query_log
+# Load half records (follow up load)
+CALL populate_t1(0);
+-- enable_query_log
+SELECT COUNT(*) FROM t1;
+
+
+/* Add column. */
+ALTER TABLE t1 ADD COLUMN content TEXT;
+
+CHECK TABLE t1;
+
+SELECT * FROM t1 WHERE id = 10;
+SELECT * FROM t1 WHERE title = 'a10';
+
+SELECT * FROM t1 WHERE id = 5000;
+SELECT * FROM t1 WHERE title = 'a5000';
+
+SELECT * FROM t1 WHERE id = 10000;
+SELECT * FROM t1 WHERE title = 'a10000';
+
+SELECT * FROM t1 WHERE id = 10010;
+SELECT * FROM t1 WHERE title = 'a10010';
+
+/* Drop column. */
+ALTER TABLE t1 DROP COLUMN content;
+
+CHECK TABLE t1;
+
+SELECT * FROM t1 WHERE id = 10;
+SELECT * FROM t1 WHERE title = 'a10';
+
+SELECT * FROM t1 WHERE id = 5000;
+SELECT * FROM t1 WHERE title = 'a5000';
+
+SELECT * FROM t1 WHERE id = 10000;
+SELECT * FROM t1 WHERE title = 'a10000';
+
+SELECT * FROM t1 WHERE id = 10010;
+SELECT * FROM t1 WHERE title = 'a10010';
+
+DROP TABLE t1;
+
+# Test Blob
+if ($row_format != 'COMPRESSED') {
+ eval CREATE TABLE t1(
+ a INT PRIMARY KEY,
+ b TEXT,
+ c TEXT) ENGINE=InnoDB ROW_FORMAT=$row_format;
+}
+
+if ($row_format == 'COMPRESSED') {
+ eval CREATE TABLE t1(
+ a INT PRIMARY KEY,
+ b BLOB,
+ c TEXT) ENGINE=InnoDB ROW_FORMAT=$row_format KEY_BLOCK_SIZE=4;
+}
+
+let $cnt= 5000;
+-- disable_query_log
+WHILE ($cnt>=4950)
+{
+EVAL INSERT INTO t1 VALUES
+ ($cnt, REPEAT(CONCAT('a', $cnt),2000), CONCAT('a', $cnt));
+dec $cnt;
+}
+-- enable_query_log
+ALTER TABLE t1 ADD INDEX `idx` (a,b(5));
+
+SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975;
+SELECT b=REPEAT(CONCAT('a',4975),2000) FROM t1 WHERE a=4975 AND b like 'a4975%';
+UPDATE t1 SET b = REPEAT(CONCAT('b',4975),2000) WHERE a=4975 AND b like 'a4975%';
+SELECT b=REPEAT(CONCAT('a',4975),2000) FROM t1 WHERE a=4975 AND b like 'a4975%';
+SELECT b=REPEAT(CONCAT('b',4975),2000) FROM t1 WHERE a=4975 AND b like 'b4975%';
+DELETE FROM t1 WHERE a=4975 AND b like 'b4975%';
+SELECT b=REPEAT(CONCAT('b',4975),2000) FROM t1 WHERE a=4975 AND b like 'b4975%';
+
+ALTER TABLE t1 DROP COLUMN c;
+
+CHECK TABLE t1;
+
+SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975;
+
+DROP TABLE t1;
+
+# Restore global variables
+if ($row_format == 'COMPRESSED')
+{
+ SET GLOBAL innodb_file_per_table=default;
+}
+
+DROP PROCEDURE populate_t1;
diff --git a/mysql-test/suite/innodb/include/innodb_bulk_create_index_debug.inc b/mysql-test/suite/innodb/include/innodb_bulk_create_index_debug.inc
new file mode 100644
index 00000000000..48de3a1962d
--- /dev/null
+++ b/mysql-test/suite/innodb/include/innodb_bulk_create_index_debug.inc
@@ -0,0 +1,221 @@
+#
+# wl#7277: InnoDB: Bulk Load for Create Index
+#
+
+# Not supported in embedded
+-- source include/not_embedded.inc
+
+# This test case needs to crash the server. Needs a debug server.
+-- source include/have_debug.inc
+
+# Don't test this under valgrind, memory leaks will occur.
+-- source include/not_valgrind.inc
+
+# Avoid CrashReporter popup on Mac
+-- source include/not_crashrep.inc
+
+-- source include/have_innodb.inc
+
+# Create Insert Procedure
+DELIMITER |;
+CREATE PROCEDURE populate_t1()
+BEGIN
+ DECLARE i int DEFAULT 1;
+
+ START TRANSACTION;
+ WHILE (i <= 10000) DO
+ INSERT INTO t1 VALUES (i, i, CONCAT('a', i));
+ SET i = i + 1;
+ END WHILE;
+ COMMIT;
+END|
+DELIMITER ;|
+
+# Test scenarios:
+# 1. Test restart;
+# 2. Test crash recovery.
+
+# Test Restart
+if ($row_format != 'COMPRESSED')
+{
+ eval CREATE TABLE t1(
+ class INT,
+ id INT,
+ title VARCHAR(100)
+ ) ENGINE=InnoDB ROW_FORMAT=$row_format;
+}
+
+if ($row_format == 'COMPRESSED')
+{
+ SET GLOBAL innodb_file_per_table=1;
+
+ eval CREATE TABLE t1(
+ class INT,
+ id INT,
+ title VARCHAR(100)
+ ) ENGINE=InnoDB ROW_FORMAT=$row_format KEY_BLOCK_SIZE=4;
+}
+
+-- disable_query_log
+CALL populate_t1();
+-- enable_query_log
+
+SELECT COUNT(*) FROM t1;
+
+CREATE INDEX idx_title ON t1(title);
+
+--source include/restart_mysqld.inc
+
+CHECK TABLE t1;
+
+SELECT * FROM t1 WHERE title = 'a10';
+
+SELECT * FROM t1 WHERE title = 'a5000';
+
+SELECT * FROM t1 WHERE title = 'a10000';
+
+SELECT * FROM t1 WHERE title = 'a10010';
+
+DROP TABLE t1;
+
+-- echo # Test Blob
+
+if ($row_format != 'COMPRESSED') {
+ eval CREATE TABLE t1(
+ a INT PRIMARY KEY,
+ b TEXT,
+ c TEXT) ENGINE=InnoDB ROW_FORMAT=$row_format;
+}
+
+if ($row_format == 'COMPRESSED') {
+ SET GLOBAL innodb_file_per_table=1;
+
+ eval CREATE TABLE t1(
+ a INT PRIMARY KEY,
+ b TEXT,
+ c TEXT) ENGINE=InnoDB ROW_FORMAT=$row_format KEY_BLOCK_SIZE=4;
+}
+
+INSERT INTO t1 VALUES
+ (1, REPEAT('a',10000), 'a'),
+ (2, REPEAT('b',20000), 'b'),
+ (3, REPEAT('c',40000), 'c'),
+ (4, REPEAT('d',60000), 'd');
+
+SELECT CHAR_LENGTH(b) FROM t1;
+
+ALTER TABLE t1 DROP COLUMN c;
+
+--source include/restart_mysqld.inc
+
+CHECK TABLE t1;
+
+SELECT CHAR_LENGTH(b) FROM t1;
+
+DROP TABLE t1;
+
+# Test Crash Recovery
+
+if ($row_format != 'COMPRESSED')
+{
+ eval CREATE TABLE t1(
+ class INT,
+ id INT,
+ title VARCHAR(100)
+ ) ENGINE=InnoDB ROW_FORMAT=$row_format;
+}
+
+if ($row_format == 'COMPRESSED')
+{
+ SET GLOBAL innodb_file_per_table=1;
+
+ eval CREATE TABLE t1(
+ class INT,
+ id INT,
+ title VARCHAR(100)
+ ) ENGINE=InnoDB ROW_FORMAT=$row_format KEY_BLOCK_SIZE=4;
+}
+
+-- disable_query_log
+CALL populate_t1();
+-- enable_query_log
+
+SET debug_dbug='+d,crash_commit_before';
+
+# Write file to make mysql-test-run.pl start up the server again
+--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+
+--error 2013
+CREATE INDEX idx_title ON t1(title);
+
+--enable_reconnect
+--source include/wait_until_connected_again.inc
+--disable_reconnect
+
+SELECT COUNT(*) FROM t1;
+
+CHECK TABLE t1;
+
+EXPLAIN SELECT * FROM t1 WHERE title = 'a10';
+
+SELECT * FROM t1 WHERE title = 'a10';
+
+SELECT * FROM t1 WHERE title = 'a5000';
+
+SELECT * FROM t1 WHERE title = 'a10000';
+
+SELECT * FROM t1 WHERE title = 'a10010';
+
+DROP TABLE t1;
+
+-- echo # Test Blob
+
+if ($row_format != 'COMPRESSED') {
+ eval CREATE TABLE t1(
+ a INT PRIMARY KEY,
+ b TEXT,
+ c TEXT) ENGINE=InnoDB ROW_FORMAT=$row_format;
+}
+
+if ($row_format == 'COMPRESSED') {
+ SET GLOBAL innodb_file_per_table=1;
+
+ eval CREATE TABLE t1(
+ a INT PRIMARY KEY,
+ b TEXT,
+ c TEXT) ENGINE=InnoDB ROW_FORMAT=$row_format KEY_BLOCK_SIZE=4;
+}
+
+INSERT INTO t1 VALUES
+ (1, REPEAT('a',10000), 'a'),
+ (2, REPEAT('b',20000), 'b'),
+ (3, REPEAT('c',40000), 'c'),
+ (4, REPEAT('d',60000), 'd');
+
+SELECT CHAR_LENGTH(b) FROM t1;
+
+SET debug_dbug='+d,crash_commit_before';
+
+# Write file to make mysql-test-run.pl start up the server again
+--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+
+--error 2013
+ALTER TABLE t1 DROP COLUMN c;
+
+--enable_reconnect
+--source include/wait_until_connected_again.inc
+--disable_reconnect
+
+CHECK TABLE t1;
+
+SELECT CHAR_LENGTH(b) FROM t1;
+
+DROP TABLE t1;
+
+# Restore global variables
+if ($row_format == 'COMPRESSED')
+{
+ SET GLOBAL innodb_file_per_table=default;
+}
+
+DROP PROCEDURE populate_t1;
diff --git a/mysql-test/suite/innodb/r/ddl_purge.result b/mysql-test/suite/innodb/r/ddl_purge.result
new file mode 100644
index 00000000000..45f4c99e97b
--- /dev/null
+++ b/mysql-test/suite/innodb/r/ddl_purge.result
@@ -0,0 +1,25 @@
+CREATE TABLE t0 (pk INT PRIMARY KEY) ENGINE=InnoDB;
+CREATE TABLE t1 (pk INT PRIMARY KEY, b INT) ENGINE=InnoDB;
+connect con1,localhost,root,,test;
+BEGIN;
+INSERT INTO t0 SET pk=1;
+connect con2,localhost,root,,test;
+BEGIN;
+INSERT INTO t0 SET pk=2;
+connection default;
+SET DEBUG_SYNC='alter_table_inplace_after_lock_downgrade SIGNAL prepared WAIT_FOR logged';
+ALTER TABLE t1 FORCE;
+connection con1;
+SET DEBUG_SYNC='now WAIT_FOR prepared';
+INSERT INTO t1 SET pk=1;
+COMMIT;
+disconnect con1;
+connection con2;
+UPDATE t1 SET b=1;
+DELETE FROM t1;
+ROLLBACK;
+SET DEBUG_SYNC='now SIGNAL logged';
+disconnect con2;
+connection default;
+SET DEBUG_SYNC='RESET';
+DROP TABLE t0,t1;
diff --git a/mysql-test/suite/innodb/r/innodb-on-duplicate-update.result b/mysql-test/suite/innodb/r/innodb-on-duplicate-update.result
new file mode 100644
index 00000000000..474ebf33bbd
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb-on-duplicate-update.result
@@ -0,0 +1,60 @@
+set sql_mode='';
+set innodb_strict_mode=0;
+CREATE TABLE `v` (
+`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
+PRIMARY KEY (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
+INSERT v values (1);
+CREATE TABLE `vp` (
+`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
+`v_id` int(10) unsigned NOT NULL,
+`p_id` int(10) unsigned NOT NULL,
+`ppp` varchar(255) NOT NULL,
+PRIMARY KEY (`id`),
+UNIQUE KEY `IDX_vp_uniq` (`v_id`,`p_id`),
+KEY `FK_vp_v` (`v_id`),
+CONSTRAINT `FK_vp_v` FOREIGN KEY (`v_id`) REFERENCES `v` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
+INSERT vp VALUES (12, 1, 100, 'text12');
+INSERT INTO `vp` (`id`,`ppp`) VALUES (12, 'test12-2') ON DUPLICATE KEY UPDATE `ppp` = VALUES(`ppp`);
+Warnings:
+Warning 1364 Field 'v_id' doesn't have a default value
+Warning 1364 Field 'p_id' doesn't have a default value
+SELECT * FROM vp;
+id v_id p_id ppp
+12 1 100 test12-2
+DROP TABLE vp, v;
+CREATE TABLE t1 (i int PRIMARY KEY) ENGINE=InnoDB;
+INSERT into t1 values (1);
+CREATE TABLE t2 (
+i int not null primary key,
+vi int not null,
+m int,
+UNIQUE KEY (vi),
+CONSTRAINT `cc` FOREIGN KEY (vi) REFERENCES t1 (i) ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB;
+INSERT into t2 VALUES (1, 1, 100);
+INSERT INTO t2 (i,m) VALUES (1, 2) ON DUPLICATE KEY UPDATE m=3;
+Warnings:
+Warning 1364 Field 'vi' doesn't have a default value
+SELECT * FROM t2;
+i vi m
+1 1 3
+DROP TABLE t2,t1;
+CREATE TABLE t1 (i int PRIMARY KEY) ENGINE=InnoDB;
+INSERT into t1 values (1);
+CREATE TABLE t2 (
+i int not null primary key,
+vi int not null,
+m int,
+KEY (vi),
+CONSTRAINT `cc` FOREIGN KEY (vi) REFERENCES t1 (i) ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB;
+INSERT into t2 VALUES (1, 1, 100);
+INSERT INTO t2 (i,m) VALUES (1, 2) ON DUPLICATE KEY UPDATE m=3;
+Warnings:
+Warning 1364 Field 'vi' doesn't have a default value
+SELECT * FROM t2;
+i vi m
+1 1 3
+DROP TABLE t2, t1;
diff --git a/mysql-test/suite/innodb/r/innodb-replace-debug.result b/mysql-test/suite/innodb/r/innodb-replace-debug.result
new file mode 100644
index 00000000000..84bc9dc9769
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb-replace-debug.result
@@ -0,0 +1,13 @@
+#
+# Bug#17604730 ASSERTION: *CURSOR->INDEX->NAME == TEMP_INDEX_PREFIX
+#
+create table t1 (f1 int primary key, f2 int, f3 int, unique key k1(f2),
+key k2(f3)) engine=innodb;
+insert into t1 values (14, 24, 34);
+set @@debug_dbug = '+d,row_ins_sec_index_entry_timeout';
+replace into t1 values (14, 25, 34);
+select * from t1;
+f1 f2 f3
+14 25 34
+drop table t1;
+set @@debug_dbug = '-d,row_ins_sec_index_entry_timeout';
diff --git a/mysql-test/suite/innodb/r/innodb_bulk_create_index.result b/mysql-test/suite/innodb/r/innodb_bulk_create_index.result
new file mode 100644
index 00000000000..ec7ce044cb7
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb_bulk_create_index.result
@@ -0,0 +1,1037 @@
+CREATE PROCEDURE populate_t1(load_even INT)
+BEGIN
+DECLARE i int DEFAULT 1;
+START TRANSACTION;
+WHILE (i <= 10000) DO
+IF i%2 = 0 AND load_even = 1 THEN
+INSERT INTO t1 VALUES (i, i, CONCAT('a', i));
+END IF;
+IF i%2 != 0 AND load_even != 1 THEN
+INSERT INTO t1 VALUES (i, i, CONCAT('a', i));
+END IF;
+SET i = i + 1;
+END WHILE;
+COMMIT;
+END|
+SELECT @@innodb_fill_factor;
+@@innodb_fill_factor
+100
+CREATE TABLE t1(
+class INT,
+id INT,
+title VARCHAR(100)
+) ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+5000
+/* Create index. */
+CREATE INDEX idx_id ON t1(id);
+CREATE INDEX idx_title ON t1(title);
+/* Check table. */
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+/* Select by index. */
+EXPLAIN SELECT * FROM t1 WHERE id = 10;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref idx_id idx_id 5 const 1
+EXPLAIN SELECT * FROM t1 WHERE title = 'a10';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref idx_title idx_title 103 const 1 Using index condition
+SELECT * FROM t1 WHERE id = 10;
+class id title
+10 10 a10
+SELECT * FROM t1 WHERE title = 'a10';
+class id title
+10 10 a10
+SELECT * FROM t1 WHERE id = 5000;
+class id title
+5000 5000 a5000
+SELECT * FROM t1 WHERE title = 'a5000';
+class id title
+5000 5000 a5000
+SELECT * FROM t1 WHERE id = 10000;
+class id title
+10000 10000 a10000
+SELECT * FROM t1 WHERE title = 'a10000';
+class id title
+10000 10000 a10000
+SELECT * FROM t1 WHERE id = 10010;
+class id title
+SELECT * FROM t1 WHERE title = 'a10010';
+class id title
+/*Insert/Update/Delete. */
+DELETE FROM t1 WHERE id < 4010 AND id > 3990;
+INSERT INTO t1 VALUES(4000, 4000, 'b4000');
+UPDATE t1 SET title = CONCAT('b', id) WHERE id < 3010 AND id > 2990;
+SELECT * FROM t1 WHERE id = 3000;
+class id title
+3000 3000 b3000
+SELECT * FROM t1 WHERE title = 'a3000';
+class id title
+SELECT * FROM t1 WHERE title = 'b3000';
+class id title
+3000 3000 b3000
+SELECT * FROM t1 WHERE id = 4000;
+class id title
+4000 4000 b4000
+SELECT * FROM t1 WHERE title = 'a4000';
+class id title
+SELECT * FROM t1 WHERE title = 'b4000';
+class id title
+4000 4000 b4000
+SELECT * FROM t1 WHERE id = 4001;
+class id title
+SELECT * FROM t1 WHERE title = 'a4001';
+class id title
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+9992
+/* Add column. */
+ALTER TABLE t1 ADD COLUMN content TEXT;
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+SELECT * FROM t1 WHERE id = 10;
+class id title content
+10 10 a10 NULL
+SELECT * FROM t1 WHERE title = 'a10';
+class id title content
+10 10 a10 NULL
+SELECT * FROM t1 WHERE id = 5000;
+class id title content
+5000 5000 a5000 NULL
+SELECT * FROM t1 WHERE title = 'a5000';
+class id title content
+5000 5000 a5000 NULL
+SELECT * FROM t1 WHERE id = 10000;
+class id title content
+10000 10000 a10000 NULL
+SELECT * FROM t1 WHERE title = 'a10000';
+class id title content
+10000 10000 a10000 NULL
+SELECT * FROM t1 WHERE id = 10010;
+class id title content
+SELECT * FROM t1 WHERE title = 'a10010';
+class id title content
+/* Drop column. */
+ALTER TABLE t1 DROP COLUMN content;
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+SELECT * FROM t1 WHERE id = 10;
+class id title
+10 10 a10
+SELECT * FROM t1 WHERE title = 'a10';
+class id title
+10 10 a10
+SELECT * FROM t1 WHERE id = 5000;
+class id title
+5000 5000 a5000
+SELECT * FROM t1 WHERE title = 'a5000';
+class id title
+5000 5000 a5000
+SELECT * FROM t1 WHERE id = 10000;
+class id title
+10000 10000 a10000
+SELECT * FROM t1 WHERE title = 'a10000';
+class id title
+10000 10000 a10000
+SELECT * FROM t1 WHERE id = 10010;
+class id title
+SELECT * FROM t1 WHERE title = 'a10010';
+class id title
+DROP TABLE t1;
+CREATE TABLE t1(
+a INT PRIMARY KEY,
+b TEXT,
+c TEXT) ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
+ALTER TABLE t1 ADD INDEX `idx` (a,b(5));
+SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975;
+CHAR_LENGTH(b)
+10000
+SELECT b=REPEAT(CONCAT('a',4975),2000) FROM t1 WHERE a=4975 AND b like 'a4975%';
+b=REPEAT(CONCAT('a',4975),2000)
+1
+UPDATE t1 SET b = REPEAT(CONCAT('b',4975),2000) WHERE a=4975 AND b like 'a4975%';
+SELECT b=REPEAT(CONCAT('a',4975),2000) FROM t1 WHERE a=4975 AND b like 'a4975%';
+b=REPEAT(CONCAT('a',4975),2000)
+SELECT b=REPEAT(CONCAT('b',4975),2000) FROM t1 WHERE a=4975 AND b like 'b4975%';
+b=REPEAT(CONCAT('b',4975),2000)
+1
+DELETE FROM t1 WHERE a=4975 AND b like 'b4975%';
+SELECT b=REPEAT(CONCAT('b',4975),2000) FROM t1 WHERE a=4975 AND b like 'b4975%';
+b=REPEAT(CONCAT('b',4975),2000)
+ALTER TABLE t1 DROP COLUMN c;
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975;
+CHAR_LENGTH(b)
+DROP TABLE t1;
+DROP PROCEDURE populate_t1;
+CREATE PROCEDURE populate_t1(load_even INT)
+BEGIN
+DECLARE i int DEFAULT 1;
+START TRANSACTION;
+WHILE (i <= 10000) DO
+IF i%2 = 0 AND load_even = 1 THEN
+INSERT INTO t1 VALUES (i, i, CONCAT('a', i));
+END IF;
+IF i%2 != 0 AND load_even != 1 THEN
+INSERT INTO t1 VALUES (i, i, CONCAT('a', i));
+END IF;
+SET i = i + 1;
+END WHILE;
+COMMIT;
+END|
+SELECT @@innodb_fill_factor;
+@@innodb_fill_factor
+100
+CREATE TABLE t1(
+class INT,
+id INT,
+title VARCHAR(100)
+) ENGINE=InnoDB ROW_FORMAT=COMPACT;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+5000
+/* Create index. */
+CREATE INDEX idx_id ON t1(id);
+CREATE INDEX idx_title ON t1(title);
+/* Check table. */
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+/* Select by index. */
+EXPLAIN SELECT * FROM t1 WHERE id = 10;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref idx_id idx_id 5 const 1
+EXPLAIN SELECT * FROM t1 WHERE title = 'a10';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref idx_title idx_title 103 const 1 Using index condition
+SELECT * FROM t1 WHERE id = 10;
+class id title
+10 10 a10
+SELECT * FROM t1 WHERE title = 'a10';
+class id title
+10 10 a10
+SELECT * FROM t1 WHERE id = 5000;
+class id title
+5000 5000 a5000
+SELECT * FROM t1 WHERE title = 'a5000';
+class id title
+5000 5000 a5000
+SELECT * FROM t1 WHERE id = 10000;
+class id title
+10000 10000 a10000
+SELECT * FROM t1 WHERE title = 'a10000';
+class id title
+10000 10000 a10000
+SELECT * FROM t1 WHERE id = 10010;
+class id title
+SELECT * FROM t1 WHERE title = 'a10010';
+class id title
+/*Insert/Update/Delete. */
+DELETE FROM t1 WHERE id < 4010 AND id > 3990;
+INSERT INTO t1 VALUES(4000, 4000, 'b4000');
+UPDATE t1 SET title = CONCAT('b', id) WHERE id < 3010 AND id > 2990;
+SELECT * FROM t1 WHERE id = 3000;
+class id title
+3000 3000 b3000
+SELECT * FROM t1 WHERE title = 'a3000';
+class id title
+SELECT * FROM t1 WHERE title = 'b3000';
+class id title
+3000 3000 b3000
+SELECT * FROM t1 WHERE id = 4000;
+class id title
+4000 4000 b4000
+SELECT * FROM t1 WHERE title = 'a4000';
+class id title
+SELECT * FROM t1 WHERE title = 'b4000';
+class id title
+4000 4000 b4000
+SELECT * FROM t1 WHERE id = 4001;
+class id title
+SELECT * FROM t1 WHERE title = 'a4001';
+class id title
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+9992
+/* Add column. */
+ALTER TABLE t1 ADD COLUMN content TEXT;
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+SELECT * FROM t1 WHERE id = 10;
+class id title content
+10 10 a10 NULL
+SELECT * FROM t1 WHERE title = 'a10';
+class id title content
+10 10 a10 NULL
+SELECT * FROM t1 WHERE id = 5000;
+class id title content
+5000 5000 a5000 NULL
+SELECT * FROM t1 WHERE title = 'a5000';
+class id title content
+5000 5000 a5000 NULL
+SELECT * FROM t1 WHERE id = 10000;
+class id title content
+10000 10000 a10000 NULL
+SELECT * FROM t1 WHERE title = 'a10000';
+class id title content
+10000 10000 a10000 NULL
+SELECT * FROM t1 WHERE id = 10010;
+class id title content
+SELECT * FROM t1 WHERE title = 'a10010';
+class id title content
+/* Drop column. */
+ALTER TABLE t1 DROP COLUMN content;
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+SELECT * FROM t1 WHERE id = 10;
+class id title
+10 10 a10
+SELECT * FROM t1 WHERE title = 'a10';
+class id title
+10 10 a10
+SELECT * FROM t1 WHERE id = 5000;
+class id title
+5000 5000 a5000
+SELECT * FROM t1 WHERE title = 'a5000';
+class id title
+5000 5000 a5000
+SELECT * FROM t1 WHERE id = 10000;
+class id title
+10000 10000 a10000
+SELECT * FROM t1 WHERE title = 'a10000';
+class id title
+10000 10000 a10000
+SELECT * FROM t1 WHERE id = 10010;
+class id title
+SELECT * FROM t1 WHERE title = 'a10010';
+class id title
+DROP TABLE t1;
+CREATE TABLE t1(
+a INT PRIMARY KEY,
+b TEXT,
+c TEXT) ENGINE=InnoDB ROW_FORMAT=COMPACT;
+ALTER TABLE t1 ADD INDEX `idx` (a,b(5));
+SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975;
+CHAR_LENGTH(b)
+10000
+SELECT b=REPEAT(CONCAT('a',4975),2000) FROM t1 WHERE a=4975 AND b like 'a4975%';
+b=REPEAT(CONCAT('a',4975),2000)
+1
+UPDATE t1 SET b = REPEAT(CONCAT('b',4975),2000) WHERE a=4975 AND b like 'a4975%';
+SELECT b=REPEAT(CONCAT('a',4975),2000) FROM t1 WHERE a=4975 AND b like 'a4975%';
+b=REPEAT(CONCAT('a',4975),2000)
+SELECT b=REPEAT(CONCAT('b',4975),2000) FROM t1 WHERE a=4975 AND b like 'b4975%';
+b=REPEAT(CONCAT('b',4975),2000)
+1
+DELETE FROM t1 WHERE a=4975 AND b like 'b4975%';
+SELECT b=REPEAT(CONCAT('b',4975),2000) FROM t1 WHERE a=4975 AND b like 'b4975%';
+b=REPEAT(CONCAT('b',4975),2000)
+ALTER TABLE t1 DROP COLUMN c;
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975;
+CHAR_LENGTH(b)
+DROP TABLE t1;
+DROP PROCEDURE populate_t1;
+CREATE PROCEDURE populate_t1(load_even INT)
+BEGIN
+DECLARE i int DEFAULT 1;
+START TRANSACTION;
+WHILE (i <= 10000) DO
+IF i%2 = 0 AND load_even = 1 THEN
+INSERT INTO t1 VALUES (i, i, CONCAT('a', i));
+END IF;
+IF i%2 != 0 AND load_even != 1 THEN
+INSERT INTO t1 VALUES (i, i, CONCAT('a', i));
+END IF;
+SET i = i + 1;
+END WHILE;
+COMMIT;
+END|
+SELECT @@innodb_fill_factor;
+@@innodb_fill_factor
+100
+CREATE TABLE t1(
+class INT,
+id INT,
+title VARCHAR(100)
+) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+5000
+/* Create index. */
+CREATE INDEX idx_id ON t1(id);
+CREATE INDEX idx_title ON t1(title);
+/* Check table. */
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+/* Select by index. */
+EXPLAIN SELECT * FROM t1 WHERE id = 10;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref idx_id idx_id 5 const 1
+EXPLAIN SELECT * FROM t1 WHERE title = 'a10';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref idx_title idx_title 103 const 1 Using index condition
+SELECT * FROM t1 WHERE id = 10;
+class id title
+10 10 a10
+SELECT * FROM t1 WHERE title = 'a10';
+class id title
+10 10 a10
+SELECT * FROM t1 WHERE id = 5000;
+class id title
+5000 5000 a5000
+SELECT * FROM t1 WHERE title = 'a5000';
+class id title
+5000 5000 a5000
+SELECT * FROM t1 WHERE id = 10000;
+class id title
+10000 10000 a10000
+SELECT * FROM t1 WHERE title = 'a10000';
+class id title
+10000 10000 a10000
+SELECT * FROM t1 WHERE id = 10010;
+class id title
+SELECT * FROM t1 WHERE title = 'a10010';
+class id title
+/*Insert/Update/Delete. */
+DELETE FROM t1 WHERE id < 4010 AND id > 3990;
+INSERT INTO t1 VALUES(4000, 4000, 'b4000');
+UPDATE t1 SET title = CONCAT('b', id) WHERE id < 3010 AND id > 2990;
+SELECT * FROM t1 WHERE id = 3000;
+class id title
+3000 3000 b3000
+SELECT * FROM t1 WHERE title = 'a3000';
+class id title
+SELECT * FROM t1 WHERE title = 'b3000';
+class id title
+3000 3000 b3000
+SELECT * FROM t1 WHERE id = 4000;
+class id title
+4000 4000 b4000
+SELECT * FROM t1 WHERE title = 'a4000';
+class id title
+SELECT * FROM t1 WHERE title = 'b4000';
+class id title
+4000 4000 b4000
+SELECT * FROM t1 WHERE id = 4001;
+class id title
+SELECT * FROM t1 WHERE title = 'a4001';
+class id title
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+9992
+/* Add column. */
+ALTER TABLE t1 ADD COLUMN content TEXT;
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+SELECT * FROM t1 WHERE id = 10;
+class id title content
+10 10 a10 NULL
+SELECT * FROM t1 WHERE title = 'a10';
+class id title content
+10 10 a10 NULL
+SELECT * FROM t1 WHERE id = 5000;
+class id title content
+5000 5000 a5000 NULL
+SELECT * FROM t1 WHERE title = 'a5000';
+class id title content
+5000 5000 a5000 NULL
+SELECT * FROM t1 WHERE id = 10000;
+class id title content
+10000 10000 a10000 NULL
+SELECT * FROM t1 WHERE title = 'a10000';
+class id title content
+10000 10000 a10000 NULL
+SELECT * FROM t1 WHERE id = 10010;
+class id title content
+SELECT * FROM t1 WHERE title = 'a10010';
+class id title content
+/* Drop column. */
+ALTER TABLE t1 DROP COLUMN content;
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+SELECT * FROM t1 WHERE id = 10;
+class id title
+10 10 a10
+SELECT * FROM t1 WHERE title = 'a10';
+class id title
+10 10 a10
+SELECT * FROM t1 WHERE id = 5000;
+class id title
+5000 5000 a5000
+SELECT * FROM t1 WHERE title = 'a5000';
+class id title
+5000 5000 a5000
+SELECT * FROM t1 WHERE id = 10000;
+class id title
+10000 10000 a10000
+SELECT * FROM t1 WHERE title = 'a10000';
+class id title
+10000 10000 a10000
+SELECT * FROM t1 WHERE id = 10010;
+class id title
+SELECT * FROM t1 WHERE title = 'a10010';
+class id title
+DROP TABLE t1;
+CREATE TABLE t1(
+a INT PRIMARY KEY,
+b TEXT,
+c TEXT) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
+ALTER TABLE t1 ADD INDEX `idx` (a,b(5));
+SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975;
+CHAR_LENGTH(b)
+10000
+SELECT b=REPEAT(CONCAT('a',4975),2000) FROM t1 WHERE a=4975 AND b like 'a4975%';
+b=REPEAT(CONCAT('a',4975),2000)
+1
+UPDATE t1 SET b = REPEAT(CONCAT('b',4975),2000) WHERE a=4975 AND b like 'a4975%';
+SELECT b=REPEAT(CONCAT('a',4975),2000) FROM t1 WHERE a=4975 AND b like 'a4975%';
+b=REPEAT(CONCAT('a',4975),2000)
+SELECT b=REPEAT(CONCAT('b',4975),2000) FROM t1 WHERE a=4975 AND b like 'b4975%';
+b=REPEAT(CONCAT('b',4975),2000)
+1
+DELETE FROM t1 WHERE a=4975 AND b like 'b4975%';
+SELECT b=REPEAT(CONCAT('b',4975),2000) FROM t1 WHERE a=4975 AND b like 'b4975%';
+b=REPEAT(CONCAT('b',4975),2000)
+ALTER TABLE t1 DROP COLUMN c;
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975;
+CHAR_LENGTH(b)
+DROP TABLE t1;
+DROP PROCEDURE populate_t1;
+CREATE PROCEDURE populate_t1(load_even INT)
+BEGIN
+DECLARE i int DEFAULT 1;
+START TRANSACTION;
+WHILE (i <= 10000) DO
+IF i%2 = 0 AND load_even = 1 THEN
+INSERT INTO t1 VALUES (i, i, CONCAT('a', i));
+END IF;
+IF i%2 != 0 AND load_even != 1 THEN
+INSERT INTO t1 VALUES (i, i, CONCAT('a', i));
+END IF;
+SET i = i + 1;
+END WHILE;
+COMMIT;
+END|
+SELECT @@innodb_fill_factor;
+@@innodb_fill_factor
+100
+SET GLOBAL innodb_file_per_table=1;
+CREATE TABLE t1(
+class INT,
+id INT,
+title VARCHAR(100)
+) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+5000
+/* Create index. */
+CREATE INDEX idx_id ON t1(id);
+CREATE INDEX idx_title ON t1(title);
+/* Check table. */
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+/* Select by index. */
+EXPLAIN SELECT * FROM t1 WHERE id = 10;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref idx_id idx_id 5 const 1
+EXPLAIN SELECT * FROM t1 WHERE title = 'a10';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref idx_title idx_title 103 const 1 Using index condition
+SELECT * FROM t1 WHERE id = 10;
+class id title
+10 10 a10
+SELECT * FROM t1 WHERE title = 'a10';
+class id title
+10 10 a10
+SELECT * FROM t1 WHERE id = 5000;
+class id title
+5000 5000 a5000
+SELECT * FROM t1 WHERE title = 'a5000';
+class id title
+5000 5000 a5000
+SELECT * FROM t1 WHERE id = 10000;
+class id title
+10000 10000 a10000
+SELECT * FROM t1 WHERE title = 'a10000';
+class id title
+10000 10000 a10000
+SELECT * FROM t1 WHERE id = 10010;
+class id title
+SELECT * FROM t1 WHERE title = 'a10010';
+class id title
+/*Insert/Update/Delete. */
+DELETE FROM t1 WHERE id < 4010 AND id > 3990;
+INSERT INTO t1 VALUES(4000, 4000, 'b4000');
+UPDATE t1 SET title = CONCAT('b', id) WHERE id < 3010 AND id > 2990;
+SELECT * FROM t1 WHERE id = 3000;
+class id title
+3000 3000 b3000
+SELECT * FROM t1 WHERE title = 'a3000';
+class id title
+SELECT * FROM t1 WHERE title = 'b3000';
+class id title
+3000 3000 b3000
+SELECT * FROM t1 WHERE id = 4000;
+class id title
+4000 4000 b4000
+SELECT * FROM t1 WHERE title = 'a4000';
+class id title
+SELECT * FROM t1 WHERE title = 'b4000';
+class id title
+4000 4000 b4000
+SELECT * FROM t1 WHERE id = 4001;
+class id title
+SELECT * FROM t1 WHERE title = 'a4001';
+class id title
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+9992
+/* Add column. */
+ALTER TABLE t1 ADD COLUMN content TEXT;
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+SELECT * FROM t1 WHERE id = 10;
+class id title content
+10 10 a10 NULL
+SELECT * FROM t1 WHERE title = 'a10';
+class id title content
+10 10 a10 NULL
+SELECT * FROM t1 WHERE id = 5000;
+class id title content
+5000 5000 a5000 NULL
+SELECT * FROM t1 WHERE title = 'a5000';
+class id title content
+5000 5000 a5000 NULL
+SELECT * FROM t1 WHERE id = 10000;
+class id title content
+10000 10000 a10000 NULL
+SELECT * FROM t1 WHERE title = 'a10000';
+class id title content
+10000 10000 a10000 NULL
+SELECT * FROM t1 WHERE id = 10010;
+class id title content
+SELECT * FROM t1 WHERE title = 'a10010';
+class id title content
+/* Drop column. */
+ALTER TABLE t1 DROP COLUMN content;
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+SELECT * FROM t1 WHERE id = 10;
+class id title
+10 10 a10
+SELECT * FROM t1 WHERE title = 'a10';
+class id title
+10 10 a10
+SELECT * FROM t1 WHERE id = 5000;
+class id title
+5000 5000 a5000
+SELECT * FROM t1 WHERE title = 'a5000';
+class id title
+5000 5000 a5000
+SELECT * FROM t1 WHERE id = 10000;
+class id title
+10000 10000 a10000
+SELECT * FROM t1 WHERE title = 'a10000';
+class id title
+10000 10000 a10000
+SELECT * FROM t1 WHERE id = 10010;
+class id title
+SELECT * FROM t1 WHERE title = 'a10010';
+class id title
+DROP TABLE t1;
+CREATE TABLE t1(
+a INT PRIMARY KEY,
+b BLOB,
+c TEXT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
+ALTER TABLE t1 ADD INDEX `idx` (a,b(5));
+SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975;
+CHAR_LENGTH(b)
+10000
+SELECT b=REPEAT(CONCAT('a',4975),2000) FROM t1 WHERE a=4975 AND b like 'a4975%';
+b=REPEAT(CONCAT('a',4975),2000)
+1
+UPDATE t1 SET b = REPEAT(CONCAT('b',4975),2000) WHERE a=4975 AND b like 'a4975%';
+SELECT b=REPEAT(CONCAT('a',4975),2000) FROM t1 WHERE a=4975 AND b like 'a4975%';
+b=REPEAT(CONCAT('a',4975),2000)
+SELECT b=REPEAT(CONCAT('b',4975),2000) FROM t1 WHERE a=4975 AND b like 'b4975%';
+b=REPEAT(CONCAT('b',4975),2000)
+1
+DELETE FROM t1 WHERE a=4975 AND b like 'b4975%';
+SELECT b=REPEAT(CONCAT('b',4975),2000) FROM t1 WHERE a=4975 AND b like 'b4975%';
+b=REPEAT(CONCAT('b',4975),2000)
+ALTER TABLE t1 DROP COLUMN c;
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975;
+CHAR_LENGTH(b)
+DROP TABLE t1;
+SET GLOBAL innodb_file_per_table=default;
+DROP PROCEDURE populate_t1;
+SET GLOBAL innodb_fill_factor=10;
+CREATE PROCEDURE populate_t1(load_even INT)
+BEGIN
+DECLARE i int DEFAULT 1;
+START TRANSACTION;
+WHILE (i <= 10000) DO
+IF i%2 = 0 AND load_even = 1 THEN
+INSERT INTO t1 VALUES (i, i, CONCAT('a', i));
+END IF;
+IF i%2 != 0 AND load_even != 1 THEN
+INSERT INTO t1 VALUES (i, i, CONCAT('a', i));
+END IF;
+SET i = i + 1;
+END WHILE;
+COMMIT;
+END|
+SELECT @@innodb_fill_factor;
+@@innodb_fill_factor
+10
+CREATE TABLE t1(
+class INT,
+id INT,
+title VARCHAR(100)
+) ENGINE=InnoDB ROW_FORMAT=COMPACT;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+5000
+/* Create index. */
+CREATE INDEX idx_id ON t1(id);
+CREATE INDEX idx_title ON t1(title);
+/* Check table. */
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+/* Select by index. */
+EXPLAIN SELECT * FROM t1 WHERE id = 10;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref idx_id idx_id 5 const 1
+EXPLAIN SELECT * FROM t1 WHERE title = 'a10';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref idx_title idx_title 103 const 1 Using index condition
+SELECT * FROM t1 WHERE id = 10;
+class id title
+10 10 a10
+SELECT * FROM t1 WHERE title = 'a10';
+class id title
+10 10 a10
+SELECT * FROM t1 WHERE id = 5000;
+class id title
+5000 5000 a5000
+SELECT * FROM t1 WHERE title = 'a5000';
+class id title
+5000 5000 a5000
+SELECT * FROM t1 WHERE id = 10000;
+class id title
+10000 10000 a10000
+SELECT * FROM t1 WHERE title = 'a10000';
+class id title
+10000 10000 a10000
+SELECT * FROM t1 WHERE id = 10010;
+class id title
+SELECT * FROM t1 WHERE title = 'a10010';
+class id title
+/*Insert/Update/Delete. */
+DELETE FROM t1 WHERE id < 4010 AND id > 3990;
+INSERT INTO t1 VALUES(4000, 4000, 'b4000');
+UPDATE t1 SET title = CONCAT('b', id) WHERE id < 3010 AND id > 2990;
+SELECT * FROM t1 WHERE id = 3000;
+class id title
+3000 3000 b3000
+SELECT * FROM t1 WHERE title = 'a3000';
+class id title
+SELECT * FROM t1 WHERE title = 'b3000';
+class id title
+3000 3000 b3000
+SELECT * FROM t1 WHERE id = 4000;
+class id title
+4000 4000 b4000
+SELECT * FROM t1 WHERE title = 'a4000';
+class id title
+SELECT * FROM t1 WHERE title = 'b4000';
+class id title
+4000 4000 b4000
+SELECT * FROM t1 WHERE id = 4001;
+class id title
+SELECT * FROM t1 WHERE title = 'a4001';
+class id title
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+9992
+/* Add column. */
+ALTER TABLE t1 ADD COLUMN content TEXT;
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+SELECT * FROM t1 WHERE id = 10;
+class id title content
+10 10 a10 NULL
+SELECT * FROM t1 WHERE title = 'a10';
+class id title content
+10 10 a10 NULL
+SELECT * FROM t1 WHERE id = 5000;
+class id title content
+5000 5000 a5000 NULL
+SELECT * FROM t1 WHERE title = 'a5000';
+class id title content
+5000 5000 a5000 NULL
+SELECT * FROM t1 WHERE id = 10000;
+class id title content
+10000 10000 a10000 NULL
+SELECT * FROM t1 WHERE title = 'a10000';
+class id title content
+10000 10000 a10000 NULL
+SELECT * FROM t1 WHERE id = 10010;
+class id title content
+SELECT * FROM t1 WHERE title = 'a10010';
+class id title content
+/* Drop column. */
+ALTER TABLE t1 DROP COLUMN content;
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+SELECT * FROM t1 WHERE id = 10;
+class id title
+10 10 a10
+SELECT * FROM t1 WHERE title = 'a10';
+class id title
+10 10 a10
+SELECT * FROM t1 WHERE id = 5000;
+class id title
+5000 5000 a5000
+SELECT * FROM t1 WHERE title = 'a5000';
+class id title
+5000 5000 a5000
+SELECT * FROM t1 WHERE id = 10000;
+class id title
+10000 10000 a10000
+SELECT * FROM t1 WHERE title = 'a10000';
+class id title
+10000 10000 a10000
+SELECT * FROM t1 WHERE id = 10010;
+class id title
+SELECT * FROM t1 WHERE title = 'a10010';
+class id title
+DROP TABLE t1;
+CREATE TABLE t1(
+a INT PRIMARY KEY,
+b TEXT,
+c TEXT) ENGINE=InnoDB ROW_FORMAT=COMPACT;
+ALTER TABLE t1 ADD INDEX `idx` (a,b(5));
+SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975;
+CHAR_LENGTH(b)
+10000
+SELECT b=REPEAT(CONCAT('a',4975),2000) FROM t1 WHERE a=4975 AND b like 'a4975%';
+b=REPEAT(CONCAT('a',4975),2000)
+1
+UPDATE t1 SET b = REPEAT(CONCAT('b',4975),2000) WHERE a=4975 AND b like 'a4975%';
+SELECT b=REPEAT(CONCAT('a',4975),2000) FROM t1 WHERE a=4975 AND b like 'a4975%';
+b=REPEAT(CONCAT('a',4975),2000)
+SELECT b=REPEAT(CONCAT('b',4975),2000) FROM t1 WHERE a=4975 AND b like 'b4975%';
+b=REPEAT(CONCAT('b',4975),2000)
+1
+DELETE FROM t1 WHERE a=4975 AND b like 'b4975%';
+SELECT b=REPEAT(CONCAT('b',4975),2000) FROM t1 WHERE a=4975 AND b like 'b4975%';
+b=REPEAT(CONCAT('b',4975),2000)
+ALTER TABLE t1 DROP COLUMN c;
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975;
+CHAR_LENGTH(b)
+DROP TABLE t1;
+DROP PROCEDURE populate_t1;
+SET GLOBAL innodb_fill_factor=50;
+CREATE PROCEDURE populate_t1(load_even INT)
+BEGIN
+DECLARE i int DEFAULT 1;
+START TRANSACTION;
+WHILE (i <= 10000) DO
+IF i%2 = 0 AND load_even = 1 THEN
+INSERT INTO t1 VALUES (i, i, CONCAT('a', i));
+END IF;
+IF i%2 != 0 AND load_even != 1 THEN
+INSERT INTO t1 VALUES (i, i, CONCAT('a', i));
+END IF;
+SET i = i + 1;
+END WHILE;
+COMMIT;
+END|
+SELECT @@innodb_fill_factor;
+@@innodb_fill_factor
+50
+CREATE TABLE t1(
+class INT,
+id INT,
+title VARCHAR(100)
+) ENGINE=InnoDB ROW_FORMAT=COMPACT;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+5000
+/* Create index. */
+CREATE INDEX idx_id ON t1(id);
+CREATE INDEX idx_title ON t1(title);
+/* Check table. */
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+/* Select by index. */
+EXPLAIN SELECT * FROM t1 WHERE id = 10;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref idx_id idx_id 5 const 1
+EXPLAIN SELECT * FROM t1 WHERE title = 'a10';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref idx_title idx_title 103 const 1 Using index condition
+SELECT * FROM t1 WHERE id = 10;
+class id title
+10 10 a10
+SELECT * FROM t1 WHERE title = 'a10';
+class id title
+10 10 a10
+SELECT * FROM t1 WHERE id = 5000;
+class id title
+5000 5000 a5000
+SELECT * FROM t1 WHERE title = 'a5000';
+class id title
+5000 5000 a5000
+SELECT * FROM t1 WHERE id = 10000;
+class id title
+10000 10000 a10000
+SELECT * FROM t1 WHERE title = 'a10000';
+class id title
+10000 10000 a10000
+SELECT * FROM t1 WHERE id = 10010;
+class id title
+SELECT * FROM t1 WHERE title = 'a10010';
+class id title
+/*Insert/Update/Delete. */
+DELETE FROM t1 WHERE id < 4010 AND id > 3990;
+INSERT INTO t1 VALUES(4000, 4000, 'b4000');
+UPDATE t1 SET title = CONCAT('b', id) WHERE id < 3010 AND id > 2990;
+SELECT * FROM t1 WHERE id = 3000;
+class id title
+3000 3000 b3000
+SELECT * FROM t1 WHERE title = 'a3000';
+class id title
+SELECT * FROM t1 WHERE title = 'b3000';
+class id title
+3000 3000 b3000
+SELECT * FROM t1 WHERE id = 4000;
+class id title
+4000 4000 b4000
+SELECT * FROM t1 WHERE title = 'a4000';
+class id title
+SELECT * FROM t1 WHERE title = 'b4000';
+class id title
+4000 4000 b4000
+SELECT * FROM t1 WHERE id = 4001;
+class id title
+SELECT * FROM t1 WHERE title = 'a4001';
+class id title
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+9992
+/* Add column. */
+ALTER TABLE t1 ADD COLUMN content TEXT;
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+SELECT * FROM t1 WHERE id = 10;
+class id title content
+10 10 a10 NULL
+SELECT * FROM t1 WHERE title = 'a10';
+class id title content
+10 10 a10 NULL
+SELECT * FROM t1 WHERE id = 5000;
+class id title content
+5000 5000 a5000 NULL
+SELECT * FROM t1 WHERE title = 'a5000';
+class id title content
+5000 5000 a5000 NULL
+SELECT * FROM t1 WHERE id = 10000;
+class id title content
+10000 10000 a10000 NULL
+SELECT * FROM t1 WHERE title = 'a10000';
+class id title content
+10000 10000 a10000 NULL
+SELECT * FROM t1 WHERE id = 10010;
+class id title content
+SELECT * FROM t1 WHERE title = 'a10010';
+class id title content
+/* Drop column. */
+ALTER TABLE t1 DROP COLUMN content;
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+SELECT * FROM t1 WHERE id = 10;
+class id title
+10 10 a10
+SELECT * FROM t1 WHERE title = 'a10';
+class id title
+10 10 a10
+SELECT * FROM t1 WHERE id = 5000;
+class id title
+5000 5000 a5000
+SELECT * FROM t1 WHERE title = 'a5000';
+class id title
+5000 5000 a5000
+SELECT * FROM t1 WHERE id = 10000;
+class id title
+10000 10000 a10000
+SELECT * FROM t1 WHERE title = 'a10000';
+class id title
+10000 10000 a10000
+SELECT * FROM t1 WHERE id = 10010;
+class id title
+SELECT * FROM t1 WHERE title = 'a10010';
+class id title
+DROP TABLE t1;
+CREATE TABLE t1(
+a INT PRIMARY KEY,
+b TEXT,
+c TEXT) ENGINE=InnoDB ROW_FORMAT=COMPACT;
+ALTER TABLE t1 ADD INDEX `idx` (a,b(5));
+SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975;
+CHAR_LENGTH(b)
+10000
+SELECT b=REPEAT(CONCAT('a',4975),2000) FROM t1 WHERE a=4975 AND b like 'a4975%';
+b=REPEAT(CONCAT('a',4975),2000)
+1
+UPDATE t1 SET b = REPEAT(CONCAT('b',4975),2000) WHERE a=4975 AND b like 'a4975%';
+SELECT b=REPEAT(CONCAT('a',4975),2000) FROM t1 WHERE a=4975 AND b like 'a4975%';
+b=REPEAT(CONCAT('a',4975),2000)
+SELECT b=REPEAT(CONCAT('b',4975),2000) FROM t1 WHERE a=4975 AND b like 'b4975%';
+b=REPEAT(CONCAT('b',4975),2000)
+1
+DELETE FROM t1 WHERE a=4975 AND b like 'b4975%';
+SELECT b=REPEAT(CONCAT('b',4975),2000) FROM t1 WHERE a=4975 AND b like 'b4975%';
+b=REPEAT(CONCAT('b',4975),2000)
+ALTER TABLE t1 DROP COLUMN c;
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975;
+CHAR_LENGTH(b)
+DROP TABLE t1;
+DROP PROCEDURE populate_t1;
+SET GLOBAL innodb_fill_factor=default;
diff --git a/mysql-test/suite/innodb/r/innodb_bulk_create_index_debug.result b/mysql-test/suite/innodb/r/innodb_bulk_create_index_debug.result
new file mode 100644
index 00000000000..cd5a3c340da
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb_bulk_create_index_debug.result
@@ -0,0 +1,485 @@
+CREATE PROCEDURE populate_t1()
+BEGIN
+DECLARE i int DEFAULT 1;
+START TRANSACTION;
+WHILE (i <= 10000) DO
+INSERT INTO t1 VALUES (i, i, CONCAT('a', i));
+SET i = i + 1;
+END WHILE;
+COMMIT;
+END|
+CREATE TABLE t1(
+class INT,
+id INT,
+title VARCHAR(100)
+) ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+10000
+CREATE INDEX idx_title ON t1(title);
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+SELECT * FROM t1 WHERE title = 'a10';
+class id title
+10 10 a10
+SELECT * FROM t1 WHERE title = 'a5000';
+class id title
+5000 5000 a5000
+SELECT * FROM t1 WHERE title = 'a10000';
+class id title
+10000 10000 a10000
+SELECT * FROM t1 WHERE title = 'a10010';
+class id title
+DROP TABLE t1;
+# Test Blob
+CREATE TABLE t1(
+a INT PRIMARY KEY,
+b TEXT,
+c TEXT) ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
+INSERT INTO t1 VALUES
+(1, REPEAT('a',10000), 'a'),
+(2, REPEAT('b',20000), 'b'),
+(3, REPEAT('c',40000), 'c'),
+(4, REPEAT('d',60000), 'd');
+SELECT CHAR_LENGTH(b) FROM t1;
+CHAR_LENGTH(b)
+10000
+20000
+40000
+60000
+ALTER TABLE t1 DROP COLUMN c;
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+SELECT CHAR_LENGTH(b) FROM t1;
+CHAR_LENGTH(b)
+10000
+20000
+40000
+60000
+DROP TABLE t1;
+CREATE TABLE t1(
+class INT,
+id INT,
+title VARCHAR(100)
+) ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
+SET debug_dbug='+d,crash_commit_before';
+CREATE INDEX idx_title ON t1(title);
+ERROR HY000: Lost connection to MySQL server during query
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+10000
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+EXPLAIN SELECT * FROM t1 WHERE title = 'a10';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref idx_title idx_title 103 const 1 Using index condition
+SELECT * FROM t1 WHERE title = 'a10';
+class id title
+10 10 a10
+SELECT * FROM t1 WHERE title = 'a5000';
+class id title
+5000 5000 a5000
+SELECT * FROM t1 WHERE title = 'a10000';
+class id title
+10000 10000 a10000
+SELECT * FROM t1 WHERE title = 'a10010';
+class id title
+DROP TABLE t1;
+# Test Blob
+CREATE TABLE t1(
+a INT PRIMARY KEY,
+b TEXT,
+c TEXT) ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
+INSERT INTO t1 VALUES
+(1, REPEAT('a',10000), 'a'),
+(2, REPEAT('b',20000), 'b'),
+(3, REPEAT('c',40000), 'c'),
+(4, REPEAT('d',60000), 'd');
+SELECT CHAR_LENGTH(b) FROM t1;
+CHAR_LENGTH(b)
+10000
+20000
+40000
+60000
+SET debug_dbug='+d,crash_commit_before';
+ALTER TABLE t1 DROP COLUMN c;
+ERROR HY000: Lost connection to MySQL server during query
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+SELECT CHAR_LENGTH(b) FROM t1;
+CHAR_LENGTH(b)
+10000
+20000
+40000
+60000
+DROP TABLE t1;
+DROP PROCEDURE populate_t1;
+CREATE PROCEDURE populate_t1()
+BEGIN
+DECLARE i int DEFAULT 1;
+START TRANSACTION;
+WHILE (i <= 10000) DO
+INSERT INTO t1 VALUES (i, i, CONCAT('a', i));
+SET i = i + 1;
+END WHILE;
+COMMIT;
+END|
+CREATE TABLE t1(
+class INT,
+id INT,
+title VARCHAR(100)
+) ENGINE=InnoDB ROW_FORMAT=COMPACT;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+10000
+CREATE INDEX idx_title ON t1(title);
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+SELECT * FROM t1 WHERE title = 'a10';
+class id title
+10 10 a10
+SELECT * FROM t1 WHERE title = 'a5000';
+class id title
+5000 5000 a5000
+SELECT * FROM t1 WHERE title = 'a10000';
+class id title
+10000 10000 a10000
+SELECT * FROM t1 WHERE title = 'a10010';
+class id title
+DROP TABLE t1;
+# Test Blob
+CREATE TABLE t1(
+a INT PRIMARY KEY,
+b TEXT,
+c TEXT) ENGINE=InnoDB ROW_FORMAT=COMPACT;
+INSERT INTO t1 VALUES
+(1, REPEAT('a',10000), 'a'),
+(2, REPEAT('b',20000), 'b'),
+(3, REPEAT('c',40000), 'c'),
+(4, REPEAT('d',60000), 'd');
+SELECT CHAR_LENGTH(b) FROM t1;
+CHAR_LENGTH(b)
+10000
+20000
+40000
+60000
+ALTER TABLE t1 DROP COLUMN c;
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+SELECT CHAR_LENGTH(b) FROM t1;
+CHAR_LENGTH(b)
+10000
+20000
+40000
+60000
+DROP TABLE t1;
+CREATE TABLE t1(
+class INT,
+id INT,
+title VARCHAR(100)
+) ENGINE=InnoDB ROW_FORMAT=COMPACT;
+SET debug_dbug='+d,crash_commit_before';
+CREATE INDEX idx_title ON t1(title);
+ERROR HY000: Lost connection to MySQL server during query
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+10000
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+EXPLAIN SELECT * FROM t1 WHERE title = 'a10';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref idx_title idx_title 103 const 1 Using index condition
+SELECT * FROM t1 WHERE title = 'a10';
+class id title
+10 10 a10
+SELECT * FROM t1 WHERE title = 'a5000';
+class id title
+5000 5000 a5000
+SELECT * FROM t1 WHERE title = 'a10000';
+class id title
+10000 10000 a10000
+SELECT * FROM t1 WHERE title = 'a10010';
+class id title
+DROP TABLE t1;
+# Test Blob
+CREATE TABLE t1(
+a INT PRIMARY KEY,
+b TEXT,
+c TEXT) ENGINE=InnoDB ROW_FORMAT=COMPACT;
+INSERT INTO t1 VALUES
+(1, REPEAT('a',10000), 'a'),
+(2, REPEAT('b',20000), 'b'),
+(3, REPEAT('c',40000), 'c'),
+(4, REPEAT('d',60000), 'd');
+SELECT CHAR_LENGTH(b) FROM t1;
+CHAR_LENGTH(b)
+10000
+20000
+40000
+60000
+SET debug_dbug='+d,crash_commit_before';
+ALTER TABLE t1 DROP COLUMN c;
+ERROR HY000: Lost connection to MySQL server during query
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+SELECT CHAR_LENGTH(b) FROM t1;
+CHAR_LENGTH(b)
+10000
+20000
+40000
+60000
+DROP TABLE t1;
+DROP PROCEDURE populate_t1;
+CREATE PROCEDURE populate_t1()
+BEGIN
+DECLARE i int DEFAULT 1;
+START TRANSACTION;
+WHILE (i <= 10000) DO
+INSERT INTO t1 VALUES (i, i, CONCAT('a', i));
+SET i = i + 1;
+END WHILE;
+COMMIT;
+END|
+CREATE TABLE t1(
+class INT,
+id INT,
+title VARCHAR(100)
+) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+10000
+CREATE INDEX idx_title ON t1(title);
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+SELECT * FROM t1 WHERE title = 'a10';
+class id title
+10 10 a10
+SELECT * FROM t1 WHERE title = 'a5000';
+class id title
+5000 5000 a5000
+SELECT * FROM t1 WHERE title = 'a10000';
+class id title
+10000 10000 a10000
+SELECT * FROM t1 WHERE title = 'a10010';
+class id title
+DROP TABLE t1;
+# Test Blob
+CREATE TABLE t1(
+a INT PRIMARY KEY,
+b TEXT,
+c TEXT) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
+INSERT INTO t1 VALUES
+(1, REPEAT('a',10000), 'a'),
+(2, REPEAT('b',20000), 'b'),
+(3, REPEAT('c',40000), 'c'),
+(4, REPEAT('d',60000), 'd');
+SELECT CHAR_LENGTH(b) FROM t1;
+CHAR_LENGTH(b)
+10000
+20000
+40000
+60000
+ALTER TABLE t1 DROP COLUMN c;
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+SELECT CHAR_LENGTH(b) FROM t1;
+CHAR_LENGTH(b)
+10000
+20000
+40000
+60000
+DROP TABLE t1;
+CREATE TABLE t1(
+class INT,
+id INT,
+title VARCHAR(100)
+) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
+SET debug_dbug='+d,crash_commit_before';
+CREATE INDEX idx_title ON t1(title);
+ERROR HY000: Lost connection to MySQL server during query
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+10000
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+EXPLAIN SELECT * FROM t1 WHERE title = 'a10';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref idx_title idx_title 103 const 1 Using index condition
+SELECT * FROM t1 WHERE title = 'a10';
+class id title
+10 10 a10
+SELECT * FROM t1 WHERE title = 'a5000';
+class id title
+5000 5000 a5000
+SELECT * FROM t1 WHERE title = 'a10000';
+class id title
+10000 10000 a10000
+SELECT * FROM t1 WHERE title = 'a10010';
+class id title
+DROP TABLE t1;
+# Test Blob
+CREATE TABLE t1(
+a INT PRIMARY KEY,
+b TEXT,
+c TEXT) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
+INSERT INTO t1 VALUES
+(1, REPEAT('a',10000), 'a'),
+(2, REPEAT('b',20000), 'b'),
+(3, REPEAT('c',40000), 'c'),
+(4, REPEAT('d',60000), 'd');
+SELECT CHAR_LENGTH(b) FROM t1;
+CHAR_LENGTH(b)
+10000
+20000
+40000
+60000
+SET debug_dbug='+d,crash_commit_before';
+ALTER TABLE t1 DROP COLUMN c;
+ERROR HY000: Lost connection to MySQL server during query
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+SELECT CHAR_LENGTH(b) FROM t1;
+CHAR_LENGTH(b)
+10000
+20000
+40000
+60000
+DROP TABLE t1;
+DROP PROCEDURE populate_t1;
+CREATE PROCEDURE populate_t1()
+BEGIN
+DECLARE i int DEFAULT 1;
+START TRANSACTION;
+WHILE (i <= 10000) DO
+INSERT INTO t1 VALUES (i, i, CONCAT('a', i));
+SET i = i + 1;
+END WHILE;
+COMMIT;
+END|
+SET GLOBAL innodb_file_per_table=1;
+CREATE TABLE t1(
+class INT,
+id INT,
+title VARCHAR(100)
+) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+10000
+CREATE INDEX idx_title ON t1(title);
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+SELECT * FROM t1 WHERE title = 'a10';
+class id title
+10 10 a10
+SELECT * FROM t1 WHERE title = 'a5000';
+class id title
+5000 5000 a5000
+SELECT * FROM t1 WHERE title = 'a10000';
+class id title
+10000 10000 a10000
+SELECT * FROM t1 WHERE title = 'a10010';
+class id title
+DROP TABLE t1;
+# Test Blob
+SET GLOBAL innodb_file_per_table=1;
+CREATE TABLE t1(
+a INT PRIMARY KEY,
+b TEXT,
+c TEXT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
+INSERT INTO t1 VALUES
+(1, REPEAT('a',10000), 'a'),
+(2, REPEAT('b',20000), 'b'),
+(3, REPEAT('c',40000), 'c'),
+(4, REPEAT('d',60000), 'd');
+SELECT CHAR_LENGTH(b) FROM t1;
+CHAR_LENGTH(b)
+10000
+20000
+40000
+60000
+ALTER TABLE t1 DROP COLUMN c;
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+SELECT CHAR_LENGTH(b) FROM t1;
+CHAR_LENGTH(b)
+10000
+20000
+40000
+60000
+DROP TABLE t1;
+SET GLOBAL innodb_file_per_table=1;
+CREATE TABLE t1(
+class INT,
+id INT,
+title VARCHAR(100)
+) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
+SET debug_dbug='+d,crash_commit_before';
+CREATE INDEX idx_title ON t1(title);
+ERROR HY000: Lost connection to MySQL server during query
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+10000
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+EXPLAIN SELECT * FROM t1 WHERE title = 'a10';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref idx_title idx_title 103 const 1 Using index condition
+SELECT * FROM t1 WHERE title = 'a10';
+class id title
+10 10 a10
+SELECT * FROM t1 WHERE title = 'a5000';
+class id title
+5000 5000 a5000
+SELECT * FROM t1 WHERE title = 'a10000';
+class id title
+10000 10000 a10000
+SELECT * FROM t1 WHERE title = 'a10010';
+class id title
+DROP TABLE t1;
+# Test Blob
+SET GLOBAL innodb_file_per_table=1;
+CREATE TABLE t1(
+a INT PRIMARY KEY,
+b TEXT,
+c TEXT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
+INSERT INTO t1 VALUES
+(1, REPEAT('a',10000), 'a'),
+(2, REPEAT('b',20000), 'b'),
+(3, REPEAT('c',40000), 'c'),
+(4, REPEAT('d',60000), 'd');
+SELECT CHAR_LENGTH(b) FROM t1;
+CHAR_LENGTH(b)
+10000
+20000
+40000
+60000
+SET debug_dbug='+d,crash_commit_before';
+ALTER TABLE t1 DROP COLUMN c;
+ERROR HY000: Lost connection to MySQL server during query
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+SELECT CHAR_LENGTH(b) FROM t1;
+CHAR_LENGTH(b)
+10000
+20000
+40000
+60000
+DROP TABLE t1;
+SET GLOBAL innodb_file_per_table=default;
+DROP PROCEDURE populate_t1;
diff --git a/mysql-test/suite/innodb/r/innodb_bulk_create_index_flush.result b/mysql-test/suite/innodb/r/innodb_bulk_create_index_flush.result
new file mode 100644
index 00000000000..d2b812642f6
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb_bulk_create_index_flush.result
@@ -0,0 +1,54 @@
+CREATE PROCEDURE populate_t1()
+BEGIN
+DECLARE i int DEFAULT 1;
+START TRANSACTION;
+WHILE (i <= 10000) DO
+INSERT INTO t1 VALUES (i, i, CONCAT('a', i));
+SET i = i + 1;
+END WHILE;
+COMMIT;
+END|
+CREATE TABLE t1(
+class INT,
+id INT,
+title VARCHAR(100)
+) ENGINE=InnoDB;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+10000
+SET @saved_dbug= @@SESSION.debug_dbug;
+SET debug_dbug='+d,ib_index_build_fail_before_flush';
+CREATE INDEX idx_id ON t1(id);
+ERROR 70100: Query execution was interrupted
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+CREATE INDEX idx_title ON t1(title);
+ERROR 70100: Query execution was interrupted
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+CREATE FULLTEXT INDEX fidx_title ON t1(title);
+ERROR 70100: Query execution was interrupted
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+ALTER TABLE t1 ADD COLUMN content TEXT, FORCE;
+ERROR 70100: Query execution was interrupted
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+SET debug_dbug= @saved_dbug;
+INSERT INTO t1 VALUES(10001, 10001, 'a10000');
+ALTER TABLE t1 ADD UNIQUE INDEX idx_title(title);
+ERROR 23000: Duplicate entry 'a10000' for key 'idx_title'
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+ALTER TABLE t1 ADD UNIQUE INDEX idx_id(id), ADD UNIQUE INDEX idx_title(title);
+ERROR 23000: Duplicate entry 'a10000' for key 'idx_title'
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+DROP TABLE t1;
+DROP PROCEDURE populate_t1;
diff --git a/mysql-test/suite/innodb/r/innodb_bulk_create_index_replication.result b/mysql-test/suite/innodb/r/innodb_bulk_create_index_replication.result
new file mode 100644
index 00000000000..ae050170b4f
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb_bulk_create_index_replication.result
@@ -0,0 +1,222 @@
+include/master-slave.inc
+[connection master]
+connection master;
+CREATE PROCEDURE populate_t1(load_even INT)
+BEGIN
+DECLARE i int DEFAULT 1;
+START TRANSACTION;
+WHILE (i <= 100) DO
+IF i%2 = 0 AND load_even = 1 THEN
+INSERT INTO t1 VALUES (i, i, CONCAT('a', i));
+END IF;
+IF i%2 != 0 AND load_even != 1 THEN
+INSERT INTO t1 VALUES (i, i, CONCAT('a', i));
+END IF;
+SET i = i + 1;
+END WHILE;
+COMMIT;
+END|
+CREATE TABLE t1(
+class INT,
+id INT,
+title VARCHAR(100)
+) ENGINE=InnoDB ;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+50
+/* Create index. */
+CREATE INDEX idx_id ON t1(id);
+CREATE INDEX idx_title ON t1(title);
+/* Select by index. */
+EXPLAIN SELECT * FROM t1 WHERE id = 10;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref idx_id idx_id 5 const 1
+EXPLAIN SELECT * FROM t1 WHERE title = 'a10';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref idx_title idx_title 103 const 1 Using index condition
+SELECT * FROM t1 WHERE id = 10;
+class id title
+10 10 a10
+SELECT * FROM t1 WHERE title = 'a10';
+class id title
+10 10 a10
+SELECT * FROM t1 WHERE id = 20;
+class id title
+20 20 a20
+SELECT * FROM t1 WHERE title = 'a20';
+class id title
+20 20 a20
+SELECT * FROM t1 WHERE id = 30;
+class id title
+30 30 a30
+SELECT * FROM t1 WHERE title = 'a30';
+class id title
+30 30 a30
+SELECT * FROM t1 WHERE id = 101;
+class id title
+SELECT * FROM t1 WHERE title = 'a101';
+class id title
+/*Insert/Update/Delete. */
+DELETE FROM t1 WHERE id < 40 AND id > 30;
+INSERT INTO t1 VALUES(38, 38, 'b38');
+UPDATE t1 SET title = CONCAT('b', id) WHERE id < 30 AND id > 20;
+SELECT * FROM t1 WHERE id = 28;
+class id title
+28 28 b28
+SELECT * FROM t1 WHERE title = 'a28';
+class id title
+SELECT * FROM t1 WHERE title = 'b28';
+class id title
+28 28 b28
+SELECT * FROM t1 WHERE id = 38;
+class id title
+38 38 b38
+SELECT * FROM t1 WHERE title = 'a38';
+class id title
+SELECT * FROM t1 WHERE title = 'b38';
+class id title
+38 38 b38
+SELECT * FROM t1 WHERE id = 101;
+class id title
+SELECT * FROM t1 WHERE title = 'a101';
+class id title
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+97
+SELECT * FROM t1 WHERE id = 10;
+class id title
+10 10 a10
+SELECT * FROM t1 WHERE title = 'a10';
+class id title
+10 10 a10
+SELECT * FROM t1 WHERE id = 20;
+class id title
+20 20 a20
+SELECT * FROM t1 WHERE title = 'a20';
+class id title
+20 20 a20
+SELECT * FROM t1 WHERE id = 30;
+class id title
+30 30 a30
+SELECT * FROM t1 WHERE title = 'a30';
+class id title
+30 30 a30
+SELECT * FROM t1 WHERE id = 101;
+class id title
+SELECT * FROM t1 WHERE title = 'a101';
+class id title
+CREATE TABLE t_part (
+class INT ,
+id INT ,
+title VARCHAR(30)
+) ENGINE=InnoDB
+PARTITION BY RANGE(id)
+SUBPARTITION BY KEY(id)
+SUBPARTITIONS 4
+(
+PARTITION p0 VALUES LESS THAN (5000),
+PARTITION p1 VALUES LESS THAN (MAXVALUE)
+);
+INSERT INTO t_part SELECT * FROM t1;
+ALTER TABLE t_part ADD INDEX `idx` (class,id,title(10));
+SELECT * FROM t_part WHERE id = 10;
+class id title
+10 10 a10
+SELECT * FROM t_part WHERE title = 'a10';
+class id title
+10 10 a10
+SELECT * FROM t_part WHERE id = 20;
+class id title
+20 20 a20
+SELECT * FROM t_part WHERE title = 'a20';
+class id title
+20 20 a20
+SELECT * FROM t_part WHERE id = 30;
+class id title
+30 30 a30
+SELECT * FROM t_part WHERE title = 'a30';
+class id title
+30 30 a30
+SELECT * FROM t_part WHERE id = 101;
+class id title
+SELECT * FROM t_part WHERE title = 'a101';
+class id title
+include/sync_slave_sql_with_master.inc
+connection slave;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `class` int(11) DEFAULT NULL,
+ `id` int(11) DEFAULT NULL,
+ `title` varchar(100) DEFAULT NULL,
+ KEY `idx_id` (`id`),
+ KEY `idx_title` (`title`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+SHOW CREATE TABLE t_part;
+Table Create Table
+t_part CREATE TABLE `t_part` (
+ `class` int(11) DEFAULT NULL,
+ `id` int(11) DEFAULT NULL,
+ `title` varchar(30) DEFAULT NULL,
+ KEY `idx` (`class`,`id`,`title`(10))
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+ PARTITION BY RANGE (`id`)
+SUBPARTITION BY KEY (`id`)
+SUBPARTITIONS 4
+(PARTITION `p0` VALUES LESS THAN (5000) ENGINE = InnoDB,
+ PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = InnoDB)
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+97
+SELECT COUNT(*) FROM t_part;
+COUNT(*)
+97
+SELECT * FROM t1 WHERE id = 10;
+class id title
+10 10 a10
+SELECT * FROM t1 WHERE title = 'a10';
+class id title
+10 10 a10
+SELECT * FROM t1 WHERE id = 20;
+class id title
+20 20 a20
+SELECT * FROM t1 WHERE title = 'a20';
+class id title
+20 20 a20
+SELECT * FROM t1 WHERE id = 30;
+class id title
+30 30 a30
+SELECT * FROM t1 WHERE title = 'a30';
+class id title
+30 30 a30
+SELECT * FROM t1 WHERE id = 101;
+class id title
+SELECT * FROM t1 WHERE title = 'a101';
+class id title
+SELECT * FROM t_part WHERE id = 10;
+class id title
+10 10 a10
+SELECT * FROM t_part WHERE title = 'a10';
+class id title
+10 10 a10
+SELECT * FROM t_part WHERE id = 20;
+class id title
+20 20 a20
+SELECT * FROM t_part WHERE title = 'a20';
+class id title
+20 20 a20
+SELECT * FROM t_part WHERE id = 30;
+class id title
+30 30 a30
+SELECT * FROM t_part WHERE title = 'a30';
+class id title
+30 30 a30
+SELECT * FROM t_part WHERE id = 101;
+class id title
+SELECT * FROM t_part WHERE title = 'a101';
+class id title
+connection master;
+DROP PROCEDURE populate_t1;
+DROP TABLE t1;
+DROP TABLE t_part;
+include/rpl_end.inc
diff --git a/mysql-test/suite/innodb/r/innodb_bulk_create_index_small.result b/mysql-test/suite/innodb/r/innodb_bulk_create_index_small.result
new file mode 100644
index 00000000000..b48207d4497
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb_bulk_create_index_small.result
@@ -0,0 +1,139 @@
+CREATE PROCEDURE populate_t1()
+BEGIN
+DECLARE i int DEFAULT 1;
+START TRANSACTION;
+WHILE (i <= 1000) DO
+INSERT INTO t1 VALUES (i, i, CONCAT('a', i));
+SET i = i + 1;
+END WHILE;
+COMMIT;
+END|
+SELECT @@innodb_fill_factor;
+@@innodb_fill_factor
+100
+CREATE TABLE t1(
+class INT,
+id INT,
+title VARCHAR(100)
+) ENGINE=InnoDB ROW_FORMAT=COMPACT;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+1000
+/* Create index. */
+CREATE INDEX idx_id ON t1(id);
+CREATE INDEX idx_title ON t1(title);
+/* Check table. */
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+/* Select by index. */
+EXPLAIN SELECT * FROM t1 WHERE id = 10;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref idx_id idx_id 5 const 1
+EXPLAIN SELECT * FROM t1 WHERE title = 'a10';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref idx_title idx_title 103 const 1 Using index condition
+SELECT * FROM t1 WHERE id = 10;
+class id title
+10 10 a10
+SELECT * FROM t1 WHERE title = 'a10';
+class id title
+10 10 a10
+SELECT * FROM t1 WHERE id = 500;
+class id title
+500 500 a500
+SELECT * FROM t1 WHERE title = 'a500';
+class id title
+500 500 a500
+SELECT * FROM t1 WHERE id = 1000;
+class id title
+1000 1000 a1000
+SELECT * FROM t1 WHERE title = 'a1000';
+class id title
+1000 1000 a1000
+SELECT * FROM t1 WHERE id = 1010;
+class id title
+SELECT * FROM t1 WHERE title = 'a1010';
+class id title
+DROP TABLE t1;
+CREATE TABLE t1(
+a INT PRIMARY KEY,
+b TEXT,
+c TEXT) ENGINE=InnoDB ROW_FORMAT=COMPACT;
+INSERT INTO t1 VALUES
+(1, REPEAT('a',10000), 'a'),
+(2, REPEAT('b',20000), 'b'),
+(3, REPEAT('c',40000), 'c'),
+(4, REPEAT('d',60000), 'd');
+ALTER TABLE t1 DROP COLUMN c;
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975;
+CHAR_LENGTH(b)
+DROP TABLE t1;
+SET GLOBAL innodb_file_per_table=default;
+SET GLOBAL innodb_file_per_table=1;
+CREATE TABLE t1(
+class INT,
+id INT,
+title VARCHAR(100)
+) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+1000
+/* Create index. */
+CREATE INDEX idx_id ON t1(id);
+CREATE INDEX idx_title ON t1(title);
+/* Check table. */
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+/* Select by index. */
+EXPLAIN SELECT * FROM t1 WHERE id = 10;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref idx_id idx_id 5 const 1
+EXPLAIN SELECT * FROM t1 WHERE title = 'a10';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref idx_title idx_title 103 const 1 Using index condition
+SELECT * FROM t1 WHERE id = 10;
+class id title
+10 10 a10
+SELECT * FROM t1 WHERE title = 'a10';
+class id title
+10 10 a10
+SELECT * FROM t1 WHERE id = 500;
+class id title
+500 500 a500
+SELECT * FROM t1 WHERE title = 'a500';
+class id title
+500 500 a500
+SELECT * FROM t1 WHERE id = 1000;
+class id title
+1000 1000 a1000
+SELECT * FROM t1 WHERE title = 'a1000';
+class id title
+1000 1000 a1000
+SELECT * FROM t1 WHERE id = 1010;
+class id title
+SELECT * FROM t1 WHERE title = 'a1010';
+class id title
+DROP TABLE t1;
+CREATE TABLE t1(
+a INT PRIMARY KEY,
+b TEXT,
+c TEXT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
+INSERT INTO t1 VALUES
+(1, REPEAT('a',10000), 'a'),
+(2, REPEAT('b',20000), 'b'),
+(3, REPEAT('c',40000), 'c'),
+(4, REPEAT('d',60000), 'd');
+ALTER TABLE t1 DROP COLUMN c;
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975;
+CHAR_LENGTH(b)
+DROP TABLE t1;
+SET GLOBAL innodb_file_per_table=default;
+DROP PROCEDURE populate_t1;
diff --git a/mysql-test/suite/innodb/r/innodb_mysql.result b/mysql-test/suite/innodb/r/innodb_mysql.result
index cdfdbad9e20..3663c18ea44 100644
--- a/mysql-test/suite/innodb/r/innodb_mysql.result
+++ b/mysql-test/suite/innodb/r/innodb_mysql.result
@@ -238,14 +238,14 @@ select 1, max(1) from t1i where 1=99;
1 NULL
explain select count(*), min(7), max(7) from t1m, t1i;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1m system NULL NULL NULL NULL 0 const row not found
+1 SIMPLE t1m system NULL NULL NULL NULL 0 Const row not found
1 SIMPLE t1i ALL NULL NULL NULL NULL 1
select count(*), min(7), max(7) from t1m, t1i;
count(*) min(7) max(7)
0 NULL NULL
explain select count(*), min(7), max(7) from t1m, t2i;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1m system NULL NULL NULL NULL 0 const row not found
+1 SIMPLE t1m system NULL NULL NULL NULL 0 Const row not found
1 SIMPLE t2i ALL NULL NULL NULL NULL 1
select count(*), min(7), max(7) from t1m, t2i;
count(*) min(7) max(7)
@@ -1853,7 +1853,7 @@ explain
select b from t1 where a not in (select max(b) from t1,t2 group by a) group by a;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
-2 DEPENDENT SUBQUERY t1 system NULL NULL NULL NULL 0 const row not found
+2 DEPENDENT SUBQUERY t1 system NULL NULL NULL NULL 0 Const row not found
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 1
set optimizer_switch=@save_optimizer_switch;
DROP TABLE t1,t2;
diff --git a/mysql-test/suite/innodb/r/innodb_stats_debug.result b/mysql-test/suite/innodb/r/innodb_stats_debug.result
new file mode 100644
index 00000000000..8f599acc08c
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb_stats_debug.result
@@ -0,0 +1,12 @@
+call mtr.add_suppression("InnoDB: Cannot save (table|index) statistics for table `test`\\.`t1`.*: Persistent statistics do not exist");
+CREATE TABLE t1 (a INT, KEY(a)) ENGINE=INNODB STATS_PERSISTENT=1;
+SET @save_debug= @@SESSION.debug_dbug;
+SET debug_dbug= '+d,stats_index_error';
+ANALYZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status Operation failed
+SET debug_dbug= @save_debug;
+ANALYZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/r/instant_alter,4k.rdiff b/mysql-test/suite/innodb/r/instant_alter,4k.rdiff
index 098d9fa3b5d..d274d834faa 100644
--- a/mysql-test/suite/innodb/r/instant_alter,4k.rdiff
+++ b/mysql-test/suite/innodb/r/instant_alter,4k.rdiff
@@ -9,7 +9,7 @@
connection default;
ROLLBACK;
connection analyze;
-@@ -191,7 +191,7 @@
+@@ -250,7 +250,7 @@
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/t2';
clust_index_size
@@ -18,7 +18,7 @@
connection default;
BEGIN;
UPDATE t2 SET d1 = repeat(id, 200);
-@@ -202,7 +202,7 @@
+@@ -261,7 +261,7 @@
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/t2';
clust_index_size
@@ -27,7 +27,7 @@
connection default;
ROLLBACK;
connection analyze;
-@@ -212,7 +212,7 @@
+@@ -271,7 +271,7 @@
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/t2';
clust_index_size
@@ -36,7 +36,7 @@
connection default;
ALTER TABLE t2 DROP p;
affected rows: 0
-@@ -317,7 +317,7 @@
+@@ -374,7 +374,7 @@
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/big';
clust_index_size
@@ -45,7 +45,7 @@
connection default;
ALTER TABLE big ADD COLUMN
(d1 INT DEFAULT 0, d2 VARCHAR(20) DEFAULT 'abcde',
-@@ -340,7 +340,7 @@
+@@ -397,7 +397,7 @@
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/big';
clust_index_size
@@ -54,16 +54,16 @@
connection default;
ROLLBACK;
CHECKSUM TABLE big;
-@@ -353,7 +353,7 @@
+@@ -410,7 +410,7 @@
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/big';
clust_index_size
-3
+8
connection default;
- DROP TABLE big;
- CREATE TABLE t1
-@@ -532,7 +532,7 @@
+ InnoDB 0 transactions not purged
+ DROP TABLE t1,t2,t3,big;
+@@ -600,7 +600,7 @@
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/t2';
clust_index_size
@@ -72,7 +72,7 @@
connection default;
ROLLBACK;
connection analyze;
-@@ -542,7 +542,7 @@
+@@ -610,7 +610,7 @@
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/t2';
clust_index_size
@@ -81,7 +81,7 @@
connection default;
BEGIN;
UPDATE t2 SET d1 = repeat(id, 200);
-@@ -553,7 +553,7 @@
+@@ -621,7 +621,7 @@
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/t2';
clust_index_size
@@ -90,7 +90,7 @@
connection default;
ROLLBACK;
connection analyze;
-@@ -563,7 +563,7 @@
+@@ -631,7 +631,7 @@
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/t2';
clust_index_size
@@ -99,7 +99,7 @@
connection default;
ALTER TABLE t2 DROP p;
affected rows: 0
-@@ -668,7 +668,7 @@
+@@ -734,7 +734,7 @@
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/big';
clust_index_size
@@ -108,7 +108,7 @@
connection default;
ALTER TABLE big ADD COLUMN
(d1 INT DEFAULT 0, d2 VARCHAR(20) DEFAULT 'abcde',
-@@ -691,7 +691,7 @@
+@@ -757,7 +757,7 @@
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/big';
clust_index_size
@@ -117,16 +117,16 @@
connection default;
ROLLBACK;
CHECKSUM TABLE big;
-@@ -704,7 +704,7 @@
+@@ -770,7 +770,7 @@
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/big';
clust_index_size
-3
+7
connection default;
- DROP TABLE big;
- CREATE TABLE t1
-@@ -883,7 +883,7 @@
+ InnoDB 0 transactions not purged
+ DROP TABLE t1,t2,t3,big;
+@@ -960,7 +960,7 @@
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/t2';
clust_index_size
@@ -135,7 +135,7 @@
connection default;
ROLLBACK;
connection analyze;
-@@ -893,7 +893,7 @@
+@@ -970,7 +970,7 @@
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/t2';
clust_index_size
@@ -144,7 +144,7 @@
connection default;
BEGIN;
UPDATE t2 SET d1 = repeat(id, 200);
-@@ -904,7 +904,7 @@
+@@ -981,7 +981,7 @@
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/t2';
clust_index_size
@@ -153,7 +153,7 @@
connection default;
ROLLBACK;
connection analyze;
-@@ -914,7 +914,7 @@
+@@ -991,7 +991,7 @@
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/t2';
clust_index_size
@@ -162,7 +162,7 @@
connection default;
ALTER TABLE t2 DROP p;
affected rows: 0
-@@ -1019,7 +1019,7 @@
+@@ -1094,7 +1094,7 @@
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/big';
clust_index_size
@@ -171,7 +171,7 @@
connection default;
ALTER TABLE big ADD COLUMN
(d1 INT DEFAULT 0, d2 VARCHAR(20) DEFAULT 'abcde',
-@@ -1042,7 +1042,7 @@
+@@ -1117,7 +1117,7 @@
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/big';
clust_index_size
@@ -180,12 +180,12 @@
connection default;
ROLLBACK;
CHECKSUM TABLE big;
-@@ -1055,7 +1055,7 @@
+@@ -1130,7 +1130,7 @@
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/big';
clust_index_size
-3
+7
connection default;
- DROP TABLE big;
- disconnect analyze;
+ InnoDB 0 transactions not purged
+ DROP TABLE t1,t2,t3,big;
diff --git a/mysql-test/suite/innodb/r/instant_alter,8k.rdiff b/mysql-test/suite/innodb/r/instant_alter,8k.rdiff
index a313765df3a..b96262866e5 100644
--- a/mysql-test/suite/innodb/r/instant_alter,8k.rdiff
+++ b/mysql-test/suite/innodb/r/instant_alter,8k.rdiff
@@ -1,6 +1,6 @@
--- instant_alter.result
+++ instant_alter,8k.result
-@@ -181,7 +181,7 @@
+@@ -240,7 +240,7 @@
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/t2';
clust_index_size
@@ -9,7 +9,7 @@
connection default;
ROLLBACK;
connection analyze;
-@@ -191,7 +191,7 @@
+@@ -250,7 +250,7 @@
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/t2';
clust_index_size
@@ -18,7 +18,7 @@
connection default;
BEGIN;
UPDATE t2 SET d1 = repeat(id, 200);
-@@ -202,7 +202,7 @@
+@@ -261,7 +261,7 @@
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/t2';
clust_index_size
@@ -27,7 +27,7 @@
connection default;
ROLLBACK;
connection analyze;
-@@ -212,7 +212,7 @@
+@@ -271,7 +271,7 @@
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/t2';
clust_index_size
@@ -36,7 +36,7 @@
connection default;
ALTER TABLE t2 DROP p;
affected rows: 0
-@@ -317,7 +317,7 @@
+@@ -374,7 +374,7 @@
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/big';
clust_index_size
@@ -45,7 +45,7 @@
connection default;
ALTER TABLE big ADD COLUMN
(d1 INT DEFAULT 0, d2 VARCHAR(20) DEFAULT 'abcde',
-@@ -340,7 +340,7 @@
+@@ -397,7 +397,7 @@
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/big';
clust_index_size
@@ -54,16 +54,16 @@
connection default;
ROLLBACK;
CHECKSUM TABLE big;
-@@ -353,7 +353,7 @@
+@@ -410,7 +410,7 @@
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/big';
clust_index_size
-3
+5
connection default;
- DROP TABLE big;
- CREATE TABLE t1
-@@ -532,7 +532,7 @@
+ InnoDB 0 transactions not purged
+ DROP TABLE t1,t2,t3,big;
+@@ -600,7 +600,7 @@
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/t2';
clust_index_size
@@ -72,7 +72,7 @@
connection default;
ROLLBACK;
connection analyze;
-@@ -542,7 +542,7 @@
+@@ -610,7 +610,7 @@
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/t2';
clust_index_size
@@ -81,7 +81,7 @@
connection default;
BEGIN;
UPDATE t2 SET d1 = repeat(id, 200);
-@@ -553,7 +553,7 @@
+@@ -621,7 +621,7 @@
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/t2';
clust_index_size
@@ -90,7 +90,7 @@
connection default;
ROLLBACK;
connection analyze;
-@@ -563,7 +563,7 @@
+@@ -631,7 +631,7 @@
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/t2';
clust_index_size
@@ -99,7 +99,7 @@
connection default;
ALTER TABLE t2 DROP p;
affected rows: 0
-@@ -668,7 +668,7 @@
+@@ -734,7 +734,7 @@
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/big';
clust_index_size
@@ -108,7 +108,7 @@
connection default;
ALTER TABLE big ADD COLUMN
(d1 INT DEFAULT 0, d2 VARCHAR(20) DEFAULT 'abcde',
-@@ -691,7 +691,7 @@
+@@ -757,7 +757,7 @@
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/big';
clust_index_size
@@ -117,16 +117,16 @@
connection default;
ROLLBACK;
CHECKSUM TABLE big;
-@@ -704,7 +704,7 @@
+@@ -770,7 +770,7 @@
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/big';
clust_index_size
-3
+5
connection default;
- DROP TABLE big;
- CREATE TABLE t1
-@@ -883,7 +883,7 @@
+ InnoDB 0 transactions not purged
+ DROP TABLE t1,t2,t3,big;
+@@ -960,7 +960,7 @@
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/t2';
clust_index_size
@@ -135,7 +135,7 @@
connection default;
ROLLBACK;
connection analyze;
-@@ -893,7 +893,7 @@
+@@ -970,7 +970,7 @@
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/t2';
clust_index_size
@@ -144,7 +144,7 @@
connection default;
BEGIN;
UPDATE t2 SET d1 = repeat(id, 200);
-@@ -904,7 +904,7 @@
+@@ -981,7 +981,7 @@
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/t2';
clust_index_size
@@ -153,7 +153,7 @@
connection default;
ROLLBACK;
connection analyze;
-@@ -914,7 +914,7 @@
+@@ -991,7 +991,7 @@
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/t2';
clust_index_size
@@ -162,7 +162,7 @@
connection default;
ALTER TABLE t2 DROP p;
affected rows: 0
-@@ -1019,7 +1019,7 @@
+@@ -1094,7 +1094,7 @@
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/big';
clust_index_size
@@ -171,7 +171,7 @@
connection default;
ALTER TABLE big ADD COLUMN
(d1 INT DEFAULT 0, d2 VARCHAR(20) DEFAULT 'abcde',
-@@ -1042,7 +1042,7 @@
+@@ -1117,7 +1117,7 @@
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/big';
clust_index_size
@@ -180,12 +180,12 @@
connection default;
ROLLBACK;
CHECKSUM TABLE big;
-@@ -1055,7 +1055,7 @@
+@@ -1130,7 +1130,7 @@
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/big';
clust_index_size
-3
+5
connection default;
- DROP TABLE big;
- disconnect analyze;
+ InnoDB 0 transactions not purged
+ DROP TABLE t1,t2,t3,big;
diff --git a/mysql-test/suite/innodb/r/instant_alter_debug.result b/mysql-test/suite/innodb/r/instant_alter_debug.result
index 137cf8b766d..795d302087f 100644
--- a/mysql-test/suite/innodb/r/instant_alter_debug.result
+++ b/mysql-test/suite/innodb/r/instant_alter_debug.result
@@ -35,7 +35,7 @@ ALTER TABLE t4 ADD COLUMN b INT;
SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS
LEFT JOIN t4 ON (NUMERIC_SCALE = pk);
COUNT(*)
-1746
+1747
SET DEBUG_SYNC='innodb_inplace_alter_table_enter SIGNAL enter WAIT_FOR delete';
ALTER TABLE t4 ADD COLUMN c INT;
connect dml,localhost,root,,;
diff --git a/mysql-test/suite/innodb/r/truncate_restart.result b/mysql-test/suite/innodb/r/truncate_restart.result
new file mode 100644
index 00000000000..b6d14124371
--- /dev/null
+++ b/mysql-test/suite/innodb/r/truncate_restart.result
@@ -0,0 +1,12 @@
+SET GLOBAL innodb_stats_persistent= ON;
+CREATE TABLE t1 (t TEXT) ENGINE=InnoDB STATS_PERSISTENT=1;
+connect con1,localhost,root,,test;
+SET DEBUG_SYNC='ib_trunc_table_trunc_completing SIGNAL committed WAIT_FOR ever';
+TRUNCATE TABLE t1;
+connection default;
+SET DEBUG_SYNC='now WAIT_FOR committed';
+disconnect con1;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+0
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/r/update_time.result b/mysql-test/suite/innodb/r/update_time.result
new file mode 100644
index 00000000000..ab3eeb08dc7
--- /dev/null
+++ b/mysql-test/suite/innodb/r/update_time.result
@@ -0,0 +1,54 @@
+#
+# Test that INFORMATION_SCHEMA.TABLES.UPDATE_TIME is filled
+# correctly for InnoDB tables.
+#
+CREATE TABLE t (a INT) ENGINE=INNODB;
+SELECT update_time FROM information_schema.tables WHERE table_name = 't';
+update_time
+NULL
+INSERT INTO t VALUES (1);
+SELECT COUNT(*) FROM information_schema.tables WHERE table_name = 't'
+AND update_time IS NOT NULL;
+COUNT(*)
+1
+# We cant deterministically check that the saved value is correct, but
+# at least we check that it is a timestamp not older than 2 minutes.
+# Usually update_time and NOW() are equal below, but on heavily loaded
+# machines NOW() could be younger.
+SELECT COUNT(*) FROM information_schema.tables WHERE table_name = 't'
+AND TIMESTAMPDIFF(SECOND, update_time, NOW()) < 120;
+COUNT(*)
+1
+CREATE TEMPORARY TABLE big (a TEXT) ENGINE=INNODB;
+SELECT COUNT(*) FROM information_schema.innodb_buffer_page
+WHERE table_name = '`test`.`t`';
+COUNT(*)
+1
+# INSERT lots of data in table 'big': begin
+# INSERT lots of data in table 'big': end
+SELECT COUNT(*) FROM information_schema.innodb_buffer_page
+WHERE table_name = '`test`.`t`';
+COUNT(*)
+0
+SELECT COUNT(*) FROM information_schema.tables WHERE table_name = 't'
+AND update_time IS NOT NULL;
+COUNT(*)
+1
+DROP TEMPORARY TABLE big;
+# Test the behavior after restart with a prepared XA transaction
+XA START 'xatrx';
+INSERT INTO t VALUES (5);
+XA END 'xatrx';
+XA PREPARE 'xatrx';
+CONNECT con1,localhost,root,,;
+call mtr.add_suppression("Found 1 prepared XA transactions");
+FLUSH TABLES;
+# Kill and restart
+SELECT update_time FROM information_schema.tables WHERE table_name = 't';
+update_time
+NULL
+XA COMMIT 'xatrx';
+SELECT COUNT(update_time) FROM information_schema.tables WHERE table_name='t';
+COUNT(update_time)
+1
+DROP TABLE t;
diff --git a/mysql-test/suite/innodb/suite.opt b/mysql-test/suite/innodb/suite.opt
new file mode 100644
index 00000000000..8374626febe
--- /dev/null
+++ b/mysql-test/suite/innodb/suite.opt
@@ -0,0 +1 @@
+--plugin-maturity=unknown
diff --git a/mysql-test/suite/innodb/t/ddl_purge.test b/mysql-test/suite/innodb/t/ddl_purge.test
new file mode 100644
index 00000000000..60d17acead8
--- /dev/null
+++ b/mysql-test/suite/innodb/t/ddl_purge.test
@@ -0,0 +1,36 @@
+--source innodb_default_row_format.inc
+--source include/have_debug.inc
+--source include/have_debug_sync.inc
+
+CREATE TABLE t0 (pk INT PRIMARY KEY) ENGINE=InnoDB;
+CREATE TABLE t1 (pk INT PRIMARY KEY, b INT) ENGINE=InnoDB;
+
+--connect (con1,localhost,root,,test)
+BEGIN;
+INSERT INTO t0 SET pk=1;
+
+--connect (con2,localhost,root,,test)
+BEGIN;
+INSERT INTO t0 SET pk=2;
+
+--connection default
+SET DEBUG_SYNC='alter_table_inplace_after_lock_downgrade SIGNAL prepared WAIT_FOR logged';
+send ALTER TABLE t1 FORCE;
+
+--connection con1
+SET DEBUG_SYNC='now WAIT_FOR prepared';
+INSERT INTO t1 SET pk=1;
+COMMIT;
+--disconnect con1
+
+--connection con2
+UPDATE t1 SET b=1;
+DELETE FROM t1;
+ROLLBACK;
+SET DEBUG_SYNC='now SIGNAL logged';
+--disconnect con2
+
+--connection default
+reap;
+SET DEBUG_SYNC='RESET';
+DROP TABLE t0,t1;
diff --git a/mysql-test/suite/innodb/t/innodb-on-duplicate-update.test b/mysql-test/suite/innodb/t/innodb-on-duplicate-update.test
new file mode 100644
index 00000000000..cc80198d24a
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb-on-duplicate-update.test
@@ -0,0 +1,63 @@
+--source include/have_innodb.inc
+
+#
+# MDEV-13206: INSERT ON DUPLICATE KEY UPDATE foreign key fail
+#
+set sql_mode='';
+set innodb_strict_mode=0;
+
+CREATE TABLE `v` (
+ `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
+
+INSERT v values (1);
+
+CREATE TABLE `vp` (
+ `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
+ `v_id` int(10) unsigned NOT NULL,
+ `p_id` int(10) unsigned NOT NULL,
+ `ppp` varchar(255) NOT NULL,
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `IDX_vp_uniq` (`v_id`,`p_id`),
+ KEY `FK_vp_v` (`v_id`),
+ CONSTRAINT `FK_vp_v` FOREIGN KEY (`v_id`) REFERENCES `v` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
+
+INSERT vp VALUES (12, 1, 100, 'text12');
+INSERT INTO `vp` (`id`,`ppp`) VALUES (12, 'test12-2') ON DUPLICATE KEY UPDATE `ppp` = VALUES(`ppp`);
+SELECT * FROM vp;
+DROP TABLE vp, v;
+
+CREATE TABLE t1 (i int PRIMARY KEY) ENGINE=InnoDB;
+INSERT into t1 values (1);
+
+CREATE TABLE t2 (
+ i int not null primary key,
+ vi int not null,
+ m int,
+ UNIQUE KEY (vi),
+ CONSTRAINT `cc` FOREIGN KEY (vi) REFERENCES t1 (i) ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB;
+
+INSERT into t2 VALUES (1, 1, 100);
+INSERT INTO t2 (i,m) VALUES (1, 2) ON DUPLICATE KEY UPDATE m=3;
+SELECT * FROM t2;
+
+DROP TABLE t2,t1;
+
+CREATE TABLE t1 (i int PRIMARY KEY) ENGINE=InnoDB;
+INSERT into t1 values (1);
+
+CREATE TABLE t2 (
+ i int not null primary key,
+ vi int not null,
+ m int,
+ KEY (vi),
+ CONSTRAINT `cc` FOREIGN KEY (vi) REFERENCES t1 (i) ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB;
+
+INSERT into t2 VALUES (1, 1, 100);
+INSERT INTO t2 (i,m) VALUES (1, 2) ON DUPLICATE KEY UPDATE m=3;
+SELECT * FROM t2;
+DROP TABLE t2, t1;
diff --git a/mysql-test/suite/innodb/t/innodb-replace-debug.test b/mysql-test/suite/innodb/t/innodb-replace-debug.test
new file mode 100644
index 00000000000..5cec9e1febf
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb-replace-debug.test
@@ -0,0 +1,15 @@
+--source include/have_innodb.inc
+--source include/have_debug.inc
+
+--echo #
+--echo # Bug#17604730 ASSERTION: *CURSOR->INDEX->NAME == TEMP_INDEX_PREFIX
+--echo #
+
+create table t1 (f1 int primary key, f2 int, f3 int, unique key k1(f2),
+ key k2(f3)) engine=innodb;
+insert into t1 values (14, 24, 34);
+set @@debug_dbug = '+d,row_ins_sec_index_entry_timeout';
+replace into t1 values (14, 25, 34);
+select * from t1;
+drop table t1;
+set @@debug_dbug = '-d,row_ins_sec_index_entry_timeout';
diff --git a/mysql-test/suite/innodb/t/innodb_bulk_create_index.test b/mysql-test/suite/innodb/t/innodb_bulk_create_index.test
new file mode 100644
index 00000000000..534b4de87f7
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_bulk_create_index.test
@@ -0,0 +1,46 @@
+######## suite/innodb/t/innodb_bulk_create_index.test #####
+# #
+# Testcase for worklog WL#7277: InnoDB: Bulk Load for Create Index #
+# The basic idea of bulk load is to build an index from bottom up #
+# (also known as sorted index build). #
+# Earlier index was create by repeatedly inserting records #
+# Test scenario : #
+# - Run bulk create index on 10K rows #
+# - Run bulk create index on table with various row types #
+# - Run DML and SELECT after bulk index creation #
+# Creation: #
+# 2014-06-19 Implemented this test as part of WL#7277 #
+# #
+######################################################################
+
+-- source include/not_embedded.inc
+-- source include/innodb_page_size_small.inc
+-- source include/big_test.inc
+
+# Test Row Format: REDUNDANT.
+let $row_format = REDUNDANT;
+-- source suite/innodb/include/innodb_bulk_create_index.inc
+
+# Test Row Format: COMPACT.
+let $row_format = COMPACT;
+-- source suite/innodb/include/innodb_bulk_create_index.inc
+
+# Test Row Format: DYNAMIC.
+let $row_format = DYNAMIC;
+-- source suite/innodb/include/innodb_bulk_create_index.inc
+
+# Test Row Format: COMPRESSED.
+let $row_format = COMPRESSED;
+-- source suite/innodb/include/innodb_bulk_create_index.inc
+
+# Test Fill Factor: 10
+let $row_format = COMPACT;
+SET GLOBAL innodb_fill_factor=10;
+-- source suite/innodb/include/innodb_bulk_create_index.inc
+
+# Test Fill Factor: 50
+let $row_format = COMPACT;
+SET GLOBAL innodb_fill_factor=50;
+-- source suite/innodb/include/innodb_bulk_create_index.inc
+
+SET GLOBAL innodb_fill_factor=default;
diff --git a/mysql-test/suite/innodb/t/innodb_bulk_create_index_debug.test b/mysql-test/suite/innodb/t/innodb_bulk_create_index_debug.test
new file mode 100644
index 00000000000..83a12431802
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_bulk_create_index_debug.test
@@ -0,0 +1,23 @@
+#
+# wl#7277: InnoDB: Bulk Load for Create Index
+#
+
+# Test Restart & Crash Recovery.
+-- source include/big_test.inc
+-- source include/innodb_page_size_small.inc
+
+# Test Row Format: REDUNDANT.
+let $row_format = REDUNDANT;
+-- source suite/innodb/include/innodb_bulk_create_index_debug.inc
+
+# Test Row Format: COMPACT.
+let $row_format = COMPACT;
+-- source suite/innodb/include/innodb_bulk_create_index_debug.inc
+
+# Test Row Format: DYNAMIC.
+let $row_format = DYNAMIC;
+-- source suite/innodb/include/innodb_bulk_create_index_debug.inc
+
+# Test Row Format: COMPRESSED.
+let $row_format = COMPRESSED;
+-- source suite/innodb/include/innodb_bulk_create_index_debug.inc
diff --git a/mysql-test/suite/innodb/t/innodb_bulk_create_index_flush.test b/mysql-test/suite/innodb/t/innodb_bulk_create_index_flush.test
new file mode 100644
index 00000000000..cffca0cc773
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_bulk_create_index_flush.test
@@ -0,0 +1,75 @@
+#
+# Test flush on error in bulk load to make sure we do a proper cleanup.
+# Note: We flush all dirty pages before applying any online log in bulk load.
+#
+
+-- source include/have_innodb.inc
+-- source include/have_debug.inc
+
+# Create Insert Procedure
+DELIMITER |;
+CREATE PROCEDURE populate_t1()
+BEGIN
+ DECLARE i int DEFAULT 1;
+
+ START TRANSACTION;
+ WHILE (i <= 10000) DO
+ INSERT INTO t1 VALUES (i, i, CONCAT('a', i));
+ SET i = i + 1;
+ END WHILE;
+ COMMIT;
+END|
+DELIMITER ;|
+
+CREATE TABLE t1(
+ class INT,
+ id INT,
+ title VARCHAR(100)
+) ENGINE=InnoDB;
+
+-- disable_query_log
+CALL populate_t1();
+-- enable_query_log
+
+SELECT COUNT(*) FROM t1;
+
+SET @saved_dbug= @@SESSION.debug_dbug;
+SET debug_dbug='+d,ib_index_build_fail_before_flush';
+
+-- error ER_QUERY_INTERRUPTED
+CREATE INDEX idx_id ON t1(id);
+
+CHECK TABLE t1;
+
+-- error ER_QUERY_INTERRUPTED
+CREATE INDEX idx_title ON t1(title);
+
+CHECK TABLE t1;
+
+-- error ER_QUERY_INTERRUPTED
+CREATE FULLTEXT INDEX fidx_title ON t1(title);
+
+CHECK TABLE t1;
+
+-- error ER_QUERY_INTERRUPTED
+ALTER TABLE t1 ADD COLUMN content TEXT, FORCE;
+
+CHECK TABLE t1;
+
+SET debug_dbug= @saved_dbug;
+
+INSERT INTO t1 VALUES(10001, 10001, 'a10000');
+
+-- error ER_DUP_ENTRY
+ALTER TABLE t1 ADD UNIQUE INDEX idx_title(title);
+
+CHECK TABLE t1;
+
+-- error ER_DUP_ENTRY
+ALTER TABLE t1 ADD UNIQUE INDEX idx_id(id), ADD UNIQUE INDEX idx_title(title);
+
+CHECK TABLE t1;
+
+DROP TABLE t1;
+
+DROP PROCEDURE populate_t1;
diff --git a/mysql-test/suite/innodb/t/innodb_bulk_create_index_replication.test b/mysql-test/suite/innodb/t/innodb_bulk_create_index_replication.test
new file mode 100644
index 00000000000..5b4eaae7557
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_bulk_create_index_replication.test
@@ -0,0 +1,182 @@
+######## suite/innodb/t/innodb_wl7277_1.test #####
+# #
+# Testcase for worklog WL#7277: InnoDB: Bulk Load for Create Index #
+# The basic idea of bulk load is to build an index from bottom up #
+# (also known as sorted index build). #
+# Earlier index was create by repeatedly inserting records #
+# Test scenario : #
+# - Run bulk create index on replication setup #
+# - Run bulk create on partitioned table and see its replictaed #
+# to slave #
+# Creation: #
+# 2014-06-19 Implemented this test as part of WL#7277 #
+# #
+######################################################################
+
+--source include/not_embedded.inc
+-- source include/have_innodb.inc
+-- source include/have_partition.inc
+-- source include/master-slave.inc
+
+-- connection master
+# Create Insert Procedure
+DELIMITER |;
+CREATE PROCEDURE populate_t1(load_even INT)
+BEGIN
+ DECLARE i int DEFAULT 1;
+
+ START TRANSACTION;
+ WHILE (i <= 100) DO
+ IF i%2 = 0 AND load_even = 1 THEN
+ INSERT INTO t1 VALUES (i, i, CONCAT('a', i));
+ END IF;
+ IF i%2 != 0 AND load_even != 1 THEN
+ INSERT INTO t1 VALUES (i, i, CONCAT('a', i));
+ END IF;
+ SET i = i + 1;
+ END WHILE;
+ COMMIT;
+END|
+DELIMITER ;|
+
+CREATE TABLE t1(
+ class INT,
+ id INT,
+ title VARCHAR(100)
+) ENGINE=InnoDB ;
+
+
+
+
+-- disable_query_log
+# Load half records
+CALL populate_t1(1);
+-- enable_query_log
+
+SELECT COUNT(*) FROM t1;
+
+/* Create index. */
+CREATE INDEX idx_id ON t1(id);
+
+CREATE INDEX idx_title ON t1(title);
+
+
+/* Select by index. */
+EXPLAIN SELECT * FROM t1 WHERE id = 10;
+EXPLAIN SELECT * FROM t1 WHERE title = 'a10';
+
+SELECT * FROM t1 WHERE id = 10;
+SELECT * FROM t1 WHERE title = 'a10';
+
+SELECT * FROM t1 WHERE id = 20;
+SELECT * FROM t1 WHERE title = 'a20';
+
+SELECT * FROM t1 WHERE id = 30;
+SELECT * FROM t1 WHERE title = 'a30';
+
+SELECT * FROM t1 WHERE id = 101;
+SELECT * FROM t1 WHERE title = 'a101';
+
+/*Insert/Update/Delete. */
+DELETE FROM t1 WHERE id < 40 AND id > 30;
+INSERT INTO t1 VALUES(38, 38, 'b38');
+UPDATE t1 SET title = CONCAT('b', id) WHERE id < 30 AND id > 20;
+
+SELECT * FROM t1 WHERE id = 28;
+SELECT * FROM t1 WHERE title = 'a28';
+SELECT * FROM t1 WHERE title = 'b28';
+
+SELECT * FROM t1 WHERE id = 38;
+SELECT * FROM t1 WHERE title = 'a38';
+SELECT * FROM t1 WHERE title = 'b38';
+
+SELECT * FROM t1 WHERE id = 101;
+SELECT * FROM t1 WHERE title = 'a101';
+
+-- disable_query_log
+# Load half records (follow up load)
+CALL populate_t1(0);
+-- enable_query_log
+SELECT COUNT(*) FROM t1;
+
+
+SELECT * FROM t1 WHERE id = 10;
+SELECT * FROM t1 WHERE title = 'a10';
+
+SELECT * FROM t1 WHERE id = 20;
+SELECT * FROM t1 WHERE title = 'a20';
+
+SELECT * FROM t1 WHERE id = 30;
+SELECT * FROM t1 WHERE title = 'a30';
+
+SELECT * FROM t1 WHERE id = 101;
+SELECT * FROM t1 WHERE title = 'a101';
+
+# Create partition table
+CREATE TABLE t_part (
+ class INT ,
+ id INT ,
+ title VARCHAR(30)
+ ) ENGINE=InnoDB
+ PARTITION BY RANGE(id)
+ SUBPARTITION BY KEY(id)
+ SUBPARTITIONS 4
+ (
+ PARTITION p0 VALUES LESS THAN (5000),
+ PARTITION p1 VALUES LESS THAN (MAXVALUE)
+ );
+INSERT INTO t_part SELECT * FROM t1;
+ALTER TABLE t_part ADD INDEX `idx` (class,id,title(10));
+
+SELECT * FROM t_part WHERE id = 10;
+SELECT * FROM t_part WHERE title = 'a10';
+
+SELECT * FROM t_part WHERE id = 20;
+SELECT * FROM t_part WHERE title = 'a20';
+
+SELECT * FROM t_part WHERE id = 30;
+SELECT * FROM t_part WHERE title = 'a30';
+
+SELECT * FROM t_part WHERE id = 101;
+SELECT * FROM t_part WHERE title = 'a101';
+
+
+--source include/sync_slave_sql_with_master.inc
+-- connection slave
+SHOW CREATE TABLE t1;
+SHOW CREATE TABLE t_part;
+SELECT COUNT(*) FROM t1;
+SELECT COUNT(*) FROM t_part;
+
+SELECT * FROM t1 WHERE id = 10;
+SELECT * FROM t1 WHERE title = 'a10';
+
+SELECT * FROM t1 WHERE id = 20;
+SELECT * FROM t1 WHERE title = 'a20';
+
+SELECT * FROM t1 WHERE id = 30;
+SELECT * FROM t1 WHERE title = 'a30';
+
+SELECT * FROM t1 WHERE id = 101;
+SELECT * FROM t1 WHERE title = 'a101';
+
+
+
+SELECT * FROM t_part WHERE id = 10;
+SELECT * FROM t_part WHERE title = 'a10';
+
+SELECT * FROM t_part WHERE id = 20;
+SELECT * FROM t_part WHERE title = 'a20';
+
+SELECT * FROM t_part WHERE id = 30;
+SELECT * FROM t_part WHERE title = 'a30';
+
+SELECT * FROM t_part WHERE id = 101;
+SELECT * FROM t_part WHERE title = 'a101';
+
+
+-- connection master
+DROP PROCEDURE populate_t1;
+DROP TABLE t1;
+DROP TABLE t_part;
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/innodb/t/innodb_bulk_create_index_small.test b/mysql-test/suite/innodb/t/innodb_bulk_create_index_small.test
new file mode 100644
index 00000000000..d04dd59f7e7
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_bulk_create_index_small.test
@@ -0,0 +1,148 @@
+#
+# wl#7277: InnoDB: Bulk Load for Create Index
+#
+
+-- source include/innodb_page_size_small.inc
+
+# Create Insert Procedure
+DELIMITER |;
+CREATE PROCEDURE populate_t1()
+BEGIN
+ DECLARE i int DEFAULT 1;
+
+ START TRANSACTION;
+ WHILE (i <= 1000) DO
+ INSERT INTO t1 VALUES (i, i, CONCAT('a', i));
+ SET i = i + 1;
+ END WHILE;
+ COMMIT;
+END|
+DELIMITER ;|
+
+SELECT @@innodb_fill_factor;
+
+# Test Compact Table
+CREATE TABLE t1(
+ class INT,
+ id INT,
+ title VARCHAR(100)
+) ENGINE=InnoDB ROW_FORMAT=COMPACT;
+
+-- disable_query_log
+CALL populate_t1();
+-- enable_query_log
+
+SELECT COUNT(*) FROM t1;
+
+/* Create index. */
+CREATE INDEX idx_id ON t1(id);
+
+CREATE INDEX idx_title ON t1(title);
+
+/* Check table. */
+CHECK TABLE t1;
+
+/* Select by index. */
+EXPLAIN SELECT * FROM t1 WHERE id = 10;
+EXPLAIN SELECT * FROM t1 WHERE title = 'a10';
+
+SELECT * FROM t1 WHERE id = 10;
+SELECT * FROM t1 WHERE title = 'a10';
+
+SELECT * FROM t1 WHERE id = 500;
+SELECT * FROM t1 WHERE title = 'a500';
+
+SELECT * FROM t1 WHERE id = 1000;
+SELECT * FROM t1 WHERE title = 'a1000';
+
+SELECT * FROM t1 WHERE id = 1010;
+SELECT * FROM t1 WHERE title = 'a1010';
+
+DROP TABLE t1;
+
+# Test Blob
+CREATE TABLE t1(
+ a INT PRIMARY KEY,
+ b TEXT,
+ c TEXT) ENGINE=InnoDB ROW_FORMAT=COMPACT;
+
+INSERT INTO t1 VALUES
+ (1, REPEAT('a',10000), 'a'),
+ (2, REPEAT('b',20000), 'b'),
+ (3, REPEAT('c',40000), 'c'),
+ (4, REPEAT('d',60000), 'd');
+
+ALTER TABLE t1 DROP COLUMN c;
+
+CHECK TABLE t1;
+
+SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975;
+
+DROP TABLE t1;
+
+SET GLOBAL innodb_file_per_table=default;
+
+# Test Compressed Table
+SET GLOBAL innodb_file_per_table=1;
+
+CREATE TABLE t1(
+ class INT,
+ id INT,
+ title VARCHAR(100)
+) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
+
+-- disable_query_log
+CALL populate_t1();
+-- enable_query_log
+
+SELECT COUNT(*) FROM t1;
+
+/* Create index. */
+CREATE INDEX idx_id ON t1(id);
+
+CREATE INDEX idx_title ON t1(title);
+
+/* Check table. */
+CHECK TABLE t1;
+
+/* Select by index. */
+EXPLAIN SELECT * FROM t1 WHERE id = 10;
+EXPLAIN SELECT * FROM t1 WHERE title = 'a10';
+
+SELECT * FROM t1 WHERE id = 10;
+SELECT * FROM t1 WHERE title = 'a10';
+
+SELECT * FROM t1 WHERE id = 500;
+SELECT * FROM t1 WHERE title = 'a500';
+
+SELECT * FROM t1 WHERE id = 1000;
+SELECT * FROM t1 WHERE title = 'a1000';
+
+SELECT * FROM t1 WHERE id = 1010;
+SELECT * FROM t1 WHERE title = 'a1010';
+
+DROP TABLE t1;
+
+# Test Compression & Blob
+CREATE TABLE t1(
+ a INT PRIMARY KEY,
+ b TEXT,
+ c TEXT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
+
+INSERT INTO t1 VALUES
+ (1, REPEAT('a',10000), 'a'),
+ (2, REPEAT('b',20000), 'b'),
+ (3, REPEAT('c',40000), 'c'),
+ (4, REPEAT('d',60000), 'd');
+
+ALTER TABLE t1 DROP COLUMN c;
+
+CHECK TABLE t1;
+
+SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975;
+
+DROP TABLE t1;
+
+SET GLOBAL innodb_file_per_table=default;
+
+DROP PROCEDURE populate_t1;
diff --git a/mysql-test/suite/innodb/t/innodb_default_row_format.combinations b/mysql-test/suite/innodb/t/innodb_default_row_format.combinations
new file mode 100644
index 00000000000..f3bc2cc0c25
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_default_row_format.combinations
@@ -0,0 +1,4 @@
+[redundant]
+innodb_default_row_format=redundant
+[dynamic]
+innodb_default_row_format=dynamic
diff --git a/mysql-test/suite/innodb/t/innodb_default_row_format.inc b/mysql-test/suite/innodb/t/innodb_default_row_format.inc
new file mode 100644
index 00000000000..15c61dc6342
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_default_row_format.inc
@@ -0,0 +1,2 @@
+# See also innodb_default_row_format.combinations
+--source include/have_innodb.inc
diff --git a/mysql-test/suite/innodb/t/innodb_stats_debug.test b/mysql-test/suite/innodb/t/innodb_stats_debug.test
new file mode 100644
index 00000000000..cd41c0b8fb0
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_stats_debug.test
@@ -0,0 +1,13 @@
+--source include/have_innodb.inc
+--source include/have_debug.inc
+
+call mtr.add_suppression("InnoDB: Cannot save (table|index) statistics for table `test`\\.`t1`.*: Persistent statistics do not exist");
+
+CREATE TABLE t1 (a INT, KEY(a)) ENGINE=INNODB STATS_PERSISTENT=1;
+SET @save_debug= @@SESSION.debug_dbug;
+SET debug_dbug= '+d,stats_index_error';
+ANALYZE TABLE t1;
+SET debug_dbug= @save_debug;
+ANALYZE TABLE t1;
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/t/innodb_stats_drop_locked.test b/mysql-test/suite/innodb/t/innodb_stats_drop_locked.test
index 26367b8e6ae..47f363a4bb6 100644
--- a/mysql-test/suite/innodb/t/innodb_stats_drop_locked.test
+++ b/mysql-test/suite/innodb/t/innodb_stats_drop_locked.test
@@ -57,5 +57,5 @@ SELECT table_name FROM mysql.innodb_index_stats
WHERE table_name='innodb_stats_drop_locked';
--disable_query_log
-call mtr.add_suppression("Unable to delete statistics for table test.innodb_stats_drop_locked: Lock wait timeout. They can be deleted later using DELETE FROM mysql.innodb_index_stats WHERE database_name");
+call mtr.add_suppression("Unable to delete statistics for table test\\.innodb_stats_drop_locked: Lock wait");
--enable_query_log
diff --git a/mysql-test/suite/innodb/t/truncate_restart.test b/mysql-test/suite/innodb/t/truncate_restart.test
new file mode 100644
index 00000000000..60a3d83cd81
--- /dev/null
+++ b/mysql-test/suite/innodb/t/truncate_restart.test
@@ -0,0 +1,16 @@
+--source include/have_innodb.inc
+--source include/have_debug.inc
+--source include/have_debug_sync.inc
+
+SET GLOBAL innodb_stats_persistent= ON;
+CREATE TABLE t1 (t TEXT) ENGINE=InnoDB STATS_PERSISTENT=1;
+--connect (con1,localhost,root,,test)
+SET DEBUG_SYNC='ib_trunc_table_trunc_completing SIGNAL committed WAIT_FOR ever';
+--send
+TRUNCATE TABLE t1;
+--connection default
+SET DEBUG_SYNC='now WAIT_FOR committed';
+--source include/restart_mysqld.inc
+--disconnect con1
+SELECT COUNT(*) FROM t1;
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/t/update_time-master.opt b/mysql-test/suite/innodb/t/update_time-master.opt
new file mode 100644
index 00000000000..9f283a9503f
--- /dev/null
+++ b/mysql-test/suite/innodb/t/update_time-master.opt
@@ -0,0 +1 @@
+--innodb-buffer-pool-size=10M
diff --git a/mysql-test/suite/innodb/t/update_time.test b/mysql-test/suite/innodb/t/update_time.test
new file mode 100644
index 00000000000..e2213c5d9b7
--- /dev/null
+++ b/mysql-test/suite/innodb/t/update_time.test
@@ -0,0 +1,78 @@
+###################################################################
+-- echo #
+-- echo # Test that INFORMATION_SCHEMA.TABLES.UPDATE_TIME is filled
+-- echo # correctly for InnoDB tables.
+-- echo #
+
+-- source include/have_innodb.inc
+-- source include/have_innodb_max_16k.inc
+# restart does not work with embedded
+-- source include/not_embedded.inc
+
+CREATE TABLE t (a INT) ENGINE=INNODB;
+
+SELECT update_time FROM information_schema.tables WHERE table_name = 't';
+
+INSERT INTO t VALUES (1);
+
+SELECT COUNT(*) FROM information_schema.tables WHERE table_name = 't'
+AND update_time IS NOT NULL;
+
+-- echo # We cant deterministically check that the saved value is correct, but
+-- echo # at least we check that it is a timestamp not older than 2 minutes.
+-- echo # Usually update_time and NOW() are equal below, but on heavily loaded
+-- echo # machines NOW() could be younger.
+SELECT COUNT(*) FROM information_schema.tables WHERE table_name = 't'
+AND TIMESTAMPDIFF(SECOND, update_time, NOW()) < 120;
+
+CREATE TEMPORARY TABLE big (a TEXT) ENGINE=INNODB;
+
+SELECT COUNT(*) FROM information_schema.innodb_buffer_page
+WHERE table_name = '`test`.`t`';
+
+# evict table 't' by inserting as much data as the BP size itself
+-- echo # INSERT lots of data in table 'big': begin
+-- disable_query_log
+BEGIN;
+-- let $i = 10240
+while ($i)
+{
+ INSERT INTO big VALUES (REPEAT('a', 1024));
+ dec $i;
+}
+COMMIT;
+-- enable_query_log
+-- echo # INSERT lots of data in table 'big': end
+
+# confirm that all pages for table 't' have been evicted
+SELECT COUNT(*) FROM information_schema.innodb_buffer_page
+WHERE table_name = '`test`.`t`';
+
+# The result from this query will change once update_time becomes persistent
+# (WL#6917).
+SELECT COUNT(*) FROM information_schema.tables WHERE table_name = 't'
+AND update_time IS NOT NULL;
+
+DROP TEMPORARY TABLE big;
+
+-- echo # Test the behavior after restart with a prepared XA transaction
+
+XA START 'xatrx';
+INSERT INTO t VALUES (5);
+XA END 'xatrx';
+XA PREPARE 'xatrx';
+
+CONNECT (con1,localhost,root,,);
+
+call mtr.add_suppression("Found 1 prepared XA transactions");
+FLUSH TABLES;
+
+--source include/kill_and_restart_mysqld.inc
+
+SELECT update_time FROM information_schema.tables WHERE table_name = 't';
+
+XA COMMIT 'xatrx';
+
+SELECT COUNT(update_time) FROM information_schema.tables WHERE table_name='t';
+
+DROP TABLE t;
diff --git a/mysql-test/suite/mariabackup/log_checksum_mismatch.result b/mysql-test/suite/mariabackup/log_checksum_mismatch.result
new file mode 100644
index 00000000000..806a5e62cb6
--- /dev/null
+++ b/mysql-test/suite/mariabackup/log_checksum_mismatch.result
@@ -0,0 +1,14 @@
+CREATE TABLE t(i INT) ENGINE INNODB;
+INSERT INTO t VALUES(1);
+# xtrabackup backup
+FOUND 1 /Invalid log block checksum/ in backup.log
+INSERT INTO t VALUES(2);
+# xtrabackup prepare
+# shutdown server
+# remove datadir
+# xtrabackup move back
+# restart server
+SELECT * FROM t;
+i
+1
+DROP TABLE t;
diff --git a/mysql-test/suite/mariabackup/log_checksum_mismatch.test b/mysql-test/suite/mariabackup/log_checksum_mismatch.test
new file mode 100644
index 00000000000..f041b0aeedd
--- /dev/null
+++ b/mysql-test/suite/mariabackup/log_checksum_mismatch.test
@@ -0,0 +1,32 @@
+--source include/have_debug.inc
+
+CREATE TABLE t(i INT) ENGINE INNODB;
+INSERT INTO t VALUES(1);
+echo # xtrabackup backup;
+let $targetdir=$MYSQLTEST_VARDIR/tmp/backup;
+let $backuplog=$MYSQLTEST_VARDIR/tmp/backup.log;
+
+--disable_result_log
+exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir --dbug=+d,log_intermittent_checksum_mismatch > $backuplog;
+--enable_result_log
+
+--let SEARCH_RANGE = 10000000
+--let SEARCH_PATTERN=Invalid log block checksum
+--let SEARCH_FILE=$backuplog
+--source include/search_pattern_in_file.inc
+remove_file $backuplog;
+
+
+INSERT INTO t VALUES(2);
+
+
+echo # xtrabackup prepare;
+--disable_result_log
+exec $XTRABACKUP --prepare --target-dir=$targetdir;
+-- source include/restart_and_restore.inc
+--enable_result_log
+
+SELECT * FROM t;
+DROP TABLE t;
+rmdir $targetdir;
+
diff --git a/mysql-test/suite/mariabackup/mdev-14447.opt b/mysql-test/suite/mariabackup/mdev-14447.opt
new file mode 100644
index 00000000000..5ac67e950c4
--- /dev/null
+++ b/mysql-test/suite/mariabackup/mdev-14447.opt
@@ -0,0 +1 @@
+--sequence --innodb-data-file-path=ibdata_first:3M;ibdata_second:1M:autoextend \ No newline at end of file
diff --git a/mysql-test/suite/mariabackup/mdev-14447.result b/mysql-test/suite/mariabackup/mdev-14447.result
new file mode 100644
index 00000000000..3bca7eb5701
--- /dev/null
+++ b/mysql-test/suite/mariabackup/mdev-14447.result
@@ -0,0 +1,19 @@
+call mtr.add_suppression("InnoDB: New log files created");
+CREATE TABLE t(a varchar(40) PRIMARY KEY, b varchar(40), c varchar(40), d varchar(40), index(b,c,d)) ENGINE INNODB;
+# Create full backup , modify table, then create incremental/differential backup
+BEGIN;
+INSERT INTO t select uuid(), uuid(), uuid(), uuid() from seq_1_to_100000;
+COMMIT;
+SELECT count(*) FROM t;
+count(*)
+100000
+# Prepare full backup, apply incremental one
+# Restore and check results
+# shutdown server
+# remove datadir
+# xtrabackup move back
+# restart server
+SELECT count(*) FROM t;
+count(*)
+100000
+DROP TABLE t;
diff --git a/mysql-test/suite/mariabackup/mdev-14447.test b/mysql-test/suite/mariabackup/mdev-14447.test
new file mode 100644
index 00000000000..48f37646231
--- /dev/null
+++ b/mysql-test/suite/mariabackup/mdev-14447.test
@@ -0,0 +1,46 @@
+call mtr.add_suppression("InnoDB: New log files created");
+
+let $basedir=$MYSQLTEST_VARDIR/tmp/backup;
+let $incremental_dir=$MYSQLTEST_VARDIR/tmp/backup_inc1;
+
+CREATE TABLE t(a varchar(40) PRIMARY KEY, b varchar(40), c varchar(40), d varchar(40), index(b,c,d)) ENGINE INNODB;
+
+echo # Create full backup , modify table, then create incremental/differential backup;
+--disable_result_log
+exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$basedir;
+--enable_result_log
+BEGIN;
+INSERT INTO t select uuid(), uuid(), uuid(), uuid() from seq_1_to_100000;
+COMMIT;
+SELECT count(*) FROM t;
+
+exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$incremental_dir --incremental-basedir=$basedir;
+
+--disable_result_log
+echo # Prepare full backup, apply incremental one;
+exec $XTRABACKUP --prepare --apply-log-only --target-dir=$basedir;
+exec $XTRABACKUP --prepare --apply-log-only --target-dir=$basedir --incremental-dir=$incremental_dir ;
+
+echo # Restore and check results;
+let $targetdir=$basedir;
+#-- source include/restart_and_restore.inc
+
+let $_datadir= `SELECT @@datadir`;
+let $innodb_data_file_path=`SELECT @@innodb_data_file_path`;
+echo # shutdown server;
+--source include/shutdown_mysqld.inc
+echo # remove datadir;
+rmdir $_datadir;
+echo # xtrabackup move back;
+exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --copy-back --datadir=$_datadir "--innodb_data_file_path=$innodb_data_file_path" --target-dir=$targetdir;
+echo # restart server;
+--source include/start_mysqld.inc
+
+
+--enable_result_log
+SELECT count(*) FROM t;
+DROP TABLE t;
+
+# Cleanup
+rmdir $basedir;
+rmdir $incremental_dir;
diff --git a/mysql-test/suite/parts/r/optimizer.result b/mysql-test/suite/parts/r/optimizer.result
index cdf0b2b83dc..465c6c7d762 100644
--- a/mysql-test/suite/parts/r/optimizer.result
+++ b/mysql-test/suite/parts/r/optimizer.result
@@ -22,7 +22,7 @@ INSERT INTO t2 SELECT * FROM t1;
# plans should be identical
EXPLAIN SELECT a, MAX(b) FROM t1 WHERE a IN (10,100) GROUP BY a;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range a a 5 NULL 1 Using where; Using index for group-by
+1 SIMPLE t1 range a a 5 NULL 2 Using where; Using index
EXPLAIN SELECT a, MAX(b) FROM t2 WHERE a IN (10,100) GROUP BY a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 range a a 5 NULL 2 Using where; Using index for group-by
@@ -33,7 +33,7 @@ a MAX(b)
# Should be no more than 4 reads.
SHOW status LIKE 'handler_read_key';
Variable_name Value
-Handler_read_key 4
+Handler_read_key 2
FLUSH status;
SELECT a, MAX(b) FROM t2 WHERE a IN (10, 100) GROUP BY a;
a MAX(b)
diff --git a/mysql-test/suite/rpl/r/rpl_create_drop_view.result b/mysql-test/suite/rpl/r/rpl_create_drop_view.result
index ebbe9efc9df..436aa7bc236 100644
--- a/mysql-test/suite/rpl/r/rpl_create_drop_view.result
+++ b/mysql-test/suite/rpl/r/rpl_create_drop_view.result
@@ -99,7 +99,7 @@ DROP VIEW v1;
ERROR 42S02: Unknown VIEW: 'test.v1'
DROP VIEW IF EXISTS v2;
Warnings:
-Note 4090 Unknown VIEW: 'test.v2'
+Note 4091 Unknown VIEW: 'test.v2'
# Syncing slave with master
connection slave;
SELECT * FROM v1;
diff --git a/mysql-test/suite/rpl/r/rpl_gtid_delete_domain.result b/mysql-test/suite/rpl/r/rpl_gtid_delete_domain.result
new file mode 100644
index 00000000000..75a22b78a32
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_gtid_delete_domain.result
@@ -0,0 +1,82 @@
+include/master-slave.inc
+[connection master]
+connection master;
+SET @@SESSION.gtid_domain_id=0;
+CREATE TABLE t (a INT);
+connection slave;
+connection slave;
+call mtr.add_suppression("connecting slave requested to start from.*which is not in the master's binlog");
+include/stop_slave.inc
+CHANGE MASTER TO master_use_gtid=slave_pos;
+connection master;
+SET @@SESSION.gtid_domain_id=11;
+SET @@SESSION.server_id=111;
+SET @@SESSION.gtid_seq_no=1;
+INSERT INTO t SET a=1;
+connection slave;
+SET @save.gtid_slave_pos=@@global.gtid_slave_pos;
+SET @@global.gtid_slave_pos=concat(@@global.gtid_slave_pos, ",", 11, "-", 111, "-", 1 + 1);
+Warnings:
+Warning 1947 Specified GTID 0-1-1 conflicts with the binary log which contains a more recent GTID 0-2-2. If MASTER_GTID_POS=CURRENT_POS is used, the binlog position will override the new value of @@gtid_slave_pos
+START SLAVE IO_THREAD;
+include/wait_for_slave_io_error.inc [errno=1236]
+connection master;
+FLUSH BINARY LOGS;
+PURGE BINARY LOGS TO 'master-bin.000002';;
+FLUSH BINARY LOGS DELETE_DOMAIN_ID=(11);
+SELECT @@global.gtid_binlog_pos, @@global.gtid_binlog_state;
+@@global.gtid_binlog_pos @@global.gtid_binlog_state
+0-1-1 0-1-1
+connection slave;
+SELECT @@global.gtid_slave_pos;
+@@global.gtid_slave_pos
+0-1-1,11-111-2
+include/start_slave.inc
+==== BEGIN include/start_slave.inc ====
+ con='slave' warn='1' qlog='1' rlog='1' aborterr='1'
+START SLAVE;
+.==== BEGIN include/wait_for_slave_to_start.inc ====
+. con='slave' warn='1' qlog='1' rlog='1' aborterr='1'
+..==== BEGIN include/wait_for_slave_io_to_start.inc ====
+.. con='slave' warn='1' qlog='1' rlog='1' aborterr='1'
+...==== BEGIN include/wait_for_slave_param.inc [Slave_IO_Running] ====
+... con='slave' warn='1' qlog='1' rlog='1' aborterr='1'
+Waiting until 'Slave_IO_Running' = 'Yes' [timeout='300', $slave_error_param='Last_IO_Errno']
+[connection slave]
+...==== END include/wait_for_slave_param.inc [Slave_IO_Running] ====
+... con='slave' warn='1' qlog='1' rlog='1' aborterr='1'
+[connection slave]
+..==== END include/wait_for_slave_io_to_start.inc ====
+.. con='slave' warn='1' qlog='1' rlog='1' aborterr='1'
+..==== BEGIN include/wait_for_slave_sql_to_start.inc ====
+.. con='slave' warn='1' qlog='1' rlog='1' aborterr='1'
+...==== BEGIN include/wait_for_slave_param.inc [Slave_SQL_Running] ====
+... con='slave' warn='1' qlog='1' rlog='1' aborterr='1'
+Waiting until 'Slave_SQL_Running' = 'Yes' [timeout='300', $slave_error_param='1']
+[connection slave]
+...==== END include/wait_for_slave_param.inc [Slave_SQL_Running] ====
+... con='slave' warn='1' qlog='1' rlog='1' aborterr='1'
+[connection slave]
+..==== END include/wait_for_slave_sql_to_start.inc ====
+.. con='slave' warn='1' qlog='1' rlog='1' aborterr='1'
+[connection slave]
+.==== END include/wait_for_slave_to_start.inc ====
+. con='slave' warn='1' qlog='1' rlog='1' aborterr='1'
+[connection slave]
+==== END include/start_slave.inc ====
+ con='slave' warn='1' qlog='1' rlog='1' aborterr='1'
+connection master;
+INSERT INTO t SET a=1;
+connection slave;
+include/wait_for_slave_io_error.inc [errno=1236]
+connection master;
+FLUSH BINARY LOGS;
+PURGE BINARY LOGS TO 'master-bin.000004';;
+FLUSH BINARY LOGS DELETE_DOMAIN_ID=(11);
+connection slave;
+include/start_slave.inc
+connection master;
+SET @@SESSION.gtid_domain_id=0;
+DROP TABLE t;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_row_log.result b/mysql-test/suite/rpl/r/rpl_row_log.result
index 0aa718cd405..d0021ac610f 100644
--- a/mysql-test/suite/rpl/r/rpl_row_log.result
+++ b/mysql-test/suite/rpl/r/rpl_row_log.result
@@ -226,7 +226,6 @@ master-bin.000001 # Query # # COMMIT
master-bin.000001 # Rotate # # master-bin.000002;pos=POS
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000002 # Binlog_checkpoint # # master-bin.000002
master-bin.000002 # Gtid # # GTID #-#-#
master-bin.000002 # Query # # use `test`; create table t3 (a int)ENGINE=MyISAM
master-bin.000002 # Gtid # # GTID #-#-#
@@ -268,7 +267,6 @@ slave-bin.000001 # Query # # use `test`; create table t3 (a int)ENGINE=MyISAM
slave-bin.000001 # Rotate # # slave-bin.000002;pos=POS
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
-slave-bin.000002 # Binlog_checkpoint # # slave-bin.000002
slave-bin.000002 # Gtid # # GTID #-#-#
slave-bin.000002 # Query # # use `test`; create table t2 (n int)ENGINE=MyISAM
slave-bin.000002 # Gtid # # BEGIN GTID #-#-#
diff --git a/mysql-test/suite/rpl/r/rpl_row_log_innodb.result b/mysql-test/suite/rpl/r/rpl_row_log_innodb.result
index 46ad3cb9557..1bf5ec91ed4 100644
--- a/mysql-test/suite/rpl/r/rpl_row_log_innodb.result
+++ b/mysql-test/suite/rpl/r/rpl_row_log_innodb.result
@@ -226,7 +226,6 @@ master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Rotate # # master-bin.000002;pos=POS
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000002 # Binlog_checkpoint # # master-bin.000002
master-bin.000002 # Gtid # # GTID #-#-#
master-bin.000002 # Query # # use `test`; create table t3 (a int)ENGINE=InnoDB
master-bin.000002 # Gtid # # GTID #-#-#
@@ -268,7 +267,6 @@ slave-bin.000001 # Query # # use `test`; create table t3 (a int)ENGINE=InnoDB
slave-bin.000001 # Rotate # # slave-bin.000002;pos=POS
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
-slave-bin.000002 # Binlog_checkpoint # # slave-bin.000002
slave-bin.000002 # Gtid # # GTID #-#-#
slave-bin.000002 # Query # # use `test`; create table t2 (n int)ENGINE=InnoDB
slave-bin.000002 # Gtid # # BEGIN GTID #-#-#
diff --git a/mysql-test/suite/rpl/r/rpl_sp.result b/mysql-test/suite/rpl/r/rpl_sp.result
index 2849e5b7ae3..486c02eef71 100644
--- a/mysql-test/suite/rpl/r/rpl_sp.result
+++ b/mysql-test/suite/rpl/r/rpl_sp.result
@@ -17,7 +17,7 @@ insert into t1 values (b);
insert into t1 values (unix_timestamp());
end|
select * from mysql.proc where name='foo' and db='mysqltest1';
-db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8
+db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 aggregate
mysqltest1 foo PROCEDURE foo SQL CONTAINS_SQL NO DEFINER begin
declare b int;
set b = 8;
@@ -28,10 +28,10 @@ declare b int;
set b = 8;
insert into t1 values (b);
insert into t1 values (unix_timestamp());
-end
+end NONE
connection slave;
select * from mysql.proc where name='foo' and db='mysqltest1';
-db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8
+db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 aggregate
mysqltest1 foo PROCEDURE foo SQL CONTAINS_SQL NO DEFINER begin
declare b int;
set b = 8;
@@ -42,7 +42,7 @@ declare b int;
set b = 8;
insert into t1 values (b);
insert into t1 values (unix_timestamp());
-end
+end NONE
connection master;
set timestamp=1000000000;
call foo();
@@ -128,7 +128,7 @@ show warnings;
Level Code Message
Error 1062 Duplicate entry '20' for key 'a'
Warning 1196 Some non-transactional changed tables couldn't be rolled back
-Note 4092 At line 4 in mysqltest1.foo4
+Note 4093 At line 4 in mysqltest1.foo4
select * from t2;
a
20
@@ -137,19 +137,19 @@ select * from t2;
a
20
select * from mysql.proc where name="foo4" and db='mysqltest1';
-db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8
+db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 aggregate
mysqltest1 foo4 PROCEDURE foo4 SQL CONTAINS_SQL YES DEFINER begin
insert into t2 values(20),(20);
end root@localhost # # latin1 latin1_swedish_ci latin1_swedish_ci begin
insert into t2 values(20),(20);
-end
+end NONE
connection master;
drop procedure foo4;
select * from mysql.proc where name="foo4" and db='mysqltest1';
-db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8
+db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 aggregate
connection slave;
select * from mysql.proc where name="foo4" and db='mysqltest1';
-db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8
+db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 aggregate
connection master;
drop procedure foo;
drop procedure foo2;
@@ -235,22 +235,22 @@ select fn3();
fn3()
0
select * from mysql.proc where db='mysqltest1';
-db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8
+db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 aggregate
mysqltest1 fn1 FUNCTION fn1 SQL NO_SQL NO DEFINER int(11) begin
return unix_timestamp();
end root@localhost # # latin1 latin1_swedish_ci latin1_swedish_ci begin
return unix_timestamp();
-end
+end NONE
mysqltest1 fn2 FUNCTION fn2 SQL NO_SQL NO DEFINER int(11) begin
return unix_timestamp();
end zedjzlcsjhd@localhost # # latin1 latin1_swedish_ci latin1_swedish_ci begin
return unix_timestamp();
-end
+end NONE
mysqltest1 fn3 FUNCTION fn3 SQL READS_SQL_DATA NO DEFINER int(11) begin
return 0;
end root@localhost # # latin1 latin1_swedish_ci latin1_swedish_ci begin
return 0;
-end
+end NONE
select * from t1;
a
1000000000
@@ -260,22 +260,22 @@ select * from t1;
a
1000000000
select * from mysql.proc where db='mysqltest1';
-db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8
+db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 aggregate
mysqltest1 fn1 FUNCTION fn1 SQL NO_SQL NO DEFINER int(11) begin
return unix_timestamp();
end root@localhost # # latin1 latin1_swedish_ci latin1_swedish_ci begin
return unix_timestamp();
-end
+end NONE
mysqltest1 fn2 FUNCTION fn2 SQL NO_SQL NO DEFINER int(11) begin
return unix_timestamp();
end zedjzlcsjhd@localhost # # latin1 latin1_swedish_ci latin1_swedish_ci begin
return unix_timestamp();
-end
+end NONE
mysqltest1 fn3 FUNCTION fn3 SQL READS_SQL_DATA NO DEFINER int(11) begin
return 0;
end root@localhost # # latin1 latin1_swedish_ci latin1_swedish_ci begin
return 0;
-end
+end NONE
connection master;
delete from t2;
alter table t2 add unique (a);
@@ -291,7 +291,7 @@ end|
do fn1(100);
Warnings:
Error 1062 Duplicate entry '100' for key 'a'
-Note 4092 At line 3 in mysqltest1.fn1
+Note 4093 At line 3 in mysqltest1.fn1
Warning 1196 Some non-transactional changed tables couldn't be rolled back
select fn1(20);
ERROR 23000: Duplicate entry '20' for key 'a'
diff --git a/mysql-test/suite/rpl/r/rpl_stm_log.result b/mysql-test/suite/rpl/r/rpl_stm_log.result
index 6453538009a..0b3f9bfe350 100644
--- a/mysql-test/suite/rpl/r/rpl_stm_log.result
+++ b/mysql-test/suite/rpl/r/rpl_stm_log.result
@@ -222,7 +222,6 @@ master-bin.000001 # Query # # COMMIT
master-bin.000001 # Rotate # # master-bin.000002;pos=POS
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000002 # Binlog_checkpoint # # master-bin.000002
master-bin.000002 # Gtid # # GTID #-#-#
master-bin.000002 # Query # # use `test`; create table t3 (a int)ENGINE=MyISAM
master-bin.000002 # Gtid # # GTID #-#-#
@@ -260,7 +259,6 @@ slave-bin.000001 # Query # # use `test`; create table t3 (a int)ENGINE=MyISAM
slave-bin.000001 # Rotate # # slave-bin.000002;pos=POS
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
-slave-bin.000002 # Binlog_checkpoint # # slave-bin.000002
slave-bin.000002 # Gtid # # GTID #-#-#
slave-bin.000002 # Query # # use `test`; create table t2 (n int)ENGINE=MyISAM
slave-bin.000002 # Gtid # # BEGIN GTID #-#-#
diff --git a/mysql-test/suite/rpl/suite.opt b/mysql-test/suite/rpl/suite.opt
new file mode 100644
index 00000000000..8374626febe
--- /dev/null
+++ b/mysql-test/suite/rpl/suite.opt
@@ -0,0 +1 @@
+--plugin-maturity=unknown
diff --git a/mysql-test/suite/rpl/t/rpl_gtid_delete_domain.test b/mysql-test/suite/rpl/t/rpl_gtid_delete_domain.test
new file mode 100644
index 00000000000..622e66c5263
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_gtid_delete_domain.test
@@ -0,0 +1,98 @@
+# In case master's gtid binlog state is divergent from the slave's gtid_slave_pos
+# slave may not be able to connect.
+# For instance when slave is more updated in some of domains, see
+# MDEV-12012 as example, the master's state may require adjustment.
+# In a specific case of an "old" divergent domain, that is there
+# won't be no more event groups from it generated, the states can be
+# made compatible with wiping the problematic domain away. After that slave
+# becomes connectable.
+#
+# Notice that the slave applied gtid state is not really required to
+# be similarly cleaned in order for replication to flow.
+# However this could lead to an expected error when the master
+# resumes binlogging of such domain which the test demonstrate.
+
+--source include/master-slave.inc
+
+--connection master
+# enforce the default domain_id binlogging explicitly
+SET @@SESSION.gtid_domain_id=0;
+CREATE TABLE t (a INT);
+--sync_slave_with_master
+
+--connection slave
+call mtr.add_suppression("connecting slave requested to start from.*which is not in the master's binlog");
+
+--source include/stop_slave.inc
+CHANGE MASTER TO master_use_gtid=slave_pos;
+
+--connection master
+# create extra gtid domains for binlog state
+--let $extra_domain_id=11
+--let $extra_domain_server_id=111
+--let $extra_gtid_seq_no=1
+--eval SET @@SESSION.gtid_domain_id=$extra_domain_id
+--eval SET @@SESSION.server_id=$extra_domain_server_id
+--eval SET @@SESSION.gtid_seq_no=$extra_gtid_seq_no
+INSERT INTO t SET a=1;
+
+#
+# Set up the slave replication state as if slave knows more events from the extra
+# domain.
+#
+--connection slave
+SET @save.gtid_slave_pos=@@global.gtid_slave_pos;
+--eval SET @@global.gtid_slave_pos=concat(@@global.gtid_slave_pos, ",", $extra_domain_id, "-", $extra_domain_server_id, "-", $extra_gtid_seq_no + 1)
+
+# unsuccessful attempt to start slave
+START SLAVE IO_THREAD;
+--let $slave_io_errno=1236
+--source include/wait_for_slave_io_error.inc
+
+--connection master
+# adjust the master binlog state
+FLUSH BINARY LOGS;
+--let $purge_to_binlog= query_get_value(SHOW MASTER STATUS, File, 1)
+--eval PURGE BINARY LOGS TO '$purge_to_binlog';
+# with final removal of the extra domain
+--eval FLUSH BINARY LOGS DELETE_DOMAIN_ID=($extra_domain_id)
+SELECT @@global.gtid_binlog_pos, @@global.gtid_binlog_state;
+--connection slave
+SELECT @@global.gtid_slave_pos;
+# start the slave sucessfully
+--let rpl_debug=1
+--source include/start_slave.inc
+--let rpl_debug=0
+
+--connection master
+# but the following gtid from the *extra* domain will break replication
+INSERT INTO t SET a=1;
+
+# take note of the slave io thread error due to being dismissed
+# extra domain at connection to master which tried becoming active;
+# slave is to stop.
+--connection slave
+--let $errno=1236
+--source include/wait_for_slave_io_error.inc
+
+# let's apply the very same medicine
+--connection master
+FLUSH BINARY LOGS;
+--let $purge_to_binlog= query_get_value(SHOW MASTER STATUS, File, 1)
+--eval PURGE BINARY LOGS TO '$purge_to_binlog';
+# with final removal of the extra domain
+--eval FLUSH BINARY LOGS DELETE_DOMAIN_ID=($extra_domain_id)
+
+--connection slave
+--source include/start_slave.inc
+
+#
+# cleanup
+#
+--connection master
+SET @@SESSION.gtid_domain_id=0;
+DROP TABLE t;
+
+sync_slave_with_master;
+
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/sql_sequence/alter.result b/mysql-test/suite/sql_sequence/alter.result
index 0400843c98a..a1789f02718 100644
--- a/mysql-test/suite/sql_sequence/alter.result
+++ b/mysql-test/suite/sql_sequence/alter.result
@@ -212,7 +212,7 @@ ERROR 42S02: 'test.t1' is not a SEQUENCE
drop table t1;
alter sequence if exists t1 minvalue=100;
Warnings:
-Note 4089 Unknown SEQUENCE: 'test.t1'
+Note 4090 Unknown SEQUENCE: 'test.t1'
alter sequence t1 minvalue=100;
ERROR 42S02: Table 'test.t1' doesn't exist
create sequence t1;
diff --git a/mysql-test/suite/sql_sequence/create.result b/mysql-test/suite/sql_sequence/create.result
index 0a44dfe8931..b9394da6fcd 100644
--- a/mysql-test/suite/sql_sequence/create.result
+++ b/mysql-test/suite/sql_sequence/create.result
@@ -165,7 +165,7 @@ drop sequence t1;
ERROR 42S02: 'test.t1' is not a SEQUENCE
drop sequence if exists t1;
Warnings:
-Note 4089 Unknown SEQUENCE: 'test.t1'
+Note 4090 Unknown SEQUENCE: 'test.t1'
create sequence t1 start with 10 maxvalue=9;
ERROR HY000: Sequence 'test.t1' values are conflicting
create sequence t1 minvalue= 100 maxvalue=10;
@@ -377,7 +377,7 @@ key key1 (next_not_cached_value)
ERROR HY000: Sequence 'test.t1' table structure is invalid (Sequence tables cannot have any keys)
drop sequence if exists t1;
Warnings:
-Note 4089 Unknown SEQUENCE: 'test.t1'
+Note 4090 Unknown SEQUENCE: 'test.t1'
create sequence t1;
create sequence t2;
create table t3 (a int) engine=myisam;
@@ -387,8 +387,8 @@ CREATE SEQUENCE s1;
drop sequence s1;
drop sequence if exists t1,t2,t3,t4;
Warnings:
-Note 4089 Unknown SEQUENCE: 'test.t3'
-Note 4089 Unknown SEQUENCE: 'test.t4'
+Note 4090 Unknown SEQUENCE: 'test.t3'
+Note 4090 Unknown SEQUENCE: 'test.t4'
drop table if exists t1,t2,t3;
Warnings:
Note 1051 Unknown table 'test.t1'
@@ -414,9 +414,9 @@ CREATE TABLE t2 (a int);
CREATE SEQUENCE s1;
drop sequence if exists t1,t2,s1,s2;
Warnings:
-Note 4089 Unknown SEQUENCE: 'test.t1'
-Note 4089 Unknown SEQUENCE: 'test.t2'
-Note 4089 Unknown SEQUENCE: 'test.s2'
+Note 4090 Unknown SEQUENCE: 'test.t1'
+Note 4090 Unknown SEQUENCE: 'test.t2'
+Note 4090 Unknown SEQUENCE: 'test.s2'
drop table if exists t1,t2;
CREATE TEMPORARY SEQUENCE s1;
DROP SEQUENCE s1;
diff --git a/mysql-test/suite/sys_vars/inc/sysvars_server.inc b/mysql-test/suite/sys_vars/inc/sysvars_server.inc
index b5c800e858a..37491315c3e 100644
--- a/mysql-test/suite/sys_vars/inc/sysvars_server.inc
+++ b/mysql-test/suite/sys_vars/inc/sysvars_server.inc
@@ -26,6 +26,7 @@ select * from information_schema.system_variables
'lower_case_file_system',
'lower_case_table_names',
'open_files_limit',
+ 'plugin_maturity',
'rand_seed1',
'rand_seed2',
'system_time_zone',
diff --git a/mysql-test/suite/sys_vars/r/slave_transaction_retry_errors.result b/mysql-test/suite/sys_vars/r/slave_transaction_retry_errors.result
new file mode 100644
index 00000000000..a7815bb3f78
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/slave_transaction_retry_errors.result
@@ -0,0 +1,21 @@
+select @@global.slave_transaction_retry_errors;
+@@global.slave_transaction_retry_errors
+1213,1205,10,20,400
+select @@session.slave_transaction_retry_errors;
+ERROR HY000: Variable 'slave_transaction_retry_errors' is a GLOBAL variable
+show global variables like 'slave_transaction_retry_errors';
+Variable_name Value
+slave_transaction_retry_errors 1213,1205,10,20,400
+show session variables like 'slave_transaction_retry_errors';
+Variable_name Value
+slave_transaction_retry_errors 1213,1205,10,20,400
+select * from information_schema.global_variables where variable_name='slave_transaction_retry_errors';
+VARIABLE_NAME VARIABLE_VALUE
+SLAVE_TRANSACTION_RETRY_ERRORS 1213,1205,10,20,400
+select * from information_schema.session_variables where variable_name='slave_transaction_retry_errors';
+VARIABLE_NAME VARIABLE_VALUE
+SLAVE_TRANSACTION_RETRY_ERRORS 1213,1205,10,20,400
+set global slave_transaction_retry_errors=1;
+ERROR HY000: Variable 'slave_transaction_retry_errors' is a read only variable
+set session slave_transaction_retry_errors=1;
+ERROR HY000: Variable 'slave_transaction_retry_errors' is a read only variable
diff --git a/mysql-test/suite/sys_vars/r/slave_transaction_retry_interval_basic.result b/mysql-test/suite/sys_vars/r/slave_transaction_retry_interval_basic.result
new file mode 100644
index 00000000000..8be45f83341
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/slave_transaction_retry_interval_basic.result
@@ -0,0 +1,126 @@
+SET @start_global_value = @@global.slave_transaction_retry_interval;
+SELECT @start_global_value;
+@start_global_value
+0
+'#--------------------FN_DYNVARS_149_01-------------------------#'
+SET @@global.slave_transaction_retry_interval = 50;
+SET @@global.slave_transaction_retry_interval = DEFAULT;
+SELECT @@global.slave_transaction_retry_interval;
+@@global.slave_transaction_retry_interval
+0
+'#--------------------FN_DYNVARS_149_02-------------------------#'
+SET @@global.slave_transaction_retry_interval = DEFAULT;
+SELECT @@global.slave_transaction_retry_interval = 10;
+@@global.slave_transaction_retry_interval = 10
+0
+'#--------------------FN_DYNVARS_149_03-------------------------#'
+SET @@global.slave_transaction_retry_interval = 0;
+SELECT @@global.slave_transaction_retry_interval;
+@@global.slave_transaction_retry_interval
+0
+SET @@global.slave_transaction_retry_interval = 1;
+SELECT @@global.slave_transaction_retry_interval;
+@@global.slave_transaction_retry_interval
+1
+SET @@global.slave_transaction_retry_interval = 15;
+SELECT @@global.slave_transaction_retry_interval;
+@@global.slave_transaction_retry_interval
+15
+SET @@global.slave_transaction_retry_interval = 1024;
+SELECT @@global.slave_transaction_retry_interval;
+@@global.slave_transaction_retry_interval
+1024
+SET @@global.slave_transaction_retry_interval = 2147483648;
+Warnings:
+Warning 1292 Truncated incorrect slave_transaction_retry_interval value: '2147483648'
+SELECT @@global.slave_transaction_retry_interval;
+@@global.slave_transaction_retry_interval
+3600
+SET @@global.slave_transaction_retry_interval = 2147483648*2-1;
+Warnings:
+Warning 1292 Truncated incorrect slave_transaction_retry_interval value: '4294967295'
+SELECT @@global.slave_transaction_retry_interval;
+@@global.slave_transaction_retry_interval
+3600
+SET @@global.slave_transaction_retry_interval = 2147483649*2;
+Warnings:
+Warning 1292 Truncated incorrect slave_transaction_retry_interval value: '4294967298'
+SELECT @@global.slave_transaction_retry_interval;
+@@global.slave_transaction_retry_interval
+3600
+SET @@global.slave_transaction_retry_interval = 4294967295;
+Warnings:
+Warning 1292 Truncated incorrect slave_transaction_retry_interval value: '4294967295'
+SELECT @@global.slave_transaction_retry_interval;
+@@global.slave_transaction_retry_interval
+3600
+'#--------------------FN_DYNVARS_149_04-------------------------#'
+SET @@slave_transaction_retry_interval = 2;
+ERROR HY000: Variable 'slave_transaction_retry_interval' is a GLOBAL variable and should be set with SET GLOBAL
+SET @@session.slave_transaction_retry_interval = 3;
+ERROR HY000: Variable 'slave_transaction_retry_interval' is a GLOBAL variable and should be set with SET GLOBAL
+SET @@local.slave_transaction_retry_interval = 4;
+ERROR HY000: Variable 'slave_transaction_retry_interval' is a GLOBAL variable and should be set with SET GLOBAL
+'#------------------FN_DYNVARS_149_05-----------------------#'
+SET @@global.slave_transaction_retry_interval = -1;
+Warnings:
+Warning 1292 Truncated incorrect slave_transaction_retry_interval value: '-1'
+SELECT @@global.slave_transaction_retry_interval;
+@@global.slave_transaction_retry_interval
+0
+SET @@global.slave_transaction_retry_interval = 2147483649*2147483649;
+Warnings:
+Warning 1292 Truncated incorrect slave_transaction_retry_interval value: '4611686022722355201'
+SELECT @@global.slave_transaction_retry_interval;
+@@global.slave_transaction_retry_interval
+3600
+SET @@global.slave_transaction_retry_interval = 65530.34;
+ERROR 42000: Incorrect argument type to variable 'slave_transaction_retry_interval'
+SET @@global.slave_transaction_retry_interval = '100';
+ERROR 42000: Incorrect argument type to variable 'slave_transaction_retry_interval'
+SET @@global.slave_transaction_retry_interval = 7483649.56;
+ERROR 42000: Incorrect argument type to variable 'slave_transaction_retry_interval'
+SET @@global.slave_transaction_retry_interval = ON;
+ERROR 42000: Incorrect argument type to variable 'slave_transaction_retry_interval'
+SET @@global.slave_transaction_retry_interval = OFF;
+ERROR 42000: Incorrect argument type to variable 'slave_transaction_retry_interval'
+'#------------------FN_DYNVARS_149_06-----------------------#'
+SET @@global.slave_transaction_retry_interval = 3000;
+SELECT @@global.slave_transaction_retry_interval = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='slave_transaction_retry_interval';
+@@global.slave_transaction_retry_interval = VARIABLE_VALUE
+1
+'#------------------FN_DYNVARS_149_07-----------------------#'
+SELECT count(VARIABLE_VALUE)
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='slave_transaction_retry_interval';
+count(VARIABLE_VALUE)
+1
+'#------------------FN_DYNVARS_149_08-----------------------#'
+SET @@global.slave_transaction_retry_interval = TRUE;
+SELECT @@global.slave_transaction_retry_interval;
+@@global.slave_transaction_retry_interval
+1
+SET @@global.slave_transaction_retry_interval = FALSE;
+SELECT @@global.slave_transaction_retry_interval;
+@@global.slave_transaction_retry_interval
+0
+'#---------------------FN_DYNVARS_149_09----------------------#'
+SET @@global.slave_transaction_retry_interval = 60*60;
+SELECT @@slave_transaction_retry_interval = @@global.slave_transaction_retry_interval;
+@@slave_transaction_retry_interval = @@global.slave_transaction_retry_interval
+1
+'#---------------------FN_DYNVARS_149_10----------------------#'
+SET slave_transaction_retry_interval = 2048;
+ERROR HY000: Variable 'slave_transaction_retry_interval' is a GLOBAL variable and should be set with SET GLOBAL
+SELECT slave_transaction_retry_interval;
+ERROR 42S22: Unknown column 'slave_transaction_retry_interval' in 'field list'
+SELECT @@slave_transaction_retry_interval;
+@@slave_transaction_retry_interval
+3600
+SET global slave_transaction_retry_interval = 99;
+SET @@global.slave_transaction_retry_interval = @start_global_value;
+SELECT @@global.slave_transaction_retry_interval;
+@@global.slave_transaction_retry_interval
+0
diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result b/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result
index 385ecb4e4e6..b4e449ab241 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result
+++ b/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result
@@ -15,6 +15,7 @@ variable_name not in (
'lower_case_file_system',
'lower_case_table_names',
'open_files_limit',
+'plugin_maturity',
'rand_seed1',
'rand_seed2',
'system_time_zone',
@@ -899,7 +900,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE OFF
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BOOLEAN
-VARIABLE_COMMENT This option causes CREATE TABLE to create all TIMESTAMP columns as NULL with DEFAULT NULL attribute, Without this option, TIMESTAMP columns are NOT NULL and have implicit DEFAULT clauses. The old behavior is deprecated.
+VARIABLE_COMMENT This option causes CREATE TABLE to create all TIMESTAMP columns as NULL with DEFAULT NULL attribute, Without this option, TIMESTAMP columns are NOT NULL and have implicit DEFAULT clauses.
NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL
@@ -3188,20 +3189,6 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST NULL
READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
-VARIABLE_NAME PLUGIN_MATURITY
-SESSION_VALUE NULL
-GLOBAL_VALUE unknown
-GLOBAL_VALUE_ORIGIN COMPILE-TIME
-DEFAULT_VALUE unknown
-VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE ENUM
-VARIABLE_COMMENT The lowest desirable plugin maturity. Plugins less mature than that will not be installed or loaded
-NUMERIC_MIN_VALUE NULL
-NUMERIC_MAX_VALUE NULL
-NUMERIC_BLOCK_SIZE NULL
-ENUM_VALUE_LIST unknown,experimental,alpha,beta,gamma,stable
-READ_ONLY YES
-COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PORT
SESSION_VALUE NULL
GLOBAL_VALUE MASTER_MYPORT
diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded,32bit.rdiff b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded,32bit.rdiff
index b27c493c6c4..8b0749810e9 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded,32bit.rdiff
+++ b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded,32bit.rdiff
@@ -1176,11 +1176,20 @@
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
- VARIABLE_COMMENT Number of times the slave SQL thread will retry a transaction in case it failed with a deadlock or elapsed lock wait timeout, before giving up and stopping
+ VARIABLE_COMMENT Number of times the slave SQL thread will retry a transaction in case it failed with a deadlock, elapsed lock wait timeout or listed in slave_transaction_retry_errors, before giving up and stopping
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 4294967295
@@ -4426,7 +4426,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
+ DEFAULT_VALUE 0
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Interval of the slave SQL thread will retry a transaction in case it failed with a deadlock or elapsed lock wait timeout or listed in slave_transaction_retry_errors
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 3600
+@@ -4257,7 +4257,7 @@
+ GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 2
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
@@ -1188,7 +1197,7 @@
VARIABLE_COMMENT If creating the thread takes longer than this value (in seconds), the Slow_launch_threads counter will be incremented
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 31536000
-@@ -4485,7 +4485,7 @@
+@@ -4316,7 +4316,7 @@
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT Each thread that needs to do a sort allocates a buffer of this size
NUMERIC_MIN_VALUE 1024
@@ -1197,7 +1206,7 @@
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -4790,7 +4790,7 @@
+@@ -4621,7 +4621,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 256
VARIABLE_SCOPE GLOBAL
@@ -1206,7 +1215,7 @@
VARIABLE_COMMENT The soft upper limit for number of cached stored routines for one connection.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 524288
-@@ -4888,7 +4888,7 @@
+@@ -4719,7 +4719,7 @@
GLOBAL_VALUE_ORIGIN AUTO
DEFAULT_VALUE 400
VARIABLE_SCOPE GLOBAL
@@ -1215,7 +1224,7 @@
VARIABLE_COMMENT The number of cached table definitions
NUMERIC_MIN_VALUE 400
NUMERIC_MAX_VALUE 524288
-@@ -4902,7 +4902,7 @@
+@@ -4733,7 +4733,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 2000
VARIABLE_SCOPE GLOBAL
@@ -1224,7 +1233,7 @@
VARIABLE_COMMENT The number of cached open tables
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 1048576
-@@ -4972,7 +4972,7 @@
+@@ -4761,7 +4761,7 @@
GLOBAL_VALUE_ORIGIN AUTO
DEFAULT_VALUE 256
VARIABLE_SCOPE GLOBAL
@@ -1233,7 +1242,7 @@
VARIABLE_COMMENT How many threads we should keep in a cache for reuse. These are freed after 5 minutes of idle time
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 16384
-@@ -4986,7 +4986,7 @@
+@@ -4775,7 +4775,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 10
VARIABLE_SCOPE GLOBAL
@@ -1242,7 +1251,7 @@
VARIABLE_COMMENT Permits the application to give the threads system a hint for the desired number of threads that should be run at the same time.This variable has no effect, and is deprecated. It will be removed in a future release.
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 512
-@@ -5191,15 +5191,15 @@
+@@ -4980,15 +4980,15 @@
READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME TMP_DISK_TABLE_SIZE
@@ -1262,7 +1271,7 @@
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -5213,7 +5213,7 @@
+@@ -5002,7 +5002,7 @@
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT If an internal in-memory temporary table exceeds this size, MariaDB will automatically convert it to an on-disk MyISAM or Aria table. Same as tmp_table_size.
NUMERIC_MIN_VALUE 1024
@@ -1271,7 +1280,7 @@
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -5227,7 +5227,7 @@
+@@ -5016,7 +5016,7 @@
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT Alias for tmp_memory_table_size. If an internal in-memory temporary table exceeds this size, MariaDB will automatically convert it to an on-disk MyISAM or Aria table.
NUMERIC_MIN_VALUE 1024
@@ -1280,7 +1289,7 @@
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -5238,7 +5238,7 @@
+@@ -5027,7 +5027,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 8192
VARIABLE_SCOPE SESSION
@@ -1289,7 +1298,7 @@
VARIABLE_COMMENT Allocation block size for transactions to be stored in binary log
NUMERIC_MIN_VALUE 1024
NUMERIC_MAX_VALUE 134217728
-@@ -5252,7 +5252,7 @@
+@@ -5041,7 +5041,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 4096
VARIABLE_SCOPE SESSION
@@ -1298,7 +1307,7 @@
VARIABLE_COMMENT Persistent buffer for transactions to be stored in binary log
NUMERIC_MIN_VALUE 1024
NUMERIC_MAX_VALUE 134217728
-@@ -5350,7 +5350,7 @@
+@@ -5139,7 +5139,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 28800
VARIABLE_SCOPE SESSION
@@ -1307,7 +1316,7 @@
VARIABLE_COMMENT The number of seconds the server waits for activity on a connection before closing it
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 31536000
-@@ -5455,7 +5455,7 @@
+@@ -5243,7 +5243,7 @@
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME OPEN_FILES_LIMIT
VARIABLE_SCOPE GLOBAL
@@ -1316,7 +1325,7 @@
VARIABLE_COMMENT If this is not 0, then mysqld will use this value to reserve file descriptors to use with setrlimit(). If this value is 0 or autoset then mysqld will reserve max_connections*5 or max_connections + table_cache*2 (whichever is larger) number of file descriptors
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 4294967295
-@@ -5468,7 +5468,7 @@
+@@ -5256,7 +5256,7 @@
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT Sets the internal state of the RAND() generator for replication purposes
NUMERIC_MIN_VALUE 0
@@ -1325,7 +1334,7 @@
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -5478,7 +5478,7 @@
+@@ -5266,7 +5266,7 @@
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT Sets the internal state of the RAND() generator for replication purposes
NUMERIC_MIN_VALUE 0
@@ -1334,7 +1343,7 @@
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -5573,7 +5573,7 @@
+@@ -5351,7 +5351,7 @@
VARIABLE_NAME LOG_TC_SIZE
GLOBAL_VALUE_ORIGIN AUTO
VARIABLE_SCOPE GLOBAL
diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result
index 0e6e87619e7..24d3e897bb0 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result
+++ b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result
@@ -15,6 +15,7 @@ variable_name not in (
'lower_case_file_system',
'lower_case_table_names',
'open_files_limit',
+'plugin_maturity',
'rand_seed1',
'rand_seed2',
'system_time_zone',
@@ -927,7 +928,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE OFF
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BOOLEAN
-VARIABLE_COMMENT This option causes CREATE TABLE to create all TIMESTAMP columns as NULL with DEFAULT NULL attribute, Without this option, TIMESTAMP columns are NOT NULL and have implicit DEFAULT clauses. The old behavior is deprecated.
+VARIABLE_COMMENT This option causes CREATE TABLE to create all TIMESTAMP columns as NULL with DEFAULT NULL attribute, Without this option, TIMESTAMP columns are NOT NULL and have implicit DEFAULT clauses.
NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL
@@ -3398,20 +3399,6 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST NULL
READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
-VARIABLE_NAME PLUGIN_MATURITY
-SESSION_VALUE NULL
-GLOBAL_VALUE unknown
-GLOBAL_VALUE_ORIGIN COMPILE-TIME
-DEFAULT_VALUE unknown
-VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE ENUM
-VARIABLE_COMMENT The lowest desirable plugin maturity. Plugins less mature than that will not be installed or loaded
-NUMERIC_MIN_VALUE NULL
-NUMERIC_MAX_VALUE NULL
-NUMERIC_BLOCK_SIZE NULL
-ENUM_VALUE_LIST unknown,experimental,alpha,beta,gamma,stable
-READ_ONLY YES
-COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PORT
SESSION_VALUE NULL
GLOBAL_VALUE MASTER_MYPORT
@@ -4399,13 +4386,41 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 10
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BIGINT UNSIGNED
-VARIABLE_COMMENT Number of times the slave SQL thread will retry a transaction in case it failed with a deadlock or elapsed lock wait timeout, before giving up and stopping
+VARIABLE_COMMENT Number of times the slave SQL thread will retry a transaction in case it failed with a deadlock, elapsed lock wait timeout or listed in slave_transaction_retry_errors, before giving up and stopping
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 4294967295
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
+VARIABLE_NAME SLAVE_TRANSACTION_RETRY_ERRORS
+SESSION_VALUE NULL
+GLOBAL_VALUE 1213,1205
+GLOBAL_VALUE_ORIGIN COMPILE-TIME
+DEFAULT_VALUE
+VARIABLE_SCOPE GLOBAL
+VARIABLE_TYPE VARCHAR
+VARIABLE_COMMENT Tells the slave thread to retry transaction for replication when a query event returns an error from the provided list. Deadlock and elapsed lock wait timeout errors are automatically added to this list
+NUMERIC_MIN_VALUE NULL
+NUMERIC_MAX_VALUE NULL
+NUMERIC_BLOCK_SIZE NULL
+ENUM_VALUE_LIST NULL
+READ_ONLY YES
+COMMAND_LINE_ARGUMENT REQUIRED
+VARIABLE_NAME SLAVE_TRANSACTION_RETRY_INTERVAL
+SESSION_VALUE NULL
+GLOBAL_VALUE 0
+GLOBAL_VALUE_ORIGIN COMPILE-TIME
+DEFAULT_VALUE 0
+VARIABLE_SCOPE GLOBAL
+VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_COMMENT Interval of the slave SQL thread will retry a transaction in case it failed with a deadlock or elapsed lock wait timeout or listed in slave_transaction_retry_errors
+NUMERIC_MIN_VALUE 0
+NUMERIC_MAX_VALUE 3600
+NUMERIC_BLOCK_SIZE 1
+ENUM_VALUE_LIST NULL
+READ_ONLY NO
+COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME SLAVE_TYPE_CONVERSIONS
SESSION_VALUE NULL
GLOBAL_VALUE
diff --git a/mysql-test/suite/sys_vars/t/slave_transaction_retry_errors-master.opt b/mysql-test/suite/sys_vars/t/slave_transaction_retry_errors-master.opt
new file mode 100644
index 00000000000..a93f9f02f70
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/slave_transaction_retry_errors-master.opt
@@ -0,0 +1 @@
+--slave_transaction_retry_errors="10,20, 5000, 400"
diff --git a/mysql-test/suite/sys_vars/t/slave_transaction_retry_errors.test b/mysql-test/suite/sys_vars/t/slave_transaction_retry_errors.test
new file mode 100644
index 00000000000..aa2299cf815
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/slave_transaction_retry_errors.test
@@ -0,0 +1,19 @@
+--source include/not_embedded.inc
+#
+# only global
+#
+select @@global.slave_transaction_retry_errors;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.slave_transaction_retry_errors;
+show global variables like 'slave_transaction_retry_errors';
+show session variables like 'slave_transaction_retry_errors';
+select * from information_schema.global_variables where variable_name='slave_transaction_retry_errors';
+select * from information_schema.session_variables where variable_name='slave_transaction_retry_errors';
+
+#
+# show that it's read-only
+#
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global slave_transaction_retry_errors=1;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session slave_transaction_retry_errors=1;
diff --git a/mysql-test/suite/sys_vars/t/slave_transaction_retry_interval_basic.test b/mysql-test/suite/sys_vars/t/slave_transaction_retry_interval_basic.test
new file mode 100644
index 00000000000..4d8d55901d1
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/slave_transaction_retry_interval_basic.test
@@ -0,0 +1,190 @@
+--source include/not_embedded.inc
+#
+# only global
+#
+####### mysql-test\t\slave_transaction_retry_interval_basic.test ##############
+# #
+# Variable Name: slave_transaction_retry_interval #
+# Scope: GLOBAL #
+# Access Type: Dynamic #
+# Data Type: numeric #
+# Default Value: 10 #
+# Range: #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Rizwan #
+# #
+# Description: Test Cases of Dynamic System Variable #
+# slave_transaction_retry_interval #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/not_embedded.inc
+--source include/load_sysvars.inc
+
+###################################################################
+# START OF slave_transaction_retry_interval TESTS #
+###################################################################
+
+
+#############################################################
+# Save initial value #
+#############################################################
+
+SET @start_global_value = @@global.slave_transaction_retry_interval;
+SELECT @start_global_value;
+
+--echo '#--------------------FN_DYNVARS_149_01-------------------------#'
+###################################################################
+# Display the DEFAULT value of slave_transaction_retry_interval #
+###################################################################
+
+SET @@global.slave_transaction_retry_interval = 50;
+SET @@global.slave_transaction_retry_interval = DEFAULT;
+SELECT @@global.slave_transaction_retry_interval;
+
+--echo '#--------------------FN_DYNVARS_149_02-------------------------#'
+###################################################################
+# Check the DEFAULT value of slave_transaction_retry_interval #
+###################################################################
+
+SET @@global.slave_transaction_retry_interval = DEFAULT;
+SELECT @@global.slave_transaction_retry_interval = 10;
+
+--echo '#--------------------FN_DYNVARS_149_03-------------------------#'
+###############################################################################
+# Change the value of slave_transaction_retry_interval to a valid value for
+# GLOBAL Scope
+###############################################################################
+
+SET @@global.slave_transaction_retry_interval = 0;
+SELECT @@global.slave_transaction_retry_interval;
+SET @@global.slave_transaction_retry_interval = 1;
+SELECT @@global.slave_transaction_retry_interval;
+SET @@global.slave_transaction_retry_interval = 15;
+SELECT @@global.slave_transaction_retry_interval;
+SET @@global.slave_transaction_retry_interval = 1024;
+SELECT @@global.slave_transaction_retry_interval;
+SET @@global.slave_transaction_retry_interval = 2147483648;
+SELECT @@global.slave_transaction_retry_interval;
+SET @@global.slave_transaction_retry_interval = 2147483648*2-1;
+SELECT @@global.slave_transaction_retry_interval;
+SET @@global.slave_transaction_retry_interval = 2147483649*2;
+SELECT @@global.slave_transaction_retry_interval;
+SET @@global.slave_transaction_retry_interval = 4294967295;
+SELECT @@global.slave_transaction_retry_interval;
+
+--echo '#--------------------FN_DYNVARS_149_04-------------------------#'
+##############################################################################
+# Check if variable can be access with session scope #
+##############################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET @@slave_transaction_retry_interval = 2;
+
+--Error ER_GLOBAL_VARIABLE
+SET @@session.slave_transaction_retry_interval = 3;
+
+--Error ER_GLOBAL_VARIABLE
+SET @@local.slave_transaction_retry_interval = 4;
+
+
+--echo '#------------------FN_DYNVARS_149_05-----------------------#'
+############################################################################
+# Change the value of slave_transaction_retry_interval to an invalid value #
+############################################################################
+
+SET @@global.slave_transaction_retry_interval = -1;
+SELECT @@global.slave_transaction_retry_interval;
+
+SET @@global.slave_transaction_retry_interval = 2147483649*2147483649;
+SELECT @@global.slave_transaction_retry_interval;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.slave_transaction_retry_interval = 65530.34;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.slave_transaction_retry_interval = '100';
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.slave_transaction_retry_interval = 7483649.56;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.slave_transaction_retry_interval = ON;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.slave_transaction_retry_interval = OFF;
+
+--echo '#------------------FN_DYNVARS_149_06-----------------------#'
+####################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+####################################################################
+
+SET @@global.slave_transaction_retry_interval = 3000;
+SELECT @@global.slave_transaction_retry_interval = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='slave_transaction_retry_interval';
+
+
+--echo '#------------------FN_DYNVARS_149_07-----------------------#'
+###########################################################################
+# Check if the value is present in INFORMATION_SCHEMA.SESSION_VARIABLES #
+###########################################################################
+
+SELECT count(VARIABLE_VALUE)
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='slave_transaction_retry_interval';
+
+
+--echo '#------------------FN_DYNVARS_149_08-----------------------#'
+####################################################################
+# Check if TRUE and FALSE values can be used on variable #
+####################################################################
+
+SET @@global.slave_transaction_retry_interval = TRUE;
+SELECT @@global.slave_transaction_retry_interval;
+SET @@global.slave_transaction_retry_interval = FALSE;
+SELECT @@global.slave_transaction_retry_interval;
+
+
+--echo '#---------------------FN_DYNVARS_149_09----------------------#'
+###############################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+###############################################################################
+
+
+SET @@global.slave_transaction_retry_interval = 60*60;
+SELECT @@slave_transaction_retry_interval = @@global.slave_transaction_retry_interval;
+
+
+--echo '#---------------------FN_DYNVARS_149_10----------------------#'
+###############################################################################
+# Check if slave_transaction_retry_interval can be accessed without @@ sign
+# and scope
+###############################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET slave_transaction_retry_interval = 2048;
+--Error ER_BAD_FIELD_ERROR
+SELECT slave_transaction_retry_interval;
+
+SELECT @@slave_transaction_retry_interval;
+
+#verifying another another syntax for setting value
+SET global slave_transaction_retry_interval = 99;
+
+####################################
+# Restore initial value #
+####################################
+
+SET @@global.slave_transaction_retry_interval = @start_global_value;
+SELECT @@global.slave_transaction_retry_interval;
+
+########################################################
+# END OF slave_transaction_retry_interval TESTS #
+########################################################
diff --git a/mysql-test/suite/versioning/r/optimized.result b/mysql-test/suite/versioning/r/optimized.result
index b28b867f8fc..4c86b6abbc2 100644
--- a/mysql-test/suite/versioning/r/optimized.result
+++ b/mysql-test/suite/versioning/r/optimized.result
@@ -17,59 +17,59 @@ a b b+0
1 NULL NULL
3 NULL NULL
Warnings:
-Warning 4108 Attempt to read unversioned field `b` in historical query
-Warning 4108 Attempt to read unversioned field `b` in historical query
+Warning 4112 Attempt to read unversioned field `b` in historical query
+Warning 4112 Attempt to read unversioned field `b` in historical query
select * from t for system_time as of timestamp now(6);
a b
1 NULL
3 NULL
Warnings:
-Warning 4108 Attempt to read unversioned field `b` in historical query
+Warning 4112 Attempt to read unversioned field `b` in historical query
select count(*) from t group by b for system_time as of timestamp now(6);
count(*)
2
Warnings:
-Warning 4108 Attempt to read unversioned field `b` in historical query
+Warning 4112 Attempt to read unversioned field `b` in historical query
select * from t for system_time as of timestamp now(6) order by b asc;
a b
1 NULL
3 NULL
Warnings:
-Warning 4108 Attempt to read unversioned field `b` in historical query
-Warning 4108 Attempt to read unversioned field `b` in historical query
+Warning 4112 Attempt to read unversioned field `b` in historical query
+Warning 4112 Attempt to read unversioned field `b` in historical query
select * from t for system_time as of timestamp now(6) order by b desc;
a b
1 NULL
3 NULL
Warnings:
-Warning 4108 Attempt to read unversioned field `b` in historical query
-Warning 4108 Attempt to read unversioned field `b` in historical query
+Warning 4112 Attempt to read unversioned field `b` in historical query
+Warning 4112 Attempt to read unversioned field `b` in historical query
select * from t group by a having a=2 for system_time as of timestamp now(6);
a b
Warnings:
-Warning 4108 Attempt to read unversioned field `b` in historical query
+Warning 4112 Attempt to read unversioned field `b` in historical query
select * from t group by b having b=2 for system_time as of timestamp now(6);
a b
Warnings:
-Warning 4108 Attempt to read unversioned field `b` in historical query
+Warning 4112 Attempt to read unversioned field `b` in historical query
select a from t where b=2 for system_time as of timestamp now(6);
a
Warnings:
-Warning 4108 Attempt to read unversioned field `b` in historical query
+Warning 4112 Attempt to read unversioned field `b` in historical query
select a from t where b=NULL for system_time as of timestamp now(6);
a
Warnings:
-Warning 4108 Attempt to read unversioned field `b` in historical query
+Warning 4112 Attempt to read unversioned field `b` in historical query
select a from t where b is NULL for system_time as of timestamp now(6);
a
1
3
Warnings:
-Warning 4108 Attempt to read unversioned field `b` in historical query
+Warning 4112 Attempt to read unversioned field `b` in historical query
select count(*), b from t group by b having b=NULL for system_time as of timestamp now(6);
count(*) b
Warnings:
-Warning 4108 Attempt to read unversioned field `b` in historical query
+Warning 4112 Attempt to read unversioned field `b` in historical query
select a, b from t;
a b
1 2
@@ -78,29 +78,29 @@ select count(*) from t for system_time as of timestamp now(6) group by b;
count(*)
2
Warnings:
-Warning 4108 Attempt to read unversioned field `b` in historical query
+Warning 4112 Attempt to read unversioned field `b` in historical query
select * from t for system_time as of timestamp now(6) group by b having b=2;
a b
Warnings:
-Warning 4108 Attempt to read unversioned field `b` in historical query
+Warning 4112 Attempt to read unversioned field `b` in historical query
select a from t for system_time as of timestamp now(6) where b=2;
a
Warnings:
-Warning 4108 Attempt to read unversioned field `b` in historical query
+Warning 4112 Attempt to read unversioned field `b` in historical query
select a from t for system_time as of timestamp now(6) where b=NULL;
a
Warnings:
-Warning 4108 Attempt to read unversioned field `b` in historical query
+Warning 4112 Attempt to read unversioned field `b` in historical query
select a from t for system_time as of timestamp now(6) where b is NULL;
a
1
3
Warnings:
-Warning 4108 Attempt to read unversioned field `b` in historical query
+Warning 4112 Attempt to read unversioned field `b` in historical query
select count(*), b from t for system_time as of timestamp now(6) group by b having b=NULL;
count(*) b
Warnings:
-Warning 4108 Attempt to read unversioned field `b` in historical query
+Warning 4112 Attempt to read unversioned field `b` in historical query
create or replace table t (
a int,
b int not null without system versioning
@@ -111,12 +111,12 @@ a b
1 NULL
3 NULL
Warnings:
-Warning 4108 Attempt to read unversioned field `b` in historical query
+Warning 4112 Attempt to read unversioned field `b` in historical query
select * from t for system_time as of timestamp now(6) where b is NULL;
a b
1 NULL
3 NULL
Warnings:
-Warning 4108 Attempt to read unversioned field `b` in historical query
-Warning 4108 Attempt to read unversioned field `b` in historical query
+Warning 4112 Attempt to read unversioned field `b` in historical query
+Warning 4112 Attempt to read unversioned field `b` in historical query
drop table t;
diff --git a/mysql-test/suite/versioning/r/partition.result b/mysql-test/suite/versioning/r/partition.result
index 629004840c1..432165d916a 100644
--- a/mysql-test/suite/versioning/r/partition.result
+++ b/mysql-test/suite/versioning/r/partition.result
@@ -72,7 +72,7 @@ ERROR HY000: Wrong partitions consistency for `t1`: must have at least one 'VERS
alter table t1 add partition (
partition p1 versioning);
Warnings:
-Warning 4111 Maybe missing parameters: no rotation condition for multiple `VERSIONING` partitions.
+Warning 4115 Maybe missing parameters: no rotation condition for multiple `VERSIONING` partitions.
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
@@ -209,7 +209,7 @@ x
2
delete from t1;
Warnings:
-Note 4112 Switching from partition `p0` to `p1`
+Note 4116 Switching from partition `p0` to `p1`
select * from t1 partition (p0) for system_time all;
x
1
@@ -219,7 +219,7 @@ x
insert into t1 values (3);
delete from t1;
Warnings:
-Warning 4110 Using full partition `p1`, need more VERSIONING partitions!
+Warning 4114 Using full partition `p1`, need more VERSIONING partitions!
select * from t1 partition (p1) for system_time all;
x
2
@@ -252,7 +252,7 @@ x
insert into t1 values (4);
delete from t1;
Warnings:
-Note 4112 Switching from partition `p0` to `p1`
+Note 4116 Switching from partition `p0` to `p1`
select * from t1 partition (p1) for system_time all;
x
4
@@ -274,8 +274,8 @@ x
2
delete from t1;
Warnings:
-Note 4112 Switching from partition `p0` to `p1`
-Warning 4110 Using full partition `p1`, need more VERSIONING partitions!
+Note 4116 Switching from partition `p0` to `p1`
+Warning 4114 Using full partition `p1`, need more VERSIONING partitions!
select * from t1 partition (p0sp0) for system_time all;
x
1
diff --git a/mysql-test/suite/wsrep/suite.pm b/mysql-test/suite/wsrep/suite.pm
index b6c5bf15ca1..03e23b8d7cb 100644
--- a/mysql-test/suite/wsrep/suite.pm
+++ b/mysql-test/suite/wsrep/suite.pm
@@ -9,8 +9,10 @@ return "Not run for embedded server" if $::opt_embedded_server;
return "WSREP is not compiled in" unless defined $::mysqld_variables{'wsrep-on'};
my ($provider) = grep { -f $_ } $ENV{WSREP_PROVIDER},
- "/usr/lib/galera/libgalera_smm.so",
- "/usr/lib64/galera/libgalera_smm.so";
+ "/usr/lib64/galera-3/libgalera_smm.so",
+ "/usr/lib64/galera/libgalera_smm.so",
+ "/usr/lib/galera-3/libgalera_smm.so",
+ "/usr/lib/galera/libgalera_smm.so";
return "No wsrep provider library" unless -f $provider;
diff --git a/mysql-test/t/bootstrap.test b/mysql-test/t/bootstrap.test
index e8589fa9242..1ae9b13e050 100644
--- a/mysql-test/t/bootstrap.test
+++ b/mysql-test/t/bootstrap.test
@@ -7,7 +7,7 @@ drop table if exists t1;
# Add the datadir to the bootstrap command
let $MYSQLD_DATADIR= `select @@datadir`;
-let $MYSQLD_BOOTSTRAP_CMD= $MYSQLD_BOOTSTRAP_CMD --datadir=$MYSQLD_DATADIR --default-storage-engine=MyISAM --loose-skip-innodb;
+let $MYSQLD_BOOTSTRAP_CMD= $MYSQLD_BOOTSTRAP_CMD --datadir=$MYSQLD_DATADIR --default-storage-engine=MyISAM --loose-skip-innodb --plugin-maturity=unknown;
#
# Check that --bootstrap reads from stdin
#
diff --git a/mysql-test/t/cast.test b/mysql-test/t/cast.test
index 17e8be839a8..b514dbb5b2d 100644
--- a/mysql-test/t/cast.test
+++ b/mysql-test/t/cast.test
@@ -587,3 +587,140 @@ SHOW CREATE TABLE t1;
SELECT * FROM t1;
DROP TABLE t1;
SET sql_mode=DEFAULT;
+
+
+--echo #
+--echo # MDEV-14376 Explicit CAST(CHAR(N)) erroneously escalates warnings to errors in STRICT_ALL_TABLES
+--echo #
+
+SET sql_mode=STRICT_ALL_TABLES;
+SELECT CAST('xxx' AS CHAR(1));
+
+CREATE OR REPLACE TABLE t1 (a VARCHAR(1));
+INSERT INTO t1 VALUES (CAST('xxx' AS CHAR(1)));
+DROP TABLE t1;
+
+CREATE OR REPLACE TABLE t1 (a VARCHAR(3));
+INSERT INTO t1 VALUES ('xxx');
+UPDATE t1 SET a=CAST(a AS CHAR(1));
+DROP TABLE t1;
+
+DELIMITER $$;
+BEGIN NOT ATOMIC
+ DECLARE a VARCHAR(30) CHARACTER SET latin1;
+ SET a=CAST('xxx' AS CHAR(1));
+END;
+$$
+DELIMITER ;$$
+
+DELIMITER $$;
+BEGIN NOT ATOMIC
+ DECLARE a VARCHAR(30) CHARACTER SET latin1;
+ SET a=CAST(_latin1'xxx' AS CHAR(1) CHARACTER SET latin1);
+END;
+$$
+DELIMITER ;$$
+
+DELIMITER $$;
+BEGIN NOT ATOMIC
+ DECLARE a VARCHAR(30) CHARACTER SET latin1;
+ SET a=CAST(_latin1'xxx' AS CHAR(1) CHARACTER SET utf8);
+END;
+$$
+DELIMITER ;$$
+
+DELIMITER $$;
+BEGIN NOT ATOMIC
+ DECLARE a VARCHAR(30) CHARACTER SET utf8;
+ SET a=CAST('xxx' AS CHAR(1));
+END;
+$$
+DELIMITER ;$$
+
+DELIMITER $$;
+BEGIN NOT ATOMIC
+ DECLARE a VARCHAR(30) CHARACTER SET utf8;
+ SET a=CAST(_latin1'xxx' AS CHAR(1) CHARACTER SET latin1);
+END;
+$$
+DELIMITER ;$$
+
+DELIMITER $$;
+BEGIN NOT ATOMIC
+ DECLARE a VARCHAR(30) CHARACTER SET utf8;
+ SET a=CAST(_latin1'xxx' AS CHAR(1) CHARACTER SET utf8);
+END;
+$$
+DELIMITER ;$$
+
+
+--echo # Conversion problems still escalate warnings to errors (without right truncation)
+
+DELIMITER $$;
+--error ER_CANNOT_CONVERT_CHARACTER
+BEGIN NOT ATOMIC
+ DECLARE a VARCHAR(30) CHARACTER SET utf8;
+ SET a=CAST(_utf8 0xD18F AS CHAR(1) CHARACTER SET latin1);
+END;
+$$
+DELIMITER ;$$
+
+
+--echo # Conversion problems still escalate warnings to errors (with right truncation)
+
+DELIMITER $$;
+--error ER_CANNOT_CONVERT_CHARACTER
+BEGIN NOT ATOMIC
+ DECLARE a VARCHAR(30) CHARACTER SET utf8;
+ SET a=CAST(_utf8 0xD18FD18F AS CHAR(1) CHARACTER SET latin1);
+END;
+$$
+DELIMITER ;$$
+
+
+--echo # CAST(number AS CHAR) escalates warnings to errors on truncation
+
+CREATE OR REPLACE TABLE t1 (a VARCHAR(10));
+--error ER_TRUNCATED_WRONG_VALUE
+INSERT INTO t1 VALUES (CAST(123 AS CHAR(1)));
+DROP TABLE t1;
+
+CREATE OR REPLACE TABLE t1 (a VARCHAR(10));
+INSERT INTO t1 VALUES ('1');
+--error ER_TRUNCATED_WRONG_VALUE
+UPDATE t1 SET a=CAST(123 AS CHAR(1));
+DROP TABLE t1;
+
+DELIMITER $$;
+--error ER_TRUNCATED_WRONG_VALUE
+BEGIN NOT ATOMIC
+ DECLARE a VARCHAR(10);
+ SET a=CAST(123 AS CHAR(1));
+END;
+$$
+DELIMITER ;$$
+
+
+--echo # CAST(temporal AS CHAR) escalates warnings to errors on truncation
+
+CREATE OR REPLACE TABLE t1 (a VARCHAR(10));
+--error ER_TRUNCATED_WRONG_VALUE
+INSERT INTO t1 VALUES (CAST(TIME'10:20:30' AS CHAR(1)));
+DROP TABLE t1;
+
+CREATE OR REPLACE TABLE t1 (a VARCHAR(10));
+INSERT INTO t1 VALUES ('1');
+--error ER_TRUNCATED_WRONG_VALUE
+UPDATE t1 SET a=CAST(TIME'10:20:30' AS CHAR(1));
+DROP TABLE t1;
+
+DELIMITER $$;
+--error ER_TRUNCATED_WRONG_VALUE
+BEGIN NOT ATOMIC
+ DECLARE a VARCHAR(10);
+ SET a=CAST(TIME'10:20:30' AS CHAR(1));
+END;
+$$
+DELIMITER ;$$
+
+SET sql_mode=DEFAULT;
diff --git a/mysql-test/t/cte_grant.test b/mysql-test/t/cte_grant.test
index 44fd4a0bc6e..c6627c05829 100644
--- a/mysql-test/t/cte_grant.test
+++ b/mysql-test/t/cte_grant.test
@@ -76,4 +76,55 @@ select * from mysqltest.v3;
connection root;
revoke all privileges on mysqltest.v1 from mysqltest_1@localhost;
drop user mysqltest_1@localhost;
-drop database mysqltest; \ No newline at end of file
+drop database mysqltest;
+
+--echo #
+--echo # MDEV-13453: privileges checking for CTE
+--echo #
+
+create database db;
+use db;
+create table t1 (i int);
+insert into t1
+ values (3), (7), (1), (4), (2), (3), (1);
+
+create table t2 (a int, b int);
+insert into t2
+ values (3,10), (7,11), (1,17), (4,15), (2,11), (3,10), (1,15);
+
+create user foo@localhost;
+grant SELECT on db.t1 to foo@localhost;
+grant SELECT(a) on db.t2 to foo@localhost;
+
+--connect (con1,localhost,foo,,)
+use db;
+with cte as (select * from t1 where i < 4)
+ select * from cte;
+with cte as (select * from t1 where i < 4 group by i)
+ select * from cte;
+with cte as (select * from t1 where i < 4)
+ select * from cte cte1 where i < 2 union select * from cte cte2 where i > 2;
+with cte as (select * from t1 where i < 4 group by i)
+ select * from cte cte1 where i < 2 union select * from cte cte2 where i > 2;
+
+--error ER_COLUMNACCESS_DENIED_ERROR
+with cte as (select b from t2 where a < 4)
+ select * from cte cte1 where b < 15 union select * from cte cte2 where b > 15;
+with cte as (select a from t2 where a < 4)
+ select * from cte cte1 where a < 2 union select * from cte cte2 where a > 2;
+
+--connection default
+revoke SELECT on db.t1 from foo@localhost;
+
+--connection con1
+
+--error ER_TABLEACCESS_DENIED_ERROR
+with cte as (select * from t1 where i < 4)
+ select * from cte;
+
+# Cleanup
+--disconnect con1
+
+--connection default
+drop database db;
+drop user foo@localhost;
diff --git a/mysql-test/t/custom_aggregate_functions.test b/mysql-test/t/custom_aggregate_functions.test
new file mode 100644
index 00000000000..20fcc35f39f
--- /dev/null
+++ b/mysql-test/t/custom_aggregate_functions.test
@@ -0,0 +1,773 @@
+create table t2 (sal int(10));
+delimiter |;
+
+create aggregate function f1(x INT) returns int
+begin
+ declare continue handler for not found return 0;
+ loop
+ fetch group next row;
+ insert into t2 (sal) values (x);
+ end loop;
+end|
+
+delimiter ;|
+
+create table t1 (sal int(10),id int(10));
+INSERT INTO t1 (sal,id) VALUES (5000,1);
+INSERT INTO t1 (sal,id) VALUES (2000,1);
+INSERT INTO t1 (sal,id) VALUES (1000,1);
+select f1(sal) from t1 where id>= 1;
+select * from t2;
+drop table t2;
+drop function f1;
+
+delimiter |;
+--error ER_INVALID_AGGREGATE_FUNCTION
+create aggregate function f1(x INT) returns INT
+begin
+ insert into t1(sal) values (x);
+ return x;
+end|
+
+--error ER_NOT_AGGREGATE_FUNCTION
+create function f1(x INT) returns INT
+begin
+ set x=5;
+ fetch group next row;
+return x+1;
+end |
+
+create aggregate function f1(x INT) returns INT
+begin
+ declare continue handler for not found return x;
+ loop
+ fetch group next row;
+ end loop;
+end |
+delimiter ;|
+
+select f1(1);
+show create function f1;
+--error ER_PARSE_ERROR
+alter function f1 aggregate none;
+show create function f1;
+select f1(1);
+drop function f1;
+
+
+delimiter |;
+
+
+create aggregate function f2(i int) returns int
+begin
+ FEtCH GROUP NEXT ROW;
+ if i <= 0 then
+ return 0;
+ elseif i = 1 then
+ return (select count(*) from t1 where id = i);
+ else
+ return (select count(*) + f2( i - 1) from t1 where id = i);
+ end if;
+end|
+select f2(1)|
+# Since currently recursive functions are disallowed ER_SP_NO_RECURSION
+# error will be returned, once we will allow them error about
+# insufficient number of locked tables will be returned instead.
+--error ER_SP_NO_RECURSION
+select f2(2)|
+--error ER_SP_NO_RECURSION
+select f2(3)|
+drop function f2|
+
+create aggregate function f1(x int) returns int
+begin
+ declare mini int default 0;
+ declare continue handler for not found return mini;
+ loop
+ fetch group next row;
+ set mini= mini+x;
+ fetch group next row;
+ end loop;
+end|
+
+
+delimiter ;|
+
+select f1(10);
+select f1(sal) from t1;
+select f1(sal) from t1 where 1=0;
+drop function f1;
+delimiter |;
+
+
+#WITHOUT RETURN STATEMENT IN AGGREGATE FUNCTIONS
+--error 1320
+create aggregate function f1(x int) returns int
+begin
+ declare mini int default 0;
+ LOOP
+ FETCH GROUP NEXT ROW;
+ set mini = mini + x;
+ END LOOP;
+end|
+
+#without handler
+create aggregate function f1(x int) returns int
+begin
+ declare mini int default 0;
+ LOOP
+ FETCH GROUP NEXT ROW;
+ set mini = mini + x;
+ END LOOP;
+ return -1;
+end|
+
+--error 1329
+select f1(sal) from t1|
+drop function f1|
+
+#without loop
+create aggregate function f1(x int) returns int
+begin
+ declare mini int default 0;
+ declare continue handler for not found return mini;
+ FETCH GROUP NEXT ROW;
+ set mini = mini + x;
+end|
+
+--error 1321
+select f1(sal) from t1|
+drop function f1|
+
+
+create aggregate function f1(x int) returns int
+begin
+ declare mini int default 0;
+ declare continue handler for not found set mini=-1;
+ LOOP
+ FETCH GROUP NEXT ROW;
+ set mini = mini + x;
+ END LOOP;
+ return 0;
+end|
+
+--error 1321
+select f1(sal) from t1|
+drop function f1|
+drop table t1|
+
+delimiter ;|
+
+# primary indexing
+
+create table t1 (sal int, id int, val int, counter int, primary key(id));
+INSERT INTO t1 (sal, id, val, counter) VALUES (1000, 1, 10, 2);
+INSERT INTO t1 (sal, id, val, counter) VALUES (2000, 2, 16, 2);
+INSERT INTO t1 (sal, id, val, counter) VALUES (6000, 3, 18, 1);
+INSERT INTO t1 (sal, id, val, counter) VALUES (5000, 4, 15, 3);
+INSERT INTO t1 (sal, id, val, counter) VALUES (3000, 5, 11, 5);
+
+delimiter |;
+
+create aggregate function f1(x INT) returns double
+begin
+ declare z double default 0;
+ declare continue handler for not found return z;
+ loop
+ fetch group next row;
+ set z= z+x;
+ end loop;
+end|
+
+delimiter ;|
+
+--sorted_result
+select id, f1(sal) from t1 where id>= 1 group by counter order by val;
+--sorted_result
+select id, f1(sal) from t1;
+--sorted_result
+select id, f1(sal) from t1 where id>= 1;
+--sorted_result
+select id, f1(sal) from t1 where id>= 1 group by counter;
+--sorted_result
+select id, f1(sal) from t1 where id>= 1 group by id;
+--sorted_result
+select id, f1(sal) from t1 where id>= 1 group by val;
+--sorted_result
+select id, f1(sal) from t1 where id>= 1 group by counter order by counter;
+--sorted_result
+select id, f1(sal) from t1 where id>= 1 group by counter order by val;
+--sorted_result
+select id, f1(sal) from t1 where id>= 1 group by counter order by id;
+--sorted_result
+select id, f1(sal) from t1 where id>= 1 group by val order by counter;
+--sorted_result
+select id, f1(sal) from t1 where id>= 1 group by val order by id;
+--sorted_result
+select id, f1(sal) from t1 where id>= 1 group by val order by val;
+drop table t1;
+
+#unique index
+
+create table t1 (sal int, id int, val int, counter int, primary key(id), unique key(val));
+
+INSERT INTO t1 (sal, id, val, counter) VALUES (1000, 1, 10, 2);
+INSERT INTO t1 (sal, id, val, counter) VALUES (2000, 2, NULL, 2);
+INSERT INTO t1 (sal, id, val, counter) VALUES (6000, 3, 18, 1);
+INSERT INTO t1 (sal, id, val, counter) VALUES (5000, 4, 15, 3);
+INSERT INTO t1 (sal, id, val, counter) VALUES (3000, 5, 11, 5);
+
+--sorted_result
+select id, f1(sal) from t1;
+--sorted_result
+select id, f1(sal) from t1 where id>= 1;
+--sorted_result
+select id, f1(sal) from t1 where id>= 1 group by counter;
+--sorted_result
+select id, f1(sal) from t1 where id>= 1 group by id;
+--sorted_result
+select id, f1(sal) from t1 where id>= 1 group by val;
+--sorted_result
+select id, f1(sal) from t1 where id>= 1 group by counter order by counter;
+--sorted_result
+select id, f1(sal) from t1 where id>= 1 group by counter order by val;
+--sorted_result
+select id, f1(sal) from t1 where id>= 1 group by counter order by id;
+--sorted_result
+select id, f1(sal) from t1 where id>= 1 group by val order by counter;
+--sorted_result
+select id, f1(sal) from t1 where id>= 1 group by val order by id;
+--sorted_result
+select id, f1(sal) from t1 where id>= 1 group by val order by val;
+drop table t1;
+
+# compound indexing
+create table t1 (sal int, id int, val int, counter int, primary key(id), INDEX name (val,counter));
+
+INSERT INTO t1 (sal, id, val, counter) VALUES (1000, 1, 10, 2);
+INSERT INTO t1 (sal, id, val, counter) VALUES (2000, 2, 10, 4);
+INSERT INTO t1 (sal, id, val, counter) VALUES (6000, 3, 18, 1);
+INSERT INTO t1 (sal, id, val, counter) VALUES (5000, 4, 11, 3);
+INSERT INTO t1 (sal, id, val, counter) VALUES (3000, 5, 11, 5);
+--sorted_result
+select id, f1(sal) from t1;
+--sorted_result
+select id, f1(sal) from t1 where id>= 1;
+--sorted_result
+select id, f1(sal) from t1 where id>= 1 group by counter;
+--sorted_result
+select id, f1(sal) from t1 where id>= 1 group by id;
+--sorted_result
+select id, f1(sal) from t1 where id>= 1 group by val;
+--sorted_result
+select id, f1(sal) from t1 where id>= 1 group by counter order by counter;
+--sorted_result
+select id, f1(sal) from t1 where id>= 1 group by counter order by val;
+--sorted_result
+select id, f1(sal) from t1 where id>= 1 group by counter order by id;
+--sorted_result
+select id, f1(sal) from t1 where id>= 1 group by val order by counter;
+--sorted_result
+select id, f1(sal) from t1 where id>= 1 group by val order by id;
+--sorted_result
+select id, f1(sal) from t1 where id>= 1 group by val order by val;
+drop table t1;
+drop function f1;
+
+# prepared statement with aggregate functions
+
+delimiter |;
+
+create aggregate function f1(x INT) returns double
+begin
+ declare z double default 0;
+ declare continue handler for not found return z;
+ loop
+ fetch group next row;
+ set z= z+x;
+ end loop;
+end|
+
+create aggregate function f2() returns double
+begin
+ declare z int default 0;
+ declare continue handler for not found return z;
+ loop
+ fetch group next row;
+ set z = z+1;
+ end loop;
+end|
+
+delimiter ;|
+
+create table t1 (sal int, id int, val int, counter int);
+INSERT INTO t1 (sal, id, val, counter) VALUES (1000, 2, 10, 2);
+INSERT INTO t1 (sal, id, val, counter) VALUES (2000, 1, 16, 5);
+INSERT INTO t1 (sal, id, val, counter) VALUES (6000, 2, 18, 1);
+INSERT INTO t1 (sal, id, val, counter) VALUES (5000, 3, 15, 3);
+INSERT INTO t1 (sal, id, val, counter) VALUES (3000, 4, 11, 4);
+
+prepare test from "select f2() from t1 where id>= ?";
+set @param= 2;
+execute test using @param;
+execute test using @param;
+execute test using @param;
+execute test using @param;
+set @param= 1;
+execute test using @param;
+set @param= 3;
+execute test using @param;
+set @param= 4;
+execute test using @param;
+deallocate prepare test;
+
+prepare test from "select f1(sal) from t1 where id>= ?";
+set @param= 2;
+execute test using @param;
+execute test using @param;
+execute test using @param;
+execute test using @param;
+set @param= 1;
+execute test using @param;
+set @param= 3;
+execute test using @param;
+set @param= 4;
+execute test using @param;
+set @param= 5;
+execute test using @param;
+deallocate prepare test;
+
+drop function f2;
+
+prepare test from "select f1(sal) from t1 where id>= ?";
+set @param= 2;
+execute test using @param;
+drop function f1;
+
+create function f1(x int) returns int
+ return -1;
+
+execute test using @param;
+
+drop function f1;
+
+delimiter |;
+
+create aggregate function f1(x INT) returns double
+begin
+ declare z double default 0;
+ declare continue handler for not found return z;
+ loop
+ fetch group next row;
+ set z= z+x;
+ end loop;
+end|
+
+delimiter ;|
+
+execute test using @param;
+
+deallocate prepare test;
+
+drop table t1;
+drop function f1;
+
+create table t1 (sal int, id int, val varchar(10), counter int);
+INSERT INTO t1 (sal, id, val, counter) VALUES (1000, 2, 'ab', 2);
+INSERT INTO t1 (sal, id, val, counter) VALUES (1000, 1, 'cd', 5);
+INSERT INTO t1 (sal, id, val, counter) VALUES (1000, 2, 'ef', 1);
+INSERT INTO t1 (sal, id, val, counter) VALUES (1000, 3, 'gh', 3);
+INSERT INTO t1 (sal, id, val, counter) VALUES (1000, 4, 'ij', 4);
+
+create table t2 (sal int, id int, val int, counter int);
+INSERT INTO t2 (sal, id, val, counter) VALUES (1000, 2, 10, 2);
+INSERT INTO t2 (sal, id, val, counter) VALUES (2000, 1, 16, 5);
+INSERT INTO t2 (sal, id, val, counter) VALUES (6000, 2, 18, 1);
+INSERT INTO t2 (sal, id, val, counter) VALUES (5000, 3, 15, 3);
+INSERT INTO t2 (sal, id, val, counter) VALUES (3000, 4, 11, 4);
+delimiter |;
+
+create aggregate function f1(x double) returns double
+begin
+ declare z double default 0;
+ declare continue handler for not found return z;
+ loop
+ fetch group next row;
+ set z= z+x;
+ end loop;
+end|
+
+create aggregate function f2(x INT) returns CHAR(10)
+ begin
+ declare mini INT default 0;
+ declare continue handler for not found return mini;
+ loop
+ fetch group next row;
+ set mini= mini + x;
+ end loop;
+end|
+
+create aggregate function f3(x INT) returns CHAR(10)
+ begin
+ declare mini INT default 0;
+ declare continue handler for not found return mini;
+ loop
+ fetch group next row;
+ set mini= mini + x;
+ fetch group next row;
+ set mini= mini - x;
+ end loop;
+end|
+
+create aggregate function f4(x INT, y varchar(10)) returns varchar(1000)
+begin
+ declare str varchar(1000) default '';
+ declare continue handler for not found return str;
+ loop
+ fetch group next row;
+ set str= concat(str,y);
+ end loop;
+end|
+
+create aggregate function f5(x INT) returns varchar(1000)
+begin
+ declare z int default 0;
+ DECLARE cur1 CURSOR FOR SELECT sal FROM test.t2;
+ declare continue handler for not found return 0;
+ loop
+ fetch group next row;
+ set z = z+x;
+ end loop;
+end|
+
+
+
+create function f6(x int) returns int
+return (select f1(sal) from t1)|
+
+delimiter ;|
+
+select f1(sal) from t1;
+
+# group by test
+
+--sorted_result
+select f1(sal) from t1 where id>= 1 group by counter;
+
+# multiple fetch statements in the loop
+--sorted_result
+select f3(sal) from t1;
+
+# incorrect column type
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+select f2(val) from t1;
+
+#subquery
+--sorted_result
+select val, id, c from (select f1(sal) as c from t2) as t1, t2;
+
+#multiple calls to an aggregate function
+--sorted_result
+select f1(sal),f1(val), f1(id), f1(sal) from t2;
+
+#string type, also more than one areguments
+--sorted_result
+select f4(sal, val) from t1;
+
+#select f1((select sal from t2 where id= 1)) from t1;
+--sorted_result
+select c from (select f1(sal) as c from t2) as t1;
+
+# this fails as more than one row is returned
+#select f1((select val from t2 where id > 1)) from t1;
+
+select f1((select val from t2 where 0 > 1)) from t1;
+select f1((select val from t2 where id= 1)) from t1;
+
+select f5(sal) from t1;
+
+SELECT f1(sal)*f1(sal) FROM t1;
+
+--sorted_result
+SELECT (SELECT f1(sal) FROM t1) FROM t2;
+--sorted_result
+select id, f1(sal) from t1;
+--sorted_result
+select id, f1(sal) from t1 where id>= 1;
+--sorted_result
+select f1(sal), f1(sal) from t1 where id>= 1 group by counter;
+--sorted_result
+select f1(sal), f1(sal) from t1 where id>= 1 group by id ;
+--sorted_result
+select f1(sal) from t1 where id>= 1 group by id ;
+select f1(sal) from t1 where id>= 1 order by counter;
+select f1(sal) from t1 where id>= 1 group by id order by counter;
+select counter, id, f1(sal) from t1 where id>= 1 group by id order by counter;
+select id, f1(sal) from t1 where id>= 1 group by id order by counter;
+drop table t1;
+drop table t2;
+drop function f1;
+drop function f2;
+drop function f3;
+drop function f4;
+drop function f5;
+drop function f6;
+
+
+delimiter |;
+
+# aggregate AND function
+
+create aggregate function f1(x INT) returns INT
+begin
+ declare z double default 1000;
+ declare continue handler for not found return z;
+ loop
+ fetch group next row;
+ set z= (z&x);
+ end loop;
+end|
+
+delimiter ;|
+
+create table t1 (sal int, id int, val int, counter int);
+INSERT INTO t1 (sal, id, val, counter) VALUES (1000, 2, 10, 2);
+INSERT INTO t1 (sal, id, val, counter) VALUES (7000, 1, 16, 5);
+INSERT INTO t1 (sal, id, val, counter) VALUES (6000, 2, 18, 1);
+INSERT INTO t1 (sal, id, val, counter) VALUES (5000, 3, 15, 3);
+INSERT INTO t1 (sal, id, val, counter) VALUES (3000, 4, 11, 4);
+INSERT INTO t1 (sal, id, val, counter) VALUES (2000, 5, 10, 7);
+INSERT INTO t1 (sal, id, val, counter) VALUES (5000, 7, 13, 8);
+INSERT INTO t1 (sal, id, val, counter) VALUES (6000, 6, 19, 9);
+INSERT INTO t1 (sal, id, val, counter) VALUES (7000, 7, 12, 0);
+INSERT INTO t1 (sal, id, val, counter) VALUES (4000, 6, 14, 1);
+INSERT INTO t1 (sal, id, val, counter) VALUES (8000, 5, 19, 3);
+INSERT INTO t1 (sal, id, val, counter) VALUES (9000, 4, 11, 4);
+INSERT INTO t1 (sal, id, val, counter) VALUES (1000, 3, 11, 2);
+
+select f1(sal) from t1 where id>= 1;
+drop function f1;
+
+delimiter |;
+
+# aggregate AVG function
+
+create aggregate function f1(x INT) returns double
+begin
+ declare z double default 0;
+ declare count double default 0;
+ declare continue handler for not found return z/count;
+ loop
+ fetch group next row;
+ set z= z+x;
+ set count= count+1;
+ end loop;
+end|
+
+delimiter ;|
+select f1(sal) from t1 where id>= 1;
+drop function f1;
+delimiter |;
+
+# aggregate MAX function
+
+create aggregate function f1(x INT) returns INT
+begin
+ declare maxi INT default -1;
+ declare continue handler for not found return maxi;
+ loop
+ fetch group next row;
+ if maxi < x then
+ set maxi= x;
+ end if;
+ end loop;
+end|
+
+delimiter ;|
+select f1(sal) from t1 where id>= 1;
+drop function f1;
+delimiter |;
+
+# aggregate MIN function
+
+create aggregate function f1(x INT) returns double
+begin
+ declare mini INT default 100000;
+ declare continue handler for not found return mini;
+ loop
+ fetch group next row;
+ if mini > x then
+ set mini = x;
+ end if;
+ end loop;
+end|
+
+delimiter ;|
+select f1(sal) from t1 where id>= 1;
+drop function f1;
+delimiter |;
+
+# aggregate XOR function
+
+create aggregate function f1(x INT) returns double
+begin
+ declare z double default 0;
+ declare continue handler for not found return z;
+ loop
+ fetch group next row;
+ set z= z^x;
+ end loop;
+end|
+
+delimiter ;|
+select f1(sal) from t1 where id>= 1;
+drop function f1;
+delimiter |;
+
+# aggregate SUM function
+
+create aggregate function f1(x INT) returns INT
+begin
+ declare z int default 0;
+ declare continue handler for not found return z;
+ loop
+ fetch group next row;
+ set z= z+x;
+ end loop;
+end|
+
+delimiter ;|
+select f1(sal) from t1 where id>= 1;
+delimiter |;
+
+
+create aggregate function f2() returns INT
+begin
+ declare z double default 0;
+ declare continue handler for not found return z;
+ loop
+ fetch group next row;
+ set z= z+1;
+ end loop;
+end|
+
+delimiter ;|
+
+# no parameters
+select f2() from t1;
+
+create table t2 (sal int, id int);
+INSERT INTO t2 (sal, id) VALUES (NULL, 1);
+INSERT INTO t2 (sal, id) VALUES (2000, 1);
+INSERT INTO t2 (sal, id) VALUES (3000, 1);
+
+# null values
+select f1(sal) from t2;
+
+# no tables
+select f1(1);
+
+# aggregate function called from regular functions
+create function f3() returns int
+return (select f1(sal) from t1);
+select f3();
+
+create function f4() returns INT
+return 1;
+
+# regular functions called from aggregate functions
+delimiter |;
+create aggregate function f5() returns INT
+begin
+ declare z double default 0;
+ declare continue handler for not found return z;
+ loop
+ fetch group next row;
+ set z= z+f3();
+ end loop;
+end|
+
+delimiter ;|
+select f5() from t2;
+delimiter |;
+
+# aggregate functions called from aggregate functions
+create aggregate function f6(x INT) returns INT
+begin
+ declare z int default 0;
+ declare continue handler for not found return z;
+ loop
+ fetch group next row;
+ if x then
+ set z= z+(select f1(sal) from t1);
+ end if;
+ end loop;
+end|
+
+delimiter ;|
+select f6(sal) from t2;
+
+# GROUP BY AND ORDER BY
+--sorted_result
+select id, f1(sal) from t1 where id>= 1 group by id;
+--sorted_result
+select counter, f1(sal) from t1 where id>= 1 group by counter;
+--sorted_result
+select val, f1(sal) from t1 where id>= 1 group by val;
+--sorted_result
+select counter, f1(sal) from t1 where id>= 1 group by id order by counter;
+--sorted_result
+select counter, id, f1(sal), f1(sal) from t1 where id>= 1 group by id order by counter;
+--sorted_result
+select counter, id, f1(sal), sum(distinct sal) from t1 where id>= 1 group by id order by counter desc;
+
+
+##### insert aggregate function value into a table ######
+create table t3 (i int);
+INSERT INTO t3 (i) select f1(sal) from t1;
+select * from t3;
+
+delimiter |;
+
+create aggregate function f7(x INT) returns INT
+begin
+ declare z int default 0;
+ DECLARE done BOOLEAN DEFAULT FALSE;
+ DECLARE a,b,c INT;
+ DECLARE cur1 CURSOR FOR SELECT id FROM test.t2;
+ declare continue handler for not found return z;
+
+ outer_loop: LOOP
+ FETCH GROUP NEXT ROW;
+ set z= z+x;
+ inner_block: begin
+ DECLARE cur2 CURSOR FOR SELECT id FROM test.t2;
+ DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
+ OPEN cur2;
+
+ read_loop: LOOP
+ FETCH cur2 INTO a;
+ IF done THEN
+ CLOSE cur2;
+ LEAVE read_loop;
+ END IF;
+ END LOOP read_loop;
+
+ end inner_block;
+ END LOOP outer_loop;
+
+end|
+
+delimiter ;|
+select f7(sal) from t1;
+
+drop table t1;
+drop table t2;
+drop table t3;
+drop function f1;
+drop function f2;
+drop function f3;
+drop function f4;
+drop function f5;
+drop function f6;
+drop function f7;
diff --git a/mysql-test/t/func_gconcat.test b/mysql-test/t/func_gconcat.test
index 1038fc0f6d0..5cbc6969e02 100644
--- a/mysql-test/t/func_gconcat.test
+++ b/mysql-test/t/func_gconcat.test
@@ -915,3 +915,76 @@ DROP TABLE t1;
--echo #
--echo # End of 10.2 tests
--echo #
+
+
+--echo #
+--echo # Start of 10.3 tests
+--echo #
+
+#
+# MDEV-11297: Add support for LIMIT clause in GROUP_CONCAT()
+#
+--disable_warnings
+drop table if exists t1, t2;
+--enable_warnings
+
+create table t1 (grp int, a bigint unsigned, c char(10) , d char(10) not null);
+insert into t1 values (1,1,NULL,"a");
+insert into t1 values (1,10,"b","a");
+insert into t1 values (1,11,"c","a");
+insert into t1 values (2,2,"c","a");
+insert into t1 values (2,3,"b","b");
+insert into t1 values (3,4,"E","a");
+insert into t1 values (3,5,"C","b");
+insert into t1 values (3,6,"D","c");
+insert into t1 values (3,7,"E","c");
+
+
+select grp,group_concat(c) from t1 group by grp;
+select grp,group_concat(c limit 1 ) from t1 group by grp;
+select grp,group_concat(c limit 1,1 ) from t1 group by grp;
+select grp,group_concat(c limit 1,10 ) from t1 group by grp;
+select grp,group_concat(c limit 1000) from t1 group by grp;
+select group_concat(grp limit 0) from t1;
+--error ER_PARSE_ERROR
+select group_concat(grp limit "sdjadjs") from t1
+--error ER_PARSE_ERROR
+select grp,group_concat(c limit 5.5) from t1 group by grp ;
+select grp,group_concat(distinct c limit 1,10 ) from t1 group by grp;
+select grp,group_concat(c order by a) from t1 group by grp;
+select grp,group_concat(c order by a limit 2 ) from t1 group by grp;
+select grp,group_concat(c order by a limit 1,1 ) from t1 group by grp;
+select grp,group_concat(c order by c) from t1 group by grp;
+select grp,group_concat(c order by c limit 2) from t1 group by grp;
+select grp,group_concat(c order by c desc) from t1 group by grp;
+select grp,group_concat(c order by c desc limit 2) from t1 group by grp;
+
+drop table t1;
+
+create table t2 (a int, b varchar(10));
+insert into t2 values(1,'a'),(1,'b'),(NULL,'c'),(2,'x'),(2,'y');
+select group_concat(a,b limit 2) from t2;
+
+set @x=4;
+prepare STMT from 'select group_concat(b limit ?) from t2';
+execute STMT using @x;
+set @x=2;
+execute STMT using @x;
+set @x=1000;
+execute STMT using @x;
+set @x=0;
+execute STMT using @x;
+set @x="adasfa";
+--error ER_INVALID_VALUE_TO_LIMIT
+execute STMT using @x;
+set @x=-1;
+--error ER_WRONG_ARGUMENTS
+execute STMT using @x;
+set @x=4;
+prepare STMT from 'select group_concat(a,b limit ?) from t2';
+execute STMT using @x;
+drop table t2;
+
+--echo #
+--echo # End of 10.3 tests
+--echo #
diff --git a/mysql-test/t/func_json.test b/mysql-test/t/func_json.test
index 47ed0c3ca75..5a5d06d456d 100644
--- a/mysql-test/t/func_json.test
+++ b/mysql-test/t/func_json.test
@@ -9,6 +9,7 @@ select json_value('{"key1":123}', '$.key2');
select json_value('{"key1":123}', '$.key1');
select json_value('{"key1":[1,2,3]}', '$.key1');
select json_value('{"key1": [1,2,3], "key1":123}', '$.key1');
+select JSON_VALUE('{ "x": [0,1], "y": "[0,1]", "z": "Mon\\\"t\\\"y" }','$.z');
select json_query('{"key1":{"a":1, "b":[1,2]}}', '$.key2');
select json_query('{"key1":{"a":1, "b":[1,2]}}', '$.key1');
@@ -377,6 +378,11 @@ SELECT JSON_OBJECT("user","Jožko Mrkvičká") as json_data;
select json_contains_path('{"foo":"bar"}', 'one', '$[]');
+#
+# MDEV-13971 crash in skip_num_constant.
+#
+select JSON_VALID(0x36f0c8dccd83c5eac156da);
+
--echo #
--echo # Start of 10.3 tests
--echo #
diff --git a/mysql-test/t/gis-json.test b/mysql-test/t/gis-json.test
index 5e695fbca9c..b91ef235fd0 100644
--- a/mysql-test/t/gis-json.test
+++ b/mysql-test/t/gis-json.test
@@ -40,6 +40,10 @@ SELECT ST_AsGeoJSON(ST_GeomFromText('POINT(5.363 7.266)'),10);
SELECT ST_AsGeoJSON(ST_GeomFromText("POINT(10 11)"), 100, 1);
SELECT ST_AsGeoJSON(ST_GeomFromText("POINT(10 11)"), 100, 5);
+SELECT st_astext(st_geomfromgeojson('{"type": "MultiLineString","coordinates": []}')) as a;
+SELECT st_astext(st_geomfromgeojson('{"type": "Polygon","coordinates": []}')) as a;
+SELECT st_astext(st_geomfromgeojson('{"type": "MultiPolygon","coordinates": []}')) as a;
+
--echo #
--echo # End of 10.2 tests
--echo #
diff --git a/mysql-test/t/information_schema.test b/mysql-test/t/information_schema.test
index 9c306de0e3f..dcd56c57650 100644
--- a/mysql-test/t/information_schema.test
+++ b/mysql-test/t/information_schema.test
@@ -867,7 +867,7 @@ drop table t1;
use mysql;
INSERT INTO `proc` VALUES ('test','','PROCEDURE','','SQL','CONTAINS_SQL',
'NO','DEFINER','','','BEGIN\r\n \r\nEND','root@%','2006-03-02 18:40:03',
-'2006-03-02 18:40:03','','','utf8','utf8_general_ci','utf8_general_ci','n/a');
+'2006-03-02 18:40:03','','','utf8','utf8_general_ci','utf8_general_ci','n/a', 'NONE');
select routine_name from information_schema.routines where ROUTINE_SCHEMA='test';
delete from proc where name='';
use test;
diff --git a/mysql-test/t/intersect.test b/mysql-test/t/intersect.test
index 99a54606291..98b6d1eb1c6 100644
--- a/mysql-test/t/intersect.test
+++ b/mysql-test/t/intersect.test
@@ -190,4 +190,19 @@ show create view v1;
drop view v1;
drop tables t1,t2,t3;
+--echo #
+--echo # MDEV-14346:incorrect result of intersect with ANY/ALL/IN subquery
+--echo #
+CREATE TABLE t (i INT);
+INSERT INTO t VALUES (1),(2);
+SELECT * FROM t WHERE i != ANY ( SELECT 6 INTERSECT SELECT 3 );
+
+select i from t where
+ exists ((select 6 as r from dual having t.i <> 6)
+ intersect
+ (select 3 from dual having t.i <> 3));
+
+drop table t;
+
+
--echo # End of 10.3 tests
diff --git a/mysql-test/t/mysqlbinlog.test b/mysql-test/t/mysqlbinlog.test
index e5bc36f6851..6988b2a8e9b 100644
--- a/mysql-test/t/mysqlbinlog.test
+++ b/mysql-test/t/mysqlbinlog.test
@@ -589,3 +589,9 @@ eval SET GLOBAL SERVER_ID = $old_server_id;
--exec $MYSQL_BINLOG --hexdump std_data/mdev-4645-binlog_group_id.binlog
--exec $MYSQL_BINLOG --hexdump std_data/mdev-4645-binlog_group_id_checksum.binlog
--exec $MYSQL_BINLOG --hexdump std_data/mdev-4645-binlog_none.binlog
+
+#
+# MDEV-12372 mysqlbinlog --version output is the same on 10.x as on 5.5.x, and contains not only version
+#
+replace_regex /.*mysqlbinlog(\.exe)? Ver .* for .* at [-_a-zA-Z0-9]+/mysqlbinlog Ver VER for OS at ARCH/;
+exec $MYSQL_BINLOG --version;
diff --git a/mysql-test/t/mysqld--help.test b/mysql-test/t/mysqld--help.test
index 1613f8e7a4f..f859d7dd9d6 100644
--- a/mysql-test/t/mysqld--help.test
+++ b/mysql-test/t/mysqld--help.test
@@ -19,7 +19,7 @@ exec $MYSQLD_BOOTSTRAP_CMD --symbolic-links=0 --lower-case-table-names=1 --help
perl;
# Variables which we don't want to display in the result file since
# their paths may vary:
- @skipvars=qw/basedir open-files-limit general-log-file log plugin-dir
+ @skipvars=qw/basedir open-files-limit general-log-file log plugin-dir plugin-maturity
log-slow-queries pid-file slow-query-log-file log-basename
datadir slave-load-tmpdir tmpdir socket thread-pool-size
large-files-support lower-case-file-system system-time-zone
diff --git a/mysql-test/t/order_by.test b/mysql-test/t/order_by.test
index 8722401ccae..914911648b2 100644
--- a/mysql-test/t/order_by.test
+++ b/mysql-test/t/order_by.test
@@ -2106,3 +2106,46 @@ INSERT INTO t1 VALUES (1),(2),(3);
SELECT DISTINCT pk FROM t1 GROUP BY 'foo';
SELECT DISTINCT pk FROM t1;
DROP TABLE t1;
+
+--echo #
+--echo # MDEV-13994: Bad join results with orderby_uses_equalities=on
+--echo #
+
+CREATE TABLE books (
+ id int(16) NOT NULL AUTO_INCREMENT,
+ library_id int(16) NOT NULL DEFAULT 0,
+ wings_id int(12) NOT NULL DEFAULT 0,
+ scheduled_for_removal int(1) DEFAULT 0,
+ PRIMARY KEY (id),
+ KEY library_idx (library_id)
+) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
+
+INSERT INTO books VALUES (32625,8663,707,0),(32624,8663,505,1);
+
+CREATE TABLE wings (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ department_id int(11) DEFAULT NULL,
+ PRIMARY KEY (id)
+) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
+
+INSERT INTO wings VALUES (505,11745),(707,11768);
+
+let $q=
+SELECT wings.id as wing_id, wings.department_id FROM wings
+ WHERE wings.id IN ( SELECT books.wings_id FROM books
+ WHERE books.library_id = 8663 AND
+ books.scheduled_for_removal=0 )
+ORDER BY wings.id;
+
+SET @save_optimizer_switch=@@optimizer_switch;
+
+SET optimizer_switch='orderby_uses_equalities=off';
+eval $q;
+
+SET optimizer_switch='orderby_uses_equalities=on';
+eval $q;
+eval explain extended $q;
+
+set optimizer_switch= @save_optimizer_switch;
+
+DROP TABLE books, wings;
diff --git a/mysql-test/t/order_by_innodb.test b/mysql-test/t/order_by_innodb.test
index 097eddd24f1..0debb777749 100644
--- a/mysql-test/t/order_by_innodb.test
+++ b/mysql-test/t/order_by_innodb.test
@@ -61,3 +61,50 @@ from t1
where key1<3 or key2<3;
drop table t0, t1;
+
+--echo #
+--echo # MDEV-14071: wrong results with orderby_uses_equalities=on
+--echo # (duplicate of MDEV-13994)
+--echo #
+
+CREATE TABLE t1 (i int, j int, z int,PRIMARY KEY (i,j), KEY (z)) ENGINE=InnoDB;
+CREATE TABLE t2 (i int, j int, PRIMARY KEY (i,j)) ENGINE=InnoDB;
+CREATE TABLE t3 (j int, n varchar(5), PRIMARY KEY (j)) ENGINE=InnoDB;
+
+INSERT INTO t1 VALUES
+ (127,0,1),(188,0,1),(206,0,1),(218,0,1),(292,0,1),(338,0,1),(375,0,1),
+ (381,0,1),(409,0,1),(466,0,1),(469,0,1),(498,0,1),(656,0,1);
+INSERT INTO t1 VALUES
+ (77,4,0),(86,7,0),(96,6,0),(96,7,0),(99,9,0),(99,10,0),(99,11,0),(104,4,0),
+ (106,5,0),(148,6,0),(177,6,0),(181,5,0),(188,8,0),(218,8,0),(253,7,0),
+ (268,4,0),(338,4,0),(409,7,0),(466,8,0),(469,8,0),(498,8,0),(656,8,0);
+
+INSERT INTO t2 VALUES
+ (127,7),(188,8),(188,9),(206,6),(218,8),(218,9),(292,7),(338,4),(338,5),
+ (375,6),(381,5),(409,7),(409,8),(466,8),(466,9),(469,8),(469,9),(498,8),
+ (498,9),(656,8),(656,9);
+INSERT INTO t3 VALUES
+ (4,'four'),(5,'five'),(6,'six'),(7,'seven'),(8,'eight'),(9,'nine');
+
+let $q1=
+SELECT i,n
+FROM t1 INNER JOIN t2 USING (i,j) LEFT JOIN t3 USING (j)
+WHERE i IN (SELECT i FROM t1 WHERE z=1) AND z=0 ORDER BY i;
+let $q2=
+SELECT i,n
+FROM t1 x INNER JOIN t2 USING (i,j) LEFT JOIN t3 USING (j)
+WHERE EXISTS (SELECT * FROM t1 WHERE i=x.i AND z=1) AND z=0 ORDER BY i;
+
+SET @save_optimizer_switch=@@optimizer_switch;
+
+SET optimizer_switch='orderby_uses_equalities=off';
+eval $q1;
+eval $q2;
+
+SET optimizer_switch='orderby_uses_equalities=on';
+eval $q1;
+eval $q2;
+
+set optimizer_switch= @save_optimizer_switch;
+
+DROP TABLE t1,t2,t3;
diff --git a/mysql-test/t/partition.test b/mysql-test/t/partition.test
index 608c8812e01..2357b806a18 100644
--- a/mysql-test/t/partition.test
+++ b/mysql-test/t/partition.test
@@ -445,6 +445,7 @@ INSERT INTO t1 VALUES (1,1,0), (1,1,1), (1,1,2), (1,1,53), (1,1,4), (1,1,5),
(1,19,1);
SELECT COUNT(*) FROM t1 WHERE b NOT IN ( 1,2,6,7,9,10,11 );
SELECT SUM(c) FROM t1 WHERE b NOT IN ( 1,2,6,7,9,10,11 );
+SELECT SUM(c+0.0) FROM t1 WHERE b NOT IN ( 1,2,6,7,9,10,11 );
ALTER TABLE t1 DROP INDEX b;
SELECT COUNT(*) FROM t1 WHERE b NOT IN ( 1,2,6,7,9,10,11 );
SELECT SUM(c) FROM t1 WHERE b NOT IN ( 1,2,6,7,9,10,11 );
@@ -2812,6 +2813,7 @@ INSERT INTO t1 VALUES (123,123,'2001-04-14','address123','city123',40,51),
(257,257,'2010-03-06','address257','city257',40,47);
--enable_query_log
+--sorted_result
select * from t1 where hours_worked_per_week = 40 and weeks_worked_last_year = 52 and dob < '1949-11-21';
select * from t1 IGNORE INDEX(dob, weeks_worked_last_year, hours_worked_per_week) where hours_worked_per_week = 40 and weeks_worked_last_year = 52 and dob < '1949-11-21';
diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test
index ec55b9c9d21..2a16a807542 100644
--- a/mysql-test/t/ps.test
+++ b/mysql-test/t/ps.test
@@ -4476,3 +4476,94 @@ EXECUTE IMMEDIATE 'CALL p1(?)' USING DEFAULT;
--error ER_SP_NOT_VAR_ARG
EXECUTE IMMEDIATE 'CALL p1(?)' USING IGNORE;
DROP PROCEDURE p1;
+
+
+--echo #
+--echo # MDEV-14434 Wrong result for CHARSET(CONCAT(?,const))
+--echo #
+
+SET NAMES utf8;
+EXECUTE IMMEDIATE "SELECT CHARSET(CONCAT(5,_latin1'a'))";
+EXECUTE IMMEDIATE "SELECT CHARSET(CONCAT(?,_latin1'a'))" USING 5;
+EXECUTE IMMEDIATE "SELECT CHARSET(CONCAT(?,_latin1'a'))" USING 5.5;
+EXECUTE IMMEDIATE "SELECT CHARSET(CONCAT(?,_latin1'a'))" USING 5.5e0;
+EXECUTE IMMEDIATE "SELECT CHARSET(CONCAT(?,_latin1'a'))" USING TIME'10:20:30';
+EXECUTE IMMEDIATE "SELECT CHARSET(CONCAT(?,_latin1'a'))" USING TIMESTAMP'2001-01-01 10:20:30';
+
+EXECUTE IMMEDIATE "SELECT COERCIBILITY(?)" USING 5;
+EXECUTE IMMEDIATE "SELECT COERCIBILITY(?)" USING 5.5;
+EXECUTE IMMEDIATE "SELECT COERCIBILITY(?)" USING 5.5e0;
+EXECUTE IMMEDIATE "SELECT COERCIBILITY(?)" USING TIME'10:20:30';
+EXECUTE IMMEDIATE "SELECT COERCIBILITY(?)" USING TIMESTAMP'2001-01-01 10:20:30';
+
+--echo #
+--echo # MDEV-14435 Different UNSIGNED flag of out user variable for YEAR parameter for direct vs prepared CALL
+--echo #
+
+CREATE PROCEDURE p1(OUT v INT UNSIGNED) SET v = 2010;
+CALL p1(@a);
+PREPARE stmt FROM 'CALL p1(?)';
+EXECUTE stmt USING @b;
+DEALLOCATE PREPARE stmt;
+CREATE TABLE t1 AS SELECT @a AS a, @b AS b;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+DROP PROCEDURE p1;
+
+CREATE PROCEDURE p1(OUT v YEAR) SET v = 2010;
+CALL p1(@a);
+PREPARE stmt FROM 'CALL p1(?)';
+EXECUTE stmt USING @b;
+DEALLOCATE PREPARE stmt;
+CREATE TABLE t1 AS SELECT @a AS a, @b AS b;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+DROP PROCEDURE p1;
+
+CREATE PROCEDURE p1(OUT v BIT(16)) SET v = 2010;
+CALL p1(@a);
+PREPARE stmt FROM 'CALL p1(?)';
+EXECUTE stmt USING @b;
+DEALLOCATE PREPARE stmt;
+CREATE TABLE t1 AS SELECT @a AS a, @b AS b;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+DROP PROCEDURE p1;
+
+--echo #
+--echo # MDEV-14454 Binary protocol returns wrong collation ID for SP OUT parameters
+--echo #
+
+CREATE PROCEDURE p1(OUT v CHAR(32) CHARACTER SET utf8) SET v='aaa';
+PREPARE stmt1 FROM 'CALL p1(?)';
+EXECUTE stmt1 USING @a;
+CREATE TABLE t1 AS SELECT @a AS c1;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+DROP PROCEDURE p1;
+
+--echo #
+--echo # MDEV-14467 Item_param: replace {INT|DECIMAL|REAL|STRING|TIME}_VALUE with Type_handler
+--echo #
+
+EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT 1 FROM DUAL LIMIT ?' USING 10;
+EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT 1 FROM DUAL LIMIT ?' USING 10.1;
+EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT 1 FROM DUAL LIMIT ?' USING 10.1e0;
+EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT 1 FROM DUAL LIMIT ?' USING '10';
+EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT 1 FROM DUAL LIMIT ?' USING TIME'10:10:10';
+
+EXECUTE IMMEDIATE 'CREATE OR REPLACE TABLE t1 AS SELECT 1 AS a,? AS b' USING 1;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+EXECUTE IMMEDIATE 'CREATE OR REPLACE TABLE t1 AS SELECT 10 AS a,? AS b' USING 10;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+EXECUTE IMMEDIATE 'CREATE OR REPLACE TABLE t1 AS SELECT 999999999 AS a,? AS b' USING 999999999;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+EXECUTE IMMEDIATE 'CREATE OR REPLACE TABLE t1 AS SELECT 2147483647 AS a,? AS b' USING 2147483647;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
diff --git a/mysql-test/t/sp-code.test b/mysql-test/t/sp-code.test
index 29b6764ebc6..1f2f5191f0a 100644
--- a/mysql-test/t/sp-code.test
+++ b/mysql-test/t/sp-code.test
@@ -758,3 +758,172 @@ DELIMITER ;$$
SHOW PROCEDURE CODE p1;
DROP PROCEDURE p1;
DROP TABLE t1;
+
+--echo #
+--echo # MDEV-14415 Add Oracle-style FOR loop to sql_mode=DEFAULT
+--echo #
+
+--echo # Integer range FOR loop
+
+DELIMITER $$;
+CREATE PROCEDURE p1()
+BEGIN
+ FOR i IN 1..3
+ DO
+ SELECT i;
+ END FOR;
+END;
+$$
+DELIMITER ;$$
+CALL p1;
+SHOW PROCEDURE CODE p1;
+DROP PROCEDURE p1;
+
+
+--echo # Nested integer range FOR loops
+
+DELIMITER $$;
+CREATE PROCEDURE p1()
+BEGIN
+ fori:
+ FOR i IN 1..3
+ DO
+ forj:
+ FOR j IN 1..3
+ DO
+ IF i = 3 THEN
+ LEAVE fori;
+ END IF;
+ IF j = 3 THEN
+ LEAVE forj;
+ END IF;
+ SELECT i,j;
+ END FOR;
+ END FOR;
+END;
+$$
+DELIMITER ;$$
+CALL p1;
+SHOW PROCEDURE CODE p1;
+DROP PROCEDURE p1;
+
+
+--echo # Explicit cursor FOR loops
+
+DELIMITER $$;
+CREATE PROCEDURE p1()
+BEGIN
+ DECLARE cur0 CURSOR FOR SELECT 10 AS a, 'b0' AS b;
+ DECLARE cur1 CURSOR FOR SELECT 10 AS a, 'b0' AS b;
+ DECLARE cur2 CURSOR FOR SELECT 10 AS a, 'b0' AS b;
+ FOR rec1 IN cur1
+ DO
+ SELECT rec1.a, rec1.b;
+ SET rec1.a= 11;
+ SET rec1.b= 'b1';
+ SELECT rec1.a, rec1.b;
+ END FOR;
+ FOR rec0 IN cur0
+ DO
+ SET rec0.a= 10;
+ SET rec0.b='b0';
+ END FOR;
+ FOR rec2 IN cur2
+ DO
+ SET rec2.a= 10;
+ SET rec2.b='b0';
+ END FOR;
+END;
+$$
+DELIMITER ;$$
+SHOW PROCEDURE CODE p1;
+DROP PROCEDURE p1;
+
+
+--echo # Nested explicit cursor FOR loops
+
+DELIMITER $$;
+CREATE PROCEDURE p1()
+BEGIN
+ DECLARE cur0 CURSOR FOR SELECT 10 AS a, 'b0' AS b;
+ FOR rec0 IN cur0
+ DO
+ BEGIN
+ DECLARE cur1 CURSOR FOR SELECT 11 AS a, 'b1' AS b;
+ SET rec0.a= 11;
+ SET rec0.b= 'b0';
+ FOR rec1 IN cur1
+ DO
+ SET rec1.a= 11;
+ SET rec1.b= 'b1';
+ BEGIN
+ DECLARE cur2 CURSOR FOR SELECT 12 AS a, 'b2' AS b;
+ FOR rec2 IN cur2
+ DO
+ SET rec2.a=12;
+ SET rec2.b='b2';
+ END FOR;
+ END;
+ END FOR;
+ END;
+ END FOR;
+END;
+$$
+DELIMITER ;$$
+SHOW PROCEDURE CODE p1;
+DROP PROCEDURE p1;
+
+
+--echo # Implicit cursor FOR loops
+
+DELIMITER $$;
+CREATE PROCEDURE p1()
+BEGIN
+ FOR rec1 IN (SELECT 11 AS a, 'b1' AS b)
+ DO
+ SELECT rec1.a, rec1.b;
+ SET rec1.a= 11;
+ SET rec1.b= 'b1';
+ SELECT rec1.a, rec1.b;
+ END FOR;
+ FOR rec0 IN (SELECT 10 AS a, 'b0' AS b)
+ DO
+ SET rec0.a= 10;
+ SET rec0.b='b0';
+ END FOR;
+ FOR rec2 IN (SELECT 12 AS a, 'b2' AS b)
+ DO
+ SET rec2.a= 10;
+ SET rec2.b='b0';
+ END FOR;
+END;
+$$
+DELIMITER ;$$
+SHOW PROCEDURE CODE p1;
+DROP PROCEDURE p1;
+
+--echo # Nested implicit cursor FOR loops
+
+DELIMITER $$;
+CREATE PROCEDURE p1()
+BEGIN
+ FOR rec0 IN (SELECT 10 AS a, 'b0' AS b)
+ DO
+ SET rec0.a= 11;
+ SET rec0.b= 'b0';
+ FOR rec1 IN (SELECT 11 AS a, 'b1' AS b)
+ DO
+ SET rec1.a= 11;
+ SET rec1.b= 'b1';
+ FOR rec2 IN (SELECT 12 AS a, 'b2' AS b)
+ DO
+ SET rec2.a=12;
+ SET rec2.b='b2';
+ END FOR;
+ END FOR;
+ END FOR;
+END;
+$$
+DELIMITER ;$$
+SHOW PROCEDURE CODE p1;
+DROP PROCEDURE p1;
diff --git a/mysql-test/t/sp-cursor.test b/mysql-test/t/sp-cursor.test
index 394dc56556a..2e7a72cf8d0 100644
--- a/mysql-test/t/sp-cursor.test
+++ b/mysql-test/t/sp-cursor.test
@@ -474,3 +474,136 @@ DROP PROCEDURE p1;
--echo #
--echo # End of MDEV-12457 Cursors with parameters
--echo #
+
+
+--echo #
+--echo # MDEV-14415 Add Oracle-style FOR loop to sql_mode=DEFAULT
+--echo #
+
+--echo # Explicit cursor
+
+CREATE TABLE t1 (a INT, b VARCHAR(10));
+INSERT INTO t1 VALUES (1,'b1'), (2,'b2'), (3,'b3');
+DELIMITER $$;
+BEGIN NOT ATOMIC
+ DECLARE cur CURSOR FOR SELECT * FROM t1;
+ FOR rec IN cur
+ DO
+ SELECT rec.a AS a, rec.b AS b;
+ END FOR;
+END;
+$$
+DELIMITER ;$$
+DROP TABLE t1;
+
+--echo # Explicit cursor with parameters
+
+CREATE TABLE t1 (a INT, b VARCHAR(10));
+INSERT INTO t1 VALUES (1,'b1'), (2,'b2'), (3,'b3');
+DELIMITER $$;
+BEGIN NOT ATOMIC
+ DECLARE cur CURSOR(pa INT) FOR SELECT * FROM t1 WHERE a>=pa;
+ FOR rec IN cur(2)
+ DO
+ SELECT rec.a AS a, rec.b AS b;
+ END FOR;
+END;
+$$
+DELIMITER ;$$
+DROP TABLE t1;
+
+--echo # Explicit cursor + label
+
+CREATE TABLE t1 (a INT, b VARCHAR(10));
+INSERT INTO t1 VALUES ('1','b1'), ('2','b2');
+DELIMITER $$;
+BEGIN NOT ATOMIC
+ DECLARE cur CURSOR FOR SELECT * FROM t1;
+ forrec:
+ FOR rec IN cur
+ DO
+ SELECT rec.a AS a, rec.b AS b;
+ IF rec.a = 2 THEN
+ LEAVE forrec;
+ END IF;
+ END FOR forrec;
+END;
+$$
+DELIMITER ;$$
+DROP TABLE t1;
+
+--echo # Explicit cursor + FETCH inside the loop body produce an error on "NOT FOUND"
+
+DELIMITER $$;
+--error ER_SP_FETCH_NO_DATA
+BEGIN NOT ATOMIC
+ DECLARE x INT;
+ DECLARE cur CURSOR FOR SELECT 1 AS x;
+ FOR rec IN cur
+ DO
+ FETCH cur INTO x;
+ END FOR;
+END;
+$$
+DELIMITER ;$$
+
+
+--echo # Explicit cursor + FETCH inside the loop body are normally handled by "HANDLER FOR NOT FOUND"
+
+DELIMITER $$;
+BEGIN NOT ATOMIC
+ DECLARE done INT DEFAULT 0;
+ DECLARE cur CURSOR FOR SELECT 1 AS x, 'y1' AS y UNION
+ SELECT 2,'y2' UNION
+ SELECT 3,'y3';
+ DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
+ forrec:
+ FOR rec IN cur
+ DO
+ SELECT CONCAT(rec.x, ' ', rec.y) AS 'Implicit FETCH';
+ FETCH cur INTO rec;
+ IF done THEN
+ SELECT 'NO DATA' AS `Explicit FETCH`;
+ LEAVE forrec;
+ ELSE
+ SELECT CONCAT(rec.x, ' ', rec.y) AS 'Explicit FETCH';
+ END IF;
+ END FOR;
+END;
+$$
+DELIMITER ;$$
+
+
+--echo # Implicit cursor
+
+CREATE TABLE t1 (a INT, b VARCHAR(10));
+INSERT INTO t1 VALUES ('1','b1'), ('2','b2');
+DELIMITER $$;
+BEGIN NOT ATOMIC
+ FOR rec IN (SELECT * FROM t1)
+ DO
+ SELECT rec.a AS a, rec.b AS b;
+ END FOR;
+END;
+$$
+DELIMITER ;$$
+DROP TABLE t1;
+
+--echo # Implicit cursor + label
+
+CREATE TABLE t1 (a INT, b VARCHAR(10));
+INSERT INTO t1 VALUES ('1','b1'), ('2','b2');
+DELIMITER $$;
+BEGIN NOT ATOMIC
+ forrec:
+ FOR rec IN (SELECT * FROM t1)
+ DO
+ SELECT rec.a AS a, rec.b AS b;
+ IF rec.a = 2 THEN
+ LEAVE forrec;
+ END IF;
+ END FOR;
+END;
+$$
+DELIMITER ;$$
+DROP TABLE t1;
diff --git a/mysql-test/t/sp-destruct.test b/mysql-test/t/sp-destruct.test
index 31da235d906..0cd80bd5427 100644
--- a/mysql-test/t/sp-destruct.test
+++ b/mysql-test/t/sp-destruct.test
@@ -10,7 +10,7 @@
-- source include/not_embedded.inc
# Supress warnings written to the log file
-call mtr.add_suppression("Column count of mysql.proc is wrong. Expected 20, found 19. The table is probably corrupted");
+call mtr.add_suppression("Column count of mysql.proc is wrong. Expected 21, found 20. The table is probably corrupted");
call mtr.add_suppression("Stored routine .test...bug14233_[123].: invalid value in column mysql.proc");
# Backup proc table
diff --git a/mysql-test/t/sp-error.test b/mysql-test/t/sp-error.test
index aa537d3596b..0e16948f438 100644
--- a/mysql-test/t/sp-error.test
+++ b/mysql-test/t/sp-error.test
@@ -1746,7 +1746,7 @@ drop procedure bug15091;
drop function if exists bug16896;
--enable_warnings
---error ER_PARSE_ERROR
+--error ER_INVALID_AGGREGATE_FUNCTION
create aggregate function bug16896() returns int return 1;
#
diff --git a/mysql-test/t/sp-for-loop.test b/mysql-test/t/sp-for-loop.test
new file mode 100644
index 00000000000..6350e9fb9d3
--- /dev/null
+++ b/mysql-test/t/sp-for-loop.test
@@ -0,0 +1,212 @@
+--echo #
+--echo # MDEV-14415 Add Oracle-style FOR loop to sql_mode=DEFAULT
+--echo #
+
+
+CREATE TABLE t1 (a INT);
+DELIMITER /;
+FOR i IN 1..3
+DO
+ INSERT INTO t1 VALUES (i);
+END FOR;
+/
+DELIMITER ;/
+SELECT * FROM t1;
+DROP TABLE t1;
+
+
+# Dots must have no delimiters in between
+
+DELIMITER /;
+--error ER_PARSE_ERROR
+CREATE FUNCTION f1 (lower_bound INT, upper_bound INT, lim INT) RETURNS INT
+BEGIN
+ DECLARE total INT DEFAULT 0;
+ FOR i IN lower_bound . . upper_bound
+ DO
+ NULL
+ END FOR;
+ RETURN total;
+END;
+/
+DELIMITER ;/
+
+
+DELIMITER /;
+CREATE FUNCTION f1 (lower_bound INT, upper_bound INT, lim INT) RETURNS INT
+BEGIN
+ DECLARE total INT DEFAULT 0;
+ lab:
+ FOR i IN lower_bound .. upper_bound
+ DO
+ SET total= total + i;
+ IF i = lim THEN
+ LEAVE lab;
+ END IF;
+ -- Bounds are calculated only once.
+ -- The below assignments have no effect on the loop condition
+ SET lower_bound= 900;
+ SET upper_bound= 1000;
+ END FOR;
+ RETURN total;
+END;
+/
+DELIMITER ;/
+SELECT f1(1, 3, 100) FROM DUAL;
+SELECT f1(1, 3, 2) FROM DUAL;
+DROP FUNCTION f1;
+
+
+DELIMITER /;
+CREATE FUNCTION f1() RETURNS INT
+BEGIN
+ DECLARE total INT DEFAULT 0;
+ FOR i IN 1 .. 5
+ DO
+ SET total= total + 1000;
+ forj:
+ FOR j IN 1 .. 5
+ DO
+ SET total= total + 1;
+ IF j = 3 THEN
+ LEAVE forj; -- End the internal loop
+ END IF;
+ END FOR;
+ END FOR;
+ RETURN total;
+END;
+/
+DELIMITER ;/
+SELECT f1() FROM DUAL;
+DROP FUNCTION f1;
+
+
+DELIMITER /;
+CREATE FUNCTION f1 (a INT, b INT) RETURNS INT
+BEGIN
+ DECLARE total INT DEFAULT 0;
+ fori:
+ FOR i IN REVERSE a..1
+ DO
+ SET total= total + i;
+ IF i = b THEN
+ LEAVE fori;
+ END IF;
+ END FOR;
+ RETURN total;
+END
+/
+DELIMITER ;/
+SELECT f1(3, 100) FROM DUAL;
+SELECT f1(3, 2) FROM DUAL;
+DROP FUNCTION f1;
+
+
+--echo # Testing labeled FOR LOOP statement
+
+DELIMITER /;
+CREATE FUNCTION f1 (a INT, limita INT, b INT, limitb INT) RETURNS INT
+BEGIN
+ DECLARE total INT DEFAULT 0;
+ la:
+ FOR ia IN 1 .. a
+ DO
+ SET total= total + 1000;
+ lb:
+ FOR ib IN 1 .. b
+ DO
+ SET total= total + 1;
+ IF ib = limitb THEN
+ LEAVE lb;
+ END IF;
+ IF ia = limita THEN
+ LEAVE la;
+ END IF;
+ END FOR lb;
+ END FOR la;
+ RETURN total;
+END;
+/
+DELIMITER ;/
+SELECT f1(1, 1, 1, 1) FROM DUAL;
+SELECT f1(1, 2, 1, 2) FROM DUAL;
+SELECT f1(2, 1, 2, 1) FROM DUAL;
+SELECT f1(2, 1, 2, 2) FROM DUAL;
+SELECT f1(2, 2, 2, 2) FROM DUAL;
+SELECT f1(2, 3, 2, 3) FROM DUAL;
+DROP FUNCTION f1;
+
+
+--echo # Testing labeled ITERATE in a labeled FOR LOOP statement
+
+DELIMITER /;
+CREATE FUNCTION f1 (a INT, b INT, blim INT) RETURNS INT
+BEGIN
+ DECLARE total INT DEFAULT 0;
+ la:
+ FOR ia IN 1 .. a
+ DO
+ SET total= total + 1000;
+ BEGIN
+ DECLARE ib INT DEFAULT 1;
+ WHILE ib <= b
+ DO
+ IF ib > blim THEN
+ ITERATE la;
+ END IF;
+ SET ib= ib + 1;
+ SET total= total + 1;
+ END WHILE;
+ END;
+ END FOR la;
+ RETURN total;
+END;
+/
+DELIMITER ;/
+SELECT f1(3,3,0), f1(3,3,1), f1(3,3,2), f1(3,3,3), f1(3,3,4) FROM DUAL;
+DROP FUNCTION f1;
+
+
+--echo # Testing INTERATE statement
+
+DELIMITER /;
+CREATE FUNCTION f1(a INT) RETURNS INT
+BEGIN
+ DECLARE total INT DEFAULT 0;
+ fori:
+ FOR i IN 1 .. a
+ DO
+ IF i=5 THEN
+ ITERATE fori;
+ END IF;
+ SET total= total + 1;
+ END FOR;
+ RETURN total;
+END;
+/
+DELIMITER ;/
+SELECT f1(3), f1(4), f1(5), f1(6) FROM DUAL;
+DROP FUNCTION f1;
+
+
+DELIMITER /;
+CREATE FUNCTION f1(a INT) RETURNS INT
+BEGIN
+ DECLARE total INT DEFAULT 0;
+ lj:
+ FOR j IN 1 .. 2
+ DO
+ FOR i IN 1 .. a
+ DO
+ IF i=5 THEN
+ ITERATE lj;
+ END IF;
+ SET total= total + 1;
+ END FOR;
+ END FOR;
+ RETURN total;
+END;
+/
+DELIMITER ;/
+SELECT f1(3), f1(4), f1(5) FROM DUAL;
+DROP FUNCTION f1;
diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test
index 3b615d29166..576512e78a4 100644
--- a/mysql-test/t/sp.test
+++ b/mysql-test/t/sp.test
@@ -6317,7 +6317,7 @@ set names utf8|
drop database if exists това_е_дълго_име_за_база_данни_нали|
--enable_warnings
create database това_е_дълго_име_за_база_данни_нали|
-INSERT INTO mysql.proc VALUES ('това_е_дълго_име_за_база_данни_нали','това_е_процедура_с_доста_дълго_име_нали_и_още_по_дълго','PROCEDURE','това_е_процедура_с_доста_дълго_име_нали_и_още_по_дълго','SQL','CONTAINS_SQL','NO','DEFINER','','','bad_body','root@localhost',now(), now(),'','', 'utf8', 'utf8_general_ci', 'utf8_general_ci', 'n/a')|
+INSERT INTO mysql.proc VALUES ('това_е_дълго_име_за_база_данни_нали','това_е_процедура_с_доста_дълго_име_нали_и_още_по_дълго','PROCEDURE','това_е_процедура_с_доста_дълго_име_нали_и_още_по_дълго','SQL','CONTAINS_SQL','NO','DEFINER','','','bad_body','root@localhost',now(), now(),'','', 'utf8', 'utf8_general_ci', 'utf8_general_ci', 'n/a', 'NONE')|
--error ER_SP_PROC_TABLE_CORRUPT
call това_е_дълго_име_за_база_данни_нали.това_е_процедура_с_доста_дълго_име_нали_и_още_по_дълго()|
drop database това_е_дълго_име_за_база_данни_нали|
@@ -9583,6 +9583,23 @@ drop procedure p;
drop view v;
drop table t, tmp_t;
+
+--echo #
+--echo # MDEV-13936: Server crashes in Time_and_counter_tracker::incr_loops
+--echo #
+CREATE TABLE t1 (i INT);
+CREATE VIEW v1 AS SELECT * FROM t1 WHERE RAND() > 0.5;
+CREATE FUNCTION f1() RETURNS INT RETURN ( SELECT MAX(i) FROM v1 );
+
+--error ER_NON_INSERTABLE_TABLE
+REPLACE INTO v1 VALUES (f1());
+SET @aux = f1();
+
+# Cleanup
+DROP FUNCTION f1;
+DROP VIEW v1;
+DROP TABLE t1;
+
--echo #End of 10.1 tests
--echo #
diff --git a/mysql-test/t/trigger.test b/mysql-test/t/trigger.test
index aeab884670d..1557ef200e5 100644
--- a/mysql-test/t/trigger.test
+++ b/mysql-test/t/trigger.test
@@ -2643,8 +2643,33 @@ DROP TABLE t1;
SET TIMESTAMP=DEFAULT;
set time_zone= @@global.time_zone;
+--echo #
+--echo # MDEV-13936: Server crashes in Time_and_counter_tracker::incr_loops
+--echo #
+
+CREATE TABLE t1 (i INT);
+CREATE VIEW v1 AS SELECT * FROM t1 WHERE RAND() > 0.5;
+CREATE TABLE t2 (a int);
+CREATE TABLE t3 (a int);
+
+create trigger trg after insert on t2 for each row
+ INSERT INTO t3 SELECT MAX(i) FROM v1 UNION SELECT MAX(i) FROM v1;
+
+drop table t1;
+
+--error ER_NO_SUCH_TABLE
+insert into t2 value (2);
+CREATE TABLE t1 (i INT);
+insert into t2 value (2);
+
+DROP VIEW v1;
+DROP TABLE t1,t2,t3;
+
+
+--echo End of 10.1 tests.
+
#
-# MDEV-10915 Count number of exceuted triggers
+# MDEV-10915 Count number of executed triggers
#
create table t1 (i int);
diff --git a/mysql-test/t/type_set.test b/mysql-test/t/type_set.test
index 8c26d5a4366..637ad40c316 100644
--- a/mysql-test/t/type_set.test
+++ b/mysql-test/t/type_set.test
@@ -240,3 +240,11 @@ EXPLAIN SELECT * FROM t1 WHERE a='1x';
EXPLAIN SELECT * FROM t1 WHERE a='1.0';
EXPLAIN SELECT * FROM t1 WHERE a='1.1';
DROP TABLE t1;
+
+--echo #
+--echo # MDEV-11155 Bad error message when creating a SET column with comma and non-ASCII characters
+--echo #
+
+SET NAMES utf8;
+--error ER_ILLEGAL_VALUE_FOR_TYPE
+CREATE TABLE t1 (a SET('a,bü'));
diff --git a/mysql-test/t/win.test b/mysql-test/t/win.test
index c353cd8b599..d74e94625e5 100644
--- a/mysql-test/t/win.test
+++ b/mysql-test/t/win.test
@@ -2038,5 +2038,26 @@ EXECUTE stmt;
DROP TABLE t1;
--echo #
+--echo # MDEV-13384: "window" seems like a reserved column name but it's not listed as one
+--echo #
+--echo # Currently we allow window as an identifier, except for table aliases.
+--echo #
+
+CREATE TABLE door (id INT, window VARCHAR(10));
+
+--error ER_PARSE_ERROR
+SELECT id
+FROM door as window;
+
+SELECT id, window
+FROM door;
+
+--error ER_PARSE_ERROR
+SELECT id, window
+FROM door as window;
+
+DROP TABLE door;
+
+--echo #
--echo # Start of 10.3 tests
--echo #