summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/include/im_check_os.inc7
-rw-r--r--mysql-test/lib/init_db.sql2
-rw-r--r--mysql-test/lib/mtr_cases.pl46
-rw-r--r--mysql-test/lib/mtr_process.pl17
-rw-r--r--mysql-test/lib/mtr_report.pl4
-rwxr-xr-xmysql-test/mysql-test-run.pl400
-rw-r--r--mysql-test/r/bdb.result12
-rw-r--r--mysql-test/r/case.result8
-rw-r--r--mysql-test/r/cast.result12
-rw-r--r--mysql-test/r/ctype_ucs_binlog.result3
-rw-r--r--mysql-test/r/ctype_ujis.result30
-rw-r--r--mysql-test/r/ctype_utf8.result39
-rw-r--r--mysql-test/r/default.result32
-rw-r--r--mysql-test/r/derived.result12
-rw-r--r--mysql-test/r/federated.result26
-rw-r--r--mysql-test/r/federated_bug_13118.result39
-rw-r--r--mysql-test/r/func_group.result136
-rw-r--r--mysql-test/r/func_in.result9
-rw-r--r--mysql-test/r/func_str.result6
-rw-r--r--mysql-test/r/group_min_max.result20
-rw-r--r--mysql-test/r/heap.result8
-rw-r--r--mysql-test/r/im_daemon_life_cycle.result7
-rw-r--r--mysql-test/r/im_life_cycle.result64
-rw-r--r--mysql-test/r/im_options_set.result20
-rw-r--r--mysql-test/r/im_options_unset.result15
-rw-r--r--mysql-test/r/im_utils.result91
-rw-r--r--mysql-test/r/information_schema.result39
-rw-r--r--mysql-test/r/information_schema_inno.result2
-rw-r--r--mysql-test/r/innodb.result133
-rw-r--r--mysql-test/r/join_nested.result28
-rw-r--r--mysql-test/r/loaddata.result11
-rw-r--r--mysql-test/r/merge.result26
-rw-r--r--mysql-test/r/metadata.result2
-rw-r--r--mysql-test/r/multi_statement.result1
-rw-r--r--mysql-test/r/myisam.result73
-rw-r--r--mysql-test/r/mysqlbinlog.result30
-rw-r--r--mysql-test/r/mysqlbinlog2.result75
-rw-r--r--mysql-test/r/mysqldump-max.result266
-rw-r--r--mysql-test/r/mysqldump.result79
-rw-r--r--mysql-test/r/mysqltest.result6
-rw-r--r--mysql-test/r/ndb_alter_table.result116
-rw-r--r--mysql-test/r/ndb_config.result2
-rw-r--r--mysql-test/r/ps_1general.result17
-rw-r--r--mysql-test/r/ps_2myisam.result4
-rw-r--r--mysql-test/r/ps_3innodb.result4
-rw-r--r--mysql-test/r/ps_4heap.result4
-rw-r--r--mysql-test/r/ps_5merge.result8
-rw-r--r--mysql-test/r/ps_6bdb.result4
-rw-r--r--mysql-test/r/ps_7ndb.result4
-rw-r--r--mysql-test/r/range.result44
-rw-r--r--mysql-test/r/rpl_charset.result3
-rw-r--r--mysql-test/r/rpl_multi_delete.result9
-rw-r--r--mysql-test/r/rpl_multi_delete2.result29
-rw-r--r--mysql-test/r/rpl_multi_update.result13
-rw-r--r--mysql-test/r/rpl_sp.result2
-rw-r--r--mysql-test/r/rpl_timezone.result3
-rw-r--r--mysql-test/r/select.result118
-rw-r--r--mysql-test/r/skip_name_resolve.result7
-rw-r--r--mysql-test/r/sp-big.result46
-rw-r--r--mysql-test/r/sp.result87
-rw-r--r--mysql-test/r/sql_mode.result26
-rw-r--r--mysql-test/r/system_mysql_db.result2
-rw-r--r--mysql-test/r/temp_table.result29
-rw-r--r--mysql-test/r/type_bit.result10
-rw-r--r--mysql-test/r/type_decimal.result13
-rw-r--r--mysql-test/r/type_float.result4
-rw-r--r--mysql-test/r/type_newdecimal.result16
-rw-r--r--mysql-test/r/union.result15
-rw-r--r--mysql-test/r/update.result12
-rw-r--r--mysql-test/r/user_var-binlog.result3
-rw-r--r--mysql-test/r/variables.result2
-rw-r--r--mysql-test/r/view.result45
-rw-r--r--mysql-test/r/view_query_cache.result9
-rw-r--r--mysql-test/r/xa.result14
-rw-r--r--mysql-test/std_data/ndb_config_mycnf1.cnf15
-rw-r--r--mysql-test/t/cast.test4
-rw-r--r--mysql-test/t/ctype_ujis.test42
-rw-r--r--mysql-test/t/ctype_utf8.test18
-rw-r--r--mysql-test/t/default.test1
-rw-r--r--mysql-test/t/derived.test13
-rw-r--r--mysql-test/t/federated.test44
-rw-r--r--mysql-test/t/federated_bug_13118.test42
-rw-r--r--mysql-test/t/func_group.test69
-rw-r--r--mysql-test/t/func_in.test7
-rw-r--r--mysql-test/t/func_str.test10
-rw-r--r--mysql-test/t/group_min_max.test23
-rw-r--r--mysql-test/t/im_daemon_life_cycle-im.opt2
-rw-r--r--mysql-test/t/im_daemon_life_cycle.imtest15
-rw-r--r--mysql-test/t/im_life_cycle.imtest141
-rw-r--r--mysql-test/t/im_options_set.imtest142
-rw-r--r--mysql-test/t/im_options_unset.imtest150
-rw-r--r--mysql-test/t/im_utils.imtest115
-rw-r--r--mysql-test/t/information_schema.test11
-rw-r--r--mysql-test/t/information_schema_inno.test2
-rw-r--r--mysql-test/t/innodb.test168
-rw-r--r--mysql-test/t/join_nested.test31
-rwxr-xr-xmysql-test/t/kill_n_check.sh66
-rw-r--r--mysql-test/t/loaddata.test28
-rw-r--r--mysql-test/t/merge.test32
-rw-r--r--mysql-test/t/multi_statement.test4
-rw-r--r--mysql-test/t/myisam.test54
-rw-r--r--mysql-test/t/mysql.test10
-rw-r--r--mysql-test/t/mysqlbinlog.test4
-rw-r--r--mysql-test/t/mysqldump-max.test73
-rw-r--r--mysql-test/t/mysqldump.test14
-rw-r--r--mysql-test/t/mysqltest.test20
-rw-r--r--mysql-test/t/ndb_alter_table.test119
-rw-r--r--mysql-test/t/ndb_config.test3
-rw-r--r--mysql-test/t/range.test50
-rw-r--r--mysql-test/t/rpl_multi_delete.test26
-rw-r--r--mysql-test/t/rpl_multi_delete2-slave.opt2
-rw-r--r--mysql-test/t/rpl_multi_delete2.test45
-rw-r--r--mysql-test/t/rpl_multi_update.test23
-rw-r--r--mysql-test/t/select.test86
-rw-r--r--mysql-test/t/skip_name_resolve.test10
-rw-r--r--mysql-test/t/sp-big.test49
-rw-r--r--mysql-test/t/sp.test108
-rw-r--r--mysql-test/t/sql_mode.test12
-rw-r--r--mysql-test/t/temp_table.test25
-rw-r--r--mysql-test/t/type_bit.test2
-rw-r--r--mysql-test/t/type_decimal.test10
-rw-r--r--mysql-test/t/type_float.test9
-rw-r--r--mysql-test/t/union.test8
-rw-r--r--mysql-test/t/update.test12
-rw-r--r--mysql-test/t/view.test43
-rw-r--r--mysql-test/t/view_query_cache.test12
-rw-r--r--mysql-test/t/xa.test14
-rw-r--r--mysql-test/valgrind.supp24
128 files changed, 4119 insertions, 503 deletions
diff --git a/mysql-test/include/im_check_os.inc b/mysql-test/include/im_check_os.inc
new file mode 100644
index 00000000000..9465115feb5
--- /dev/null
+++ b/mysql-test/include/im_check_os.inc
@@ -0,0 +1,7 @@
+--connect (dflt_server_con,localhost,root,,mysql,$IM_MYSQLD1_PORT,$IM_MYSQLD1_SOCK)
+--connection dflt_server_con
+
+--source include/not_windows.inc
+
+--connection default
+--disconnect dflt_server_con
diff --git a/mysql-test/lib/init_db.sql b/mysql-test/lib/init_db.sql
index 37353e5974f..b366a429ab2 100644
--- a/mysql-test/lib/init_db.sql
+++ b/mysql-test/lib/init_db.sql
@@ -62,7 +62,7 @@ comment='Host privileges; Merged with database privileges';
CREATE TABLE user (
Host char(60) binary DEFAULT '' NOT NULL,
User char(16) binary DEFAULT '' NOT NULL,
- Password char(41) binary DEFAULT '' NOT NULL,
+ Password binary(41) DEFAULT '' NOT NULL,
Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
diff --git a/mysql-test/lib/mtr_cases.pl b/mysql-test/lib/mtr_cases.pl
index 250c3562227..ca984d37ecf 100644
--- a/mysql-test/lib/mtr_cases.pl
+++ b/mysql-test/lib/mtr_cases.pl
@@ -61,22 +61,6 @@ sub collect_test_cases ($) {
$elem= $tname;
$tname =~ s/\.imtest$//;
$component_id= 'im';
-
- if ( $::glob_use_embedded_server )
- {
- mtr_report(
- "Instance Manager's tests are not available in embedded mode." .
- "Test case '$tname' is skipped.");
- next;
- }
-
- unless ( $::exe_im )
- {
- mtr_report(
- "Instance Manager executable is unavailable. " .
- "Test case '$tname' is skipped.");
- next;
- }
}
# If target component is known, check that the specified test case
@@ -115,7 +99,7 @@ sub collect_test_cases ($) {
$component_id= 'im';
}
}
-
+
collect_one_test_case($testdir,$resdir,$tname,$elem,$cases,{},
$component_id);
}
@@ -403,6 +387,34 @@ sub collect_one_test_case($$$$$$$) {
$tinfo->{'comment'}= mtr_fromfile($disabled_file);
}
+ if ( $component_id eq 'im' )
+ {
+ if ( $::glob_use_embedded_server )
+ {
+ $tinfo->{'skip'}= 1;
+
+ mtr_report(
+ "Instance Manager tests are not available in embedded mode. " .
+ "Test case '$tname' is skipped.");
+ }
+ elsif ( $::opt_ps_protocol )
+ {
+ $tinfo->{'skip'}= 1;
+
+ mtr_report(
+ "Instance Manager tests are not run with --ps-protocol. " .
+ "Test case '$tname' is skipped.");
+ }
+ elsif ( !$::exe_im )
+ {
+ $tinfo->{'skip'}= 1;
+
+ mtr_report(
+ "Instance Manager executable is unavailable." .
+ "Test case '$tname' is skipped.");
+ }
+ }
+
# We can't restart a running server that may be in use
if ( $::glob_use_running_server and
diff --git a/mysql-test/lib/mtr_process.pl b/mysql-test/lib/mtr_process.pl
index 5149d322f7f..eb60df4a5cb 100644
--- a/mysql-test/lib/mtr_process.pl
+++ b/mysql-test/lib/mtr_process.pl
@@ -680,7 +680,8 @@ sub mtr_mysqladmin_shutdown {
mtr_add_arg($args, "shutdown");
# We don't wait for termination of mysqladmin
my $pid= mtr_spawn($::exe_mysqladmin, $args,
- "", $::path_manager_log, $::path_manager_log, "");
+ "", $::path_manager_log, $::path_manager_log, "",
+ { append_log_file => 1 });
$mysql_admin_pids{$pid}= 1;
}
@@ -847,14 +848,16 @@ sub sleep_until_file_created ($$$) {
sub mtr_kill_processes ($) {
my $pids = shift;
- foreach my $sig (15,9)
+ foreach my $sig (15, 9)
{
- my $retries= 20; # FIXME 20 seconds, this is silly!
- kill($sig, @{$pids});
- while ( $retries-- and kill(0, @{$pids}) )
+ my $retries= 10;
+ while (1)
{
- mtr_debug("Sleep 1 second waiting for processes to die");
- sleep(1) # Wait one second
+ kill($sig, @{$pids});
+ last unless kill (0, @{$pids}) and $retries--;
+
+ mtr_debug("Sleep 2 second waiting for processes to die");
+ sleep(2);
}
}
}
diff --git a/mysql-test/lib/mtr_report.pl b/mysql-test/lib/mtr_report.pl
index 9002f204602..515988ee5c7 100644
--- a/mysql-test/lib/mtr_report.pl
+++ b/mysql-test/lib/mtr_report.pl
@@ -257,11 +257,11 @@ sub mtr_print_header () {
print "\n";
if ( $::opt_timer )
{
- print "TEST RESULT TIME (ms)\n";
+ print "TEST RESULT TIME (ms)\n";
}
else
{
- print "TEST RESULT\n";
+ print "TEST RESULT\n";
}
mtr_print_line();
print "\n";
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index d1db4a65bac..101c18ec80f 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -2,37 +2,35 @@
# -*- cperl -*-
# This is a transformation of the "mysql-test-run" Bourne shell script
-# to Perl. This is just an intermediate step, the goal is to rewrite
-# the Perl script to C. The complexity of the mysql-test-run script
-# makes it a bit hard to write and debug it as a C program directly,
-# so this is considered a prototype.
+# to Perl. There are reasons this rewrite is not the prettiest Perl
+# you have seen
#
-# Because of this the Perl coding style may in some cases look a bit
-# funny. The rules used are
+# - The original script is huge and for most part uncommented,
+# not even a usage description of the flags.
#
-# - The coding style is as close as possible to the C/C++ MySQL
-# coding standard.
+# - There has been an attempt to write a replacement in C for the
+# original Bourne shell script. It was kind of working but lacked
+# lot of functionality to really be a replacement. Not to redo
+# that mistake and catch all the obscure features of the original
+# script, the rewrite in Perl is more close to the original script
+# meaning it also share some of the ugly parts as well.
#
-# - Where NULL is to be returned, the undefined value is used.
+# - The original intention was that this script was to be a prototype
+# to be the base for a new C version with full functionality. Since
+# then it was decided that the Perl version should replace the
+# Bourne shell version, but the Perl style still reflects the wish
+# to make the Perl to C step easy.
#
-# - Regexp comparisons are simple and can be translated to strcmp
-# and other string functions. To ease this transformation matching
-# is done in the lib "lib/mtr_match.pl", i.e. regular expressions
-# should be avoided in the main program.
+# Some coding style from the original intent has been kept
#
-# - The "unless" construct is not to be used. It is the same as "if !".
-#
-# - opendir/readdir/closedir is used instead of glob()/<*>.
+# - To make this Perl script easy to alter even for those that not
+# code Perl that often, the coding style is as close as possible to
+# the C/C++ MySQL coding standard.
#
# - All lists of arguments to send to commands are Perl lists/arrays,
# not strings we append args to. Within reason, most string
# concatenation for arguments should be avoided.
#
-# - sprintf() is to be used, within reason, for all string creation.
-# This mtr_add_arg() function is also based on sprintf(), i.e. you
-# use a format string and put the variable argument in the argument
-# list.
-#
# - Functions defined in the main program are not to be prefixed,
# functions in "library files" are to be prefixed with "mtr_" (for
# Mysql-Test-Run). There are some exceptions, code that fits best in
@@ -241,8 +239,10 @@ our $opt_ps_protocol;
our $opt_sleep_time_after_restart= 1;
our $opt_sleep_time_for_delete= 10;
-our $opt_testcase_timeout= 5; # 5 min max
-our $opt_suite_timeout= 120; # 2 hours max
+our $opt_testcase_timeout;
+our $opt_suite_timeout;
+my $default_testcase_timeout= 10; # 10 min max
+my $default_suite_timeout= 120; # 2 hours max
our $opt_socket;
@@ -260,6 +260,7 @@ our $opt_user;
our $opt_user_test;
our $opt_valgrind;
+our $opt_valgrind_mysqltest;
our $opt_valgrind_all;
our $opt_valgrind_options;
@@ -473,6 +474,7 @@ sub command_line_setup () {
# Read the command line
# Note: Keep list, and the order, in sync with usage at end of this file
+ Getopt::Long::Configure("pass_through");
GetOptions(
# Control what engine/variation to run
'embedded-server' => \$opt_embedded_server,
@@ -521,8 +523,9 @@ sub command_line_setup () {
# Coverage, profiling etc
'gcov' => \$opt_gcov,
'gprof' => \$opt_gprof,
- 'valgrind' => \$opt_valgrind,
- 'valgrind-all' => \$opt_valgrind_all,
+ 'valgrind:s' => \$opt_valgrind,
+ 'valgrind-mysqltest:s' => \$opt_valgrind_mysqltest,
+ 'valgrind-all:s' => \$opt_valgrind_all,
'valgrind-options=s' => \$opt_valgrind_options,
# Misc
@@ -562,7 +565,21 @@ sub command_line_setup () {
usage("");
}
- @opt_cases= @ARGV;
+ foreach my $arg ( @ARGV )
+ {
+ if ( $arg =~ /^--skip-/ )
+ {
+ push(@opt_extra_mysqld_opt, $arg);
+ }
+ elsif ( $arg =~ /^-/ )
+ {
+ usage("Invalid option \"$arg\"");
+ }
+ else
+ {
+ push(@opt_cases, $arg);
+ }
+ }
# --------------------------------------------------------------------------
# Set the "var/" directory, as it is the base for everything else
@@ -654,11 +671,6 @@ sub command_line_setup () {
mtr_error("Coverage test needs the source - please use source dist");
}
- if ( $glob_use_embedded_server and ! $opt_source_dist )
- {
- mtr_error("Embedded server needs source tree - please use source dist");
- }
-
if ( $opt_gdb )
{
$opt_wait_timeout= 300;
@@ -700,29 +712,42 @@ sub command_line_setup () {
$opt_with_ndbcluster= 0;
}
- # FIXME
+ # The ":s" in the argument spec, means we have three different cases
+ #
+ # undefined option not set
+ # "" option set with no argument
+ # "somestring" option is name/path of valgrind executable
+
+ # Take executable path from any of them, if any
+ $opt_valgrind= $opt_valgrind_mysqltest if $opt_valgrind_mysqltest;
+ $opt_valgrind= $opt_valgrind_all if $opt_valgrind_all;
+
+ # If valgrind flag not defined, define if other valgrind flags are
+ unless ( defined $opt_valgrind )
+ {
+ $opt_valgrind= ""
+ if defined $opt_valgrind_mysqltest or defined $opt_valgrind_all;
+ }
+
+ if ( ! $opt_testcase_timeout )
+ {
+ $opt_testcase_timeout= $default_testcase_timeout;
+ $opt_testcase_timeout*= 10 if defined $opt_valgrind;
+ }
+
+ if ( ! $opt_suite_timeout )
+ {
+ $opt_suite_timeout= $default_suite_timeout;
+ $opt_suite_timeout*= 4 if defined $opt_valgrind;
+ }
- #if ( $opt_valgrind or $opt_valgrind_all )
- #{
- # VALGRIND=`which valgrind` # this will print an error if not found FIXME
- # Give good warning to the user and stop
- # if ( ! $VALGRIND )
- # {
- # print "You need to have the 'valgrind' program in your PATH to run mysql-test-run with option --valgrind. Valgrind's home page is http://valgrind.kde.org.\n"
- # exit 1
- # }
+ if ( defined $opt_valgrind )
+ {
+ $opt_sleep_time_after_restart= 10;
+ $opt_sleep_time_for_delete= 60;
# >=2.1.2 requires the --tool option, some versions write to stdout, some to stderr
- # valgrind --help 2>&1 | grep "\-\-tool" > /dev/null && VALGRIND="$VALGRIND --tool=memcheck"
- # VALGRIND="$VALGRIND --alignment=8 --leak-check=yes --num-callers=16"
- # $opt_extra_mysqld_opt.= " --skip-safemalloc --skip-bdb";
- # SLEEP_TIME_AFTER_RESTART=10
- # $opt_sleep_time_for_delete= 60
- # $glob_use_running_server= ""
- # if ( "$1"= "--valgrind-all" )
- # {
- # VALGRIND="$VALGRIND -v --show-reachable=yes"
- # }
- #}
+ # valgrind --help 2>&1 | grep "\-\-tool" > /dev/null && VALGRIND="$VALGRIND --tool=memcheck"
+ }
if ( ! $opt_user )
{
@@ -738,78 +763,96 @@ sub command_line_setup () {
# Put this into a hash, will be a C struct
- $master->[0]->{'path_myddir'}= "$opt_vardir/master-data";
- $master->[0]->{'path_myerr'}= "$opt_vardir/log/master.err";
- $master->[0]->{'path_mylog'}= "$opt_vardir/log/master.log";
- $master->[0]->{'path_mypid'}= "$opt_vardir/run/master.pid";
- $master->[0]->{'path_mysock'}= "$opt_tmpdir/master.sock";
- $master->[0]->{'path_myport'}= $opt_master_myport;
- $master->[0]->{'start_timeout'}= 400; # enough time create innodb tables
-
- $master->[0]->{'ndbcluster'}= 1; # ndbcluster not started
-
- $master->[1]->{'path_myddir'}= "$opt_vardir/master1-data";
- $master->[1]->{'path_myerr'}= "$opt_vardir/log/master1.err";
- $master->[1]->{'path_mylog'}= "$opt_vardir/log/master1.log";
- $master->[1]->{'path_mypid'}= "$opt_vardir/run/master1.pid";
- $master->[1]->{'path_mysock'}= "$opt_tmpdir/master1.sock";
- $master->[1]->{'path_myport'}= $opt_master_myport + 1;
- $master->[1]->{'start_timeout'}= 400; # enough time create innodb tables
-
- $slave->[0]->{'path_myddir'}= "$opt_vardir/slave-data";
- $slave->[0]->{'path_myerr'}= "$opt_vardir/log/slave.err";
- $slave->[0]->{'path_mylog'}= "$opt_vardir/log/slave.log";
- $slave->[0]->{'path_mypid'}= "$opt_vardir/run/slave.pid";
- $slave->[0]->{'path_mysock'}= "$opt_tmpdir/slave.sock";
- $slave->[0]->{'path_myport'}= $opt_slave_myport;
- $slave->[0]->{'start_timeout'}= 400;
-
- $slave->[1]->{'path_myddir'}= "$opt_vardir/slave1-data";
- $slave->[1]->{'path_myerr'}= "$opt_vardir/log/slave1.err";
- $slave->[1]->{'path_mylog'}= "$opt_vardir/log/slave1.log";
- $slave->[1]->{'path_mypid'}= "$opt_vardir/run/slave1.pid";
- $slave->[1]->{'path_mysock'}= "$opt_tmpdir/slave1.sock";
- $slave->[1]->{'path_myport'}= $opt_slave_myport + 1;
- $slave->[1]->{'start_timeout'}= 300;
-
- $slave->[2]->{'path_myddir'}= "$opt_vardir/slave2-data";
- $slave->[2]->{'path_myerr'}= "$opt_vardir/log/slave2.err";
- $slave->[2]->{'path_mylog'}= "$opt_vardir/log/slave2.log";
- $slave->[2]->{'path_mypid'}= "$opt_vardir/run/slave2.pid";
- $slave->[2]->{'path_mysock'}= "$opt_tmpdir/slave2.sock";
- $slave->[2]->{'path_myport'}= $opt_slave_myport + 2;
- $slave->[2]->{'start_timeout'}= 300;
-
- $instance_manager->{'path_err'}= "$opt_vardir/log/im.err";
- $instance_manager->{'path_log'}= "$opt_vardir/log/im.log";
- $instance_manager->{'path_pid'}= "$opt_vardir/run/im.pid";
- $instance_manager->{'path_sock'}= "$opt_tmpdir/im.sock";
- $instance_manager->{'port'}= $im_port;
- $instance_manager->{'start_timeout'}= $master->[0]->{'start_timeout'};
- $instance_manager->{'admin_login'}= 'im_admin';
- $instance_manager->{'admin_password'}= 'im_admin_secret';
- $instance_manager->{'admin_sha1'}= '*598D51AD2DFF7792045D6DF3DDF9AA1AF737B295';
- $instance_manager->{'password_file'}= "$opt_vardir/im.passwd";
- $instance_manager->{'defaults_file'}= "$opt_vardir/im.cnf";
-
- $instance_manager->{'instances'}->[0]->{'server_id'}= 1;
- $instance_manager->{'instances'}->[0]->{'port'}= $im_mysqld1_port;
- $instance_manager->{'instances'}->[0]->{'path_datadir'}=
- "$opt_vardir/im_mysqld_1.data";
- $instance_manager->{'instances'}->[0]->{'path_sock'}=
- "$opt_vardir/mysqld_1.sock";
- $instance_manager->{'instances'}->[0]->{'path_pid'}=
- "$opt_vardir/mysqld_1.pid";
-
- $instance_manager->{'instances'}->[1]->{'server_id'}= 2;
- $instance_manager->{'instances'}->[1]->{'port'}= $im_mysqld2_port;
- $instance_manager->{'instances'}->[1]->{'path_datadir'}=
- "$opt_vardir/im_mysqld_2.data";
- $instance_manager->{'instances'}->[1]->{'path_sock'}=
- "$opt_vardir/mysqld_2.sock";
- $instance_manager->{'instances'}->[1]->{'path_pid'}=
- "$opt_vardir/mysqld_2.pid";
- $instance_manager->{'instances'}->[1]->{'nonguarded'}= 1;
+ $master->[0]=
+ {
+ path_myddir => "$opt_vardir/master-data",
+ path_myerr => "$opt_vardir/log/master.err",
+ path_mylog => "$opt_vardir/log/master.log",
+ path_mypid => "$opt_vardir/run/master.pid",
+ path_mysock => "$opt_tmpdir/master.sock",
+ path_myport => $opt_master_myport,
+ start_timeout => 400, # enough time create innodb tables
+
+ ndbcluster => 1, # ndbcluster not started
+ };
+
+ $master->[1]=
+ {
+ path_myddir => "$opt_vardir/master1-data",
+ path_myerr => "$opt_vardir/log/master1.err",
+ path_mylog => "$opt_vardir/log/master1.log",
+ path_mypid => "$opt_vardir/run/master1.pid",
+ path_mysock => "$opt_tmpdir/master1.sock",
+ path_myport => $opt_master_myport + 1,
+ start_timeout => 400, # enough time create innodb tables
+ };
+
+ $slave->[0]=
+ {
+ path_myddir => "$opt_vardir/slave-data",
+ path_myerr => "$opt_vardir/log/slave.err",
+ path_mylog => "$opt_vardir/log/slave.log",
+ path_mypid => "$opt_vardir/run/slave.pid",
+ path_mysock => "$opt_tmpdir/slave.sock",
+ path_myport => $opt_slave_myport,
+ start_timeout => 400,
+ };
+
+ $slave->[1]=
+ {
+ path_myddir => "$opt_vardir/slave1-data",
+ path_myerr => "$opt_vardir/log/slave1.err",
+ path_mylog => "$opt_vardir/log/slave1.log",
+ path_mypid => "$opt_vardir/run/slave1.pid",
+ path_mysock => "$opt_tmpdir/slave1.sock",
+ path_myport => $opt_slave_myport + 1,
+ start_timeout => 300,
+ };
+
+ $slave->[2]=
+ {
+ path_myddir => "$opt_vardir/slave2-data",
+ path_myerr => "$opt_vardir/log/slave2.err",
+ path_mylog => "$opt_vardir/log/slave2.log",
+ path_mypid => "$opt_vardir/run/slave2.pid",
+ path_mysock => "$opt_tmpdir/slave2.sock",
+ path_myport => $opt_slave_myport + 2,
+ start_timeout => 300,
+ };
+
+ $instance_manager=
+ {
+ path_err => "$opt_vardir/log/im.err",
+ path_log => "$opt_vardir/log/im.log",
+ path_pid => "$opt_vardir/run/im.pid",
+ path_sock => "$opt_tmpdir/im.sock",
+ port => $im_port,
+ start_timeout => $master->[0]->{'start_timeout'},
+ admin_login => 'im_admin',
+ admin_password => 'im_admin_secret',
+ admin_sha1 => '*598D51AD2DFF7792045D6DF3DDF9AA1AF737B295',
+ password_file => "$opt_vardir/im.passwd",
+ defaults_file => "$opt_vardir/im.cnf",
+ };
+
+ $instance_manager->{'instances'}->[0]=
+ {
+ server_id => 1,
+ port => $im_mysqld1_port,
+ path_datadir => "$opt_vardir/im_mysqld_1.data",
+ path_sock => "$opt_vardir/mysqld_1.sock",
+ path_pid => "$opt_vardir/mysqld_1.pid",
+ };
+
+ $instance_manager->{'instances'}->[1]=
+ {
+ server_id => 2,
+ port => $im_mysqld2_port,
+ path_datadir => "$opt_vardir/im_mysqld_2.data",
+ path_sock => "$opt_vardir/mysqld_2.sock",
+ path_pid => "$opt_vardir/mysqld_2.pid",
+ nonguarded => 1,
+ };
if ( $opt_extern )
{
@@ -854,7 +897,7 @@ sub executable_setup () {
if ( $glob_use_embedded_server )
{
my $path_examples= "$glob_basedir/libmysqld/examples";
- $exe_mysqltest= mtr_exe_exists("$path_examples/mysqltest");
+ $exe_mysqltest= mtr_exe_exists("$path_examples/mysqltest_embedded");
$exe_mysql_client_test=
mtr_exe_exists("$path_examples/mysql_client_test_embedded",
"/usr/bin/false");
@@ -881,7 +924,6 @@ sub executable_setup () {
else
{
$path_client_bindir= mtr_path_exists("$glob_basedir/bin");
- $exe_mysqltest= mtr_exe_exists("$path_client_bindir/mysqltest");
$exe_mysqldump= mtr_exe_exists("$path_client_bindir/mysqldump");
$exe_mysqlshow= mtr_exe_exists("$path_client_bindir/mysqlshow");
$exe_mysqlbinlog= mtr_exe_exists("$path_client_bindir/mysqlbinlog");
@@ -975,10 +1017,14 @@ sub environment_setup () {
# $ENV{'MYSQL_TCP_PORT'}= '@MYSQL_TCP_PORT@'; # FIXME
$ENV{'MYSQL_TCP_PORT'}= 3306;
+ $ENV{'IM_PATH_PID'}= $instance_manager->{path_pid};
+
$ENV{'IM_MYSQLD1_SOCK'}= $instance_manager->{instances}->[0]->{path_sock};
$ENV{'IM_MYSQLD1_PORT'}= $instance_manager->{instances}->[0]->{port};
+ $ENV{'IM_MYSQLD1_PATH_PID'}=$instance_manager->{instances}->[0]->{path_pid};
$ENV{'IM_MYSQLD2_SOCK'}= $instance_manager->{instances}->[1]->{path_sock};
$ENV{'IM_MYSQLD2_PORT'}= $instance_manager->{instances}->[1]->{port};
+ $ENV{'IM_MYSQLD2_PATH_PID'}=$instance_manager->{instances}->[1]->{path_pid};
if ( $glob_cygwin_perl )
{
@@ -1883,7 +1929,7 @@ sub mysqld_arguments ($$$$$) {
mtr_add_arg($args, "%s--language=%s", $prefix, $path_language);
mtr_add_arg($args, "%s--tmpdir=$opt_tmpdir", $prefix);
- if ( $opt_valgrind )
+ if ( defined $opt_valgrind )
{
mtr_add_arg($args, "%s--skip-safemalloc", $prefix);
mtr_add_arg($args, "%s--skip-bdb", $prefix);
@@ -2109,29 +2155,9 @@ sub mysqld_start ($$$$) {
mtr_init_args(\$args);
- if ( $opt_valgrind )
+ if ( defined $opt_valgrind )
{
-
- mtr_add_arg($args, "--tool=memcheck");
- mtr_add_arg($args, "--alignment=8");
- mtr_add_arg($args, "--leak-check=yes");
- mtr_add_arg($args, "--num-callers=16");
-
- if ( $opt_valgrind_all )
- {
- mtr_add_arg($args, "-v");
- mtr_add_arg($args, "--show-reachable=yes");
- }
-
- if ( $opt_valgrind_options )
- {
- # FIXME split earlier and put into @glob_valgrind_*
- mtr_add_arg($args, split(' ', $opt_valgrind_options));
- }
-
- mtr_add_arg($args, $exe);
-
- $exe= $opt_valgrind;
+ valgrind_arguments($args, \$exe);
}
mysqld_arguments($args,$type,$idx,$extra_opt,$slave_master_info);
@@ -2140,7 +2166,9 @@ sub mysqld_start ($$$$) {
{
if ( $pid= mtr_spawn($exe, $args, "",
$master->[$idx]->{'path_myerr'},
- $master->[$idx]->{'path_myerr'}, "") )
+ $master->[$idx]->{'path_myerr'},
+ "",
+ { append_log_file => 1 }) )
{
return sleep_until_file_created($master->[$idx]->{'path_mypid'},
$master->[$idx]->{'start_timeout'}, $pid);
@@ -2151,7 +2179,9 @@ sub mysqld_start ($$$$) {
{
if ( $pid= mtr_spawn($exe, $args, "",
$slave->[$idx]->{'path_myerr'},
- $slave->[$idx]->{'path_myerr'}, "") )
+ $slave->[$idx]->{'path_myerr'},
+ "",
+ { append_log_file => 1 }) )
{
return sleep_until_file_created($slave->[$idx]->{'path_mypid'},
$master->[$idx]->{'start_timeout'}, $pid);
@@ -2291,6 +2321,12 @@ sub im_stop($) {
return;
}
+ # Re-read pid from the file, since during tests Instance Manager could have
+ # been restarted, so its pid could have been changed.
+
+ $instance_manager->{'pid'} =
+ mtr_get_pid_from_file($instance_manager->{'path_pid'});
+
# Inspired from mtr_stop_mysqld_servers().
start_reap_all();
@@ -2403,6 +2439,11 @@ sub run_mysqltest ($) {
mtr_init_args(\$args);
+ if ( defined $opt_valgrind_mysqltest )
+ {
+ valgrind_arguments($args, \$exe);
+ }
+
mtr_add_arg($args, "--no-defaults");
mtr_add_arg($args, "--silent");
mtr_add_arg($args, "-v");
@@ -2448,11 +2489,6 @@ sub run_mysqltest ($) {
mtr_add_arg($args, "--big-test");
}
- if ( $opt_record )
- {
- mtr_add_arg($args, "--record");
- }
-
if ( $opt_compress )
{
mtr_add_arg($args, "--compress");
@@ -2478,9 +2514,6 @@ sub run_mysqltest ($) {
$glob_mysql_test_dir);
}
- mtr_add_arg($args, "-R");
- mtr_add_arg($args, $tinfo->{'result_file'});
-
# ----------------------------------------------------------------------
# If embedded server, we create server args to give mysqltest to pass on
# ----------------------------------------------------------------------
@@ -2495,9 +2528,51 @@ sub run_mysqltest ($) {
# ----------------------------------------------------------------------
$ENV{'MYSQL_TEST'}= "$exe_mysqltest " . join(" ", @$args);
+ # ----------------------------------------------------------------------
+ # Add arguments that should not go into the MYSQL_TEST env var
+ # ----------------------------------------------------------------------
+
+ mtr_add_arg($args, "-R");
+ mtr_add_arg($args, $tinfo->{'result_file'});
+
+ if ( $opt_record )
+ {
+ mtr_add_arg($args, "--record");
+ }
+
return mtr_run_test($exe,$args,$tinfo->{'path'},"",$path_timefile,"");
}
+
+sub valgrind_arguments {
+ my $args= shift;
+ my $exe= shift;
+
+ mtr_add_arg($args, "--tool=memcheck"); # From >= 2.1.2 needs this option
+ mtr_add_arg($args, "--alignment=8");
+ mtr_add_arg($args, "--leak-check=yes");
+ mtr_add_arg($args, "--num-callers=16");
+ mtr_add_arg($args, "--suppressions=%s/valgrind.supp", $glob_mysql_test_dir)
+ if -f "$glob_mysql_test_dir/valgrind.supp";
+
+ if ( defined $opt_valgrind_all )
+ {
+ mtr_add_arg($args, "-v");
+ mtr_add_arg($args, "--show-reachable=yes");
+ }
+
+ if ( $opt_valgrind_options )
+ {
+ # FIXME split earlier and put into @glob_valgrind_*
+ mtr_add_arg($args, split(' ', $opt_valgrind_options));
+ }
+
+ mtr_add_arg($args, $$exe);
+
+ $$exe= $opt_valgrind || "valgrind";
+}
+
+
##############################################################################
#
# Usage
@@ -2562,8 +2637,11 @@ Options for coverage, profiling etc
gcov FIXME
gprof FIXME
- valgrind FIXME
- valgrind-all FIXME
+ valgrind[=EXE] Run the "mysqltest" executable as well as the "mysqld"
+ server using valgrind, optionally specifying the
+ executable path/name
+ valgrind-mysqltest[=EXE] In addition, run the "mysqltest" executable with valgrind
+ valgrind-all[=EXE] Adds verbose flag, and --show-reachable to valgrind
valgrind-options=ARGS Extra options to give valgrind
Misc options
diff --git a/mysql-test/r/bdb.result b/mysql-test/r/bdb.result
index d525b019c64..2bba44d36e9 100644
--- a/mysql-test/r/bdb.result
+++ b/mysql-test/r/bdb.result
@@ -1429,10 +1429,10 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 13 NULL # Using where
explain select count(*) from t1 where v between 'a' and 'a ';
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 13 NULL # Using where
+1 SIMPLE t1 ref v v 13 const # Using where
explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n';
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 13 NULL # Using where
+1 SIMPLE t1 ref v v 13 const # Using where
alter table t1 add unique(v);
ERROR 23000: Duplicate entry '{ ' for key 1
alter table t1 add key(v);
@@ -1622,10 +1622,10 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 258 NULL # Using where
explain select count(*) from t1 where v between 'a' and 'a ';
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 258 NULL # Using where
+1 SIMPLE t1 ref v v 258 const # Using where
explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n';
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 258 NULL # Using where
+1 SIMPLE t1 ref v v 258 const # Using where
explain select * from t1 where v='a';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref v v 258 const # Using where
@@ -1702,10 +1702,10 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 33 NULL # Using where
explain select count(*) from t1 where v between 'a' and 'a ';
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 33 NULL # Using where
+1 SIMPLE t1 ref v v 33 const # Using where
explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n';
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 33 NULL # Using where
+1 SIMPLE t1 ref v v 33 const # Using where
explain select * from t1 where v='a';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref v v 33 const # Using where
diff --git a/mysql-test/r/case.result b/mysql-test/r/case.result
index b02f85132aa..ea80695ad7b 100644
--- a/mysql-test/r/case.result
+++ b/mysql-test/r/case.result
@@ -103,8 +103,8 @@ t1 CREATE TABLE `t1` (
`c2` varchar(1) character set latin1 collate latin1_danish_ci NOT NULL default '',
`c3` varbinary(1) NOT NULL default '',
`c4` varbinary(1) NOT NULL default '',
- `c5` varbinary(4) NOT NULL default '',
- `c6` varbinary(4) NOT NULL default '',
+ `c5` varbinary(3) NOT NULL default '',
+ `c6` varbinary(3) NOT NULL default '',
`c7` decimal(2,1) NOT NULL default '0.0',
`c8` decimal(2,1) NOT NULL default '0.0',
`c9` decimal(2,1) default NULL,
@@ -152,11 +152,11 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`COALESCE(1)` int(1) NOT NULL default '0',
- `COALESCE(1.0)` decimal(2,1) NOT NULL default '0.0',
+ `COALESCE(1.0)` decimal(2,1) unsigned NOT NULL default '0.0',
`COALESCE('a')` varchar(1) NOT NULL default '',
`COALESCE(1,1.0)` decimal(2,1) NOT NULL default '0.0',
`COALESCE(1,'1')` varbinary(1) NOT NULL default '',
- `COALESCE(1.1,'1')` varbinary(4) NOT NULL default '',
+ `COALESCE(1.1,'1')` varbinary(3) NOT NULL default '',
`COALESCE('a' COLLATE latin1_bin,'b')` varchar(1) character set latin1 collate latin1_bin NOT NULL default ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
diff --git a/mysql-test/r/cast.result b/mysql-test/r/cast.result
index 1b5bdf98afd..fa8e810cf2b 100644
--- a/mysql-test/r/cast.result
+++ b/mysql-test/r/cast.result
@@ -74,6 +74,18 @@ CAST(DATE "2004-01-22 21:45:33" AS BINARY(4))
2004
Warnings:
Warning 1292 Truncated incorrect CHAR(4) value: '2004-01-22 21:45:33'
+select CAST(0xb3 as signed);
+CAST(0xb3 as signed)
+179
+select CAST(0x8fffffffffffffff as signed);
+CAST(0x8fffffffffffffff as signed)
+-8070450532247928833
+select CAST(0xffffffffffffffff as unsigned);
+CAST(0xffffffffffffffff as unsigned)
+18446744073709551615
+select CAST(0xfffffffffffffffe as signed);
+CAST(0xfffffffffffffffe as signed)
+-2
select cast('-10a' as signed integer);
cast('-10a' as signed integer)
-10
diff --git a/mysql-test/r/ctype_ucs_binlog.result b/mysql-test/r/ctype_ucs_binlog.result
index 4267e495959..14220a7df13 100644
--- a/mysql-test/r/ctype_ucs_binlog.result
+++ b/mysql-test/r/ctype_ucs_binlog.result
@@ -17,6 +17,7 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq
SET @@session.sql_mode=0;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
insert into t2 values (@v);
-ROLLBACK;
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
drop table t2;
diff --git a/mysql-test/r/ctype_ujis.result b/mysql-test/r/ctype_ujis.result
index 0bc101d491d..0fee6fc3456 100644
--- a/mysql-test/r/ctype_ujis.result
+++ b/mysql-test/r/ctype_ujis.result
@@ -2271,3 +2271,33 @@ select c1 from t1 where c1 like 'abcde111%' order by c1;
c1
abcde111
drop table t1;
+DROP TABLE IF EXISTS t1, t2;
+DROP PROCEDURE IF EXISTS sp1;
+set names ujis;
+set character_set_database = ujis;
+set character_set_server = ujis;
+CREATE TABLE t1(c1 char(2)) default charset = ujis;
+CREATE TABLE t2(c2 char(2)) default charset = ujis;
+INSERT INTO t1 VALUES(_ujis 0xA4A2);
+CREATE PROCEDURE sp1()
+BEGIN
+DECLARE a CHAR(1);
+DECLARE cur1 CURSOR FOR SELECT c1 FROM t1;
+OPEN cur1;
+FETCH cur1 INTO a;
+INSERT INTO t2 VALUES (a);
+CLOSE cur1;
+END|
+CALL sp1();
+SELECT c1,c2 FROM t1,t2;
+c1 c2
+¤¢ ¤¢
+SELECT hex(convert(_latin1 0xA4A2 using ujis)),hex(c2) FROM t1,t2;
+hex(convert(_latin1 0xA4A2 using ujis)) hex(c2)
+8FA2F0A1F1 A4A2
+DROP PROCEDURE sp1;
+DROP TABLE t1;
+DROP TABLE t2;
+set names default;
+set character_set_database=default;
+set character_set_server=default;
diff --git a/mysql-test/r/ctype_utf8.result b/mysql-test/r/ctype_utf8.result
index 844750e3fed..8e10e97d49d 100644
--- a/mysql-test/r/ctype_utf8.result
+++ b/mysql-test/r/ctype_utf8.result
@@ -1028,6 +1028,45 @@ xxx
yyy
DROP TABLE t1;
set names utf8;
+select hex(char(1));
+hex(char(1))
+01
+select char(0xd1,0x8f);
+char(0xd1,0x8f)
+select char(0xd18f);
+char(0xd18f)
+select char(53647);
+char(53647)
+select char(0xff,0x8f);
+char(0xff,0x8f)
+ÿ
+Warnings:
+Warning 1300 Invalid utf8 character string: 'FF8F'
+set sql_mode=traditional;
+select char(0xff,0x8f);
+char(0xff,0x8f)
+NULL
+Warnings:
+Error 1300 Invalid utf8 character string: 'FF8F'
+select char(195);
+char(195)
+NULL
+Warnings:
+Error 1300 Invalid utf8 character string: 'C3'
+select char(196);
+char(196)
+NULL
+Warnings:
+Error 1300 Invalid utf8 character string: 'C4'
+select char(2557);
+char(2557)
+NULL
+Warnings:
+Error 1300 Invalid utf8 character string: 'FD'
+set names utf8;
create table t1 (a char(1)) default character set utf8;
create table t2 (a char(1)) default character set utf8;
insert into t1 values('a'),('a'),(0xE38182),(0xE38182);
diff --git a/mysql-test/r/default.result b/mysql-test/r/default.result
index 7db20c2b096..aef49af6c62 100644
--- a/mysql-test/r/default.result
+++ b/mysql-test/r/default.result
@@ -29,38 +29,6 @@ z varchar(20) binary NOT NULL DEFAULT ' ',
a1 varchar(30) binary NOT NULL DEFAULT ' ',
b1 tinyblob NULL)
ENGINE=InnoDB DEFAULT CHARACTER SET = latin1 COLLATE latin1_bin;
-SHOW CREATE TABLE t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `a` varchar(30) collate latin1_bin NOT NULL default ' ',
- `b` varchar(1) collate latin1_bin NOT NULL default ' ',
- `c` varchar(4) collate latin1_bin NOT NULL default '0000',
- `d` tinyblob,
- `e` tinyblob,
- `f` tinyblob,
- `g` tinyblob,
- `h` tinyblob,
- `i` tinyblob,
- `j` tinyblob,
- `k` tinyblob,
- `l` tinyblob,
- `m` tinyblob,
- `n` tinyblob,
- `o` tinyblob,
- `p` tinyblob,
- `q` varchar(30) collate latin1_bin NOT NULL default ' ',
- `r` varchar(30) collate latin1_bin NOT NULL default ' ',
- `s` tinyblob,
- `t` varchar(4) collate latin1_bin NOT NULL default ' ',
- `u` varchar(1) collate latin1_bin NOT NULL default ' ',
- `v` varchar(30) collate latin1_bin NOT NULL default ' ',
- `w` varchar(30) collate latin1_bin NOT NULL default ' ',
- `x` tinyblob,
- `y` varchar(5) collate latin1_bin NOT NULL default ' ',
- `z` varchar(20) collate latin1_bin NOT NULL default ' ',
- `a1` varchar(30) collate latin1_bin NOT NULL default ' ',
- `b1` tinyblob
-) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_bin
INSERT into t1 (b) values ('1');
SHOW WARNINGS;
Level Code Message
diff --git a/mysql-test/r/derived.result b/mysql-test/r/derived.result
index 7c9d88acf90..19325731d35 100644
--- a/mysql-test/r/derived.result
+++ b/mysql-test/r/derived.result
@@ -368,3 +368,15 @@ create table t2 (a int);
select * from (select * from t1,t2) foo;
ERROR 42S21: Duplicate column name 'a'
drop table t1,t2;
+create table t1 (ID int unsigned not null auto_increment,
+DATA varchar(5) not null, primary key (ID));
+create table t2 (ID int unsigned not null auto_increment,
+DATA varchar(5) not null, FID int unsigned not null,
+primary key (ID));
+select A.* from (t1 inner join (select * from t2) as A on t1.ID = A.FID);
+ID DATA FID
+select t2.* from ((select * from t1) as A inner join t2 on A.ID = t2.FID);
+ID DATA FID
+select t2.* from (select * from t1) as A inner join t2 on A.ID = t2.FID;
+ID DATA FID
+drop table t1, t2;
diff --git a/mysql-test/r/federated.result b/mysql-test/r/federated.result
index 1ec9857c8a7..e0e0bba3271 100644
--- a/mysql-test/r/federated.result
+++ b/mysql-test/r/federated.result
@@ -1457,6 +1457,32 @@ federated.t1 repair status OK
REPAIR TABLE federated.t1 USE_FRM;
Table Op Msg_type Msg_text
federated.t1 repair status OK
+DROP TABLE IF EXISTS federated.normal_table;
+CREATE TABLE federated.normal_table (
+`id` int(4) NOT NULL,
+`name` varchar(10) default NULL
+) DEFAULT CHARSET=latin1;
+DROP TABLE IF EXISTS federated.alter_me;
+CREATE TABLE federated.alter_me (
+`id` int(4) NOT NULL,
+`name` varchar(10) default NULL,
+PRIMARY KEY (`id`)
+) ENGINE="FEDERATED" DEFAULT CHARSET=latin1
+CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/normal_table';
+INSERT INTO federated.alter_me (id, name) VALUES (1, 'Monty');
+INSERT INTO federated.alter_me (id, name) VALUES (2, 'David');
+SELECT * FROM federated.alter_me;
+id name
+1 Monty
+2 David
+ALTER TABLE federated.alter_me MODIFY COLUMN id int(16) NOT NULL;
+ERROR HY000: Table storage engine for 'alter_me' doesn't have this option
+SELECT * FROM federated.alter_me;
+id name
+1 Monty
+2 David
+DROP TABLE federated.alter_me;
+DROP TABLE federated.normal_table;
DROP TABLE IF EXISTS federated.t1;
DROP DATABASE IF EXISTS federated;
DROP TABLE IF EXISTS federated.t1;
diff --git a/mysql-test/r/federated_bug_13118.result b/mysql-test/r/federated_bug_13118.result
new file mode 100644
index 00000000000..cc14dae87d9
--- /dev/null
+++ b/mysql-test/r/federated_bug_13118.result
@@ -0,0 +1,39 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+stop slave;
+DROP DATABASE IF EXISTS federated;
+CREATE DATABASE federated;
+DROP DATABASE IF EXISTS federated;
+CREATE DATABASE federated;
+DROP TABLE IF EXISTS federated.bug_13118_table;
+CREATE TABLE federated.bug_13118_table (
+`foo` integer,
+`bar` integer
+);
+DROP TABLE IF EXISTS federated.t1;
+CREATE TABLE federated.t1 (
+`foo` integer,
+`bar` integer
+) ENGINE="FEDERATED"
+ CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/bug_13118_table';
+SELECT * from federated.t1;
+foo bar
+INSERT INTO federated.t1 VALUES (1,1);
+SELECT * FROM federated.t1;
+foo bar
+1 1
+INSERT INTO federated.t1 VALUES (1,1);
+SELECT * FROM federated.t1;
+foo bar
+1 1
+1 1
+DROP TABLE federated.t1;
+DROP TABLE federated.bug_13118_table;
+DROP TABLE IF EXISTS federated.t1;
+DROP DATABASE IF EXISTS federated;
+DROP TABLE IF EXISTS federated.t1;
+DROP DATABASE IF EXISTS federated;
diff --git a/mysql-test/r/func_group.result b/mysql-test/r/func_group.result
index 1542794798a..2b0176179ed 100644
--- a/mysql-test/r/func_group.result
+++ b/mysql-test/r/func_group.result
@@ -821,6 +821,142 @@ SELECT MAX(id) FROM t1 WHERE id < 3 AND a=2 AND b=6;
MAX(id)
NULL
DROP TABLE t1;
+create table t1m (a int) engine=myisam;
+create table t1i (a int) engine=innodb;
+create table t2m (a int) engine=myisam;
+create table t2i (a int) engine=innodb;
+insert into t2m values (5);
+insert into t2i values (5);
+select min(a) from t1m;
+min(a)
+NULL
+select min(7) from t1m;
+min(7)
+NULL
+select min(7) from DUAL;
+min(7)
+NULL
+explain select min(7) from t2m join t1m;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
+select min(7) from t2m join t1m;
+min(7)
+NULL
+select max(a) from t1m;
+max(a)
+NULL
+select max(7) from t1m;
+max(7)
+NULL
+select max(7) from DUAL;
+max(7)
+NULL
+explain select max(7) from t2m join t1m;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
+select max(7) from t2m join t1m;
+max(7)
+NULL
+select 1, min(a) from t1m where a=99;
+1 min(a)
+1 NULL
+select 1, min(a) from t1m where 1=99;
+1 min(a)
+1 NULL
+select 1, min(1) from t1m where a=99;
+1 min(1)
+select 1, min(1) from t1m where 1=99;
+1 min(1)
+1 NULL
+select 1, max(a) from t1m where a=99;
+1 max(a)
+1 NULL
+select 1, max(a) from t1m where 1=99;
+1 max(a)
+1 NULL
+select 1, max(1) from t1m where a=99;
+1 max(1)
+select 1, max(1) from t1m where 1=99;
+1 max(1)
+1 NULL
+select min(a) from t1i;
+min(a)
+NULL
+select min(7) from t1i;
+min(7)
+NULL
+select min(7) from DUAL;
+min(7)
+NULL
+explain select min(7) from t2i join t1i;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2i ALL NULL NULL NULL NULL 1
+1 SIMPLE t1i ALL NULL NULL NULL NULL 1
+select min(7) from t2i join t1i;
+min(7)
+NULL
+select max(a) from t1i;
+max(a)
+NULL
+select max(7) from t1i;
+max(7)
+NULL
+select max(7) from DUAL;
+max(7)
+NULL
+explain select max(7) from t2i join t1i;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2i ALL NULL NULL NULL NULL 1
+1 SIMPLE t1i ALL NULL NULL NULL NULL 1
+select max(7) from t2i join t1i;
+max(7)
+NULL
+select 1, min(a) from t1i where a=99;
+1 min(a)
+1 NULL
+select 1, min(a) from t1i where 1=99;
+1 min(a)
+1 NULL
+select 1, min(1) from t1i where a=99;
+1 min(1)
+1 NULL
+select 1, min(1) from t1i where 1=99;
+1 min(1)
+1 NULL
+select 1, max(a) from t1i where a=99;
+1 max(a)
+1 NULL
+select 1, max(a) from t1i where 1=99;
+1 max(a)
+1 NULL
+select 1, max(1) from t1i where a=99;
+1 max(1)
+1 NULL
+select 1, max(1) from t1i where 1=99;
+1 max(1)
+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 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 t2i ALL NULL NULL NULL NULL 1
+select count(*), min(7), max(7) from t1m, t2i;
+count(*) min(7) max(7)
+0 NULL NULL
+explain select count(*), min(7), max(7) from t2m, t1i;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2m system NULL NULL NULL NULL 1
+1 SIMPLE t1i ALL NULL NULL NULL NULL 1
+select count(*), min(7), max(7) from t2m, t1i;
+count(*) min(7) max(7)
+0 NULL NULL
+drop table t1m, t1i, t2m, t2i;
create table t2 (ff double);
insert into t2 values (2.2);
select cast(sum(distinct ff) as decimal(5,2)) from t2;
diff --git a/mysql-test/r/func_in.result b/mysql-test/r/func_in.result
index a0868d09242..8562937f1ac 100644
--- a/mysql-test/r/func_in.result
+++ b/mysql-test/r/func_in.result
@@ -193,6 +193,15 @@ select * from t1 where a in (NULL, 'aa');
a
aa
drop table t1;
+create table t1 (id int, key(id));
+insert into t1 values (1),(2),(3);
+select count(*) from t1 where id not in (1);
+count(*)
+2
+select count(*) from t1 where id not in (1,2);
+count(*)
+1
+drop table t1;
CREATE TABLE t1 (a int PRIMARY KEY);
INSERT INTO t1 VALUES (44), (45), (46);
SELECT * FROM t1 WHERE a IN (45);
diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result
index 577f943ebde..3d7d693cdce 100644
--- a/mysql-test/r/func_str.result
+++ b/mysql-test/r/func_str.result
@@ -1011,3 +1011,9 @@ t
1000000
1
drop table t1;
+create table t1 (d decimal default null);
+insert into t1 values (null);
+select format(d, 2) from t1;
+format(d, 2)
+NULL
+drop table t1;
diff --git a/mysql-test/r/group_min_max.result b/mysql-test/r/group_min_max.result
index e26f32e49e5..038d0c75f74 100644
--- a/mysql-test/r/group_min_max.result
+++ b/mysql-test/r/group_min_max.result
@@ -1972,29 +1972,23 @@ a
b
c
d
-create table bug12672 (
+create table t4 (
pk_col int auto_increment primary key, a1 char(64), a2 char(64), b char(16), c char(16) not null, d char(16), dummy char(64) default ' '
) engine=innodb;
-insert into bug12672 (a1, a2, b, c, d, dummy) select * from t1;
-create index idx12672_0 on bug12672 (a1);
-create index idx12672_1 on bug12672 (a1,a2,b,c);
-create index idx12672_2 on bug12672 (a1,a2,b);
+insert into t4 (a1, a2, b, c, d, dummy) select * from t1;
+create index idx12672_0 on t4 (a1);
+create index idx12672_1 on t4 (a1,a2,b,c);
+create index idx12672_2 on t4 (a1,a2,b);
analyze table t1;
Table Op Msg_type Msg_text
test.t1 analyze status Table is already up to date
-explain select distinct a1 from bug12672 where pk_col not in (1,2,3,4);
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE bug12672 range PRIMARY PRIMARY 4 NULL # Using where; Using temporary
-select distinct a1 from bug12672 where pk_col not in (1,2,3,4);
+select distinct a1 from t4 where pk_col not in (1,2,3,4);
a1
a
b
c
d
-drop table bug12672;
-drop table t1;
-drop table t2;
-drop table t3;
+drop table t1,t2,t3,t4;
create table t1 (
a varchar(30), b varchar(30), primary key(a), key(b)
) engine=innodb;
diff --git a/mysql-test/r/heap.result b/mysql-test/r/heap.result
index 969cb06e9fe..7f40dfa3a36 100644
--- a/mysql-test/r/heap.result
+++ b/mysql-test/r/heap.result
@@ -379,10 +379,10 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL v NULL NULL NULL 271 Using where
explain select count(*) from t1 where v between 'a' and 'a ';
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL v NULL NULL NULL 271 Using where
+1 SIMPLE t1 ref v v 13 const 10 Using where
explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n';
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL v NULL NULL NULL 271 Using where
+1 SIMPLE t1 ref v v 13 const 10 Using where
alter table t1 add unique(v);
ERROR 23000: Duplicate entry '{ ' for key 1
select concat('*',v,'*',c,'*',t,'*') as qq from t1 where v='a' order by length(concat('*',v,'*',c,'*',t,'*'));
@@ -602,10 +602,10 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 13 NULL # Using where
explain select count(*) from t1 where v between 'a' and 'a ';
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 13 NULL # Using where
+1 SIMPLE t1 ref v v 13 const # Using where
explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n';
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 13 NULL # Using where
+1 SIMPLE t1 ref v v 13 const # Using where
alter table t1 add unique(v);
ERROR 23000: Duplicate entry '{ ' for key 1
select concat('*',v,'*',c,'*',t,'*') as qq from t1 where v='a' order by length(concat('*',v,'*',c,'*',t,'*'));
diff --git a/mysql-test/r/im_daemon_life_cycle.result b/mysql-test/r/im_daemon_life_cycle.result
new file mode 100644
index 00000000000..d0a76b450fe
--- /dev/null
+++ b/mysql-test/r/im_daemon_life_cycle.result
@@ -0,0 +1,7 @@
+SHOW INSTANCES;
+instance_name status
+mysqld1 online
+mysqld2 offline
+Killing the process...
+Sleeping...
+Success: the process was restarted.
diff --git a/mysql-test/r/im_life_cycle.result b/mysql-test/r/im_life_cycle.result
new file mode 100644
index 00000000000..810953e0578
--- /dev/null
+++ b/mysql-test/r/im_life_cycle.result
@@ -0,0 +1,64 @@
+SHOW INSTANCES;
+instance_name status
+mysqld1 online
+mysqld2 offline
+SHOW INSTANCE STATUS mysqld1;
+instance_name status version
+mysqld1 online VERSION
+SHOW INSTANCE STATUS mysqld2;
+instance_name status version
+mysqld2 offline VERSION
+START INSTANCE mysqld2;
+SHOW INSTANCES;
+instance_name status
+mysqld1 online
+mysqld2 online
+SHOW INSTANCE STATUS mysqld1;
+instance_name status version
+mysqld1 online VERSION
+SHOW INSTANCE STATUS mysqld2;
+instance_name status version
+mysqld2 online VERSION
+SHOW VARIABLES LIKE 'port';
+Variable_name Value
+port 9312
+STOP INSTANCE mysqld2;
+SHOW INSTANCES;
+instance_name status
+mysqld1 online
+mysqld2 offline
+SHOW INSTANCE STATUS mysqld1;
+instance_name status version
+mysqld1 online VERSION
+SHOW INSTANCE STATUS mysqld2;
+instance_name status version
+mysqld2 offline VERSION
+START INSTANCE mysqld3;
+ERROR HY000: Bad instance name. Check that the instance with such a name exists
+START INSTANCE mysqld1;
+ERROR HY000: The instance is already started
+STOP INSTANCE mysqld3;
+ERROR HY000: Bad instance name. Check that the instance with such a name exists
+SHOW INSTANCES;
+instance_name status
+mysqld1 online
+mysqld2 offline
+Killing the process...
+Sleeping...
+Success: the process was restarted.
+SHOW INSTANCES;
+instance_name status
+mysqld1 online
+mysqld2 offline
+START INSTANCE mysqld2;
+SHOW INSTANCES;
+instance_name status
+mysqld1 online
+mysqld2 online
+Killing the process...
+Sleeping...
+Success: the process was killed.
+SHOW INSTANCES;
+instance_name status
+mysqld1 online
+mysqld2 offline
diff --git a/mysql-test/r/im_options_set.result b/mysql-test/r/im_options_set.result
new file mode 100644
index 00000000000..0d2fa699fc7
--- /dev/null
+++ b/mysql-test/r/im_options_set.result
@@ -0,0 +1,20 @@
+server_id =1
+server_id =2
+SHOW VARIABLES LIKE 'server_id';
+Variable_name Value
+server_id 1
+SET mysqld1.server_id = 11;
+server_id =11
+server_id =2
+SHOW VARIABLES LIKE 'server_id';
+Variable_name Value
+server_id 1
+SET mysqld2.server_id = 12;
+server_id =11
+server_id =12
+FLUSH INSTANCES;
+server_id =11
+server_id =12
+SHOW VARIABLES LIKE 'server_id';
+Variable_name Value
+server_id 1
diff --git a/mysql-test/r/im_options_unset.result b/mysql-test/r/im_options_unset.result
new file mode 100644
index 00000000000..834152c35d2
--- /dev/null
+++ b/mysql-test/r/im_options_unset.result
@@ -0,0 +1,15 @@
+server_id =1
+server_id =2
+SHOW VARIABLES LIKE 'server_id';
+Variable_name Value
+server_id 1
+UNSET mysqld1.server_id;
+server_id =2
+SHOW VARIABLES LIKE 'server_id';
+Variable_name Value
+server_id 1
+UNSET mysqld2.server_id;
+FLUSH INSTANCES;
+SHOW VARIABLES LIKE 'server_id';
+Variable_name Value
+server_id 1
diff --git a/mysql-test/r/im_utils.result b/mysql-test/r/im_utils.result
new file mode 100644
index 00000000000..fbfaeaebcac
--- /dev/null
+++ b/mysql-test/r/im_utils.result
@@ -0,0 +1,91 @@
+SHOW INSTANCES;
+instance_name status
+mysqld1 online
+mysqld2 offline
+SHOW INSTANCE OPTIONS mysqld1;
+option_name value
+instance_name VALUE
+mysqld-path VALUE
+socket VALUE
+pid-file VALUE
+port VALUE
+datadir VALUE
+log VALUE
+log-error VALUE
+log-slow-queries VALUE
+language VALUE
+character-sets-dir VALUE
+basedir VALUE
+server_id VALUE
+skip-stack-trace VALUE
+skip-innodb VALUE
+skip-bdb VALUE
+skip-ndbcluster VALUE
+SHOW INSTANCE OPTIONS mysqld2;
+option_name value
+instance_name VALUE
+mysqld-path VALUE
+nonguarded VALUE
+socket VALUE
+pid-file VALUE
+port VALUE
+datadir VALUE
+log VALUE
+log-error VALUE
+log-slow-queries VALUE
+language VALUE
+character-sets-dir VALUE
+basedir VALUE
+server_id VALUE
+skip-stack-trace VALUE
+skip-innodb VALUE
+skip-bdb VALUE
+skip-ndbcluster VALUE
+START INSTANCE mysqld2;
+STOP INSTANCE mysqld2;
+SHOW mysqld1 LOG FILES;
+Logfile Path File size
+ERROR LOG PATH FILE_SIZE
+GENERAL LOG PATH FILE_SIZE
+SLOW LOG PATH FILE_SIZE
+SHOW mysqld2 LOG FILES;
+Logfile Path File size
+ERROR LOG PATH FILE_SIZE
+GENERAL LOG PATH FILE_SIZE
+SLOW LOG PATH FILE_SIZE
+SHOW mysqld1 LOG ERROR 10;
+Log
+LOG_DATA
+SHOW mysqld1 LOG SLOW 10;
+Log
+LOG_DATA
+SHOW mysqld1 LOG GENERAL 10;
+Log
+LOG_DATA
+SHOW mysqld1 LOG ERROR 10, 2;
+Log
+LOG_DATA
+SHOW mysqld1 LOG SLOW 10, 2;
+Log
+LOG_DATA
+SHOW mysqld1 LOG GENERAL 10, 2;
+Log
+LOG_DATA
+SHOW mysqld2 LOG ERROR 10;
+Log
+LOG_DATA
+SHOW mysqld2 LOG SLOW 10;
+Log
+LOG_DATA
+SHOW mysqld2 LOG GENERAL 10;
+Log
+LOG_DATA
+SHOW mysqld2 LOG ERROR 10, 2;
+Log
+LOG_DATA
+SHOW mysqld2 LOG SLOW 10, 2;
+Log
+LOG_DATA
+SHOW mysqld2 LOG GENERAL 10, 2;
+Log
+LOG_DATA
diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result
index d506aa69488..0d53180b6d6 100644
--- a/mysql-test/r/information_schema.result
+++ b/mysql-test/r/information_schema.result
@@ -1,4 +1,5 @@
-DROP TABLE IF EXISTS t0,t1,t2,t3,t5;
+DROP TABLE IF EXISTS t0,t1,t2,t3,t4,t5;
+DROP VIEW IF EXISTS v1;
show variables where variable_name like "skip_show_database";
Variable_name Value
skip_show_database OFF
@@ -361,11 +362,11 @@ show keys from v4;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
select * from information_schema.views where TABLE_NAME like "v%";
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE
-NULL test v0 select sql_no_cache `schemata`.`SCHEMA_NAME` AS `c` from `information_schema`.`schemata` NONE NO root@localhos DEFINER
-NULL test v1 select sql_no_cache `tables`.`TABLE_NAME` AS `c` from `information_schema`.`tables` where (`tables`.`TABLE_NAME` = _utf8'v1') NONE NO root@localhos DEFINER
-NULL test v2 select sql_no_cache `columns`.`COLUMN_NAME` AS `c` from `information_schema`.`columns` where (`columns`.`TABLE_NAME` = _utf8'v2') NONE NO root@localhos DEFINER
-NULL test v3 select sql_no_cache `character_sets`.`CHARACTER_SET_NAME` AS `c` from `information_schema`.`character_sets` where (`character_sets`.`CHARACTER_SET_NAME` like _utf8'latin1%') NONE NO root@localhos DEFINER
-NULL test v4 select sql_no_cache `collations`.`COLLATION_NAME` AS `c` from `information_schema`.`collations` where (`collations`.`COLLATION_NAME` like _utf8'latin1%') NONE NO root@localhos DEFINER
+NULL test v0 select sql_no_cache `schemata`.`SCHEMA_NAME` AS `c` from `information_schema`.`schemata` NONE NO root@localhost DEFINER
+NULL test v1 select sql_no_cache `tables`.`TABLE_NAME` AS `c` from `information_schema`.`tables` where (`tables`.`TABLE_NAME` = _utf8'v1') NONE NO root@localhost DEFINER
+NULL test v2 select sql_no_cache `columns`.`COLUMN_NAME` AS `c` from `information_schema`.`columns` where (`columns`.`TABLE_NAME` = _utf8'v2') NONE NO root@localhost DEFINER
+NULL test v3 select sql_no_cache `character_sets`.`CHARACTER_SET_NAME` AS `c` from `information_schema`.`character_sets` where (`character_sets`.`CHARACTER_SET_NAME` like _utf8'latin1%') NONE NO root@localhost DEFINER
+NULL test v4 select sql_no_cache `collations`.`COLLATION_NAME` AS `c` from `information_schema`.`collations` where (`collations`.`COLLATION_NAME` like _utf8'latin1%') NONE NO root@localhost DEFINER
drop view v0, v1, v2, v3, v4;
create table t1 (a int);
grant select,update,insert on t1 to mysqltest_1@localhost;
@@ -456,9 +457,9 @@ create view v2 (c) as select a from t1 WITH LOCAL CHECK OPTION;
create view v3 (c) as select a from t1 WITH CASCADED CHECK OPTION;
select * from information_schema.views;
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE
-NULL test v1 select `test`.`t1`.`a` AS `c` from `test`.`t1` CASCADED YES root@localhos DEFINER
-NULL test v2 select `test`.`t1`.`a` AS `c` from `test`.`t1` LOCAL YES root@localhos DEFINER
-NULL test v3 select `test`.`t1`.`a` AS `c` from `test`.`t1` CASCADED YES root@localhos DEFINER
+NULL test v1 select `test`.`t1`.`a` AS `c` from `test`.`t1` CASCADED YES root@localhost DEFINER
+NULL test v2 select `test`.`t1`.`a` AS `c` from `test`.`t1` LOCAL YES root@localhost DEFINER
+NULL test v3 select `test`.`t1`.`a` AS `c` from `test`.`t1` CASCADED YES root@localhost DEFINER
grant select (a) on test.t1 to joe@localhost with grant option;
select * from INFORMATION_SCHEMA.COLUMN_PRIVILEGES;
GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME PRIVILEGE_TYPE IS_GRANTABLE
@@ -638,8 +639,8 @@ use test;
create function sub1(i int) returns int
return i+1;
create table t1(f1 int);
-create view t2 (c) as select f1 from t1;
-create view t3 (c) as select sub1(1);
+create view v2 (c) as select f1 from t1;
+create view v3 (c) as select sub1(1);
create table t4(f1 int, KEY f1_key (f1));
drop table t1;
drop function sub1;
@@ -647,29 +648,29 @@ select table_name from information_schema.views
where table_schema='test';
table_name
Warnings:
-Warning 1356 View 'test.t2' references invalid table(s) or column(s) or function(s)
-Warning 1356 View 'test.t3' references invalid table(s) or column(s) or function(s)
+Warning 1356 View 'test.v2' references invalid table(s) or column(s) or function(s)
+Warning 1356 View 'test.v3' references invalid table(s) or column(s) or function(s)
select table_name from information_schema.views
where table_schema='test';
table_name
Warnings:
-Warning 1356 View 'test.t2' references invalid table(s) or column(s) or function(s)
-Warning 1356 View 'test.t3' references invalid table(s) or column(s) or function(s)
+Warning 1356 View 'test.v2' references invalid table(s) or column(s) or function(s)
+Warning 1356 View 'test.v3' references invalid table(s) or column(s) or function(s)
select column_name from information_schema.columns
where table_schema='test';
column_name
f1
Warnings:
-Warning 1356 View 'test.t2' references invalid table(s) or column(s) or function(s)
-Warning 1356 View 'test.t3' references invalid table(s) or column(s) or function(s)
+Warning 1356 View 'test.v2' references invalid table(s) or column(s) or function(s)
+Warning 1356 View 'test.v3' references invalid table(s) or column(s) or function(s)
select index_name from information_schema.statistics where table_schema='test';
index_name
f1_key
select constraint_name from information_schema.table_constraints
where table_schema='test';
constraint_name
-drop view t2;
-drop view t3;
+drop view v2;
+drop view v3;
drop table t4;
select * from information_schema.table_names;
ERROR 42S02: Unknown table 'table_names' in information_schema
diff --git a/mysql-test/r/information_schema_inno.result b/mysql-test/r/information_schema_inno.result
index 9dd92baf62f..fb6584673f6 100644
--- a/mysql-test/r/information_schema_inno.result
+++ b/mysql-test/r/information_schema_inno.result
@@ -1,4 +1,4 @@
-DROP TABLE IF EXISTS t1,t2;
+DROP TABLE IF EXISTS t1,t2,t3;
CREATE TABLE t1 (id INT NOT NULL, PRIMARY KEY (id)) ENGINE=INNODB;
CREATE TABLE t2 (id INT PRIMARY KEY, t1_id INT, INDEX par_ind (t1_id, id),
FOREIGN KEY (t1_id) REFERENCES t1(id) ON DELETE CASCADE,
diff --git a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result
index 559e88aad46..a66259ff5f4 100644
--- a/mysql-test/r/innodb.result
+++ b/mysql-test/r/innodb.result
@@ -1378,9 +1378,9 @@ insert into `t2`values ( 1 ) ;
create table `t3` (`id` int( 11 ) not null default '0',key `id` ( `id` ) ,constraint `t2_id_fk` foreign key ( `id` ) references `t2` (`id` )) engine = innodb;
insert into `t3`values ( 1 ) ;
delete t3,t2,t1 from t1,t2,t3 where t1.id =1 and t2.id = t1.id and t3.id = t2.id;
-ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test/t2`, CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`))
update t1,t2,t3 set t3.id=5, t2.id=6, t1.id=7 where t1.id =1 and t2.id = t1.id and t3.id = t2.id;
-ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test/t2`, CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`))
update t3 set t3.id=7 where t1.id =1 and t2.id = t1.id and t3.id = t2.id;
ERROR 42S22: Unknown column 't1.id' in 'where clause'
drop table t3,t2,t1;
@@ -1392,7 +1392,7 @@ foreign key(pid) references t1(id) on delete cascade) engine=innodb;
insert into t1 values(0,0),(1,0),(2,1),(3,2),(4,3),(5,4),(6,5),(7,6),
(8,7),(9,8),(10,9),(11,10),(12,11),(13,12),(14,13),(15,14);
delete from t1 where id=0;
-ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test/t1`, CONSTRAINT `t1_ibfk_1` FOREIGN KEY (`pid`) REFERENCES `t1` (`id`) ON DELETE CASCADE)
delete from t1 where id=15;
delete from t1 where id=0;
drop table t1;
@@ -1730,6 +1730,15 @@ explain select * from t1 order by a,b,c,d;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using filesort
drop table t1;
+create table t1 (a char(1), b char(1), key(a, b)) engine=innodb;
+insert into t1 values ('8', '6'), ('4', '7');
+select min(a) from t1;
+min(a)
+4
+select min(b) from t1 where a='8';
+min(b)
+6
+drop table t1;
create table t1 (x bigint unsigned not null primary key) engine=innodb;
insert into t1(x) values (0xfffffffffffffff0),(0xfffffffffffffff1);
select * from t1;
@@ -1776,7 +1785,7 @@ Variable_name Value
Innodb_rows_deleted 2070
show status like "Innodb_rows_inserted";
Variable_name Value
-Innodb_rows_inserted 31725
+Innodb_rows_inserted 31727
show status like "Innodb_rows_updated";
Variable_name Value
Innodb_rows_updated 29530
@@ -1988,10 +1997,10 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 13 NULL # Using where; Using index
explain select count(*) from t1 where v between 'a' and 'a ';
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 13 NULL # Using where; Using index
+1 SIMPLE t1 ref v v 13 const # Using where; Using index
explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n';
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 13 NULL # Using where; Using index
+1 SIMPLE t1 ref v v 13 const # Using where; Using index
alter table t1 add unique(v);
ERROR 23000: Duplicate entry '{ ' for key 1
alter table t1 add key(v);
@@ -2179,10 +2188,10 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 303 NULL # Using where; Using index
explain select count(*) from t1 where v between 'a' and 'a ';
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 303 NULL # Using where; Using index
+1 SIMPLE t1 ref v v 303 const # Using where; Using index
explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n';
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 303 NULL # Using where; Using index
+1 SIMPLE t1 ref v v 303 const # Using where; Using index
explain select * from t1 where v='a';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref v v 303 const # Using where
@@ -2259,10 +2268,10 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 33 NULL # Using where
explain select count(*) from t1 where v between 'a' and 'a ';
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 33 NULL # Using where
+1 SIMPLE t1 ref v v 33 const # Using where
explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n';
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 33 NULL # Using where
+1 SIMPLE t1 ref v v 33 const # Using where
explain select * from t1 where v='a';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref v v 33 const # Using where
@@ -2550,3 +2559,107 @@ FOREIGN KEY (b) REFERENCES test.t1(id)
) ENGINE=InnoDB;
Got one of the listed errors
DROP TABLE t1;
+create table t1 (col1 varchar(2000), index (col1(767)))
+character set = latin1 engine = innodb;
+create table t2 (col1 char(255), index (col1))
+character set = latin1 engine = innodb;
+create table t3 (col1 binary(255), index (col1))
+character set = latin1 engine = innodb;
+create table t4 (col1 varchar(767), index (col1))
+character set = latin1 engine = innodb;
+create table t5 (col1 varchar(767) primary key)
+character set = latin1 engine = innodb;
+create table t6 (col1 varbinary(767) primary key)
+character set = latin1 engine = innodb;
+create table t7 (col1 text, index(col1(767)))
+character set = latin1 engine = innodb;
+create table t8 (col1 blob, index(col1(767)))
+character set = latin1 engine = innodb;
+create table t9 (col1 varchar(512), col2 varchar(512), index(col1, col2))
+character set = latin1 engine = innodb;
+drop table t1, t2, t3, t4, t5, t6, t7, t8, t9;
+create table t1 (col1 varchar(768), index (col1))
+character set = latin1 engine = innodb;
+ERROR HY000: Can't create table './test/t1.frm' (errno: 139)
+create table t2 (col1 varchar(768) primary key)
+character set = latin1 engine = innodb;
+ERROR HY000: Can't create table './test/t2.frm' (errno: 139)
+create table t3 (col1 varbinary(768) primary key)
+character set = latin1 engine = innodb;
+ERROR HY000: Can't create table './test/t3.frm' (errno: 139)
+create table t4 (col1 text, index(col1(768)))
+character set = latin1 engine = innodb;
+ERROR HY000: Can't create table './test/t4.frm' (errno: 139)
+create table t5 (col1 blob, index(col1(768)))
+character set = latin1 engine = innodb;
+ERROR HY000: Can't create table './test/t5.frm' (errno: 139)
+CREATE TABLE t1
+(
+id INT PRIMARY KEY
+) ENGINE=InnoDB;
+CREATE TABLE t2
+(
+v INT,
+CONSTRAINT c1 FOREIGN KEY (v) REFERENCES t1(id)
+) ENGINE=InnoDB;
+INSERT INTO t2 VALUES(2);
+ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test/t2`, CONSTRAINT `c1` FOREIGN KEY (`v`) REFERENCES `t1` (`id`))
+INSERT INTO t1 VALUES(1);
+INSERT INTO t2 VALUES(1);
+DELETE FROM t1 WHERE id = 1;
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test/t2`, CONSTRAINT `c1` FOREIGN KEY (`v`) REFERENCES `t1` (`id`))
+DROP TABLE t1;
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails
+SET FOREIGN_KEY_CHECKS=0;
+DROP TABLE t1;
+SET FOREIGN_KEY_CHECKS=1;
+INSERT INTO t2 VALUES(3);
+ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test/t2`, CONSTRAINT `c1` FOREIGN KEY (`v`) REFERENCES `t1` (`id`))
+DROP TABLE t2;
+create table t1(a int not null) engine=innodb DEFAULT CHARSET=latin1;
+insert into t1 values (1),(2);
+set autocommit=0;
+checksum table t1;
+Table Checksum
+test.t1 1531596814
+insert into t1 values(3);
+checksum table t1;
+Table Checksum
+test.t1 1531596814
+commit;
+checksum table t1;
+Table Checksum
+test.t1 2050879373
+commit;
+drop table t1;
+create table t1(a int not null) engine=innodb DEFAULT CHARSET=latin1;
+insert into t1 values (1),(2);
+set autocommit=1;
+checksum table t1;
+Table Checksum
+test.t1 1531596814
+set autocommit=1;
+insert into t1 values(3);
+checksum table t1;
+Table Checksum
+test.t1 2050879373
+drop table t1;
+create table t1 (col1 integer primary key, col2 integer) engine=innodb;
+insert t1 values (1,100);
+create function f1 () returns integer begin
+declare var1 int;
+select col2 into var1 from t1 where col1=1 for update;
+return var1;
+end|
+start transaction;
+select f1();
+f1()
+100
+ update t1 set col2=0 where col1=1;
+select * from t1;
+col1 col2
+1 100
+rollback;
+rollback;
+drop table t1;
+drop function f1;
diff --git a/mysql-test/r/join_nested.result b/mysql-test/r/join_nested.result
index f9a25898a6f..9d514be76e8 100644
--- a/mysql-test/r/join_nested.result
+++ b/mysql-test/r/join_nested.result
@@ -1375,3 +1375,31 @@ groupid price
6 9900
DROP VIEW v1,v2;
DROP TABLE t1,t2,t3,t4;
+CREATE TABLE t1(a int);
+CREATE TABLE t2(b int);
+CREATE TABLE t3(c int, d int);
+CREATE TABLE t4(d int);
+CREATE TABLE t5(e int, f int);
+CREATE TABLE t6(f int);
+CREATE VIEW v1 AS
+SELECT e FROM t5 JOIN t6 ON t5.e=t6.f;
+CREATE VIEW v2 AS
+SELECT e FROM t5 NATURAL JOIN t6;
+SELECT t1.a FROM t1 JOIN t2 ON a=b JOIN t3 ON a=c JOIN t4 USING(d);
+a
+SELECT t1.x FROM t1 JOIN t2 ON a=b JOIN t3 ON a=c JOIN t4 USING(d);
+ERROR 42S22: Unknown column 't1.x' in 'field list'
+SELECT t1.a FROM t1 JOIN t2 ON a=b JOIN t3 ON a=c NATURAL JOIN t4;
+a
+SELECT t1.x FROM t1 JOIN t2 ON a=b JOIN t3 ON a=c NATURAL JOIN t4;
+ERROR 42S22: Unknown column 't1.x' in 'field list'
+SELECT v1.e FROM v1 JOIN t2 ON e=b JOIN t3 ON e=c JOIN t4 USING(d);
+e
+SELECT v1.x FROM v1 JOIN t2 ON e=b JOIN t3 ON e=c JOIN t4 USING(d);
+ERROR 42S22: Unknown column 'v1.x' in 'field list'
+SELECT v2.e FROM v2 JOIN t2 ON e=b JOIN t3 ON e=c JOIN t4 USING(d);
+e
+SELECT v2.x FROM v2 JOIN t2 ON e=b JOIN t3 ON e=c JOIN t4 USING(d);
+ERROR 42S22: Unknown column 'v2.x' in 'field list'
+DROP VIEW v1, v2;
+DROP TABLE t1, t2, t3, t4, t5, t6;
diff --git a/mysql-test/r/loaddata.result b/mysql-test/r/loaddata.result
index d76fff372f5..f9d47e3533c 100644
--- a/mysql-test/r/loaddata.result
+++ b/mysql-test/r/loaddata.result
@@ -66,6 +66,17 @@ a b
3 row 3
0
drop table t1;
+SET @OLD_SQL_MODE=@@SQL_MODE, @@SQL_MODE=NO_AUTO_VALUE_ON_ZERO;
+create table t1(id integer not null auto_increment primary key);
+insert into t1 values(0);
+select * from t1;
+id
+0
+select * from t1;
+id
+0
+SET @@SQL_MODE=@OLD_SQL_MODE;
+drop table t1;
create table t1 (a int default 100, b int, c varchar(60));
load data infile '../../std_data/rpl_loaddata.dat' into table t1 (a, @b) set b=@b+10, c=concat("b=",@b);
select * from t1;
diff --git a/mysql-test/r/merge.result b/mysql-test/r/merge.result
index d4e19201173..e028e58acf5 100644
--- a/mysql-test/r/merge.result
+++ b/mysql-test/r/merge.result
@@ -653,6 +653,32 @@ ERROR HY000: You can't specify target table 't2' for update in FROM clause
create table t3 engine=merge union=(t1, t2) select (select max(a) from t2);
ERROR HY000: You can't specify target table 't2' for update in FROM clause
drop table t1, t2;
+create table t1 (
+a double(14,4),
+b varchar(10),
+index (a,b)
+) engine=merge union=(t2,t3);
+create table t2 (
+a double(14,4),
+b varchar(10),
+index (a,b)
+) engine=myisam;
+create table t3 (
+a double(14,4),
+b varchar(10),
+index (a,b)
+) engine=myisam;
+insert into t2 values ( null, '');
+insert into t2 values ( 9999999999.999, '');
+insert into t3 select * from t2;
+select min(a), max(a) from t1;
+min(a) max(a)
+9999999999.9990 9999999999.9990
+flush tables;
+select min(a), max(a) from t1;
+min(a) max(a)
+9999999999.9990 9999999999.9990
+drop table t1, t2, t3;
create table t1 (a int,b int,c int, index (a,b,c));
create table t2 (a int,b int,c int, index (a,b,c));
create table t3 (a int,b int,c int, index (a,b,c))
diff --git a/mysql-test/r/metadata.result b/mysql-test/r/metadata.result
index 50b0b6ae294..0a170e16188 100644
--- a/mysql-test/r/metadata.result
+++ b/mysql-test/r/metadata.result
@@ -2,7 +2,7 @@ drop table if exists t1,t2;
select 1, 1.0, -1, "hello", NULL;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def 1 8 1 1 N 32897 0 63
-def 1.0 246 4 3 N 129 1 63
+def 1.0 246 3 3 N 161 1 63
def -1 8 2 2 N 32897 0 63
def hello 253 5 5 N 1 31 8
def NULL 6 0 0 Y 32896 0 63
diff --git a/mysql-test/r/multi_statement.result b/mysql-test/r/multi_statement.result
index 3a8d86bf349..ff19cbdd698 100644
--- a/mysql-test/r/multi_statement.result
+++ b/mysql-test/r/multi_statement.result
@@ -1,3 +1,4 @@
+DROP TABLE IF EXISTS t1;
select 1;
1
1
diff --git a/mysql-test/r/myisam.result b/mysql-test/r/myisam.result
index ce215d6a7d8..f484a937b27 100644
--- a/mysql-test/r/myisam.result
+++ b/mysql-test/r/myisam.result
@@ -608,6 +608,67 @@ checksum table t2;
Table Checksum
test.t2 984116287
drop table t1, t2;
+show variables like 'myisam_stats_method';
+Variable_name Value
+myisam_stats_method nulls_unequal
+create table t1 (a int, key(a));
+insert into t1 values (0),(1),(2),(3),(4);
+insert into t1 select NULL from t1;
+analyze table t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+show index from t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 1 a 1 a A 10 NULL NULL YES BTREE
+insert into t1 values (11);
+delete from t1 where a=11;
+check table t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+show index from t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 1 a 1 a A 10 NULL NULL YES BTREE
+set myisam_stats_method=nulls_equal;
+show variables like 'myisam_stats_method';
+Variable_name Value
+myisam_stats_method nulls_equal
+insert into t1 values (11);
+delete from t1 where a=11;
+analyze table t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+show index from t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 1 a 1 a A 5 NULL NULL YES BTREE
+insert into t1 values (11);
+delete from t1 where a=11;
+check table t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+show index from t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 1 a 1 a A 5 NULL NULL YES BTREE
+set myisam_stats_method=DEFAULT;
+show variables like 'myisam_stats_method';
+Variable_name Value
+myisam_stats_method nulls_unequal
+insert into t1 values (11);
+delete from t1 where a=11;
+analyze table t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+show index from t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 1 a 1 a A 10 NULL NULL YES BTREE
+insert into t1 values (11);
+delete from t1 where a=11;
+check table t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+show index from t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 1 a 1 a A 10 NULL NULL YES BTREE
+drop table t1;
set storage_engine=MyISAM;
drop table if exists t1,t2,t3;
--- Testing varchar ---
@@ -741,10 +802,10 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 13 NULL # Using where; Using index
explain select count(*) from t1 where v between 'a' and 'a ';
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 13 NULL # Using where; Using index
+1 SIMPLE t1 ref v v 13 const # Using where; Using index
explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n';
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 13 NULL # Using where; Using index
+1 SIMPLE t1 ref v v 13 const # Using where; Using index
alter table t1 add unique(v);
ERROR 23000: Duplicate entry '{ ' for key 1
alter table t1 add key(v);
@@ -932,10 +993,10 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 303 NULL # Using where; Using index
explain select count(*) from t1 where v between 'a' and 'a ';
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 303 NULL # Using where; Using index
+1 SIMPLE t1 ref v v 303 const # Using where; Using index
explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n';
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 303 NULL # Using where; Using index
+1 SIMPLE t1 ref v v 303 const # Using where; Using index
explain select * from t1 where v='a';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref v v 303 const # Using where
@@ -1012,10 +1073,10 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 33 NULL # Using where
explain select count(*) from t1 where v between 'a' and 'a ';
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 33 NULL # Using where
+1 SIMPLE t1 ref v v 33 const # Using where
explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n';
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 33 NULL # Using where
+1 SIMPLE t1 ref v v 33 const # Using where
explain select * from t1 where v='a';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref v v 33 const # Using where
diff --git a/mysql-test/r/mysqlbinlog.result b/mysql-test/r/mysqlbinlog.result
index 8765e65f11b..cab3d924dd2 100644
--- a/mysql-test/r/mysqlbinlog.result
+++ b/mysql-test/r/mysqlbinlog.result
@@ -39,7 +39,8 @@ SET TIMESTAMP=1000000000;
load data LOCAL INFILE 'MYSQL_TEST_DIR/var/tmp/SQL_LOAD_MB-3-0' INTO table t1;
SET TIMESTAMP=1000000000;
load data LOCAL INFILE 'MYSQL_TEST_DIR/var/tmp/SQL_LOAD_MB-4-0' INTO table t1;
-ROLLBACK;
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
--- Broken LOAD DATA --
@@ -51,7 +52,8 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq
SET @@session.sql_mode=0;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
insert into t1 values ("Alas");
-ROLLBACK;
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
--- --database --
@@ -59,7 +61,8 @@ ROLLBACK;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
ROLLBACK;
SET INSERT_ID=1;
-ROLLBACK;
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
--- --position --
@@ -71,7 +74,8 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq
SET @@session.sql_mode=0;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
insert into t1 values ("Alas");
-ROLLBACK;
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
--- Remote --
@@ -101,7 +105,8 @@ SET TIMESTAMP=1000000000;
load data LOCAL INFILE 'MYSQL_TEST_DIR/var/tmp/SQL_LOAD_MB-3-2' INTO table t1;
SET TIMESTAMP=1000000000;
load data LOCAL INFILE 'MYSQL_TEST_DIR/var/tmp/SQL_LOAD_MB-4-2' INTO table t1;
-ROLLBACK;
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
--- Broken LOAD DATA --
@@ -113,7 +118,8 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq
SET @@session.sql_mode=0;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
insert into t1 values ("Alas");
-ROLLBACK;
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
--- --database --
@@ -121,7 +127,8 @@ ROLLBACK;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
ROLLBACK;
SET INSERT_ID=1;
-ROLLBACK;
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
--- --position --
@@ -133,7 +140,8 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq
SET @@session.sql_mode=0;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
insert into t1 values ("Alas");
-ROLLBACK;
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
--- reading stdin --
@@ -145,7 +153,8 @@ SET TIMESTAMP=1108844556;
BEGIN;
SET TIMESTAMP=1108844555;
insert t1 values (1);
-ROLLBACK;
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
@@ -154,6 +163,7 @@ SET TIMESTAMP=1108844556;
BEGIN;
SET TIMESTAMP=1108844555;
insert t1 values (1);
-ROLLBACK;
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
drop table t1, t2;
diff --git a/mysql-test/r/mysqlbinlog2.result b/mysql-test/r/mysqlbinlog2.result
index 9899fa54301..eb5fb4a87f8 100644
--- a/mysql-test/r/mysqlbinlog2.result
+++ b/mysql-test/r/mysqlbinlog2.result
@@ -39,7 +39,8 @@ insert into t1 values(null, "d");
SET INSERT_ID=5;
SET TIMESTAMP=1579609946;
insert into t1 values(null, "e");
-ROLLBACK;
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
--- offset --
@@ -65,7 +66,8 @@ insert into t1 values(null, "d");
SET INSERT_ID=5;
SET TIMESTAMP=1579609946;
insert into t1 values(null, "e");
-ROLLBACK;
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
--- start-position --
@@ -81,7 +83,8 @@ insert into t1 values(null, "d");
SET INSERT_ID=5;
SET TIMESTAMP=1579609946;
insert into t1 values(null, "e");
-ROLLBACK;
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
--- stop-position --
@@ -103,7 +106,8 @@ insert into t1 values(null, "b");
SET INSERT_ID=3;
SET TIMESTAMP=1579609944;
insert into t1 values(null, "c");
-ROLLBACK;
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
--- start-datetime --
@@ -123,7 +127,8 @@ insert into t1 values(null, "d");
SET INSERT_ID=5;
SET TIMESTAMP=1579609946;
insert into t1 values(null, "e");
-ROLLBACK;
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
--- stop-datetime --
@@ -142,7 +147,8 @@ insert into t1 values(null, "a");
SET INSERT_ID=2;
SET TIMESTAMP=1579609942;
insert into t1 values(null, "b");
-ROLLBACK;
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
--- Local with 2 binlogs on command line --
@@ -177,7 +183,8 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq
SET @@session.sql_mode=0;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
insert into t1 values(null, "f");
-ROLLBACK;
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
--- offset --
@@ -210,7 +217,8 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq
SET @@session.sql_mode=0;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
insert into t1 values(null, "f");
-ROLLBACK;
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
--- start-position --
@@ -233,7 +241,8 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq
SET @@session.sql_mode=0;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
insert into t1 values(null, "f");
-ROLLBACK;
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
--- stop-position --
@@ -262,7 +271,8 @@ SET INSERT_ID=5;
SET TIMESTAMP=1579609946;
insert into t1 values(null, "e");
SET INSERT_ID=6;
-ROLLBACK;
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
--- start-datetime --
@@ -289,7 +299,8 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq
SET @@session.sql_mode=0;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
insert into t1 values(null, "f");
-ROLLBACK;
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
--- stop-datetime --
@@ -308,7 +319,8 @@ insert into t1 values(null, "a");
SET INSERT_ID=2;
SET TIMESTAMP=1579609942;
insert into t1 values(null, "b");
-ROLLBACK;
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
--- Remote --
@@ -336,7 +348,8 @@ insert into t1 values(null, "d");
SET INSERT_ID=5;
SET TIMESTAMP=1579609946;
insert into t1 values(null, "e");
-ROLLBACK;
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
--- offset --
@@ -362,7 +375,8 @@ insert into t1 values(null, "d");
SET INSERT_ID=5;
SET TIMESTAMP=1579609946;
insert into t1 values(null, "e");
-ROLLBACK;
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
--- start-position --
@@ -378,7 +392,8 @@ insert into t1 values(null, "d");
SET INSERT_ID=5;
SET TIMESTAMP=1579609946;
insert into t1 values(null, "e");
-ROLLBACK;
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
--- stop-position --
@@ -400,7 +415,8 @@ insert into t1 values(null, "b");
SET INSERT_ID=3;
SET TIMESTAMP=1579609944;
insert into t1 values(null, "c");
-ROLLBACK;
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
--- start-datetime --
@@ -420,7 +436,8 @@ insert into t1 values(null, "d");
SET INSERT_ID=5;
SET TIMESTAMP=1579609946;
insert into t1 values(null, "e");
-ROLLBACK;
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
--- stop-datetime --
@@ -439,7 +456,8 @@ insert into t1 values(null, "a");
SET INSERT_ID=2;
SET TIMESTAMP=1579609942;
insert into t1 values(null, "b");
-ROLLBACK;
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
--- Remote with 2 binlogs on command line --
@@ -474,7 +492,8 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq
SET @@session.sql_mode=0;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
insert into t1 values(null, "f");
-ROLLBACK;
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
--- offset --
@@ -507,7 +526,8 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq
SET @@session.sql_mode=0;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
insert into t1 values(null, "f");
-ROLLBACK;
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
--- start-position --
@@ -530,7 +550,8 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq
SET @@session.sql_mode=0;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
insert into t1 values(null, "f");
-ROLLBACK;
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
--- stop-position --
@@ -559,7 +580,8 @@ SET INSERT_ID=5;
SET TIMESTAMP=1579609946;
insert into t1 values(null, "e");
SET INSERT_ID=6;
-ROLLBACK;
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
--- start-datetime --
@@ -586,7 +608,8 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq
SET @@session.sql_mode=0;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
insert into t1 values(null, "f");
-ROLLBACK;
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
--- stop-datetime --
@@ -605,7 +628,8 @@ insert into t1 values(null, "a");
SET INSERT_ID=2;
SET TIMESTAMP=1579609942;
insert into t1 values(null, "b");
-ROLLBACK;
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
--- to-last-log --
@@ -636,7 +660,8 @@ insert into t1 values(null, "e");
SET INSERT_ID=6;
SET TIMESTAMP=1579609943;
insert into t1 values(null, "f");
-ROLLBACK;
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
--- end of test --
diff --git a/mysql-test/r/mysqldump-max.result b/mysql-test/r/mysqldump-max.result
new file mode 100644
index 00000000000..699552bd514
--- /dev/null
+++ b/mysql-test/r/mysqldump-max.result
@@ -0,0 +1,266 @@
+drop table if exists t1;
+Warnings:
+Note 1051 Unknown table 't1'
+drop table if exists t2;
+Warnings:
+Note 1051 Unknown table 't2'
+drop table if exists t3;
+Warnings:
+Note 1051 Unknown table 't3'
+drop table if exists t4;
+Warnings:
+Note 1051 Unknown table 't4'
+drop table if exists t5;
+Warnings:
+Note 1051 Unknown table 't5'
+drop table if exists t6;
+Warnings:
+Note 1051 Unknown table 't6'
+create table t1 (id int(8), name varchar(32));
+create table t2 (id int(8), name varchar(32)) ENGINE="MyISAM";
+create table t3 (id int(8), name varchar(32)) ENGINE="MEMORY";
+create table t4 (id int(8), name varchar(32)) ENGINE="HEAP";
+create table t5 (id int(8), name varchar(32)) ENGINE="ARCHIVE";
+create table t6 (id int(8), name varchar(32)) ENGINE="InnoDB";
+insert into t1 values (1, 'first value');
+insert into t1 values (2, 'first value');
+insert into t1 values (3, 'first value');
+insert into t1 values (4, 'first value');
+insert into t1 values (5, 'first value');
+insert into t2 values (1, 'first value');
+insert into t2 values (2, 'first value');
+insert into t2 values (3, 'first value');
+insert into t2 values (4, 'first value');
+insert into t2 values (5, 'first value');
+insert into t3 values (1, 'first value');
+insert into t3 values (2, 'first value');
+insert into t3 values (3, 'first value');
+insert into t3 values (4, 'first value');
+insert into t3 values (5, 'first value');
+insert into t4 values (1, 'first value');
+insert into t4 values (2, 'first value');
+insert into t4 values (3, 'first value');
+insert into t4 values (4, 'first value');
+insert into t4 values (5, 'first value');
+insert into t5 values (1, 'first value');
+insert into t5 values (2, 'first value');
+insert into t5 values (3, 'first value');
+insert into t5 values (4, 'first value');
+insert into t5 values (5, 'first value');
+insert into t6 values (1, 'first value');
+insert into t6 values (2, 'first value');
+insert into t6 values (3, 'first value');
+insert into t6 values (4, 'first value');
+insert into t6 values (5, 'first value');
+select * from t1;
+id name
+1 first value
+2 first value
+3 first value
+4 first value
+5 first value
+select * from t2;
+id name
+1 first value
+2 first value
+3 first value
+4 first value
+5 first value
+select * from t3;
+id name
+1 first value
+2 first value
+3 first value
+4 first value
+5 first value
+select * from t4;
+id name
+1 first value
+2 first value
+3 first value
+4 first value
+5 first value
+select * from t5;
+id name
+1 first value
+2 first value
+3 first value
+4 first value
+5 first value
+select * from t6;
+id name
+1 first value
+2 first value
+3 first value
+4 first value
+5 first value
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+
+CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET latin1 */;
+
+USE `test`;
+DROP TABLE IF EXISTS `t1`;
+CREATE TABLE `t1` (
+ `id` int(8) default NULL,
+ `name` varchar(32) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+
+
+/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
+INSERT DELAYED IGNORE INTO `t1` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
+/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
+DROP TABLE IF EXISTS `t2`;
+CREATE TABLE `t2` (
+ `id` int(8) default NULL,
+ `name` varchar(32) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+
+
+/*!40000 ALTER TABLE `t2` DISABLE KEYS */;
+INSERT DELAYED IGNORE INTO `t2` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
+/*!40000 ALTER TABLE `t2` ENABLE KEYS */;
+DROP TABLE IF EXISTS `t3`;
+CREATE TABLE `t3` (
+ `id` int(8) default NULL,
+ `name` varchar(32) default NULL
+) ENGINE=MEMORY DEFAULT CHARSET=latin1;
+
+
+/*!40000 ALTER TABLE `t3` DISABLE KEYS */;
+INSERT DELAYED IGNORE INTO `t3` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
+/*!40000 ALTER TABLE `t3` ENABLE KEYS */;
+DROP TABLE IF EXISTS `t4`;
+CREATE TABLE `t4` (
+ `id` int(8) default NULL,
+ `name` varchar(32) default NULL
+) ENGINE=MEMORY DEFAULT CHARSET=latin1;
+
+
+/*!40000 ALTER TABLE `t4` DISABLE KEYS */;
+INSERT DELAYED IGNORE INTO `t4` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
+/*!40000 ALTER TABLE `t4` ENABLE KEYS */;
+DROP TABLE IF EXISTS `t5`;
+CREATE TABLE `t5` (
+ `id` int(8) default NULL,
+ `name` varchar(32) default NULL
+) ENGINE=ARCHIVE DEFAULT CHARSET=latin1;
+
+
+/*!40000 ALTER TABLE `t5` DISABLE KEYS */;
+INSERT DELAYED IGNORE INTO `t5` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
+/*!40000 ALTER TABLE `t5` ENABLE KEYS */;
+DROP TABLE IF EXISTS `t6`;
+CREATE TABLE `t6` (
+ `id` int(8) default NULL,
+ `name` varchar(32) default NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+
+/*!40000 ALTER TABLE `t6` DISABLE KEYS */;
+INSERT IGNORE INTO `t6` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
+/*!40000 ALTER TABLE `t6` ENABLE KEYS */;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
+/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
+/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
+
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+
+CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET latin1 */;
+
+USE `test`;
+DROP TABLE IF EXISTS `t1`;
+CREATE TABLE `t1` (
+ `id` int(8) default NULL,
+ `name` varchar(32) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+
+
+/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
+INSERT DELAYED INTO `t1` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
+/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
+DROP TABLE IF EXISTS `t2`;
+CREATE TABLE `t2` (
+ `id` int(8) default NULL,
+ `name` varchar(32) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+
+
+/*!40000 ALTER TABLE `t2` DISABLE KEYS */;
+INSERT DELAYED INTO `t2` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
+/*!40000 ALTER TABLE `t2` ENABLE KEYS */;
+DROP TABLE IF EXISTS `t3`;
+CREATE TABLE `t3` (
+ `id` int(8) default NULL,
+ `name` varchar(32) default NULL
+) ENGINE=MEMORY DEFAULT CHARSET=latin1;
+
+
+/*!40000 ALTER TABLE `t3` DISABLE KEYS */;
+INSERT DELAYED INTO `t3` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
+/*!40000 ALTER TABLE `t3` ENABLE KEYS */;
+DROP TABLE IF EXISTS `t4`;
+CREATE TABLE `t4` (
+ `id` int(8) default NULL,
+ `name` varchar(32) default NULL
+) ENGINE=MEMORY DEFAULT CHARSET=latin1;
+
+
+/*!40000 ALTER TABLE `t4` DISABLE KEYS */;
+INSERT DELAYED INTO `t4` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
+/*!40000 ALTER TABLE `t4` ENABLE KEYS */;
+DROP TABLE IF EXISTS `t5`;
+CREATE TABLE `t5` (
+ `id` int(8) default NULL,
+ `name` varchar(32) default NULL
+) ENGINE=ARCHIVE DEFAULT CHARSET=latin1;
+
+
+/*!40000 ALTER TABLE `t5` DISABLE KEYS */;
+INSERT DELAYED INTO `t5` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
+/*!40000 ALTER TABLE `t5` ENABLE KEYS */;
+DROP TABLE IF EXISTS `t6`;
+CREATE TABLE `t6` (
+ `id` int(8) default NULL,
+ `name` varchar(32) default NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+
+/*!40000 ALTER TABLE `t6` DISABLE KEYS */;
+INSERT INTO `t6` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
+/*!40000 ALTER TABLE `t6` ENABLE KEYS */;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
+/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
+/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
+
+drop table t1;
+drop table t2;
+drop table t3;
+drop table t4;
+drop table t5;
+drop table t6;
diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result
index 48e6ded689e..9bb669fd9b8 100644
--- a/mysql-test/r/mysqldump.result
+++ b/mysql-test/r/mysqldump.result
@@ -614,9 +614,7 @@ CREATE TABLE `t1` (
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
-LOCK TABLES `t1` WRITE;
-INSERT IGNORE INTO `t1` VALUES (1),(2),(3),(4),(5),(6);
-UNLOCK TABLES;
+INSERT DELAYED IGNORE INTO `t1` VALUES (1),(2),(3),(4),(5),(6);
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
@@ -1737,22 +1735,65 @@ create view v1 as
select * from v3 where b in (1, 2, 3, 4, 5, 6, 7);
create view v2 as
select v3.a from v3, v1 where v1.a=v3.a and v3.b=3 limit 1;
-drop view v1, v2, v3;
-drop table t1;
-show full tables;
-Tables_in_test Table_type
-t1 BASE TABLE
-v1 VIEW
-v2 VIEW
-v3 VIEW
-show create view v1;
-View Create View
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `v3`.`a` AS `a`,`v3`.`b` AS `b`,`v3`.`c` AS `c` from `v3` where (`v3`.`b` in (1,2,3,4,5,6,7))
-select * from v1;
-a b c
-1 2 one
-2 4 two
-3 6 three
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+DROP TABLE IF EXISTS `t1`;
+CREATE TABLE `t1` (
+ `a` int(11) default NULL,
+ `b` int(11) default NULL,
+ `c` varchar(30) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+
+
+/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
+LOCK TABLES `t1` WRITE;
+INSERT INTO `t1` VALUES (1,2,'one'),(2,4,'two'),(3,6,'three');
+UNLOCK TABLES;
+/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
+DROP TABLE IF EXISTS `v1`;
+/*!50001 DROP VIEW IF EXISTS `v1`*/;
+/*!50001 CREATE TABLE `v1` (
+ `a` int(11) default NULL,
+ `b` int(11) default NULL,
+ `c` varchar(30) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1*/;
+DROP TABLE IF EXISTS `v2`;
+/*!50001 DROP VIEW IF EXISTS `v2`*/;
+/*!50001 CREATE TABLE `v2` (
+ `a` int(11) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1*/;
+DROP TABLE IF EXISTS `v3`;
+/*!50001 DROP VIEW IF EXISTS `v3`*/;
+/*!50001 CREATE TABLE `v3` (
+ `a` int(11) default NULL,
+ `b` int(11) default NULL,
+ `c` varchar(30) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1*/;
+/*!50001 DROP TABLE IF EXISTS `v1`*/;
+/*!50001 DROP VIEW IF EXISTS `v1`*/;
+/*!50001 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `v3`.`a` AS `a`,`v3`.`b` AS `b`,`v3`.`c` AS `c` from `v3` where (`v3`.`b` in (1,2,3,4,5,6,7))*/;
+/*!50001 DROP TABLE IF EXISTS `v2`*/;
+/*!50001 DROP VIEW IF EXISTS `v2`*/;
+/*!50001 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select `v3`.`a` AS `a` from (`v3` join `v1`) where ((`v1`.`a` = `v3`.`a`) and (`v3`.`b` = 3)) limit 1*/;
+/*!50001 DROP TABLE IF EXISTS `v3`*/;
+/*!50001 DROP VIEW IF EXISTS `v3`*/;
+/*!50001 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select `t1`.`a` AS `a`,`t1`.`b` AS `b`,`t1`.`c` AS `c` from `t1`*/;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
+/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
+/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
+
drop view v1, v2, v3;
drop table t1;
CREATE TABLE t1 (a int, b bigint default NULL);
diff --git a/mysql-test/r/mysqltest.result b/mysql-test/r/mysqltest.result
index 36618140306..0ad6db8c57e 100644
--- a/mysql-test/r/mysqltest.result
+++ b/mysql-test/r/mysqltest.result
@@ -178,6 +178,7 @@ source database
echo message echo message
mysqltest: At line 1: Empty variable
+mysqltest: At line 1: command "false" failed
mysqltest: At line 1: Missing argument in exec
MySQL
"MySQL"
@@ -299,6 +300,7 @@ mysqltest: At line 1: First argument to dec must be a variable (start with $)
mysqltest: At line 1: End of line junk detected: "1000"
mysqltest: At line 1: Missing arguments to system, nothing to do!
mysqltest: At line 1: Missing arguments to system, nothing to do!
+mysqltest: At line 1: system command 'false' failed
test
test2
test3
@@ -342,6 +344,10 @@ mysqltest: At line 1: Wrong column number to replace_column in 'replace_column 1
mysqltest: At line 1: Invalid integer argument "10!"
mysqltest: At line 1: End of line junk detected: "!"
mysqltest: At line 1: Invalid integer argument "a"
+Output from mysqltest-x.inc
+Output from mysqltest-x.inc
+Output from mysqltest-x.inc
+mysqltest: Could not open ./non_existing_file.inc: errno = 2
failing_statement;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'failing_statement' at line 1
failing_statement;
diff --git a/mysql-test/r/ndb_alter_table.result b/mysql-test/r/ndb_alter_table.result
index 0d9837e76c4..e766a25b111 100644
--- a/mysql-test/r/ndb_alter_table.result
+++ b/mysql-test/r/ndb_alter_table.result
@@ -200,3 +200,119 @@ a
drop table t4;
show tables;
Tables_in_test
+create table t1 (
+ai bigint auto_increment,
+c001 int(11) not null,
+c002 int(11) not null,
+c003 int(11) not null,
+c004 int(11) not null,
+c005 int(11) not null,
+c006 int(11) not null,
+c007 int(11) not null,
+c008 int(11) not null,
+c009 int(11) not null,
+c010 int(11) not null,
+c011 int(11) not null,
+c012 int(11) not null,
+c013 int(11) not null,
+c014 int(11) not null,
+c015 int(11) not null,
+c016 int(11) not null,
+c017 int(11) not null,
+c018 int(11) not null,
+c019 int(11) not null,
+c020 int(11) not null,
+c021 int(11) not null,
+c022 int(11) not null,
+c023 int(11) not null,
+c024 int(11) not null,
+c025 int(11) not null,
+c026 int(11) not null,
+c027 int(11) not null,
+c028 int(11) not null,
+c029 int(11) not null,
+c030 int(11) not null,
+c031 int(11) not null,
+c032 int(11) not null,
+c033 int(11) not null,
+c034 int(11) not null,
+c035 int(11) not null,
+c036 int(11) not null,
+c037 int(11) not null,
+c038 int(11) not null,
+c039 int(11) not null,
+c040 int(11) not null,
+c041 int(11) not null,
+c042 int(11) not null,
+c043 int(11) not null,
+c044 int(11) not null,
+c045 int(11) not null,
+c046 int(11) not null,
+c047 int(11) not null,
+c048 int(11) not null,
+c049 int(11) not null,
+c050 int(11) not null,
+c051 int(11) not null,
+c052 int(11) not null,
+c053 int(11) not null,
+c054 int(11) not null,
+c055 int(11) not null,
+c056 int(11) not null,
+c057 int(11) not null,
+c058 int(11) not null,
+c059 int(11) not null,
+c060 int(11) not null,
+c061 int(11) not null,
+c062 int(11) not null,
+c063 int(11) not null,
+c064 int(11) not null,
+c065 int(11) not null,
+c066 int(11) not null,
+c067 int(11) not null,
+c068 int(11) not null,
+c069 int(11) not null,
+c070 int(11) not null,
+c071 int(11) not null,
+c072 int(11) not null,
+c073 int(11) not null,
+c074 int(11) not null,
+c075 int(11) not null,
+c076 int(11) not null,
+c077 int(11) not null,
+c078 int(11) not null,
+c079 int(11) not null,
+c080 int(11) not null,
+c081 int(11) not null,
+c082 int(11) not null,
+c083 int(11) not null,
+c084 int(11) not null,
+c085 int(11) not null,
+c086 int(11) not null,
+c087 int(11) not null,
+c088 int(11) not null,
+c089 int(11) not null,
+c090 int(11) not null,
+c091 int(11) not null,
+c092 int(11) not null,
+c093 int(11) not null,
+c094 int(11) not null,
+c095 int(11) not null,
+c096 int(11) not null,
+c097 int(11) not null,
+c098 int(11) not null,
+c099 int(11) not null,
+c100 int(11) not null,
+c101 int(11) not null,
+c102 int(11) not null,
+c103 int(11) not null,
+c104 int(11) not null,
+c105 int(11) not null,
+c106 int(11) not null,
+c107 int(11) not null,
+c108 int(11) not null,
+c109 int(11) not null,
+primary key (ai),
+unique key tx1 (c002, c003, c004, c005)) engine=ndb;
+create index tx2
+on t1 (c010, c011, c012, c013);
+drop table t1;
diff --git a/mysql-test/r/ndb_config.result b/mysql-test/r/ndb_config.result
index c2557f85c0b..629d37f1e5e 100644
--- a/mysql-test/r/ndb_config.result
+++ b/mysql-test/r/ndb_config.result
@@ -3,3 +3,5 @@ ndbd,1,localhost ndbd,2,localhost ndb_mgmd,3,localhost mysqld,4, mysqld,5, mysql
1 localhost 41943040 12582912
2 localhost 41943040 12582912
1 2
+ndbd,1,localhost ndbd,2,localhost ndb_mgmd,3,localhost mysqld,4, mysqld,5, mysqld,6, mysqld,7,
+ndbd,1,localhost,52428800,26214400 ndbd,2,localhost,52428800,36700160 ndbd,3,localhost,52428800,52428800 ndbd,4,localhost,52428800,52428800 ndb_mgmd,5,localhost,, mysqld,6,localhost,,
diff --git a/mysql-test/r/ps_1general.result b/mysql-test/r/ps_1general.result
index 7fb1e1b4df4..d41d1b74ca7 100644
--- a/mysql-test/r/ps_1general.result
+++ b/mysql-test/r/ps_1general.result
@@ -323,22 +323,17 @@ execute stmt4;
Engine Support Comment
MyISAM YES/NO Default engine as of MySQL 3.23 with great performance
MEMORY YES/NO Hash based, stored in memory, useful for temporary tables
-HEAP YES/NO Alias for MEMORY
-MERGE YES/NO Collection of identical MyISAM tables
-MRG_MYISAM YES/NO Alias for MERGE
-ISAM YES/NO Obsolete storage engine, now replaced by MyISAM
-MRG_ISAM YES/NO Obsolete storage engine, now replaced by MERGE
InnoDB YES/NO Supports transactions, row-level locking, and foreign keys
-INNOBASE YES/NO Alias for INNODB
-BDB YES/NO Supports transactions and page-level locking
-BERKELEYDB YES/NO Alias for BDB
-NDBCLUSTER YES/NO Clustered, fault-tolerant, memory-based tables
-NDB YES/NO Alias for NDBCLUSTER
+BerkeleyDB YES/NO Supports transactions and page-level locking
+BLACKHOLE YES/NO /dev/null storage engine (anything you write to it disappears)
EXAMPLE YES/NO Example storage engine
ARCHIVE YES/NO Archive storage engine
CSV YES/NO CSV storage engine
+ndbcluster YES/NO Clustered, fault-tolerant, memory-based tables
FEDERATED YES/NO Federated MySQL storage engine
-BLACKHOLE YES/NO /dev/null storage engine (anything you write to it disappears)
+MRG_MYISAM YES/NO Collection of identical MyISAM tables
+binlog YES/NO This is a meta storage engine to represent the binlog in a transaction
+ISAM YES/NO Obsolete storage engine
drop table if exists t5;
prepare stmt1 from ' drop table if exists t5 ' ;
execute stmt1 ;
diff --git a/mysql-test/r/ps_2myisam.result b/mysql-test/r/ps_2myisam.result
index 16ead200933..c839c8a65b9 100644
--- a/mysql-test/r/ps_2myisam.result
+++ b/mysql-test/r/ps_2myisam.result
@@ -1775,7 +1775,7 @@ Table Create Table
t5 CREATE TABLE `t5` (
`const01` bigint(1) NOT NULL default '0',
`param01` bigint(20) default NULL,
- `const02` decimal(2,1) NOT NULL default '0.0',
+ `const02` decimal(2,1) unsigned NOT NULL default '0.0',
`param02` decimal(65,30) default NULL,
`const03` double NOT NULL default '0',
`param03` double default NULL,
@@ -1805,7 +1805,7 @@ select * from t5 ;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def test t5 t5 const01 const01 8 1 1 N 32769 0 63
def test t5 t5 param01 param01 8 20 1 Y 32768 0 63
-def test t5 t5 const02 const02 246 4 3 N 1 1 63
+def test t5 t5 const02 const02 246 3 3 N 33 1 63
def test t5 t5 param02 param02 246 67 32 Y 0 30 63
def test t5 t5 const03 const03 5 17 1 N 32769 31 63
def test t5 t5 param03 param03 5 23 1 Y 32768 31 63
diff --git a/mysql-test/r/ps_3innodb.result b/mysql-test/r/ps_3innodb.result
index 9ab5a79f755..81d6180e41f 100644
--- a/mysql-test/r/ps_3innodb.result
+++ b/mysql-test/r/ps_3innodb.result
@@ -1758,7 +1758,7 @@ Table Create Table
t5 CREATE TABLE `t5` (
`const01` bigint(1) NOT NULL default '0',
`param01` bigint(20) default NULL,
- `const02` decimal(2,1) NOT NULL default '0.0',
+ `const02` decimal(2,1) unsigned NOT NULL default '0.0',
`param02` decimal(65,30) default NULL,
`const03` double NOT NULL default '0',
`param03` double default NULL,
@@ -1788,7 +1788,7 @@ select * from t5 ;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def test t5 t5 const01 const01 8 1 1 N 32769 0 63
def test t5 t5 param01 param01 8 20 1 Y 32768 0 63
-def test t5 t5 const02 const02 246 4 3 N 1 1 63
+def test t5 t5 const02 const02 246 3 3 N 33 1 63
def test t5 t5 param02 param02 246 67 32 Y 0 30 63
def test t5 t5 const03 const03 5 17 1 N 32769 31 63
def test t5 t5 param03 param03 5 23 1 Y 32768 31 63
diff --git a/mysql-test/r/ps_4heap.result b/mysql-test/r/ps_4heap.result
index 8336a5bf99b..931e6b7c86c 100644
--- a/mysql-test/r/ps_4heap.result
+++ b/mysql-test/r/ps_4heap.result
@@ -1759,7 +1759,7 @@ Table Create Table
t5 CREATE TABLE `t5` (
`const01` bigint(1) NOT NULL default '0',
`param01` bigint(20) default NULL,
- `const02` decimal(2,1) NOT NULL default '0.0',
+ `const02` decimal(2,1) unsigned NOT NULL default '0.0',
`param02` decimal(65,30) default NULL,
`const03` double NOT NULL default '0',
`param03` double default NULL,
@@ -1789,7 +1789,7 @@ select * from t5 ;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def test t5 t5 const01 const01 8 1 1 N 32769 0 63
def test t5 t5 param01 param01 8 20 1 Y 32768 0 63
-def test t5 t5 const02 const02 246 4 3 N 1 1 63
+def test t5 t5 const02 const02 246 3 3 N 33 1 63
def test t5 t5 param02 param02 246 67 32 Y 0 30 63
def test t5 t5 const03 const03 5 17 1 N 32769 31 63
def test t5 t5 param03 param03 5 23 1 Y 32768 31 63
diff --git a/mysql-test/r/ps_5merge.result b/mysql-test/r/ps_5merge.result
index f341247a417..3b9244c251f 100644
--- a/mysql-test/r/ps_5merge.result
+++ b/mysql-test/r/ps_5merge.result
@@ -1695,7 +1695,7 @@ Table Create Table
t5 CREATE TABLE `t5` (
`const01` bigint(1) NOT NULL default '0',
`param01` bigint(20) default NULL,
- `const02` decimal(2,1) NOT NULL default '0.0',
+ `const02` decimal(2,1) unsigned NOT NULL default '0.0',
`param02` decimal(65,30) default NULL,
`const03` double NOT NULL default '0',
`param03` double default NULL,
@@ -1725,7 +1725,7 @@ select * from t5 ;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def test t5 t5 const01 const01 8 1 1 N 32769 0 63
def test t5 t5 param01 param01 8 20 1 Y 32768 0 63
-def test t5 t5 const02 const02 246 4 3 N 1 1 63
+def test t5 t5 const02 const02 246 3 3 N 33 1 63
def test t5 t5 param02 param02 246 67 32 Y 0 30 63
def test t5 t5 const03 const03 5 17 1 N 32769 31 63
def test t5 t5 param03 param03 5 23 1 Y 32768 31 63
@@ -4707,7 +4707,7 @@ Table Create Table
t5 CREATE TABLE `t5` (
`const01` bigint(1) NOT NULL default '0',
`param01` bigint(20) default NULL,
- `const02` decimal(2,1) NOT NULL default '0.0',
+ `const02` decimal(2,1) unsigned NOT NULL default '0.0',
`param02` decimal(65,30) default NULL,
`const03` double NOT NULL default '0',
`param03` double default NULL,
@@ -4737,7 +4737,7 @@ select * from t5 ;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def test t5 t5 const01 const01 8 1 1 N 32769 0 63
def test t5 t5 param01 param01 8 20 1 Y 32768 0 63
-def test t5 t5 const02 const02 246 4 3 N 1 1 63
+def test t5 t5 const02 const02 246 3 3 N 33 1 63
def test t5 t5 param02 param02 246 67 32 Y 0 30 63
def test t5 t5 const03 const03 5 17 1 N 32769 31 63
def test t5 t5 param03 param03 5 23 1 Y 32768 31 63
diff --git a/mysql-test/r/ps_6bdb.result b/mysql-test/r/ps_6bdb.result
index fe4536827e6..643e12f7e2d 100644
--- a/mysql-test/r/ps_6bdb.result
+++ b/mysql-test/r/ps_6bdb.result
@@ -1758,7 +1758,7 @@ Table Create Table
t5 CREATE TABLE `t5` (
`const01` bigint(1) NOT NULL default '0',
`param01` bigint(20) default NULL,
- `const02` decimal(2,1) NOT NULL default '0.0',
+ `const02` decimal(2,1) unsigned NOT NULL default '0.0',
`param02` decimal(65,30) default NULL,
`const03` double NOT NULL default '0',
`param03` double default NULL,
@@ -1788,7 +1788,7 @@ select * from t5 ;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def test t5 t5 const01 const01 8 1 1 N 32769 0 63
def test t5 t5 param01 param01 8 20 1 Y 32768 0 63
-def test t5 t5 const02 const02 246 4 3 N 1 1 63
+def test t5 t5 const02 const02 246 3 3 N 33 1 63
def test t5 t5 param02 param02 246 67 32 Y 0 30 63
def test t5 t5 const03 const03 5 17 1 N 32769 31 63
def test t5 t5 param03 param03 5 23 1 Y 32768 31 63
diff --git a/mysql-test/r/ps_7ndb.result b/mysql-test/r/ps_7ndb.result
index c4cb92bdc02..9fbe67f581b 100644
--- a/mysql-test/r/ps_7ndb.result
+++ b/mysql-test/r/ps_7ndb.result
@@ -1758,7 +1758,7 @@ Table Create Table
t5 CREATE TABLE `t5` (
`const01` bigint(1) NOT NULL default '0',
`param01` bigint(20) default NULL,
- `const02` decimal(2,1) NOT NULL default '0.0',
+ `const02` decimal(2,1) unsigned NOT NULL default '0.0',
`param02` decimal(65,30) default NULL,
`const03` double NOT NULL default '0',
`param03` double default NULL,
@@ -1788,7 +1788,7 @@ select * from t5 ;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def test t5 t5 const01 const01 8 1 1 N 32769 0 63
def test t5 t5 param01 param01 8 20 1 Y 32768 0 63
-def test t5 t5 const02 const02 246 4 3 N 1 1 63
+def test t5 t5 const02 const02 246 3 3 N 33 1 63
def test t5 t5 param02 param02 246 67 32 Y 0 30 63
def test t5 t5 const03 const03 5 17 1 N 32769 31 63
def test t5 t5 param03 param03 5 23 1 Y 32768 31 63
diff --git a/mysql-test/r/range.result b/mysql-test/r/range.result
index f490c2e1383..69c150fc0b7 100644
--- a/mysql-test/r/range.result
+++ b/mysql-test/r/range.result
@@ -1,4 +1,4 @@
-drop table if exists t1, t2;
+drop table if exists t1, t2, t3;
CREATE TABLE t1 (
event_date date DEFAULT '0000-00-00' NOT NULL,
type int(11) DEFAULT '0' NOT NULL,
@@ -768,3 +768,45 @@ SELECT * FROM t1;
a
2
DROP TABLE t1;
+create table t1 (a int, b int, primary key(a,b));
+create view v1 as select a, b from t1;
+INSERT INTO `t1` VALUES
+(0,0),(1,0),(2,0),(3,0),(4,0),(5,1),(6,1),(7,1),(8,1),(9,1),(10,2),(11,2),(12,2)
+,(13,2),(14,2),(15,3),(16,3),(17,3),(18,3),(19,3);
+explain select * from t1 where a in (3,4) and b in (1,2,3);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range PRIMARY PRIMARY 8 NULL # Using where; Using index
+explain select * from v1 where a in (3,4) and b in (1,2,3);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 range PRIMARY PRIMARY 8 NULL # Using where; Using index
+explain select * from t1 where a between 3 and 4 and b between 1 and 2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range PRIMARY PRIMARY 8 NULL # Using where; Using index
+explain select * from v1 where a between 3 and 4 and b between 1 and 2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 range PRIMARY PRIMARY 8 NULL # Using where; Using index
+drop view v1;
+drop table t1;
+create table t3 (a int);
+insert into t3 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+create table t1 (a varchar(10), filler char(200), key(a)) charset=binary;
+insert into t1 values ('a','');
+insert into t1 values ('a ','');
+insert into t1 values ('a ', '');
+insert into t1 select concat('a', 1000 + A.a + 10 * (B.a + 10 * C.a)), ''
+ from t3 A, t3 B, t3 C;
+create table t2 (a varchar(10), filler char(200), key(a));
+insert into t2 select * from t1;
+explain select * from t1 where a between 'a' and 'a ';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 13 NULL # Using where
+explain select * from t1 where a = 'a' or a='a ';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 13 NULL # Using where
+explain select * from t2 where a between 'a' and 'a ';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ref a a 13 const # Using where
+explain select * from t2 where a = 'a' or a='a ';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ref a a 13 const # Using where
+drop table t1,t2,t3;
diff --git a/mysql-test/r/rpl_charset.result b/mysql-test/r/rpl_charset.result
index b27acc0972e..28f694a3933 100644
--- a/mysql-test/r/rpl_charset.result
+++ b/mysql-test/r/rpl_charset.result
@@ -246,7 +246,8 @@ CREATE TABLE t1 (c1 VARBINARY(255), c2 VARBINARY(255));
SET TIMESTAMP=1000000000;
SET @@session.character_set_client=7,@@session.collation_connection=51,@@session.collation_server=30;
INSERT INTO t1 (c1, c2) VALUES ('îÕ, ÚÁ ÒÙÂÁÌËÕ','îÕ, ÚÁ ÒÙÂÁÌËÕ');
-ROLLBACK;
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
drop table t1;
create table `t1` (
diff --git a/mysql-test/r/rpl_multi_delete.result b/mysql-test/r/rpl_multi_delete.result
index e94a4e7947e..d2c68eee62e 100644
--- a/mysql-test/r/rpl_multi_delete.result
+++ b/mysql-test/r/rpl_multi_delete.result
@@ -19,4 +19,13 @@ a
select * from t2;
a
1
+delete from t1;
+delete from t2;
+insert into t1 values(1);
+insert into t2 values(1);
+DELETE t1.*, t2.* from t1, t2;
+select * from t1;
+a
+select * from t2;
+a
drop table t1,t2;
diff --git a/mysql-test/r/rpl_multi_delete2.result b/mysql-test/r/rpl_multi_delete2.result
index c6c088111fc..73db9f62eb4 100644
--- a/mysql-test/r/rpl_multi_delete2.result
+++ b/mysql-test/r/rpl_multi_delete2.result
@@ -4,6 +4,26 @@ reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
+set sql_log_bin=0;
+create database mysqltest_from;
+set sql_log_bin=1;
+create database mysqltest_to;
+use mysqltest_from;
+drop table if exists a;
+CREATE TABLE a (i INT);
+INSERT INTO a VALUES(1);
+DELETE alias FROM a alias WHERE alias.i=1;
+SELECT * FROM a;
+i
+insert into a values(2),(3);
+delete a alias FROM a alias where alias.i=2;
+select * from a;
+i
+3
+use mysqltest_to;
+select * from a;
+i
+3
create table t1 (a int);
create table t2 (a int);
insert into t1 values (1);
@@ -15,7 +35,10 @@ select * from t2;
a
1
select * from t1;
-ERROR 42S02: Table 'test.t1' doesn't exist
+ERROR 42S02: Table 'mysqltest_to.t1' doesn't exist
select * from t2;
-ERROR 42S02: Table 'test.t2' doesn't exist
-drop table t1,t2;
+ERROR 42S02: Table 'mysqltest_to.t2' doesn't exist
+set sql_log_bin=0;
+drop database mysqltest_from;
+set sql_log_bin=1;
+drop database mysqltest_to;
diff --git a/mysql-test/r/rpl_multi_update.result b/mysql-test/r/rpl_multi_update.result
index 34f99746c7d..04cb1bc7460 100644
--- a/mysql-test/r/rpl_multi_update.result
+++ b/mysql-test/r/rpl_multi_update.result
@@ -24,3 +24,16 @@ a b
1 0
2 1
UPDATE t1, t2 SET t1.b = t2.b WHERE t1.a = t2.a;
+delete from t1;
+delete from t2;
+insert into t1 values(1,1);
+insert into t2 values(1,1);
+update t1 set a=2;
+UPDATE t1, t2 SET t1.a = t2.a;
+select * from t1;
+a b
+1 1
+select * from t2;
+a b
+1 1
+drop table t1, t2;
diff --git a/mysql-test/r/rpl_sp.result b/mysql-test/r/rpl_sp.result
index 394f93f2ea0..b1f564a0791 100644
--- a/mysql-test/r/rpl_sp.result
+++ b/mysql-test/r/rpl_sp.result
@@ -121,7 +121,7 @@ call foo4();
Got one of the listed errors
show warnings;
Level Code Message
-Error 1142 INSERT command denied to user 'zedjzlcsjhd'@'localhost' for table 't1'
+Error 1142 INSERT command denied to user 'zedjzlcsjhd'@'127.0.0.1' for table 't1'
Warning 1417 A routine failed and has neither NO SQL nor READS SQL DATA in its declaration and binary logging is enabled; if non-transactional tables were updated, the binary log will miss their changes
alter procedure foo4 sql security invoker;
call foo4();
diff --git a/mysql-test/r/rpl_timezone.result b/mysql-test/r/rpl_timezone.result
index 85637638f99..64d05aa787e 100644
--- a/mysql-test/r/rpl_timezone.result
+++ b/mysql-test/r/rpl_timezone.result
@@ -63,7 +63,8 @@ delete from t1;
SET TIMESTAMP=100000000;
SET @@session.time_zone='Europe/Moscow';
insert into t1 values ('20040101000000'), ('20040611093902');
-ROLLBACK;
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
delete from t1;
set time_zone='UTC';
diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result
index d7de9b6509b..3e4f29d7a01 100644
--- a/mysql-test/r/select.result
+++ b/mysql-test/r/select.result
@@ -2620,6 +2620,15 @@ select found_rows();
found_rows()
1
DROP TABLE t1;
+create table t1(f1 int, f2 int);
+create table t2(f3 int);
+select f1 from t1,t2 where f1=f2 and (f1,f2) = ((1,1));
+f1
+select f1 from t1,t2 where f1=f2 and (f1,NULL) = ((1,1));
+f1
+select f1 from t1,t2 where f1=f2 and (f1,f2) = ((1,NULL));
+f1
+drop table t1,t2;
CREATE TABLE t1 ( city char(30) );
INSERT INTO t1 VALUES ('London');
INSERT INTO t1 VALUES ('Paris');
@@ -2943,3 +2952,112 @@ select * from t1 join t2 join t4 using (c);
c a b
1 1 1
drop table t1, t2, t3, t4;
+create table t1(x int, y int);
+create table t2(x int, y int);
+create table t3(x int, primary key(x));
+insert into t1 values (1, 1), (2, 1), (3, 1), (4, 3), (5, 6), (6, 6);
+insert into t2 values (1, 1), (2, 1), (3, 3), (4, 6), (5, 6);
+insert into t3 values (1), (2), (3), (4), (5);
+select t1.x, t3.x from t1, t2, t3 where t1.x = t2.x and t3.x >= t1.y and t3.x <= t2.y;
+x x
+1 1
+2 1
+3 1
+3 2
+3 3
+4 3
+4 4
+4 5
+drop table t1,t2,t3;
+create table t1 (id char(16) not null default '', primary key (id));
+insert into t1 values ('100'),('101'),('102');
+create table t2 (id char(16) default null);
+insert into t2 values (1);
+create view v1 as select t1.id from t1;
+create view v2 as select t2.id from t2;
+create view v3 as select (t1.id+2) as id from t1 natural left join t2;
+select t1.id from t1 left join v2 using (id);
+id
+100
+101
+102
+select t1.id from v2 right join t1 using (id);
+id
+100
+101
+102
+select t1.id from t1 left join v3 using (id);
+id
+100
+101
+102
+select * from t1 left join v2 using (id);
+id
+100
+101
+102
+select * from v2 right join t1 using (id);
+id
+100
+101
+102
+select * from t1 left join v3 using (id);
+id
+100
+101
+102
+select v1.id from v1 left join v2 using (id);
+id
+100
+101
+102
+select v1.id from v2 right join v1 using (id);
+id
+100
+101
+102
+select v1.id from v1 left join v3 using (id);
+id
+100
+101
+102
+select * from v1 left join v2 using (id);
+id
+100
+101
+102
+select * from v2 right join v1 using (id);
+id
+100
+101
+102
+select * from v1 left join v3 using (id);
+id
+100
+101
+102
+drop table t1, t2;
+drop view v1, v2, v3;
+create table a (
+id int(11) not null default '0'
+) engine=myisam default charset=latin1;
+insert into a values (123),(191),(192);
+create table b (
+id char(16) character set utf8 not null default ''
+) engine=myisam default charset=latin1;
+insert into b values ('58013'),('58014'),('58015'),('58016');
+create table c (
+a_id int(11) not null default '0',
+b_id char(16) character set utf8 default null
+) engine=myisam default charset=latin1;
+insert into c values
+(123,null),(123,null),(123,null),(123,null),(123,null),(123,'58013');
+select count(*)
+from a inner join (c left join b on b.id = c.b_id) on a.id = c.a_id;
+count(*)
+6
+select count(*)
+from a inner join (b right join c on b.id = c.b_id) on a.id = c.a_id;
+count(*)
+6
+drop table a, b, c;
diff --git a/mysql-test/r/skip_name_resolve.result b/mysql-test/r/skip_name_resolve.result
index d8d873699a5..a969c5c9ae0 100644
--- a/mysql-test/r/skip_name_resolve.result
+++ b/mysql-test/r/skip_name_resolve.result
@@ -5,3 +5,10 @@ GRANT USAGE ON *.* TO 'mysqltest_1'@'127.0.0.1/255.255.255.255'
GRANT ALL PRIVILEGES ON `test`.* TO 'mysqltest_1'@'127.0.0.1/255.255.255.255'
REVOKE ALL ON test.* FROM mysqltest_1@'127.0.0.1/255.255.255.255';
DROP USER mysqltest_1@'127.0.0.1/255.255.255.255';
+select user();
+user()
+#
+show processlist;
+Id User Host db Command Time State Info
+# root # test Sleep # NULL
+# root # test Query # NULL show processlist
diff --git a/mysql-test/r/sp-big.result b/mysql-test/r/sp-big.result
index 004ff586aab..1f0b6b34651 100644
--- a/mysql-test/r/sp-big.result
+++ b/mysql-test/r/sp-big.result
@@ -13,3 +13,49 @@ select @value;
3
drop procedure test.longprocedure;
drop table t1;
+create table t1 (f1 char(100) , f2 mediumint , f3 int , f4 real, f5 numeric);
+insert into t1 (f1, f2, f3, f4, f5) values
+("This is a test case for for Bug#9819", 1, 2, 3.0, 4.598);
+Warnings:
+Note 1265 Data truncated for column 'f5' at row 1
+create table t2 like t1;
+select count(*) from t1;
+count(*)
+256
+select count(*) from t2;
+count(*)
+0
+create procedure p1()
+begin
+declare done integer default 0;
+declare vf1 char(100) ;
+declare vf2 mediumint;
+declare vf3 int ;
+declare vf4 real ;
+declare vf5 numeric ;
+declare cur1 cursor for select f1,f2,f3,f4,f5 from t1;
+declare continue handler for sqlstate '02000' set done = 1;
+open cur1;
+while done <> 1 do
+fetch cur1 into vf1, vf2, vf3, vf4, vf5;
+if not done then
+insert into t2 values (vf1, vf2, vf3, vf4, vf5);
+end if;
+end while;
+close cur1;
+end|
+call p1();
+select count(*) from t1;
+count(*)
+256
+select count(*) from t2;
+count(*)
+256
+select f1 from t1 limit 1;
+f1
+This is a test case for for Bug#9819
+select f1 from t2 limit 1;
+f1
+This is a test case for for Bug#9819
+drop procedure p1;
+drop table t1, t2;
diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result
index aedaaad9398..1b8cde6d3db 100644
--- a/mysql-test/r/sp.result
+++ b/mysql-test/r/sp.result
@@ -3206,6 +3206,18 @@ set f1= concat( 'hello', f1 );
return f1;
end|
drop function bug9048|
+drop function if exists bug12812|
+create function bug12812() returns char(2)
+begin
+return 'ok';
+end;
+create user user_bug12812@localhost IDENTIFIED BY 'ABC'|
+SELECT test.bug12812()|
+ERROR 42000: execute command denied to user 'user_bug12812'@'localhost' for routine 'test.bug12812'
+CREATE VIEW v1 AS SELECT test.bug12812()|
+ERROR 42000: execute command denied to user 'user_bug12812'@'localhost' for routine 'test.bug12812'
+DROP USER user_bug12812@localhost|
+drop function bug12812|
drop procedure if exists bug12849_1|
create procedure bug12849_1(inout x char) select x into x|
set @var='a'|
@@ -3348,4 +3360,79 @@ call bug12979_2()|
internal_var
NULL
drop procedure bug12979_2|
+drop table if exists t3|
+drop procedure if exists bug6127|
+create table t3 (s1 int unique)|
+set @sm=@@sql_mode|
+set sql_mode='traditional'|
+create procedure bug6127()
+begin
+declare continue handler for sqlstate '23000'
+ begin
+declare continue handler for sqlstate '22003'
+ insert into t3 values (0);
+insert into t3 values (1000000000000000);
+end;
+insert into t3 values (1);
+insert into t3 values (1);
+end|
+call bug6127()|
+select * from t3|
+s1
+0
+1
+call bug6127()|
+ERROR 23000: Duplicate entry '0' for key 1
+select * from t3|
+s1
+0
+1
+set sql_mode=@sm|
+drop table t3|
+drop procedure bug6127|
+drop procedure if exists bug12589_1|
+drop procedure if exists bug12589_2|
+drop procedure if exists bug12589_3|
+create procedure bug12589_1()
+begin
+declare spv1 decimal(3,3);
+set spv1= 123.456;
+set spv1 = 'test';
+create temporary table tm1 as select spv1;
+show create table tm1;
+drop temporary table tm1;
+end|
+create procedure bug12589_2()
+begin
+declare spv1 decimal(6,3);
+set spv1= 123.456;
+create temporary table tm1 as select spv1;
+show create table tm1;
+drop temporary table tm1;
+end|
+create procedure bug12589_3()
+begin
+declare spv1 decimal(6,3);
+set spv1= -123.456;
+create temporary table tm1 as select spv1;
+show create table tm1;
+drop temporary table tm1;
+end|
+call bug12589_1()|
+Table Create Table
+tm1 CREATE TEMPORARY TABLE `tm1` (
+ `spv1` decimal(1,0) unsigned default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+Warnings:
+Warning 1292 Truncated incorrect DECIMAL value: 'test'
+call bug12589_2()|
+Table Create Table
+tm1 CREATE TEMPORARY TABLE `tm1` (
+ `spv1` decimal(6,3) unsigned default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+call bug12589_3()|
+Table Create Table
+tm1 CREATE TEMPORARY TABLE `tm1` (
+ `spv1` decimal(6,3) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1,t2;
diff --git a/mysql-test/r/sql_mode.result b/mysql-test/r/sql_mode.result
index 6ceb1cda888..83099623e23 100644
--- a/mysql-test/r/sql_mode.result
+++ b/mysql-test/r/sql_mode.result
@@ -65,7 +65,7 @@ sql_mode NO_FIELD_OPTIONS,MYSQL323,MYSQL40,HIGH_NOT_PRECEDENCE
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` int(11) NOT NULL auto_increment,
+ `a` int(11) NOT NULL,
`pseudo` varchar(35) NOT NULL default '',
`email` varchar(60) NOT NULL default '',
PRIMARY KEY (`a`),
@@ -79,8 +79,8 @@ show create table t1;
Table Create Table
t1 CREATE TABLE "t1" (
"a" int(11) NOT NULL,
- "pseudo" varchar(35) NOT NULL default '',
- "email" varchar(60) NOT NULL default '',
+ "pseudo" varchar(35) character set latin2 NOT NULL default '',
+ "email" varchar(60) character set latin2 NOT NULL default '',
PRIMARY KEY ("a"),
UNIQUE KEY "email" ("email")
)
@@ -140,6 +140,26 @@ t1 CREATE TABLE `t1` (
drop table t1 ;
set @@SQL_MODE=NULL;
ERROR 42000: Variable 'sql_mode' can't be set to the value of 'NULL'
+set session sql_mode=ansi;
+create table t1
+(f1 integer auto_increment primary key,
+f2 timestamp default current_timestamp on update current_timestamp);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE "t1" (
+ "f1" int(11) NOT NULL auto_increment,
+ "f2" timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
+ PRIMARY KEY ("f1")
+)
+set session sql_mode=no_field_options;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) NOT NULL,
+ `f2` timestamp NOT NULL default CURRENT_TIMESTAMP,
+ PRIMARY KEY (`f1`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
SET @OLD_SQL_MODE=@@SQL_MODE, @@SQL_MODE='';
show local variables like 'SQL_MODE';
Variable_name Value
diff --git a/mysql-test/r/system_mysql_db.result b/mysql-test/r/system_mysql_db.result
index d2872878cb9..f68c4805d72 100644
--- a/mysql-test/r/system_mysql_db.result
+++ b/mysql-test/r/system_mysql_db.result
@@ -73,7 +73,7 @@ Table Create Table
user CREATE TABLE `user` (
`Host` char(60) collate utf8_bin NOT NULL default '',
`User` char(16) collate utf8_bin NOT NULL default '',
- `Password` char(41) collate utf8_bin NOT NULL default '',
+ `Password` binary(41) NOT NULL default '',
`Select_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
`Insert_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
`Update_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
diff --git a/mysql-test/r/temp_table.result b/mysql-test/r/temp_table.result
index 726861bb525..82479504b10 100644
--- a/mysql-test/r/temp_table.result
+++ b/mysql-test/r/temp_table.result
@@ -1,4 +1,5 @@
drop table if exists t1,t2;
+drop view if exists v1;
CREATE TABLE t1 (c int not null, d char (10) not null);
insert into t1 values(1,""),(2,"a"),(3,"b");
CREATE TEMPORARY TABLE t1 (a int not null, b char (10) not null);
@@ -99,32 +100,32 @@ Variable_name Value
Created_tmp_disk_tables 0
Created_tmp_tables 2
drop table t1;
-create temporary table t1 as select 'This is temp. table' A;
-create view t1 as select 'This is view' A;
-select * from t1;
+create temporary table v1 as select 'This is temp. table' A;
+create view v1 as select 'This is view' A;
+select * from v1;
A
This is temp. table
-show create table t1;
+show create table v1;
Table Create Table
-t1 CREATE TEMPORARY TABLE `t1` (
+v1 CREATE TEMPORARY TABLE `v1` (
`A` varchar(19) NOT NULL default ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-show create view t1;
+show create view v1;
View Create View
-t1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `t1` AS select _latin1'This is view' AS `A`
-drop view t1;
-select * from t1;
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select _latin1'This is view' AS `A`
+drop view v1;
+select * from v1;
A
This is temp. table
-create view t1 as select 'This is view again' A;
-select * from t1;
+create view v1 as select 'This is view again' A;
+select * from v1;
A
This is temp. table
-drop table t1;
-select * from t1;
+drop table v1;
+select * from v1;
A
This is view again
-drop view t1;
+drop view v1;
create table t1 (a int, b int, index(a), index(b));
create table t2 (c int auto_increment, d varchar(255), primary key (c));
insert into t1 values (3,1),(3,2);
diff --git a/mysql-test/r/type_bit.result b/mysql-test/r/type_bit.result
index 5988b4f745e..0213dbaffde 100644
--- a/mysql-test/r/type_bit.result
+++ b/mysql-test/r/type_bit.result
@@ -553,3 +553,13 @@ sum(a1) b1+0 b2+0
2 0 0
4 2 2
8 1 1
+select 1 from t1 join t2 on b1 = b2 group by b1 order by 1;
+1
+1
+1
+1
+select b1+0,sum(b1), sum(b2) from t1 join t2 on b1 = b2 group by b1 order by 1;
+b1+0 sum(b1) sum(b2)
+0 0 0
+1 4 4
+2 2 2
diff --git a/mysql-test/r/type_decimal.result b/mysql-test/r/type_decimal.result
index 15f9b839994..d7f5f9fa328 100644
--- a/mysql-test/r/type_decimal.result
+++ b/mysql-test/r/type_decimal.result
@@ -476,7 +476,7 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
CREATE TABLE t1 (a_dec DECIMAL(-1,1));
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-1,1))' at line 1
CREATE TABLE t1 (a_dec DECIMAL(0,11));
-ERROR 42000: Scale may not be larger than the precision (column 'a_dec').
+ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column 'a_dec').
create table t1(a decimal(7,3));
insert into t1 values ('1'),('+1'),('-1'),('0000000001'),('+0000000001'),('-0000000001'),('10'),('+10'),('-10'),('0000000010'),('+0000000010'),('-0000000010'),('100'),('+100'),('-100'),('0000000100'),('+0000000100'),('-0000000100'),('1000'),('+1000'),('-1000'),('0000001000'),('+0000001000'),('-0000001000'),('10000'),('+10000'),('-10000'),('0000010000'),('+0000010000'),('-0000010000'),('100000'),('+100000'),('-100000'),('0000100000'),('+0000100000'),('-0000100000'),('1000000'),('+1000000'),('-1000000'),('0001000000'),('+0001000000'),('-0001000000'),('10000000'),('+10000000'),('-10000000'),('0010000000'),('+0010000000'),('-0010000000'),('100000000'),('+100000000'),('-100000000'),('0100000000'),('+0100000000'),('-0100000000'),('1000000000'),('+1000000000'),('-1000000000'),('1000000000'),('+1000000000'),('-1000000000');
select * from t1;
@@ -672,6 +672,17 @@ a
9999.999
0000.000
drop table t1;
+create table t1(a decimal(10,5), b decimal(10,1));
+insert into t1 values(123.12345, 123.12345);
+Warnings:
+Note 1265 Data truncated for column 'b' at row 1
+update t1 set b=a;
+Warnings:
+Note 1265 Data truncated for column 'b' at row 1
+select * from t1;
+a b
+123.12345 123.1
+drop table t1;
CREATE TABLE t1
(EMPNUM CHAR(3) NOT NULL,
HOURS DECIMAL(5));
diff --git a/mysql-test/r/type_float.result b/mysql-test/r/type_float.result
index d243985332e..6b124caac14 100644
--- a/mysql-test/r/type_float.result
+++ b/mysql-test/r/type_float.result
@@ -225,3 +225,7 @@ select * from t1 where reckey=1.09E2;
reckey recdesc
109 Has 109 as key
drop table t1;
+create table t1 (s1 float(0,2));
+ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column 's1').
+create table t1 (s1 float(1,2));
+ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column 's1').
diff --git a/mysql-test/r/type_newdecimal.result b/mysql-test/r/type_newdecimal.result
index d821339a229..be5e29ab662 100644
--- a/mysql-test/r/type_newdecimal.result
+++ b/mysql-test/r/type_newdecimal.result
@@ -68,10 +68,10 @@ NULL 1.1 NULL NULL NULL 1
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `nullif(1.1, 1.1)` decimal(2,1) default NULL,
- `nullif(1.1, 1.2)` decimal(2,1) default NULL,
- `nullif(1.1, 0.11e1)` decimal(2,1) default NULL,
- `nullif(1.0, 1)` decimal(2,1) default NULL,
+ `nullif(1.1, 1.1)` decimal(2,1) unsigned default NULL,
+ `nullif(1.1, 1.2)` decimal(2,1) unsigned default NULL,
+ `nullif(1.1, 0.11e1)` decimal(2,1) unsigned default NULL,
+ `nullif(1.0, 1)` decimal(2,1) unsigned default NULL,
`nullif(1, 1.0)` int(1) default NULL,
`nullif(1, 1.1)` int(1) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
@@ -174,9 +174,9 @@ create table t1 select round(15.4,-1), truncate(-5678.123451,-3), abs(-1.1), -(-
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `round(15.4,-1)` decimal(3,0) NOT NULL default '0',
+ `round(15.4,-1)` decimal(3,0) unsigned NOT NULL default '0',
`truncate(-5678.123451,-3)` decimal(4,0) NOT NULL default '0',
- `abs(-1.1)` decimal(3,1) NOT NULL default '0.0',
+ `abs(-1.1)` decimal(2,1) NOT NULL default '0.0',
`-(-1.1)` decimal(2,1) NOT NULL default '0.0'
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
@@ -781,7 +781,7 @@ create table t1 as select 0.5;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `0.5` decimal(2,1) NOT NULL default '0.0'
+ `0.5` decimal(2,1) unsigned NOT NULL default '0.0'
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select round(1.5),round(2.5);
@@ -936,7 +936,7 @@ ERROR 42000: Too big scale 31 specified for column 'sl'. Maximum is 30.
create table t1 (sl decimal(0,38));
ERROR 42000: Too big scale 38 specified for column 'sl'. Maximum is 30.
create table t1 (sl decimal(0,30));
-ERROR 42000: Scale may not be larger than the precision (column 'sl').
+ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column 'sl').
create table t1 (sl decimal(5, 5));
show create table t1;
Table Create Table
diff --git a/mysql-test/r/union.result b/mysql-test/r/union.result
index eb129e32983..042dfb5ad8d 100644
--- a/mysql-test/r/union.result
+++ b/mysql-test/r/union.result
@@ -780,21 +780,6 @@ t1 CREATE TABLE `t1` (
`b` longblob
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1,t2;
-create table t1 (d decimal(10,1));
-create table t2 (d decimal(10,9));
-insert into t1 values ("100000000.0");
-insert into t2 values ("1.23456780");
-create table t3 select * from t2 union select * from t1;
-select * from t3;
-d
-1.234567800
-100000000.000000000
-show create table t3;
-Table Create Table
-t3 CREATE TABLE `t3` (
- `d` decimal(18,9) default NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1
-drop table t1,t2,t3;
create table t1 select 1 union select -1;
select * from t1;
1
diff --git a/mysql-test/r/update.result b/mysql-test/r/update.result
index 42fb8064044..9ca6370dff6 100644
--- a/mysql-test/r/update.result
+++ b/mysql-test/r/update.result
@@ -251,3 +251,15 @@ f1 f2
1 1
2 2
drop table t1,t2;
+create table t1(f1 int);
+select DATABASE();
+DATABASE()
+test
+update t1 set f1=1 where count(*)=1;
+ERROR HY000: Invalid use of group function
+select DATABASE();
+DATABASE()
+test
+delete from t1 where count(*)=1;
+ERROR HY000: Invalid use of group function
+drop table t1;
diff --git a/mysql-test/r/user_var-binlog.result b/mysql-test/r/user_var-binlog.result
index 0e9692523ef..17ac8809d52 100644
--- a/mysql-test/r/user_var-binlog.result
+++ b/mysql-test/r/user_var-binlog.result
@@ -27,6 +27,7 @@ SET @`var1`:=_latin1 0x273B616161 COLLATE `latin1_swedish_ci`;
SET @`var2`:=_latin1 0x61 COLLATE `latin1_swedish_ci`;
SET TIMESTAMP=10000;
insert into t1 values (@var1),(@var2);
-ROLLBACK;
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
drop table t1;
diff --git a/mysql-test/r/variables.result b/mysql-test/r/variables.result
index 265f353ae3c..30ebeb462df 100644
--- a/mysql-test/r/variables.result
+++ b/mysql-test/r/variables.result
@@ -147,7 +147,7 @@ Variable_name Value
storage_engine MEMORY
show global variables like 'storage_engine';
Variable_name Value
-storage_engine MERGE
+storage_engine MRG_MYISAM
set GLOBAL query_cache_size=100000;
set GLOBAL myisam_max_sort_file_size=2000000;
show global variables like 'myisam_max_sort_file_size';
diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result
index a40d776000d..e52ec950c8c 100644
--- a/mysql-test/r/view.result
+++ b/mysql-test/r/view.result
@@ -845,6 +845,15 @@ select * from v1;
cast(1 as char(3))
1
drop view v1;
+create table t1 (a int);
+create view v1 as select a from t1;
+create database seconddb;
+rename table v1 to seconddb.v1;
+ERROR HY000: Changing schema from 'test' to 'seconddb' is not allowed.
+rename table v1 to v2;
+drop table t1;
+drop view v2;
+drop database seconddb;
create view v1 as select 'a',1;
create view v2 as select * from v1 union all select * from v1;
create view v3 as select * from v2 where 1 = (select `1` from v2);
@@ -2253,3 +2262,39 @@ WEEKDAY(date)
1
DROP TABLE t1;
DROP VIEW v1, v2, v3;
+CREATE TABLE t1 ( a int, b int );
+INSERT INTO t1 VALUES (1,1),(2,2),(3,3);
+CREATE VIEW v1 AS SELECT a,b FROM t1;
+SELECT t1.a FROM t1 GROUP BY t1.a HAVING a > 1;
+a
+2
+3
+SELECT v1.a FROM v1 GROUP BY v1.a HAVING a > 1;
+a
+2
+3
+DROP VIEW v1;
+DROP TABLE t1;
+CREATE TABLE t1 ( a int, b int );
+INSERT INTO t1 VALUES (1,1),(2,2),(3,3);
+CREATE VIEW v1 AS SELECT a,b FROM t1;
+SELECT t1.a FROM t1 GROUP BY t1.a HAVING t1.a > 1;
+a
+2
+3
+SELECT v1.a FROM v1 GROUP BY v1.a HAVING v1.a > 1;
+a
+2
+3
+SELECT t_1.a FROM t1 AS t_1 GROUP BY t_1.a HAVING t_1.a IN (1,2,3);
+a
+1
+2
+3
+SELECT v_1.a FROM v1 AS v_1 GROUP BY v_1.a HAVING v_1.a IN (1,2,3);
+a
+1
+2
+3
+DROP VIEW v1;
+DROP TABLE t1;
diff --git a/mysql-test/r/view_query_cache.result b/mysql-test/r/view_query_cache.result
index e6c2c0152f3..944e1db34c9 100644
--- a/mysql-test/r/view_query_cache.result
+++ b/mysql-test/r/view_query_cache.result
@@ -123,4 +123,13 @@ select * from v3;
a b
drop view v3;
drop table t1, t2;
+create table t1(f1 int);
+insert into t1 values(1),(2),(3);
+create view v1 as select * from t1;
+set query_cache_wlock_invalidate=1;
+lock tables v1 read /*!32311 local */;
+unlock tables;
+set query_cache_wlock_invalidate=default;
+drop view v1;
+drop table t1;
set GLOBAL query_cache_size=default;
diff --git a/mysql-test/r/xa.result b/mysql-test/r/xa.result
index f3d7e151628..5fb03d2378e 100644
--- a/mysql-test/r/xa.result
+++ b/mysql-test/r/xa.result
@@ -9,10 +9,10 @@ select * from t1;
a
xa start 'test2';
xa start 'test-bad';
-ERROR XAE07: XAER_RMFAIL: The command cannot be executed in the ACTIVE state
+ERROR XAE07: XAER_RMFAIL: The command cannot be executed when global transaction is in the ACTIVE state
insert t1 values (20);
xa prepare 'test2';
-ERROR XAE07: XAER_RMFAIL: The command cannot be executed in the ACTIVE state
+ERROR XAE07: XAER_RMFAIL: The command cannot be executed when global transaction is in the ACTIVE state
xa end 'test2';
xa prepare 'test2';
xa commit 'test2';
@@ -21,13 +21,23 @@ a
20
xa start 'testa','testb';
insert t1 values (30);
+commit;
+ERROR XAE07: XAER_RMFAIL: The command cannot be executed when global transaction is in the ACTIVE state
xa end 'testa','testb';
+begin;
+ERROR XAE07: XAER_RMFAIL: The command cannot be executed when global transaction is in the IDLE state
+create table t2 (a int);
+ERROR XAE07: XAER_RMFAIL: The command cannot be executed when global transaction is in the IDLE state
xa start 'testa','testb';
ERROR XAE08: XAER_DUPID: The XID already exists
+xa start 'testa','testb', 123;
+ERROR XAE08: XAER_DUPID: The XID already exists
xa start 0x7465737462, 0x2030405060, 0xb;
insert t1 values (40);
xa end 'testb',' 0@P`',11;
xa prepare 'testb',0x2030405060,11;
+start transaction;
+ERROR XAE07: XAER_RMFAIL: The command cannot be executed when global transaction is in the PREPARED state
xa recover;
formatID gtrid_length bqual_length data
11 5 5 testb 0@P`
diff --git a/mysql-test/std_data/ndb_config_mycnf1.cnf b/mysql-test/std_data/ndb_config_mycnf1.cnf
new file mode 100644
index 00000000000..c680bfd8fa3
--- /dev/null
+++ b/mysql-test/std_data/ndb_config_mycnf1.cnf
@@ -0,0 +1,15 @@
+[cluster_config]
+NoOfReplicas=1
+DataMemory=50M
+
+[cluster_config.jonas]
+IndexMemory=50M
+ndbd = localhost,localhost,localhost,localhost
+ndb_mgmd = localhost
+mysqld = localhost
+
+[cluster_config.ndbd.1]
+DataMemory=25M
+
+[cluster_config.ndbd.2.jonas]
+DataMemory=35M
diff --git a/mysql-test/t/cast.test b/mysql-test/t/cast.test
index 2049c17580e..6220b4cbae7 100644
--- a/mysql-test/t/cast.test
+++ b/mysql-test/t/cast.test
@@ -27,6 +27,10 @@ select CONVERT(DATE "2004-01-22 21:45:33",CHAR);
select CONVERT(DATE "2004-01-22 21:45:33",CHAR(4));
select CONVERT(DATE "2004-01-22 21:45:33",BINARY(4));
select CAST(DATE "2004-01-22 21:45:33" AS BINARY(4));
+select CAST(0xb3 as signed);
+select CAST(0x8fffffffffffffff as signed);
+select CAST(0xffffffffffffffff as unsigned);
+select CAST(0xfffffffffffffffe as signed);
select cast('-10a' as signed integer);
select cast('a10' as unsigned integer);
select 10+'a';
diff --git a/mysql-test/t/ctype_ujis.test b/mysql-test/t/ctype_ujis.test
index 88386500c9f..7730fd0db6d 100644
--- a/mysql-test/t/ctype_ujis.test
+++ b/mysql-test/t/ctype_ujis.test
@@ -1151,3 +1151,45 @@ SET collation_connection='ujis_bin';
-- source include/ctype_innodb_like.inc
# End of 4.1 tests
+--disable_warnings
+DROP TABLE IF EXISTS t1, t2;
+DROP PROCEDURE IF EXISTS sp1;
+--enable_warnings
+
+set names ujis;
+set character_set_database = ujis;
+set character_set_server = ujis;
+
+CREATE TABLE t1(c1 char(2)) default charset = ujis;
+CREATE TABLE t2(c2 char(2)) default charset = ujis;
+
+INSERT INTO t1 VALUES(_ujis 0xA4A2);
+
+DELIMITER |;
+CREATE PROCEDURE sp1()
+BEGIN
+ DECLARE a CHAR(1);
+ DECLARE cur1 CURSOR FOR SELECT c1 FROM t1;
+ OPEN cur1;
+ FETCH cur1 INTO a;
+ INSERT INTO t2 VALUES (a);
+ CLOSE cur1;
+END|
+DELIMITER ;|
+CALL sp1();
+
+#The data in t1 and t2 should be the same but different
+SELECT c1,c2 FROM t1,t2;
+
+#Since the result of hex(convert(_latin1 0xA4A2 using ujis))
+#equals to hex(c2), it seems that the value which was inserted
+#by using cursor is interpreted as latin1 character set
+SELECT hex(convert(_latin1 0xA4A2 using ujis)),hex(c2) FROM t1,t2;
+
+DROP PROCEDURE sp1;
+DROP TABLE t1;
+DROP TABLE t2;
+
+set names default;
+set character_set_database=default;
+set character_set_server=default;
diff --git a/mysql-test/t/ctype_utf8.test b/mysql-test/t/ctype_utf8.test
index 3a89da3a41e..b009e13874f 100644
--- a/mysql-test/t/ctype_utf8.test
+++ b/mysql-test/t/ctype_utf8.test
@@ -865,6 +865,24 @@ SELECT DISTINCT id FROM t1 ORDER BY id;
DROP TABLE t1;
#
+# Bugs#10504: Character set does not support traditional mode
+#
+set names utf8;
+# correct value
+select hex(char(1));
+select char(0xd1,0x8f);
+select char(0xd18f);
+select char(53647);
+# incorrect value: return with warning
+select char(0xff,0x8f);
+# incorrect value in strict mode: return NULL with "Error" level warning
+set sql_mode=traditional;
+select char(0xff,0x8f);
+select char(195);
+select char(196);
+select char(2557);
+
+#
# Bug#12891: UNION doesn't return DISTINCT result for multi-byte characters
#
set names utf8;
diff --git a/mysql-test/t/default.test b/mysql-test/t/default.test
index 42620a27b66..b5522394d2d 100644
--- a/mysql-test/t/default.test
+++ b/mysql-test/t/default.test
@@ -40,7 +40,6 @@ CREATE TABLE t1 (a varchar(30) binary NOT NULL DEFAULT ' ',
ENGINE=InnoDB DEFAULT CHARACTER SET = latin1 COLLATE latin1_bin;
--enable_warnings
-SHOW CREATE TABLE t1;
INSERT into t1 (b) values ('1');
SHOW WARNINGS;
SELECT * from t1;
diff --git a/mysql-test/t/derived.test b/mysql-test/t/derived.test
index f52e12849e4..33b06e9bc11 100644
--- a/mysql-test/t/derived.test
+++ b/mysql-test/t/derived.test
@@ -258,4 +258,17 @@ create table t2 (a int);
select * from (select * from t1,t2) foo;
drop table t1,t2;
+#
+# Bug#10586 - query works with 4.1.8, but not with 4.1.11
+#
+create table t1 (ID int unsigned not null auto_increment,
+ DATA varchar(5) not null, primary key (ID));
+create table t2 (ID int unsigned not null auto_increment,
+ DATA varchar(5) not null, FID int unsigned not null,
+ primary key (ID));
+select A.* from (t1 inner join (select * from t2) as A on t1.ID = A.FID);
+select t2.* from ((select * from t1) as A inner join t2 on A.ID = t2.FID);
+select t2.* from (select * from t1) as A inner join t2 on A.ID = t2.FID;
+drop table t1, t2;
+
# End of 4.1 tests
diff --git a/mysql-test/t/federated.test b/mysql-test/t/federated.test
index 28091676dd7..c401468a940 100644
--- a/mysql-test/t/federated.test
+++ b/mysql-test/t/federated.test
@@ -1137,11 +1137,53 @@ ORDER BY federated.t1.country_id;
DROP TABLE federated.countries;
-# optimize and repair tests
+#BEGIN optimize and repair tests
OPTIMIZE TABLE federated.t1;
REPAIR TABLE federated.t1;
REPAIR TABLE federated.t1 QUICK;
REPAIR TABLE federated.t1 EXTENDED;
REPAIR TABLE federated.t1 USE_FRM;
+#END optimize and repair tests
+
+
+# BEGIN ALTER TEST
+connection slave;
+--disable_warnings
+DROP TABLE IF EXISTS federated.normal_table;
+--enable_warnings
+
+CREATE TABLE federated.normal_table (
+ `id` int(4) NOT NULL,
+ `name` varchar(10) default NULL
+ ) DEFAULT CHARSET=latin1;
+
+connection master;
+--disable_warnings
+DROP TABLE IF EXISTS federated.alter_me;
+--enable_warnings
+
+--replace_result $SLAVE_MYPORT SLAVE_PORT
+eval CREATE TABLE federated.alter_me (
+ `id` int(4) NOT NULL,
+ `name` varchar(10) default NULL,
+ PRIMARY KEY (`id`)
+ ) ENGINE="FEDERATED" DEFAULT CHARSET=latin1
+ CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/normal_table';
+
+INSERT INTO federated.alter_me (id, name) VALUES (1, 'Monty');
+INSERT INTO federated.alter_me (id, name) VALUES (2, 'David');
+
+SELECT * FROM federated.alter_me;
+
+--error 1031
+ALTER TABLE federated.alter_me MODIFY COLUMN id int(16) NOT NULL;
+
+SELECT * FROM federated.alter_me;
+
+DROP TABLE federated.alter_me;
+connection slave;
+DROP TABLE federated.normal_table;
+# END ALTER TEST
+
source include/federated_cleanup.inc;
diff --git a/mysql-test/t/federated_bug_13118.test b/mysql-test/t/federated_bug_13118.test
new file mode 100644
index 00000000000..deec79becd2
--- /dev/null
+++ b/mysql-test/t/federated_bug_13118.test
@@ -0,0 +1,42 @@
+source include/federated.inc;
+
+
+connection slave;
+--disable_warnings
+DROP TABLE IF EXISTS federated.bug_13118_table;
+--enable_warnings
+
+CREATE TABLE federated.bug_13118_table (
+ `foo` integer,
+ `bar` integer
+ );
+
+
+connection master;
+--disable_warnings
+DROP TABLE IF EXISTS federated.t1;
+--enable_warnings
+
+--replace_result $SLAVE_MYPORT SLAVE_PORT
+eval CREATE TABLE federated.t1 (
+ `foo` integer,
+ `bar` integer
+ ) ENGINE="FEDERATED"
+ CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/bug_13118_table';
+
+SELECT * from federated.t1;
+
+INSERT INTO federated.t1 VALUES (1,1);
+SELECT * FROM federated.t1;
+
+INSERT INTO federated.t1 VALUES (1,1);
+SELECT * FROM federated.t1;
+
+
+DROP TABLE federated.t1;
+connection slave;
+DROP TABLE federated.bug_13118_table;
+
+
+source include/federated_cleanup.inc;
+
diff --git a/mysql-test/t/func_group.test b/mysql-test/t/func_group.test
index fb9470c16dd..19596c1b55a 100644
--- a/mysql-test/t/func_group.test
+++ b/mysql-test/t/func_group.test
@@ -539,6 +539,75 @@ INSERT INTO t1 VALUES
SELECT MAX(id) FROM t1 WHERE id < 3 AND a=2 AND b=6;
DROP TABLE t1;
+#
+# Bug #12882 min/max inconsistent on empty table
+#
+
+create table t1m (a int) engine=myisam;
+create table t1i (a int) engine=innodb;
+create table t2m (a int) engine=myisam;
+create table t2i (a int) engine=innodb;
+insert into t2m values (5);
+insert into t2i values (5);
+
+# test with MyISAM
+select min(a) from t1m;
+select min(7) from t1m;
+select min(7) from DUAL;
+explain select min(7) from t2m join t1m;
+select min(7) from t2m join t1m;
+
+select max(a) from t1m;
+select max(7) from t1m;
+select max(7) from DUAL;
+explain select max(7) from t2m join t1m;
+select max(7) from t2m join t1m;
+
+select 1, min(a) from t1m where a=99;
+select 1, min(a) from t1m where 1=99;
+select 1, min(1) from t1m where a=99;
+select 1, min(1) from t1m where 1=99;
+
+select 1, max(a) from t1m where a=99;
+select 1, max(a) from t1m where 1=99;
+select 1, max(1) from t1m where a=99;
+select 1, max(1) from t1m where 1=99;
+
+# test with InnoDB
+select min(a) from t1i;
+select min(7) from t1i;
+select min(7) from DUAL;
+explain select min(7) from t2i join t1i;
+select min(7) from t2i join t1i;
+
+select max(a) from t1i;
+select max(7) from t1i;
+select max(7) from DUAL;
+explain select max(7) from t2i join t1i;
+select max(7) from t2i join t1i;
+
+select 1, min(a) from t1i where a=99;
+select 1, min(a) from t1i where 1=99;
+select 1, min(1) from t1i where a=99;
+select 1, min(1) from t1i where 1=99;
+
+select 1, max(a) from t1i where a=99;
+select 1, max(a) from t1i where 1=99;
+select 1, max(1) from t1i where a=99;
+select 1, max(1) from t1i where 1=99;
+
+# mixed MyISAM/InnoDB test
+explain select count(*), min(7), max(7) from t1m, t1i;
+select count(*), min(7), max(7) from t1m, t1i;
+
+explain select count(*), min(7), max(7) from t1m, t2i;
+select count(*), min(7), max(7) from t1m, t2i;
+
+explain select count(*), min(7), max(7) from t2m, t1i;
+select count(*), min(7), max(7) from t2m, t1i;
+
+drop table t1m, t1i, t2m, t2i;
+
# End of 4.1 tests
#
diff --git a/mysql-test/t/func_in.test b/mysql-test/t/func_in.test
index 7bf737402ef..dd4edd8ca48 100644
--- a/mysql-test/t/func_in.test
+++ b/mysql-test/t/func_in.test
@@ -102,6 +102,13 @@ insert into t1 values ('aa'), ('bb');
select * from t1 where a in (NULL, 'aa');
drop table t1;
+# BUG#13419
+create table t1 (id int, key(id));
+insert into t1 values (1),(2),(3);
+select count(*) from t1 where id not in (1);
+select count(*) from t1 where id not in (1,2);
+drop table t1;
+
# End of 4.1 tests
#
diff --git a/mysql-test/t/func_str.test b/mysql-test/t/func_str.test
index 4a6c98c8d7f..5f32b7b2b49 100644
--- a/mysql-test/t/func_str.test
+++ b/mysql-test/t/func_str.test
@@ -665,3 +665,13 @@ select rpad(i, 7, ' ') as t from t1;
drop table t1;
# End of 4.1 tests
+
+#
+# Bug #13361: SELECT FORMAT(<decimal field with null>, 2) crashes
+#
+create table t1 (d decimal default null);
+insert into t1 values (null);
+select format(d, 2) from t1;
+drop table t1;
+
+# End of 5.0 tests
diff --git a/mysql-test/t/group_min_max.test b/mysql-test/t/group_min_max.test
index da3fdec80d2..3d751f4a571 100644
--- a/mysql-test/t/group_min_max.test
+++ b/mysql-test/t/group_min_max.test
@@ -655,26 +655,21 @@ select distinct a1 from t1 where a2 = 'b';
# Bug #12672: primary key implcitly included in every innodb index
#
-create table bug12672 (
+--disable_warnings
+create table t4 (
pk_col int auto_increment primary key, a1 char(64), a2 char(64), b char(16), c char(16) not null, d char(16), dummy char(64) default ' '
) engine=innodb;
+--enable_warnings
+insert into t4 (a1, a2, b, c, d, dummy) select * from t1;
-insert into bug12672 (a1, a2, b, c, d, dummy) select * from t1;
-
-create index idx12672_0 on bug12672 (a1);
-create index idx12672_1 on bug12672 (a1,a2,b,c);
-create index idx12672_2 on bug12672 (a1,a2,b);
+create index idx12672_0 on t4 (a1);
+create index idx12672_1 on t4 (a1,a2,b,c);
+create index idx12672_2 on t4 (a1,a2,b);
analyze table t1;
---replace_column 9 #
-explain select distinct a1 from bug12672 where pk_col not in (1,2,3,4);
-select distinct a1 from bug12672 where pk_col not in (1,2,3,4);
-
-drop table bug12672;
+select distinct a1 from t4 where pk_col not in (1,2,3,4);
-drop table t1;
-drop table t2;
-drop table t3;
+drop table t1,t2,t3,t4;
#
# Bug #6142: a problem with the empty innodb table
diff --git a/mysql-test/t/im_daemon_life_cycle-im.opt b/mysql-test/t/im_daemon_life_cycle-im.opt
new file mode 100644
index 00000000000..6bfd9a24107
--- /dev/null
+++ b/mysql-test/t/im_daemon_life_cycle-im.opt
@@ -0,0 +1,2 @@
+--run-as-service
+--log=$MYSQL_TEST_DIR/var/log/im.log
diff --git a/mysql-test/t/im_daemon_life_cycle.imtest b/mysql-test/t/im_daemon_life_cycle.imtest
new file mode 100644
index 00000000000..87388d7c1e6
--- /dev/null
+++ b/mysql-test/t/im_daemon_life_cycle.imtest
@@ -0,0 +1,15 @@
+###########################################################################
+#
+# This file contains test for (1.2) test suite.
+#
+# Consult WL#2789 for more information.
+#
+###########################################################################
+
+--source include/im_check_os.inc
+
+###########################################################################
+
+SHOW INSTANCES;
+
+--exec $MYSQL_TEST_DIR/t/kill_n_check.sh $IM_PATH_PID restarted
diff --git a/mysql-test/t/im_life_cycle.imtest b/mysql-test/t/im_life_cycle.imtest
new file mode 100644
index 00000000000..fff57e16eab
--- /dev/null
+++ b/mysql-test/t/im_life_cycle.imtest
@@ -0,0 +1,141 @@
+###########################################################################
+#
+# This file contains test for (1.1) test suite.
+#
+# Consult WL#2789 for more information.
+#
+###########################################################################
+
+--source include/im_check_os.inc
+
+###########################################################################
+#
+# 1.1.1. Check that Instance Manager is able:
+# - to read definitions of two mysqld-instances;
+# - to start the first instance;
+# - to understand 'nonguarded' option and keep the second instance down;
+#
+###########################################################################
+
+SHOW INSTANCES;
+--replace_column 3 VERSION
+SHOW INSTANCE STATUS mysqld1;
+--replace_column 3 VERSION
+SHOW INSTANCE STATUS mysqld2;
+
+###########################################################################
+#
+# 1.1.2. Check 'START INSTANCE' command:
+# - start the second instance;
+# - check that it is reported as online;
+# - execute some SQL-statement on mysqld2 to ensure that it is really up and
+# running;
+#
+###########################################################################
+
+START INSTANCE mysqld2;
+# FIXME
+--sleep 3
+
+SHOW INSTANCES;
+--replace_column 3 VERSION
+SHOW INSTANCE STATUS mysqld1;
+--replace_column 3 VERSION
+SHOW INSTANCE STATUS mysqld2;
+
+--connect (mysql_con,localhost,root,,mysql,$IM_MYSQLD1_PORT,$IM_MYSQLD1_SOCK)
+--connection mysql_con
+
+SHOW VARIABLES LIKE 'port';
+
+--connection default
+--disconnect mysql_con
+
+###########################################################################
+#
+# 1.1.3. Check 'STOP INSTANCE' command:
+# - stop the second instance;
+# - check that it is reported as offline;
+# - TODO: try to execute some SQL-statement to ensure that it is really down;
+#
+###########################################################################
+
+STOP INSTANCE mysqld2;
+# FIXME
+--sleep 3
+
+SHOW INSTANCES;
+--replace_column 3 VERSION
+SHOW INSTANCE STATUS mysqld1;
+--replace_column 3 VERSION
+SHOW INSTANCE STATUS mysqld2;
+
+###########################################################################
+#
+# 1.1.4. Check that Instance Manager reports correct errors for 'START
+# INSTANCE' command:
+# - if the client tries to start unregistered instance;
+# - if the client tries to start already started instance;
+# - if the client submits invalid arguments;
+#
+###########################################################################
+
+--error 3000
+START INSTANCE mysqld3;
+
+--error 3002
+START INSTANCE mysqld1;
+
+# FIXME TODO
+# BUG#12813: START/STOP INSTANCE commands accept a list as argument
+# START INSTANCE mysqld1, mysqld2;
+
+###########################################################################
+#
+# 1.1.5. Check that Instance Manager reports correct errors for 'STOP INSTANCE'
+# command:
+# - if the client tries to start unregistered instance;
+# - if the client tries to start already stopped instance;
+# - if the client submits invalid arguments;
+#
+###########################################################################
+
+--error 3000
+STOP INSTANCE mysqld3;
+
+# TODO: IM should be fixed.
+# BUG#12673: Instance Manager allows to stop the instance many times
+# --error 3002
+# STOP INSTANCE mysqld2;
+
+# FIXME TODO
+# BUG#12813: START/STOP INSTANCE commands accept a list as argument
+# STOP INSTANCE mysqld1, mysqld2;
+
+###########################################################################
+#
+# 1.1.6. Check that Instance Manager is able to restart guarded instances.
+#
+###########################################################################
+
+SHOW INSTANCES;
+
+--exec $MYSQL_TEST_DIR/t/kill_n_check.sh $IM_MYSQLD1_PATH_PID restarted
+
+###########################################################################
+#
+# 1.1.7. Check that Instance Manager does not restart non-guarded instance.
+#
+###########################################################################
+
+SHOW INSTANCES;
+
+START INSTANCE mysqld2;
+# FIXME
+--sleep 3
+
+SHOW INSTANCES;
+
+--exec $MYSQL_TEST_DIR/t/kill_n_check.sh $IM_MYSQLD2_PATH_PID killed
+
+SHOW INSTANCES;
diff --git a/mysql-test/t/im_options_set.imtest b/mysql-test/t/im_options_set.imtest
new file mode 100644
index 00000000000..785c6d05fef
--- /dev/null
+++ b/mysql-test/t/im_options_set.imtest
@@ -0,0 +1,142 @@
+###########################################################################
+#
+# This file contains test for (3) test suite.
+#
+# Consult WL#2789 for more information.
+#
+###########################################################################
+
+#
+# Check the options-management commands:
+# - SET;
+# - FLUSH INSTANCES;
+#
+# Let's test the commands on the option 'server_id'. It's expected that
+# originally the instances have the following server ids:
+# - mysqld1: 1
+# - mysqld2: 2
+#
+# 1. SET <instance_id>.server_id= SERVER_ID); where SERVER_ID is 11 or 12.
+# 1.1. check that the configuration file has been updated (i.e. contains
+# server_id=SERVER_ID for the instance);
+# 1.2. (for mysqld1) check that the running instance has not been affected:
+# connect to the instance and check that 'SHOW VARIABLES LIKE 'server_id''
+# returns zero;
+# 1.3. check that internal cache of Instance Manager has not been affected
+# (i.e. SHOW INSTANCE OPTIONS <instance> does not contain updated value).
+#
+# 2. FLUSH INSTANCES;
+# 2.1. check that the configuration file has not been updated;
+# 2.2. (for mysqld1) check that the running instance has not been affected:
+# connect to the instance and check that 'SHOW VARIABLES LIKE 'server_id''
+# returns zero value;
+# 2.3. check that internal cache of Instance Manager has been updated (i.e.
+# SHOW INSTANCE OPTIONS <instance> contains 'server_id=SERVER_ID' line).
+#
+# 3. Restore options.
+#
+
+###########################################################################
+
+--source include/im_check_os.inc
+
+###########################################################################
+#
+# 0. Check starting conditions.
+#
+###########################################################################
+
+# - check the configuration file;
+
+--exec grep server_id $MYSQL_TEST_DIR/var/im.cnf ;
+
+# - check the running instances.
+
+--connect (mysql1_con,localhost,root,,mysql,$IM_MYSQLD1_PORT,$IM_MYSQLD1_SOCK)
+
+--connection mysql1_con
+
+SHOW VARIABLES LIKE 'server_id';
+
+--connection default
+
+# - check the internal cache.
+# TODO: we should check only server_id option here.
+
+# SHOW INSTANCE OPTIONS mysqld1;
+# SHOW INSTANCE OPTIONS mysqld2;
+
+###########################################################################
+#
+# 1. SET <instance_id>.server_id= SERVER_ID); where SERVER_ID is 11 or 12.
+#
+###########################################################################
+
+# * mysqld1
+
+SET mysqld1.server_id = 11;
+
+# - check that the configuration file has been updated (i.e. contains
+# server_id=SERVER_ID for the instance);
+
+--exec grep server_id $MYSQL_TEST_DIR/var/im.cnf ;
+
+# - (for mysqld1) check that the running instance has not been affected:
+# connect to the instance and check that 'SHOW VARIABLES LIKE 'server_id''
+# returns zero;
+
+--connection mysql1_con
+
+SHOW VARIABLES LIKE 'server_id';
+
+--connection default
+
+# - check that internal cache of Instance Manager has not been affected
+# (i.e. SHOW INSTANCE OPTIONS <instance> does not contain updated value).
+# TODO: we should check only server_id option here.
+
+# SHOW INSTANCE OPTIONS mysqld1;
+
+# * mysqld2
+
+SET mysqld2.server_id = 12;
+
+# - check that the configuration file has been updated (i.e. contains
+# server_id=SERVER_ID for the instance);
+
+--exec grep server_id $MYSQL_TEST_DIR/var/im.cnf ;
+
+# - check that internal cache of Instance Manager has not been affected
+# (i.e. SHOW INSTANCE OPTIONS <instance> does not contain updated value).
+# TODO: we should check only server_id option here.
+
+# SHOW INSTANCE OPTIONS mysqld2;
+
+###########################################################################
+#
+# 2. FLUSH INSTANCES;
+#
+###########################################################################
+
+FLUSH INSTANCES;
+
+# - check that the configuration file has not been updated;
+
+--exec grep server_id $MYSQL_TEST_DIR/var/im.cnf ;
+
+# - (for mysqld1) check that the running instance has not been affected:
+# connect to the instance and check that 'SHOW VARIABLES LIKE 'server_id''
+# returns zero value;
+
+--connection mysql1_con
+
+SHOW VARIABLES LIKE 'server_id';
+
+--connection default
+
+# - check that internal cache of Instance Manager has been updated (i.e.
+# SHOW INSTANCE OPTIONS <instance> contains 'server_id=' line).
+# TODO: we should check only server_id option here.
+
+# SHOW INSTANCE OPTIONS mysqld1;
+# SHOW INSTANCE OPTIONS mysqld2;
diff --git a/mysql-test/t/im_options_unset.imtest b/mysql-test/t/im_options_unset.imtest
new file mode 100644
index 00000000000..74ec42ac3f9
--- /dev/null
+++ b/mysql-test/t/im_options_unset.imtest
@@ -0,0 +1,150 @@
+###########################################################################
+#
+# This file contains test for (3) test suite.
+#
+# Consult WL#2789 for more information.
+#
+###########################################################################
+
+#
+# Check the options-management commands:
+# - UNSET;
+# - FLUSH INSTANCES;
+#
+# Let's test the commands on the option 'server_id'. It's expected that
+# originally the instances have the following server ids:
+# - mysqld1: 1
+# - mysqld2: 2
+#
+# The test case:
+#
+# 1. UNSET <instance_id>.server_id;
+#
+# Do the step for both instances.
+#
+# 1.1. check that the configuration file has been updated (i.e. does not
+# contain 'server_id=' line for the instance);
+# 1.2. (for mysqld1) check that the running instance has not been affected:
+# connect to the instance and check that 'SHOW VARIABLES LIKE 'server_id''
+# returns non-zero value;
+# 1.3. check that internal cache of Instance Manager is not affected (i.e.
+# SHOW INSTANCE OPTIONS <instance> contains non-zero value for server_id);
+#
+# 2. FLUSH INSTANCES;
+#
+# Do the step for both instances.
+#
+# 2.1. check that the configuration file has not been updated (i.e. does not
+# contain 'server_id=' for the instance);
+# 2.2. (for mysqld1) check that the running instance has not been affected:
+# connect to the instance and check that 'SHOW VARIABLES LIKE 'server_id''
+# returns non-zero value;
+# 2.3. check that internal cache of Instance Manager has been updated (i.e.
+# SHOW INSTANCE OPTIONS <instance> does not contain 'server_id=' line).
+#
+
+###########################################################################
+
+--source include/im_check_os.inc
+
+###########################################################################
+#
+# 0. Check starting conditions.
+#
+###########################################################################
+
+# - check the configuration file;
+
+--exec grep server_id $MYSQL_TEST_DIR/var/im.cnf ;
+
+# - check the running instances.
+
+--connect (mysql1_con,localhost,root,,mysql,$IM_MYSQLD1_PORT,$IM_MYSQLD1_SOCK)
+
+--connection mysql1_con
+
+SHOW VARIABLES LIKE 'server_id';
+
+--connection default
+
+# - check the internal cache.
+# TODO: we should check only server_id option here.
+
+# SHOW INSTANCE OPTIONS mysqld1;
+# SHOW INSTANCE OPTIONS mysqld2;
+
+###########################################################################
+#
+# 1. UNSET <instance_id>.server_id;
+#
+###########################################################################
+
+# * mysqld1
+
+UNSET mysqld1.server_id;
+
+# - check that the configuration file has been updated (i.e. does not
+# contain 'server_id=' line for the instance);
+
+--exec grep server_id $MYSQL_TEST_DIR/var/im.cnf ;
+
+# - check that the running instance has not been affected: connect to the
+# instance and check that 'SHOW VARIABLES LIKE 'server_id'' returns non-zero
+# value;
+
+--connection mysql1_con
+
+SHOW VARIABLES LIKE 'server_id';
+
+--connection default
+
+# - check that internal cache of Instance Manager is not affected (i.e. SHOW
+# INSTANCE OPTIONS <instance> contains non-zero value for server_id);
+# TODO: we should check only server_id option here.
+
+# SHOW INSTANCE OPTIONS mysqld1;
+
+# * mysqld2
+
+UNSET mysqld2.server_id;
+
+# - check that the configuration file has been updated (i.e. does not
+# contain 'server_id=' line for the instance);
+
+--exec grep server_id $MYSQL_TEST_DIR/var/im.cnf || true;
+
+# - check that internal cache of Instance Manager is not affected (i.e. SHOW
+# INSTANCE OPTIONS <instance> contains non-zero value for server_id);
+# TODO: we should check only server_id option here.
+
+# SHOW INSTANCE OPTIONS mysqld2;
+
+###########################################################################
+#
+# 2. FLUSH INSTANCES;
+#
+###########################################################################
+
+FLUSH INSTANCES;
+
+# - check that the configuration file has not been updated (i.e. does not
+# contain 'server_id=' for the instance);
+
+--exec grep server_id $MYSQL_TEST_DIR/var/im.cnf || true;
+
+# - (for mysqld1) check that the running instance has not been affected:
+# connect to the instance and check that 'SHOW VARIABLES LIKE 'server_id''
+# returns non-zero value;
+
+--connection mysql1_con
+
+SHOW VARIABLES LIKE 'server_id';
+
+--connection default
+
+# - check that internal cache of Instance Manager has been updated (i.e.
+# SHOW INSTANCE OPTIONS <instance> does not contain 'server_id=' line).
+# TODO: we should check only server_id option here.
+
+# SHOW INSTANCE OPTIONS mysqld1;
+# SHOW INSTANCE OPTIONS mysqld2;
diff --git a/mysql-test/t/im_utils.imtest b/mysql-test/t/im_utils.imtest
new file mode 100644
index 00000000000..dc6fb93c4ff
--- /dev/null
+++ b/mysql-test/t/im_utils.imtest
@@ -0,0 +1,115 @@
+###########################################################################
+#
+# This file contains test for (2) test suite.
+#
+# Consult WL#2789 for more information.
+#
+###########################################################################
+
+--source include/im_check_os.inc
+
+###########################################################################
+
+#
+# Check starting conditions. This test case assumes that:
+# - two mysqld-instances are registered;
+# - the first instance is online;
+# - the second instance is offline;
+#
+
+SHOW INSTANCES;
+
+#
+# Check 'SHOW INSTANCE OPTIONS' command:
+# - check that options of both offline and online instances are accessible;
+# - since configuration of an mysqld-instance contains directories, we should
+# completely ignore the second column (values) in order to make the test
+# case produce the same results on different installations;
+# TODO: ignore values of only directory-specific options.
+#
+
+--replace_column 2 VALUE
+SHOW INSTANCE OPTIONS mysqld1;
+
+--replace_column 2 VALUE
+SHOW INSTANCE OPTIONS mysqld2;
+
+#
+# Before checking log files, we should start the second instance (mysqld2) to
+# give it a chance to create log files.
+#
+
+START INSTANCE mysqld2;
+
+# FIXME
+-- sleep 3
+
+STOP INSTANCE mysqld2;
+
+#
+# Check 'SHOW LOG FILES' command:
+# - check that log files of both offline and online instances are accessible;
+# - since placement of the log files is installation-specific, we should
+# ignore it in comparisson;
+# - also, we should ignore log file size, since it may depend on the version
+# being tested;
+#
+
+--replace_column 2 PATH 3 FILE_SIZE
+SHOW mysqld1 LOG FILES;
+
+--replace_column 2 PATH 3 FILE_SIZE
+SHOW mysqld2 LOG FILES;
+
+#
+# Check 'SHOW LOG' command:
+# - check that all three kinds of logs are available for both offline and
+# online instances;
+# - we should ignore the value, because it is very specific and depends on
+# many factors; we only check that Instance Manager is able to provide log
+# files.
+#
+
+# mysqld1 (online) w/o the optional argument.
+
+--replace_column 1 LOG_DATA
+SHOW mysqld1 LOG ERROR 10;
+
+--replace_column 1 LOG_DATA
+SHOW mysqld1 LOG SLOW 10;
+
+--replace_column 1 LOG_DATA
+SHOW mysqld1 LOG GENERAL 10;
+
+# mysqld1 (online) with the optional argument.
+
+--replace_column 1 LOG_DATA
+SHOW mysqld1 LOG ERROR 10, 2;
+
+--replace_column 1 LOG_DATA
+SHOW mysqld1 LOG SLOW 10, 2;
+
+--replace_column 1 LOG_DATA
+SHOW mysqld1 LOG GENERAL 10, 2;
+
+# mysqld2 (offline) w/o the optional argument.
+
+--replace_column 1 LOG_DATA
+SHOW mysqld2 LOG ERROR 10;
+
+--replace_column 1 LOG_DATA
+SHOW mysqld2 LOG SLOW 10;
+
+--replace_column 1 LOG_DATA
+SHOW mysqld2 LOG GENERAL 10;
+
+# mysqld2 (offline) with the optional argument.
+
+--replace_column 1 LOG_DATA
+SHOW mysqld2 LOG ERROR 10, 2;
+
+--replace_column 1 LOG_DATA
+SHOW mysqld2 LOG SLOW 10, 2;
+
+--replace_column 1 LOG_DATA
+SHOW mysqld2 LOG GENERAL 10, 2;
diff --git a/mysql-test/t/information_schema.test b/mysql-test/t/information_schema.test
index 51cca0a3db1..f351d315680 100644
--- a/mysql-test/t/information_schema.test
+++ b/mysql-test/t/information_schema.test
@@ -5,7 +5,8 @@
# show databases
--disable_warnings
-DROP TABLE IF EXISTS t0,t1,t2,t3,t5;
+DROP TABLE IF EXISTS t0,t1,t2,t3,t4,t5;
+DROP VIEW IF EXISTS v1;
--enable_warnings
@@ -364,8 +365,8 @@ use test;
create function sub1(i int) returns int
return i+1;
create table t1(f1 int);
-create view t2 (c) as select f1 from t1;
-create view t3 (c) as select sub1(1);
+create view v2 (c) as select f1 from t1;
+create view v3 (c) as select sub1(1);
create table t4(f1 int, KEY f1_key (f1));
drop table t1;
drop function sub1;
@@ -378,8 +379,8 @@ where table_schema='test';
select index_name from information_schema.statistics where table_schema='test';
select constraint_name from information_schema.table_constraints
where table_schema='test';
-drop view t2;
-drop view t3;
+drop view v2;
+drop view v3;
drop table t4;
#
diff --git a/mysql-test/t/information_schema_inno.test b/mysql-test/t/information_schema_inno.test
index dd7015bfd9a..9cd64a54ad9 100644
--- a/mysql-test/t/information_schema_inno.test
+++ b/mysql-test/t/information_schema_inno.test
@@ -1,6 +1,6 @@
-- source include/have_innodb.inc
--disable_warnings
-DROP TABLE IF EXISTS t1,t2;
+DROP TABLE IF EXISTS t1,t2,t3;
--enable_warnings
#
diff --git a/mysql-test/t/innodb.test b/mysql-test/t/innodb.test
index beec3b0f8c7..5a45b3524ac 100644
--- a/mysql-test/t/innodb.test
+++ b/mysql-test/t/innodb.test
@@ -978,9 +978,9 @@ create table `t2` (`id` int( 11 ) not null default '0',unique key `id` ( `id` )
insert into `t2`values ( 1 ) ;
create table `t3` (`id` int( 11 ) not null default '0',key `id` ( `id` ) ,constraint `t2_id_fk` foreign key ( `id` ) references `t2` (`id` )) engine = innodb;
insert into `t3`values ( 1 ) ;
---error 1217
+--error 1451
delete t3,t2,t1 from t1,t2,t3 where t1.id =1 and t2.id = t1.id and t3.id = t2.id;
---error 1217
+--error 1451
update t1,t2,t3 set t3.id=5, t2.id=6, t1.id=7 where t1.id =1 and t2.id = t1.id and t3.id = t2.id;
--error 1054
update t3 set t3.id=7 where t1.id =1 and t2.id = t1.id and t3.id = t2.id;
@@ -996,7 +996,7 @@ create table t1(
foreign key(pid) references t1(id) on delete cascade) engine=innodb;
insert into t1 values(0,0),(1,0),(2,1),(3,2),(4,3),(5,4),(6,5),(7,6),
(8,7),(9,8),(10,9),(11,10),(12,11),(13,12),(14,13),(15,14);
--- error 1217
+-- error 1451
delete from t1 where id=0;
delete from t1 where id=15;
delete from t1 where id=0;
@@ -1259,6 +1259,16 @@ select * from t1 order by a,b,c,d;
explain select * from t1 order by a,b,c,d;
drop table t1;
+#
+# BUG#11039,#13218 Wrong key length in min()
+#
+
+create table t1 (a char(1), b char(1), key(a, b)) engine=innodb;
+insert into t1 values ('8', '6'), ('4', '7');
+select min(a) from t1;
+select min(b) from t1 where a='8';
+drop table t1;
+
# End of 4.1 tests
#
@@ -1473,3 +1483,155 @@ CREATE TEMPORARY TABLE t2
FOREIGN KEY (b) REFERENCES test.t1(id)
) ENGINE=InnoDB;
DROP TABLE t1;
+
+#
+# Test that index column max sizes are checked (bug #13315)
+#
+
+# prefix index
+create table t1 (col1 varchar(2000), index (col1(767)))
+ character set = latin1 engine = innodb;
+
+# normal indexes
+create table t2 (col1 char(255), index (col1))
+ character set = latin1 engine = innodb;
+create table t3 (col1 binary(255), index (col1))
+ character set = latin1 engine = innodb;
+create table t4 (col1 varchar(767), index (col1))
+ character set = latin1 engine = innodb;
+create table t5 (col1 varchar(767) primary key)
+ character set = latin1 engine = innodb;
+create table t6 (col1 varbinary(767) primary key)
+ character set = latin1 engine = innodb;
+create table t7 (col1 text, index(col1(767)))
+ character set = latin1 engine = innodb;
+create table t8 (col1 blob, index(col1(767)))
+ character set = latin1 engine = innodb;
+
+# multi-column indexes are allowed to be longer
+create table t9 (col1 varchar(512), col2 varchar(512), index(col1, col2))
+ character set = latin1 engine = innodb;
+
+drop table t1, t2, t3, t4, t5, t6, t7, t8, t9;
+
+--error 1005
+create table t1 (col1 varchar(768), index (col1))
+ character set = latin1 engine = innodb;
+--error 1005
+create table t2 (col1 varchar(768) primary key)
+ character set = latin1 engine = innodb;
+--error 1005
+create table t3 (col1 varbinary(768) primary key)
+ character set = latin1 engine = innodb;
+--error 1005
+create table t4 (col1 text, index(col1(768)))
+ character set = latin1 engine = innodb;
+--error 1005
+create table t5 (col1 blob, index(col1(768)))
+ character set = latin1 engine = innodb;
+
+#
+# Test improved foreign key error messages (bug #3443)
+#
+
+CREATE TABLE t1
+(
+ id INT PRIMARY KEY
+) ENGINE=InnoDB;
+
+CREATE TABLE t2
+(
+ v INT,
+ CONSTRAINT c1 FOREIGN KEY (v) REFERENCES t1(id)
+) ENGINE=InnoDB;
+
+--error 1452
+INSERT INTO t2 VALUES(2);
+
+INSERT INTO t1 VALUES(1);
+INSERT INTO t2 VALUES(1);
+
+--error 1451
+DELETE FROM t1 WHERE id = 1;
+
+--error 1217
+DROP TABLE t1;
+
+SET FOREIGN_KEY_CHECKS=0;
+DROP TABLE t1;
+SET FOREIGN_KEY_CHECKS=1;
+
+--error 1452
+INSERT INTO t2 VALUES(3);
+
+DROP TABLE t2;
+#
+# Test that checksum table uses a consistent read Bug #12669
+#
+connect (a,localhost,root,,);
+connect (b,localhost,root,,);
+connection a;
+create table t1(a int not null) engine=innodb DEFAULT CHARSET=latin1;
+insert into t1 values (1),(2);
+set autocommit=0;
+checksum table t1;
+connection b;
+insert into t1 values(3);
+connection a;
+#
+# Here checksum should not see insert
+#
+checksum table t1;
+connection a;
+commit;
+checksum table t1;
+commit;
+drop table t1;
+#
+# autocommit = 1
+#
+connection a;
+create table t1(a int not null) engine=innodb DEFAULT CHARSET=latin1;
+insert into t1 values (1),(2);
+set autocommit=1;
+checksum table t1;
+connection b;
+set autocommit=1;
+insert into t1 values(3);
+connection a;
+#
+# Here checksum sees insert
+#
+checksum table t1;
+drop table t1;
+
+#
+# BUG#11238 - in prelocking mode SELECT .. FOR UPDATE is changed to
+# non-blocking SELECT
+#
+create table t1 (col1 integer primary key, col2 integer) engine=innodb;
+insert t1 values (1,100);
+delimiter |;
+create function f1 () returns integer begin
+declare var1 int;
+select col2 into var1 from t1 where col1=1 for update;
+return var1;
+end|
+delimiter ;|
+start transaction;
+select f1();
+connection b;
+send update t1 set col2=0 where col1=1;
+connection default;
+select * from t1;
+connection a;
+rollback;
+connection b;
+reap;
+rollback;
+connection default;
+drop table t1;
+drop function f1;
+disconnect a;
+disconnect b;
+
diff --git a/mysql-test/t/join_nested.test b/mysql-test/t/join_nested.test
index 482c7f9f8b9..0592ec3152f 100644
--- a/mysql-test/t/join_nested.test
+++ b/mysql-test/t/join_nested.test
@@ -801,3 +801,34 @@ SELECT * FROM
DROP VIEW v1,v2;
DROP TABLE t1,t2,t3,t4;
+
+#
+# Bug #13545: problem with NATURAL/USING joins.
+#
+
+CREATE TABLE t1(a int);
+CREATE TABLE t2(b int);
+CREATE TABLE t3(c int, d int);
+CREATE TABLE t4(d int);
+CREATE TABLE t5(e int, f int);
+CREATE TABLE t6(f int);
+CREATE VIEW v1 AS
+ SELECT e FROM t5 JOIN t6 ON t5.e=t6.f;
+CREATE VIEW v2 AS
+ SELECT e FROM t5 NATURAL JOIN t6;
+
+SELECT t1.a FROM t1 JOIN t2 ON a=b JOIN t3 ON a=c JOIN t4 USING(d);
+--error 1054
+SELECT t1.x FROM t1 JOIN t2 ON a=b JOIN t3 ON a=c JOIN t4 USING(d);
+SELECT t1.a FROM t1 JOIN t2 ON a=b JOIN t3 ON a=c NATURAL JOIN t4;
+--error 1054
+SELECT t1.x FROM t1 JOIN t2 ON a=b JOIN t3 ON a=c NATURAL JOIN t4;
+SELECT v1.e FROM v1 JOIN t2 ON e=b JOIN t3 ON e=c JOIN t4 USING(d);
+--error 1054
+SELECT v1.x FROM v1 JOIN t2 ON e=b JOIN t3 ON e=c JOIN t4 USING(d);
+SELECT v2.e FROM v2 JOIN t2 ON e=b JOIN t3 ON e=c JOIN t4 USING(d);
+--error 1054
+SELECT v2.x FROM v2 JOIN t2 ON e=b JOIN t3 ON e=c JOIN t4 USING(d);
+
+DROP VIEW v1, v2;
+DROP TABLE t1, t2, t3, t4, t5, t6;
diff --git a/mysql-test/t/kill_n_check.sh b/mysql-test/t/kill_n_check.sh
new file mode 100755
index 00000000000..7fe30c4774c
--- /dev/null
+++ b/mysql-test/t/kill_n_check.sh
@@ -0,0 +1,66 @@
+#!/bin/sh
+
+if [ $# -ne 2 ]; then
+ echo "Usage: kill_n_check.sh <pid file path> killed|restarted"
+ exit 0
+fi
+
+pid_path="$1"
+expected_result="$2"
+
+if [ -z "$pid_path" -o ! -r "$pid_path" ]; then
+ echo "Error: invalid PID path ($pid_path) or PID file does not exist."
+ exit 0
+fi
+
+if [ "$expected_result" != "killed" -a \
+ "$expected_result" != "restarted" ]; then
+ echo "Error: expected result must be either 'killed' or 'restarted'."
+ exit 0
+fi
+
+# echo "PID path: '$pid_path'"
+
+original_pid=`cat "$pid_path"`
+
+# echo "Original PID: $original_pid"
+
+echo "Killing the process..."
+
+kill -9 $original_pid
+
+echo "Sleeping..."
+
+sleep 3
+
+new_pid=""
+
+[ -r "$pid_path" ] && new_pid=`cat "$pid_path"`
+
+# echo "New PID: $new_pid"
+
+if [ "$expected_result" == "restarted" ]; then
+
+ if [ -z "$new_pid" ]; then
+ echo "Error: the process was killed."
+ exit 0
+ fi
+
+ if [ "$original_pid" -eq "$new_pid" ]; then
+ echo "Error: the process was not restarted."
+ exit 0
+ fi
+
+ echo "Success: the process was restarted."
+ exit 0
+
+else # $expected_result == killed
+
+ if [ "$new_pid" -a "$new_pid" -ne "$original_pid" ]; then
+ echo "Error: the process was restarted."
+ exit 0
+ fi
+
+ echo "Success: the process was killed."
+ exit 0
+fi
diff --git a/mysql-test/t/loaddata.test b/mysql-test/t/loaddata.test
index fe6828916a3..cd3a8f0fd92 100644
--- a/mysql-test/t/loaddata.test
+++ b/mysql-test/t/loaddata.test
@@ -31,6 +31,34 @@ load data infile '../../std_data/loaddata4.dat' into table t1 fields terminated
select * from t1;
drop table t1;
+
+#
+# Bug #12053 LOAD DATA INFILE ignores NO_AUTO_VALUE_ON_ZERO setting
+#
+SET @OLD_SQL_MODE=@@SQL_MODE, @@SQL_MODE=NO_AUTO_VALUE_ON_ZERO;
+create table t1(id integer not null auto_increment primary key);
+insert into t1 values(0);
+disable_query_log;
+eval SELECT * INTO OUTFILE '$MYSQL_TEST_DIR/var/tmp/t1' from t1;
+delete from t1;
+eval load data infile '$MYSQL_TEST_DIR/var/tmp/t1' into table t1;
+enable_query_log;
+select * from t1;
+--exec rm $MYSQL_TEST_DIR/var/tmp/t1
+
+disable_query_log;
+eval SELECT * INTO OUTFILE '$MYSQL_TEST_DIR/var/tmp/t1'
+FIELDS TERMINATED BY '' OPTIONALLY ENCLOSED BY '' LINES TERMINATED BY '\r\n'
+FROM t1;
+delete from t1;
+eval load data infile '$MYSQL_TEST_DIR/var/tmp/t1' into table t1
+FIELDS TERMINATED BY '' OPTIONALLY ENCLOSED BY '' LINES TERMINATED BY '\r\n';
+enable_query_log;
+select * from t1;
+--exec rm $MYSQL_TEST_DIR/var/tmp/t1
+SET @@SQL_MODE=@OLD_SQL_MODE;
+drop table t1;
+
# End of 4.1 tests
#
diff --git a/mysql-test/t/merge.test b/mysql-test/t/merge.test
index 7d708243a10..ff05867b7c1 100644
--- a/mysql-test/t/merge.test
+++ b/mysql-test/t/merge.test
@@ -288,6 +288,38 @@ create table t3 engine=merge union=(t1, t2) select * from t2;
create table t3 engine=merge union=(t1, t2) select (select max(a) from t2);
drop table t1, t2;
+#
+# Bug#9112 - Merge table with composite index producing invalid results with some queries
+# This test case will fail only without the bugfix and some
+# non-deterministic circumstances. It depends on properly initialized
+# "un-initialized" memory. At the time it happens with a standard
+# non-debug build. But there is no guarantee that this will be always so.
+#
+create table t1 (
+ a double(14,4),
+ b varchar(10),
+ index (a,b)
+) engine=merge union=(t2,t3);
+
+create table t2 (
+ a double(14,4),
+ b varchar(10),
+ index (a,b)
+) engine=myisam;
+
+create table t3 (
+ a double(14,4),
+ b varchar(10),
+ index (a,b)
+) engine=myisam;
+
+insert into t2 values ( null, '');
+insert into t2 values ( 9999999999.999, '');
+insert into t3 select * from t2;
+select min(a), max(a) from t1;
+flush tables;
+select min(a), max(a) from t1;
+drop table t1, t2, t3;
# BUG#6699 : no sorting on 'ref' retrieval
create table t1 (a int,b int,c int, index (a,b,c));
create table t2 (a int,b int,c int, index (a,b,c));
diff --git a/mysql-test/t/multi_statement.test b/mysql-test/t/multi_statement.test
index eb8d867f3f0..785aa749f5e 100644
--- a/mysql-test/t/multi_statement.test
+++ b/mysql-test/t/multi_statement.test
@@ -1,6 +1,10 @@
# PS doesn't support multi-statements
--disable_ps_protocol
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
select 1;
delimiter ||||;
select 2;
diff --git a/mysql-test/t/myisam.test b/mysql-test/t/myisam.test
index eeac2971788..73afcab5e27 100644
--- a/mysql-test/t/myisam.test
+++ b/mysql-test/t/myisam.test
@@ -578,6 +578,59 @@ checksum table t1;
# The above should give the same number as the following.
checksum table t2;
drop table t1, t2;
+
+#
+# BUG#12232: New myisam_stats_method variable.
+#
+
+show variables like 'myisam_stats_method';
+
+create table t1 (a int, key(a));
+insert into t1 values (0),(1),(2),(3),(4);
+insert into t1 select NULL from t1;
+
+# default: NULLs considered inequal
+analyze table t1;
+show index from t1;
+insert into t1 values (11);
+delete from t1 where a=11;
+check table t1;
+show index from t1;
+
+# Set nulls to be equal:
+set myisam_stats_method=nulls_equal;
+show variables like 'myisam_stats_method';
+insert into t1 values (11);
+delete from t1 where a=11;
+
+analyze table t1;
+show index from t1;
+
+insert into t1 values (11);
+delete from t1 where a=11;
+
+check table t1;
+show index from t1;
+
+# Set nulls back to be equal
+set myisam_stats_method=DEFAULT;
+show variables like 'myisam_stats_method';
+insert into t1 values (11);
+delete from t1 where a=11;
+
+analyze table t1;
+show index from t1;
+
+insert into t1 values (11);
+delete from t1 where a=11;
+
+check table t1;
+show index from t1;
+
+drop table t1;
+
+# End of 4.1 tests
+
#
# Test varchar
#
@@ -700,4 +753,3 @@ create table t3 (c1 int) engine=myisam pack_keys=default;
create table t4 (c1 int) engine=myisam pack_keys=2;
drop table t1, t2, t3;
-# End of 4.1 tests
diff --git a/mysql-test/t/mysql.test b/mysql-test/t/mysql.test
index c1d9813ea39..0b031ea1be8 100644
--- a/mysql-test/t/mysql.test
+++ b/mysql-test/t/mysql.test
@@ -19,16 +19,16 @@ insert into t1 values(1);
--disable_query_log
# Test delimiter : supplied on the command line
select "Test delimiter : from command line" as " ";
---exec $MYSQL test --delimiter=':' -e 'select * from t1:'
+--exec $MYSQL test --delimiter=":" -e "select * from t1:"
# Test delimiter :; supplied on the command line
select "Test delimiter :; from command line" as " ";
---exec $MYSQL test --delimiter=':;' -e 'select * from t1:;'
+--exec $MYSQL test --delimiter=":;" -e "select * from t1:;"
# Test 'go' command (vertical output) \G
select "Test 'go' command(vertical output) \G" as " ";
---exec $MYSQL test -e 'select * from t1\G'
+--exec $MYSQL test -e "select * from t1\G"
# Test 'go' command \g
select "Test 'go' command \g" as " ";
---exec $MYSQL test -e 'select * from t1\g'
+--exec $MYSQL test -e "select * from t1\g"
--enable_query_log
drop table t1;
@@ -37,7 +37,7 @@ drop table t1;
#
create table t1(a int);
lock tables t1 write;
---exec $MYSQL -e 'use test; select database();'
+--exec $MYSQL -e "use test; select database();"
unlock tables;
drop table t1;
diff --git a/mysql-test/t/mysqlbinlog.test b/mysql-test/t/mysqlbinlog.test
index e5bd8c554cb..61d7d9994ba 100644
--- a/mysql-test/t/mysqlbinlog.test
+++ b/mysql-test/t/mysqlbinlog.test
@@ -102,10 +102,10 @@ select "--- --position --" as "";
select "--- reading stdin --" as "";
--enable_query_log
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
---exec cat $MYSQL_TEST_DIR/std_data/trunc_binlog.000001 | $MYSQL_BINLOG --short-form -
+--exec $MYSQL_BINLOG --short-form - < $MYSQL_TEST_DIR/std_data/trunc_binlog.000001
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
---exec cat $MYSQL_TEST_DIR/std_data/trunc_binlog.000001 | $MYSQL_BINLOG --short-form --position=79 -
+--exec $MYSQL_BINLOG --short-form --position=79 - < $MYSQL_TEST_DIR/std_data/trunc_binlog.000001
# clean up
drop table t1, t2;
diff --git a/mysql-test/t/mysqldump-max.test b/mysql-test/t/mysqldump-max.test
new file mode 100644
index 00000000000..fbea84808b4
--- /dev/null
+++ b/mysql-test/t/mysqldump-max.test
@@ -0,0 +1,73 @@
+# Embedded server doesn't support external clients
+--source include/not_embedded.inc
+--source include/have_innodb.inc
+--source include/have_archive.inc
+
+--disable-warnings
+drop table if exists t1;
+drop table if exists t2;
+drop table if exists t3;
+drop table if exists t4;
+drop table if exists t5;
+drop table if exists t6;
+--enable-warnings
+
+create table t1 (id int(8), name varchar(32));
+create table t2 (id int(8), name varchar(32)) ENGINE="MyISAM";
+create table t3 (id int(8), name varchar(32)) ENGINE="MEMORY";
+create table t4 (id int(8), name varchar(32)) ENGINE="HEAP";
+create table t5 (id int(8), name varchar(32)) ENGINE="ARCHIVE";
+create table t6 (id int(8), name varchar(32)) ENGINE="InnoDB";
+
+insert into t1 values (1, 'first value');
+insert into t1 values (2, 'first value');
+insert into t1 values (3, 'first value');
+insert into t1 values (4, 'first value');
+insert into t1 values (5, 'first value');
+
+insert into t2 values (1, 'first value');
+insert into t2 values (2, 'first value');
+insert into t2 values (3, 'first value');
+insert into t2 values (4, 'first value');
+insert into t2 values (5, 'first value');
+
+insert into t3 values (1, 'first value');
+insert into t3 values (2, 'first value');
+insert into t3 values (3, 'first value');
+insert into t3 values (4, 'first value');
+insert into t3 values (5, 'first value');
+
+insert into t4 values (1, 'first value');
+insert into t4 values (2, 'first value');
+insert into t4 values (3, 'first value');
+insert into t4 values (4, 'first value');
+insert into t4 values (5, 'first value');
+
+insert into t5 values (1, 'first value');
+insert into t5 values (2, 'first value');
+insert into t5 values (3, 'first value');
+insert into t5 values (4, 'first value');
+insert into t5 values (5, 'first value');
+
+insert into t6 values (1, 'first value');
+insert into t6 values (2, 'first value');
+insert into t6 values (3, 'first value');
+insert into t6 values (4, 'first value');
+insert into t6 values (5, 'first value');
+
+select * from t1;
+select * from t2;
+select * from t3;
+select * from t4;
+select * from t5;
+select * from t6;
+
+--exec $MYSQL_DUMP --skip-comments --delayed-insert --insert-ignore --databases test
+--exec $MYSQL_DUMP --skip-comments --delayed-insert --databases test
+
+drop table t1;
+drop table t2;
+drop table t3;
+drop table t4;
+drop table t5;
+drop table t6;
diff --git a/mysql-test/t/mysqldump.test b/mysql-test/t/mysqldump.test
index 2ce4b1071e2..7dafac2bde5 100644
--- a/mysql-test/t/mysqldump.test
+++ b/mysql-test/t/mysqldump.test
@@ -142,7 +142,7 @@ drop table t1;
--exec $MYSQL_DUMP --skip-comments --databases test
create database mysqldump_test_db character set latin2 collate latin2_bin;
---exec $MYSQL_DUMP --skip-comments --databases mysqldump_test_db;
+--exec $MYSQL_DUMP --skip-comments --databases mysqldump_test_db
drop database mysqldump_test_db;
#
@@ -758,17 +758,7 @@ select * from v3 where b in (1, 2, 3, 4, 5, 6, 7);
create view v2 as
select v3.a from v3, v1 where v1.a=v3.a and v3.b=3 limit 1;
---exec $MYSQL_DUMP test > var/tmp/bug10927.sql
-drop view v1, v2, v3;
-drop table t1;
---exec $MYSQL test < var/tmp/bug10927.sql
-
-# Without dropping the original tables in between
---exec $MYSQL_DUMP test > var/tmp/bug10927.sql
---exec $MYSQL test < var/tmp/bug10927.sql
-show full tables;
-show create view v1;
-select * from v1;
+--exec $MYSQL_DUMP --skip-comments test
drop view v1, v2, v3;
drop table t1;
diff --git a/mysql-test/t/mysqltest.test b/mysql-test/t/mysqltest.test
index c903749839d..11fbb023963 100644
--- a/mysql-test/t/mysqltest.test
+++ b/mysql-test/t/mysqltest.test
@@ -428,9 +428,8 @@ echo ;
# ----------------------------------------------------------------------------
# Illegal use of exec
-# Disabled, some shells prints the failed command regardless of pipes
-#--error 1
-#--exec echo "--exec ';' 2> /dev/null" | $MYSQL_TEST 2>&1
+--error 1
+--exec echo "--exec false" | $MYSQL_TEST 2>&1
--error 1
--exec echo "--exec " | $MYSQL_TEST 2>&1
@@ -677,9 +676,8 @@ system echo "hej" > /dev/null;
--exec echo "system;" | $MYSQL_TEST 2>&1
--error 1
--exec echo "system $NONEXISTSINFVAREABLI;" | $MYSQL_TEST 2>&1
-# Disabled, some shells prints the failed command regardless of pipes
-#--error 1
-#--exec echo "system NonExistsinfComamdn 2> /dev/null;" | $MYSQL_TEST 2>&1
+--error 1
+--exec echo "system false;" | $MYSQL_TEST 2>&1
--disable_abort_on_error
system NonExistsinfComamdn;
@@ -814,11 +812,11 @@ select "a" as col1, "c" as col2;
# ----------------------------------------------------------------------------
# -x <file_name>, use the file specified after -x as the test file
-#--exec $MYSQL_TEST < $MYSQL_TEST_DIR/include/mysqltest-x.inc 2>&1
-#--exec $MYSQL_TEST -x $MYSQL_TEST_DIR/include/mysqltest-x.inc 2>&1
-#--exec $MYSQL_TEST --result_file=$MYSQL_TEST_DIR/include/mysqltest-x.inc 2>&1
-#--error 1
-#--exec $MYSQL_TEST -x non_existing_file.inc 2>&1
+--exec $MYSQL_TEST < $MYSQL_TEST_DIR/include/mysqltest-x.inc
+--exec $MYSQL_TEST -x $MYSQL_TEST_DIR/include/mysqltest-x.inc
+--exec $MYSQL_TEST --test_file=$MYSQL_TEST_DIR/include/mysqltest-x.inc
+--error 1
+--exec $MYSQL_TEST -x non_existing_file.inc 2>&1
# ----------------------------------------------------------------------------
diff --git a/mysql-test/t/ndb_alter_table.test b/mysql-test/t/ndb_alter_table.test
index 0f7b0bb7edc..357f658a296 100644
--- a/mysql-test/t/ndb_alter_table.test
+++ b/mysql-test/t/ndb_alter_table.test
@@ -203,5 +203,124 @@ drop table t4;
show tables;
connection server1;
+create table t1 (
+ai bigint auto_increment,
+c001 int(11) not null,
+c002 int(11) not null,
+c003 int(11) not null,
+c004 int(11) not null,
+c005 int(11) not null,
+c006 int(11) not null,
+c007 int(11) not null,
+c008 int(11) not null,
+c009 int(11) not null,
+c010 int(11) not null,
+c011 int(11) not null,
+c012 int(11) not null,
+c013 int(11) not null,
+c014 int(11) not null,
+c015 int(11) not null,
+c016 int(11) not null,
+c017 int(11) not null,
+c018 int(11) not null,
+c019 int(11) not null,
+c020 int(11) not null,
+c021 int(11) not null,
+c022 int(11) not null,
+c023 int(11) not null,
+c024 int(11) not null,
+c025 int(11) not null,
+c026 int(11) not null,
+c027 int(11) not null,
+c028 int(11) not null,
+c029 int(11) not null,
+c030 int(11) not null,
+c031 int(11) not null,
+c032 int(11) not null,
+c033 int(11) not null,
+c034 int(11) not null,
+c035 int(11) not null,
+c036 int(11) not null,
+c037 int(11) not null,
+c038 int(11) not null,
+c039 int(11) not null,
+c040 int(11) not null,
+c041 int(11) not null,
+c042 int(11) not null,
+c043 int(11) not null,
+c044 int(11) not null,
+c045 int(11) not null,
+c046 int(11) not null,
+c047 int(11) not null,
+c048 int(11) not null,
+c049 int(11) not null,
+c050 int(11) not null,
+c051 int(11) not null,
+c052 int(11) not null,
+c053 int(11) not null,
+c054 int(11) not null,
+c055 int(11) not null,
+c056 int(11) not null,
+c057 int(11) not null,
+c058 int(11) not null,
+c059 int(11) not null,
+c060 int(11) not null,
+c061 int(11) not null,
+c062 int(11) not null,
+c063 int(11) not null,
+c064 int(11) not null,
+c065 int(11) not null,
+c066 int(11) not null,
+c067 int(11) not null,
+c068 int(11) not null,
+c069 int(11) not null,
+c070 int(11) not null,
+c071 int(11) not null,
+c072 int(11) not null,
+c073 int(11) not null,
+c074 int(11) not null,
+c075 int(11) not null,
+c076 int(11) not null,
+c077 int(11) not null,
+c078 int(11) not null,
+c079 int(11) not null,
+c080 int(11) not null,
+c081 int(11) not null,
+c082 int(11) not null,
+c083 int(11) not null,
+c084 int(11) not null,
+c085 int(11) not null,
+c086 int(11) not null,
+c087 int(11) not null,
+c088 int(11) not null,
+c089 int(11) not null,
+c090 int(11) not null,
+c091 int(11) not null,
+c092 int(11) not null,
+c093 int(11) not null,
+c094 int(11) not null,
+c095 int(11) not null,
+c096 int(11) not null,
+c097 int(11) not null,
+c098 int(11) not null,
+c099 int(11) not null,
+c100 int(11) not null,
+c101 int(11) not null,
+c102 int(11) not null,
+c103 int(11) not null,
+c104 int(11) not null,
+c105 int(11) not null,
+c106 int(11) not null,
+c107 int(11) not null,
+c108 int(11) not null,
+c109 int(11) not null,
+primary key (ai),
+unique key tx1 (c002, c003, c004, c005)) engine=ndb;
+
+create index tx2
+on t1 (c010, c011, c012, c013);
+
+drop table t1;
+
# End of 4.1 tests
diff --git a/mysql-test/t/ndb_config.test b/mysql-test/t/ndb_config.test
index ab3063af672..9d1c107472f 100644
--- a/mysql-test/t/ndb_config.test
+++ b/mysql-test/t/ndb_config.test
@@ -6,5 +6,8 @@
--exec $NDB_TOOLS_DIR/ndb_config --no-defaults --query=nodeid,host,DataMemory,IndexMemory --type=ndbd 2> /dev/null
--exec $NDB_TOOLS_DIR/ndb_config --no-defaults -r \\n -f " " --query=nodeid,host,DataMemory,IndexMemory --type=ndbd 2> /dev/null
--exec $NDB_TOOLS_DIR/ndb_config --no-defaults --query=nodeid --type=ndbd --host=localhost 2> /dev/null
+--exec $NDB_TOOLS_DIR/ndb_config --no-defaults --query=type,nodeid,host --config-file=$NDB_BACKUP_DIR/config.ini 2> /dev/null
# End of 4.1 tests
+
+--exec $NDB_TOOLS_DIR/ndb_config --defaults-group-suffix=.jonas --defaults-file=$MYSQL_TEST_DIR/std_data/ndb_config_mycnf1.cnf --query=type,nodeid,host,IndexMemory,DataMemory --mycnf 2> /dev/null
diff --git a/mysql-test/t/range.test b/mysql-test/t/range.test
index bbe5798e7e5..11c5e8d7bc5 100644
--- a/mysql-test/t/range.test
+++ b/mysql-test/t/range.test
@@ -3,7 +3,7 @@
#
--disable_warnings
-drop table if exists t1, t2;
+drop table if exists t1, t2, t3;
--enable_warnings
CREATE TABLE t1 (
@@ -578,3 +578,51 @@ DELETE FROM t1 WHERE NOT(a <=> 2);
SELECT * FROM t1;
DROP TABLE t1;
+
+#
+# BUG#13317: range optimization doesn't work for IN over VIEW.
+#
+create table t1 (a int, b int, primary key(a,b));
+create view v1 as select a, b from t1;
+
+INSERT INTO `t1` VALUES
+(0,0),(1,0),(2,0),(3,0),(4,0),(5,1),(6,1),(7,1),(8,1),(9,1),(10,2),(11,2),(12,2)
+,(13,2),(14,2),(15,3),(16,3),(17,3),(18,3),(19,3);
+
+--replace_column 9 #
+explain select * from t1 where a in (3,4) and b in (1,2,3);
+--replace_column 9 #
+explain select * from v1 where a in (3,4) and b in (1,2,3);
+--replace_column 9 #
+explain select * from t1 where a between 3 and 4 and b between 1 and 2;
+--replace_column 9 #
+explain select * from v1 where a between 3 and 4 and b between 1 and 2;
+
+drop view v1;
+drop table t1;
+
+# BUG#13455:
+create table t3 (a int);
+insert into t3 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+
+create table t1 (a varchar(10), filler char(200), key(a)) charset=binary;
+insert into t1 values ('a','');
+insert into t1 values ('a ','');
+insert into t1 values ('a ', '');
+insert into t1 select concat('a', 1000 + A.a + 10 * (B.a + 10 * C.a)), ''
+ from t3 A, t3 B, t3 C;
+
+create table t2 (a varchar(10), filler char(200), key(a));
+insert into t2 select * from t1;
+
+--replace_column 9 #
+explain select * from t1 where a between 'a' and 'a ';
+--replace_column 9 #
+explain select * from t1 where a = 'a' or a='a ';
+
+--replace_column 9 #
+explain select * from t2 where a between 'a' and 'a ';
+--replace_column 9 #
+explain select * from t2 where a = 'a' or a='a ';
+
+drop table t1,t2,t3;
diff --git a/mysql-test/t/rpl_multi_delete.test b/mysql-test/t/rpl_multi_delete.test
index 2fd7b820b1a..4a8c0ab6912 100644
--- a/mysql-test/t/rpl_multi_delete.test
+++ b/mysql-test/t/rpl_multi_delete.test
@@ -16,10 +16,26 @@ sync_with_master;
select * from t1;
select * from t2;
+# End of 4.1 tests
+
+# Check if deleting 0 rows is binlogged (BUG#13348)
+
connection master;
-drop table t1,t2;
-save_master_pos;
-connection slave;
-sync_with_master;
+delete from t1;
+delete from t2;
-# End of 4.1 tests
+sync_slave_with_master;
+# force a difference to see if master's multi-DELETE will correct it
+insert into t1 values(1);
+insert into t2 values(1);
+
+connection master;
+DELETE t1.*, t2.* from t1, t2;
+
+sync_slave_with_master;
+select * from t1;
+select * from t2;
+
+connection master;
+drop table t1,t2;
+sync_slave_with_master;
diff --git a/mysql-test/t/rpl_multi_delete2-slave.opt b/mysql-test/t/rpl_multi_delete2-slave.opt
index b828d03fafb..0febb2891b1 100644
--- a/mysql-test/t/rpl_multi_delete2-slave.opt
+++ b/mysql-test/t/rpl_multi_delete2-slave.opt
@@ -1 +1 @@
---replicate-wild-ignore-table=test.%
+"--replicate-rewrite-db=mysqltest_from->mysqltest_to" --replicate-do-table=mysqltest_to.a
diff --git a/mysql-test/t/rpl_multi_delete2.test b/mysql-test/t/rpl_multi_delete2.test
index 62d95a3a90f..c50311de363 100644
--- a/mysql-test/t/rpl_multi_delete2.test
+++ b/mysql-test/t/rpl_multi_delete2.test
@@ -1,4 +1,41 @@
+#multi delete replication bugs
+
+
source include/master-slave.inc;
+
+#BUG#11139 - improper wild-table and table rules
+#checking for multi deletes with an alias
+
+connection master;
+set sql_log_bin=0;
+create database mysqltest_from;
+set sql_log_bin=1;
+
+connection slave;
+create database mysqltest_to;
+
+
+connection master;
+use mysqltest_from;
+--disable_warnings
+drop table if exists a;
+--enable_warnings
+CREATE TABLE a (i INT);
+INSERT INTO a VALUES(1);
+DELETE alias FROM a alias WHERE alias.i=1;
+SELECT * FROM a;
+insert into a values(2),(3);
+delete a alias FROM a alias where alias.i=2;
+select * from a;
+save_master_pos;
+connection slave;
+
+use mysqltest_to;
+sync_with_master;
+select * from a;
+
+# BUG#3461
+connection master;
create table t1 (a int);
create table t2 (a int);
@@ -19,7 +56,13 @@ select * from t1;
error 1146;
select * from t2;
+# cleanup
connection master;
-drop table t1,t2;
+set sql_log_bin=0;
+drop database mysqltest_from;
+set sql_log_bin=1;
+connection slave;
+drop database mysqltest_to;
# End of 4.1 tests
+
diff --git a/mysql-test/t/rpl_multi_update.test b/mysql-test/t/rpl_multi_update.test
index dd75edb3055..f6a960434ad 100644
--- a/mysql-test/t/rpl_multi_update.test
+++ b/mysql-test/t/rpl_multi_update.test
@@ -24,3 +24,26 @@ connection slave;
sync_with_master;
# End of 4.1 tests
+
+# Check if updating 0 rows is binlogged (BUG#13348)
+
+connection master;
+delete from t1;
+delete from t2;
+insert into t1 values(1,1);
+insert into t2 values(1,1);
+
+sync_slave_with_master;
+# force a difference to see if master's multi-UPDATE will correct it
+update t1 set a=2;
+
+connection master;
+UPDATE t1, t2 SET t1.a = t2.a;
+
+sync_slave_with_master;
+select * from t1;
+select * from t2;
+
+connection master;
+drop table t1, t2;
+sync_slave_with_master;
diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test
index 61242b3d96e..f7de7239292 100644
--- a/mysql-test/t/select.test
+++ b/mysql-test/t/select.test
@@ -2181,6 +2181,16 @@ select found_rows();
DROP TABLE t1;
+#
+# Bug #13356 assertion failed in resolve_const_item()
+#
+create table t1(f1 int, f2 int);
+create table t2(f3 int);
+select f1 from t1,t2 where f1=f2 and (f1,f2) = ((1,1));
+select f1 from t1,t2 where f1=f2 and (f1,NULL) = ((1,1));
+select f1 from t1,t2 where f1=f2 and (f1,f2) = ((1,NULL));
+drop table t1,t2;
+
# End of 4.1 tests
#
@@ -2523,3 +2533,79 @@ select * from t1, t2 join t3 on (t2.b = t3.b and t1.a = t3.a);
select * from t1 join t2 join t3 join t4 on (t1.a = t4.c and t2.b = t4.c);
select * from t1 join t2 join t4 using (c);
drop table t1, t2, t3, t4;
+
+#
+# Bug #12291 Table wasn't reinited for index scan after sequential scan
+#
+create table t1(x int, y int);
+create table t2(x int, y int);
+create table t3(x int, primary key(x));
+insert into t1 values (1, 1), (2, 1), (3, 1), (4, 3), (5, 6), (6, 6);
+insert into t2 values (1, 1), (2, 1), (3, 3), (4, 6), (5, 6);
+insert into t3 values (1), (2), (3), (4), (5);
+select t1.x, t3.x from t1, t2, t3 where t1.x = t2.x and t3.x >= t1.y and t3.x <= t2.y;
+drop table t1,t2,t3;
+
+#
+# Bug #13127 LEFT JOIN against a VIEW returns NULL instead of correct value
+#
+
+create table t1 (id char(16) not null default '', primary key (id));
+insert into t1 values ('100'),('101'),('102');
+create table t2 (id char(16) default null);
+insert into t2 values (1);
+create view v1 as select t1.id from t1;
+create view v2 as select t2.id from t2;
+create view v3 as select (t1.id+2) as id from t1 natural left join t2;
+
+# all queries must return the same result
+select t1.id from t1 left join v2 using (id);
+select t1.id from v2 right join t1 using (id);
+select t1.id from t1 left join v3 using (id);
+select * from t1 left join v2 using (id);
+select * from v2 right join t1 using (id);
+select * from t1 left join v3 using (id);
+
+select v1.id from v1 left join v2 using (id);
+select v1.id from v2 right join v1 using (id);
+select v1.id from v1 left join v3 using (id);
+select * from v1 left join v2 using (id);
+select * from v2 right join v1 using (id);
+select * from v1 left join v3 using (id);
+
+drop table t1, t2;
+drop view v1, v2, v3;
+
+#
+# Bug #13597 Column in ON condition not resolved if references a table in
+# nested right join.
+#
+
+create table a (
+ id int(11) not null default '0'
+) engine=myisam default charset=latin1;
+
+insert into a values (123),(191),(192);
+
+create table b (
+ id char(16) character set utf8 not null default ''
+) engine=myisam default charset=latin1;
+
+insert into b values ('58013'),('58014'),('58015'),('58016');
+
+create table c (
+ a_id int(11) not null default '0',
+ b_id char(16) character set utf8 default null
+) engine=myisam default charset=latin1;
+
+insert into c values
+(123,null),(123,null),(123,null),(123,null),(123,null),(123,'58013');
+
+-- both queries are equivalent
+select count(*)
+from a inner join (c left join b on b.id = c.b_id) on a.id = c.a_id;
+
+select count(*)
+from a inner join (b right join c on b.id = c.b_id) on a.id = c.a_id;
+
+drop table a, b, c;
diff --git a/mysql-test/t/skip_name_resolve.test b/mysql-test/t/skip_name_resolve.test
index 02339ca14c5..b67869692d2 100644
--- a/mysql-test/t/skip_name_resolve.test
+++ b/mysql-test/t/skip_name_resolve.test
@@ -8,3 +8,13 @@ REVOKE ALL ON test.* FROM mysqltest_1@'127.0.0.1/255.255.255.255';
DROP USER mysqltest_1@'127.0.0.1/255.255.255.255';
# End of 4.1 tests
+
+# Bug #13407 "Remote connecting crashes server".
+# Server crashed when one used USER() function in connection for which
+# was impossible to obtain peer hostname.
+connect (con1, 127.0.0.1, root, , test, $MASTER_MYPORT, );
+--replace_column 1 #
+select user();
+--replace_column 1 # 6 # 3 #
+show processlist;
+connection default;
diff --git a/mysql-test/t/sp-big.test b/mysql-test/t/sp-big.test
index 769d77dbef9..389a6f04504 100644
--- a/mysql-test/t/sp-big.test
+++ b/mysql-test/t/sp-big.test
@@ -31,3 +31,52 @@ call test.longprocedure(@value); select @value;
drop procedure test.longprocedure;
drop table t1;
+#
+# Bug #9819 "Cursors: Mysql Server Crash while fetching from table with 5
+# million records.":
+# To really test the bug, increase the number of loop iterations ($1).
+# For 4 millions set $1 to 22.
+create table t1 (f1 char(100) , f2 mediumint , f3 int , f4 real, f5 numeric);
+insert into t1 (f1, f2, f3, f4, f5) values
+("This is a test case for for Bug#9819", 1, 2, 3.0, 4.598);
+create table t2 like t1;
+let $1=8;
+--disable_query_log
+--disable_result_log
+while ($1)
+{
+ eval insert into t1 select * from t1;
+ dec $1;
+}
+--enable_result_log
+--enable_query_log
+select count(*) from t1;
+select count(*) from t2;
+delimiter |;
+create procedure p1()
+begin
+ declare done integer default 0;
+ declare vf1 char(100) ;
+ declare vf2 mediumint;
+ declare vf3 int ;
+ declare vf4 real ;
+ declare vf5 numeric ;
+ declare cur1 cursor for select f1,f2,f3,f4,f5 from t1;
+ declare continue handler for sqlstate '02000' set done = 1;
+ open cur1;
+ while done <> 1 do
+ fetch cur1 into vf1, vf2, vf3, vf4, vf5;
+ if not done then
+ insert into t2 values (vf1, vf2, vf3, vf4, vf5);
+ end if;
+ end while;
+ close cur1;
+end|
+delimiter ;|
+call p1();
+select count(*) from t1;
+select count(*) from t2;
+select f1 from t1 limit 1;
+select f1 from t2 limit 1;
+drop procedure p1;
+drop table t1, t2;
diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test
index b6a8eb6518a..e16e7456056 100644
--- a/mysql-test/t/sp.test
+++ b/mysql-test/t/sp.test
@@ -4038,6 +4038,27 @@ end|
drop function bug9048|
#
+# BUG#12812 create view calling a function works without execute right
+# on function
+--disable_warnings
+drop function if exists bug12812|
+--enable_warnings
+create function bug12812() returns char(2)
+begin
+ return 'ok';
+end;
+create user user_bug12812@localhost IDENTIFIED BY 'ABC'|
+--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
+connect (test_user_12812,localhost,user_bug12812,ABC,test)|
+--error 1370
+SELECT test.bug12812()|
+--error 1370
+CREATE VIEW v1 AS SELECT test.bug12812()|
+# Cleanup
+connection default|
+disconnect test_user_12812|
+DROP USER user_bug12812@localhost|
+drop function bug12812|
# Bug #12849 Stored Procedure: Crash on procedure call with CHAR type
# 'INOUT' parameter
#
@@ -4208,6 +4229,93 @@ drop procedure bug12979_2|
#
+# BUG#6127: Stored procedure handlers within handlers don't work
+#
+--disable_warnings
+drop table if exists t3|
+drop procedure if exists bug6127|
+--enable_warnings
+create table t3 (s1 int unique)|
+
+set @sm=@@sql_mode|
+set sql_mode='traditional'|
+
+create procedure bug6127()
+begin
+ declare continue handler for sqlstate '23000'
+ begin
+ declare continue handler for sqlstate '22003'
+ insert into t3 values (0);
+
+ insert into t3 values (1000000000000000);
+ end;
+
+ insert into t3 values (1);
+ insert into t3 values (1);
+end|
+
+call bug6127()|
+select * from t3|
+--error ER_DUP_ENTRY
+call bug6127()|
+select * from t3|
+set sql_mode=@sm|
+drop table t3|
+drop procedure bug6127|
+
+
+#
+# BUG#12589: Assert when creating temp. table from decimal stored procedure
+# variable
+#
+--disable_warnings
+drop procedure if exists bug12589_1|
+drop procedure if exists bug12589_2|
+drop procedure if exists bug12589_3|
+--enable_warnings
+create procedure bug12589_1()
+begin
+ declare spv1 decimal(3,3);
+ set spv1= 123.456;
+
+ set spv1 = 'test';
+ create temporary table tm1 as select spv1;
+ show create table tm1;
+ drop temporary table tm1;
+end|
+
+create procedure bug12589_2()
+begin
+ declare spv1 decimal(6,3);
+ set spv1= 123.456;
+
+ create temporary table tm1 as select spv1;
+ show create table tm1;
+ drop temporary table tm1;
+end|
+
+create procedure bug12589_3()
+begin
+ declare spv1 decimal(6,3);
+ set spv1= -123.456;
+
+ create temporary table tm1 as select spv1;
+ show create table tm1;
+ drop temporary table tm1;
+end|
+
+# Note: The type of the field will match the value, not the declared
+# type of the variable. (This is a type checking issue which
+# might be changed later.)
+
+# Warning expected from "set spv1 = 'test'", the value is set to decimal "0".
+call bug12589_1()|
+# No warnings here
+call bug12589_2()|
+call bug12589_3()|
+
+
+#
# BUG#NNNN: New bug synopsis
#
#--disable_warnings
diff --git a/mysql-test/t/sql_mode.test b/mysql-test/t/sql_mode.test
index 10db520cd12..b11afe9e59d 100644
--- a/mysql-test/t/sql_mode.test
+++ b/mysql-test/t/sql_mode.test
@@ -86,6 +86,18 @@ drop table t1 ;
--error 1231
set @@SQL_MODE=NULL;
+#
+# Bug #797: in sql_mode=ANSI, show create table ignores auto_increment
+#
+set session sql_mode=ansi;
+create table t1
+(f1 integer auto_increment primary key,
+ f2 timestamp default current_timestamp on update current_timestamp);
+show create table t1;
+set session sql_mode=no_field_options;
+show create table t1;
+drop table t1;
+
# End of 4.1 tests
#
diff --git a/mysql-test/t/temp_table.test b/mysql-test/t/temp_table.test
index 9a7678ed712..6b3991c9c78 100644
--- a/mysql-test/t/temp_table.test
+++ b/mysql-test/t/temp_table.test
@@ -4,6 +4,7 @@
--disable_warnings
drop table if exists t1,t2;
+drop view if exists v1;
--enable_warnings
CREATE TABLE t1 (c int not null, d char (10) not null);
@@ -91,18 +92,18 @@ show status like "created_tmp%tables";
drop table t1;
# Fix for BUG#8921: Check that temporary table is ingored by view commands.
-create temporary table t1 as select 'This is temp. table' A;
-create view t1 as select 'This is view' A;
-select * from t1;
-show create table t1;
-show create view t1;
-drop view t1;
-select * from t1;
-create view t1 as select 'This is view again' A;
-select * from t1;
-drop table t1;
-select * from t1;
-drop view t1;
+create temporary table v1 as select 'This is temp. table' A;
+create view v1 as select 'This is view' A;
+select * from v1;
+show create table v1;
+show create view v1;
+drop view v1;
+select * from v1;
+create view v1 as select 'This is view again' A;
+select * from v1;
+drop table v1;
+select * from v1;
+drop view v1;
# Bug #8497: tmpdir with extra slashes would cause failures
#
diff --git a/mysql-test/t/type_bit.test b/mysql-test/t/type_bit.test
index 6906cfc2808..0c45dea21bb 100644
--- a/mysql-test/t/type_bit.test
+++ b/mysql-test/t/type_bit.test
@@ -224,3 +224,5 @@ select a1, a2, b1+0, b2+0 from t1 join t2 on a1 = a2;
select a1, a2, b1+0, b2+0 from t1 join t2 on a1 = a2 order by a1;
select a1, a2, b1+0, b2+0 from t1 join t2 on b1 = b2;
select sum(a1), b1+0, b2+0 from t1 join t2 on b1 = b2 group by b1 order by 1;
+select 1 from t1 join t2 on b1 = b2 group by b1 order by 1;
+select b1+0,sum(b1), sum(b2) from t1 join t2 on b1 = b2 group by b1 order by 1;
diff --git a/mysql-test/t/type_decimal.test b/mysql-test/t/type_decimal.test
index 44032fde46f..1f6310cb819 100644
--- a/mysql-test/t/type_decimal.test
+++ b/mysql-test/t/type_decimal.test
@@ -268,6 +268,16 @@ insert into t1 values ('1'),('+1'),('-1'),('0000000001'),('+0000000001'),('-0000
select * from t1;
drop table t1;
+#
+# Bug #7589: a problem with update from column
+#
+
+create table t1(a decimal(10,5), b decimal(10,1));
+insert into t1 values(123.12345, 123.12345);
+update t1 set b=a;
+select * from t1;
+drop table t1;
+
# End of 4.1 tests
#
diff --git a/mysql-test/t/type_float.test b/mysql-test/t/type_float.test
index c0f1854d5b2..cf2a2676ab0 100644
--- a/mysql-test/t/type_float.test
+++ b/mysql-test/t/type_float.test
@@ -147,3 +147,12 @@ select * from t1 where reckey=1.09E2;
drop table t1;
# End of 4.1 tests
+
+#
+# bug #12694 (float(m,d) specifications)
+#
+
+--error 1427
+create table t1 (s1 float(0,2));
+--error 1427
+create table t1 (s1 float(1,2));
diff --git a/mysql-test/t/union.test b/mysql-test/t/union.test
index d4b0c1746af..daa83ef0fa4 100644
--- a/mysql-test/t/union.test
+++ b/mysql-test/t/union.test
@@ -443,14 +443,6 @@ create table t1 SELECT b from t2 UNION select tx from t2;
select * from t1;
show create table t1;
drop table t1,t2;
-create table t1 (d decimal(10,1));
-create table t2 (d decimal(10,9));
-insert into t1 values ("100000000.0");
-insert into t2 values ("1.23456780");
-create table t3 select * from t2 union select * from t1;
-select * from t3;
-show create table t3;
-drop table t1,t2,t3;
create table t1 select 1 union select -1;
select * from t1;
show create table t1;
diff --git a/mysql-test/t/update.test b/mysql-test/t/update.test
index dd6c36d8414..3822d1fe4e7 100644
--- a/mysql-test/t/update.test
+++ b/mysql-test/t/update.test
@@ -215,4 +215,16 @@ UPDATE t1 SET t1.f2=(SELECT MAX(t2.f4) FROM t2 WHERE t2.f3=t1.f1);
select * from t1;
drop table t1,t2;
+#
+# Bug #13180 sometimes server accepts sum func in update/delete where condition
+#
+create table t1(f1 int);
+select DATABASE();
+--error 1111
+update t1 set f1=1 where count(*)=1;
+select DATABASE();
+--error 1111
+delete from t1 where count(*)=1;
+drop table t1;
+
# End of 4.1 tests
diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test
index 59ec47821f6..15c8cccf69c 100644
--- a/mysql-test/t/view.test
+++ b/mysql-test/t/view.test
@@ -786,6 +786,19 @@ select * from v1;
drop view v1;
#
+# renaming views
+#
+create table t1 (a int);
+create view v1 as select a from t1;
+create database seconddb;
+-- error 1450
+rename table v1 to seconddb.v1;
+rename table v1 to v2;
+drop table t1;
+drop view v2;
+drop database seconddb;
+
+#
# bug handling from VIEWs
#
create view v1 as select 'a',1;
@@ -2030,6 +2043,7 @@ drop view v1;
drop table t1;
# BUG#12941
#
+--disable_warnings
create table t1 (
r_object_id char(16) NOT NULL,
group_name varchar(32) NOT NULL
@@ -2040,6 +2054,7 @@ create table t2 (
i_position int(11) NOT NULL,
users_names varchar(32) default NULL
) Engine = InnoDB;
+--enable_warnings
create view v1 as select r_object_id, group_name from t1;
create view v2 as select r_object_id, i_position, users_names from t2;
@@ -2124,3 +2139,31 @@ SELECT * FROM v3;
DROP TABLE t1;
DROP VIEW v1, v2, v3;
+
+#
+# Bug #13411: crash when using non-qualified view column in HAVING clause
+#
+
+CREATE TABLE t1 ( a int, b int );
+INSERT INTO t1 VALUES (1,1),(2,2),(3,3);
+CREATE VIEW v1 AS SELECT a,b FROM t1;
+SELECT t1.a FROM t1 GROUP BY t1.a HAVING a > 1;
+SELECT v1.a FROM v1 GROUP BY v1.a HAVING a > 1;
+
+DROP VIEW v1;
+DROP TABLE t1;
+
+#
+# Bug #13410: failed name resolution for qualified view column in HAVING
+#
+
+CREATE TABLE t1 ( a int, b int );
+INSERT INTO t1 VALUES (1,1),(2,2),(3,3);
+CREATE VIEW v1 AS SELECT a,b FROM t1;
+SELECT t1.a FROM t1 GROUP BY t1.a HAVING t1.a > 1;
+SELECT v1.a FROM v1 GROUP BY v1.a HAVING v1.a > 1;
+SELECT t_1.a FROM t1 AS t_1 GROUP BY t_1.a HAVING t_1.a IN (1,2,3);
+SELECT v_1.a FROM v1 AS v_1 GROUP BY v_1.a HAVING v_1.a IN (1,2,3);
+
+DROP VIEW v1;
+DROP TABLE t1;
diff --git a/mysql-test/t/view_query_cache.test b/mysql-test/t/view_query_cache.test
index bca111a5ed1..81994407641 100644
--- a/mysql-test/t/view_query_cache.test
+++ b/mysql-test/t/view_query_cache.test
@@ -84,4 +84,16 @@ select * from v3;
drop view v3;
drop table t1, t2;
+#
+# Bug #13424 locking view with query cache enabled crashes server
+#
+create table t1(f1 int);
+insert into t1 values(1),(2),(3);
+create view v1 as select * from t1;
+set query_cache_wlock_invalidate=1;
+lock tables v1 read /*!32311 local */;
+unlock tables;
+set query_cache_wlock_invalidate=default;
+drop view v1;
+drop table t1;
set GLOBAL query_cache_size=default;
diff --git a/mysql-test/t/xa.test b/mysql-test/t/xa.test
index 1347fd05415..92405bac137 100644
--- a/mysql-test/t/xa.test
+++ b/mysql-test/t/xa.test
@@ -26,13 +26,24 @@ select * from t1;
xa start 'testa','testb';
insert t1 values (30);
+
+--error 1399
+commit;
+
xa end 'testa','testb';
+--error 1399
+begin;
+--error 1399
+create table t2 (a int);
+
connect (con1,localhost,,,);
connection con1;
--error 1440
xa start 'testa','testb';
+--error 1440
+xa start 'testa','testb', 123;
# gtrid [ , bqual [ , formatID ] ]
xa start 0x7465737462, 0x2030405060, 0xb;
@@ -40,6 +51,9 @@ insert t1 values (40);
xa end 'testb',' 0@P`',11;
xa prepare 'testb',0x2030405060,11;
+--error 1399
+start transaction;
+
xa recover;
# uncomment the line below when binlog will be able to prepare
diff --git a/mysql-test/valgrind.supp b/mysql-test/valgrind.supp
index 26f3477140b..7737810653d 100644
--- a/mysql-test/valgrind.supp
+++ b/mysql-test/valgrind.supp
@@ -52,6 +52,16 @@
}
{
+ pthread pthread_key_create
+ Memcheck:Leak
+ fun:malloc
+ fun:*
+ fun:*
+ fun:pthread_key_create
+ fun:my_thread_global_init
+}
+
+{
pthread strstr uninit
Memcheck:Cond
fun:strstr
@@ -127,8 +137,18 @@
{
libz deflate
Memcheck:Cond
- obj:/usr/lib/libz.so.*
- obj:/usr/lib/libz.so.*
+ obj:*/libz.so.*
+ obj:*/libz.so.*
fun:deflate
fun:compress2
}
+
+{
+ libz deflate2
+ Memcheck:Cond
+ obj:*/libz.so.*
+ obj:*/libz.so.*
+ fun:deflate
+ obj:*/libz.so.*
+ fun:gzflush
+}