summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorunknown <tsmith@maint2.mysql.com>2006-09-12 19:40:00 +0200
committerunknown <tsmith@maint2.mysql.com>2006-09-12 19:40:00 +0200
commitbc053aa0a1764220d3c0191f1293f78decfe7c4d (patch)
tree1a304e121de5b8b9285480986927f6230f33230d /mysql-test
parent9e89ea6fa8734c2538a416b29fc3120447f6b733 (diff)
parentf320b01a805637b4269a8a3aa3e9b5455995f58f (diff)
downloadmariadb-git-bc053aa0a1764220d3c0191f1293f78decfe7c4d.tar.gz
Merge maint2.mysql.com:/data/localhome/tsmith/bk/mrg/g51
into maint2.mysql.com:/data/localhome/tsmith/bk/mrg/51 libmysqld/libmysqld.def: Auto merged mysql-test/t/handler.test: Auto merged sql/log.cc: Auto merged sql-common/client.c: Auto merged sql/mysqld.cc: Auto merged sql/sql_select.cc: Auto merged
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/Makefile.am6
-rw-r--r--mysql-test/lib/mtr_cases.pl66
-rw-r--r--mysql-test/lib/mtr_misc.pl2
-rw-r--r--mysql-test/lib/mtr_process.pl7
-rwxr-xr-xmysql-test/mysql-test-run.pl751
-rw-r--r--mysql-test/r/auto_increment.result46
-rw-r--r--mysql-test/r/ctype_recoding.result11
-rw-r--r--mysql-test/r/ctype_ucs.result40
-rw-r--r--mysql-test/r/ctype_utf8.result31
-rw-r--r--mysql-test/r/func_misc.result5
-rw-r--r--mysql-test/r/func_time.result12
-rw-r--r--mysql-test/r/heap_btree.result1
-rw-r--r--mysql-test/r/innodb.result16
-rw-r--r--mysql-test/r/innodb_mysql.result68
-rw-r--r--mysql-test/r/mysql.result14
-rw-r--r--mysql-test/r/mysqldump.result322
-rw-r--r--mysql-test/r/ndb_dd_advance.result14
-rw-r--r--mysql-test/r/ndb_dd_advance2.result8
-rw-r--r--mysql-test/r/ndb_dd_backuprestore.result12
-rw-r--r--mysql-test/r/ndb_dd_basic.result2
-rw-r--r--mysql-test/r/ndb_dd_disk2memory.result4
-rw-r--r--mysql-test/r/partition.result8
-rw-r--r--mysql-test/r/show_check.result15
-rw-r--r--mysql-test/r/variables.result6
-rw-r--r--mysql-test/r/view.result59
-rw-r--r--mysql-test/r/windows.result28
-rw-r--r--mysql-test/t/auto_increment.test36
-rw-r--r--mysql-test/t/crash_commit_before.test1
-rw-r--r--mysql-test/t/ctype_recoding.test14
-rw-r--r--mysql-test/t/ctype_ucs.test48
-rw-r--r--mysql-test/t/ctype_utf8.test18
-rw-r--r--mysql-test/t/disabled.def1
-rw-r--r--mysql-test/t/func_misc.test12
-rw-r--r--mysql-test/t/func_time.test18
-rw-r--r--mysql-test/t/grant.test2
-rw-r--r--mysql-test/t/heap_btree.test1
-rw-r--r--mysql-test/t/innodb.test8
-rw-r--r--mysql-test/t/innodb_mysql.test52
-rw-r--r--mysql-test/t/mysql.test4
-rw-r--r--mysql-test/t/mysqldump.test215
-rw-r--r--mysql-test/t/partition.test16
-rw-r--r--mysql-test/t/partition_mgm.test8
-rw-r--r--mysql-test/t/show_check.test13
-rw-r--r--mysql-test/t/system_mysql_db_fix.test3
-rw-r--r--mysql-test/t/variables.test11
-rw-r--r--mysql-test/t/view.test85
-rw-r--r--mysql-test/t/windows.test39
47 files changed, 1368 insertions, 791 deletions
diff --git a/mysql-test/Makefile.am b/mysql-test/Makefile.am
index 7fa6fa1e23e..61bac05b224 100644
--- a/mysql-test/Makefile.am
+++ b/mysql-test/Makefile.am
@@ -24,7 +24,7 @@ benchdir_root= $(prefix)
testdir = $(benchdir_root)/mysql-test
EXTRA_SCRIPTS = mysql-test-run.sh install_test_db.sh valgrind.supp $(PRESCRIPTS)
EXTRA_DIST = $(EXTRA_SCRIPTS)
-GENSCRIPTS = mysql-test-run install_test_db
+GENSCRIPTS = mysql-test-run install_test_db mtr
PRESCRIPTS = mysql-test-run.pl
test_SCRIPTS = $(GENSCRIPTS) $(PRESCRIPTS)
test_DATA = std_data/client-key.pem std_data/client-cert.pem \
@@ -113,6 +113,10 @@ install-data-local:
uninstall-local:
@RM@ -f -r $(DESTDIR)$(testdir)
+# mtr - a shortcut for executing mysql-test-run.pl
+mtr:
+ $(RM) -f mtr
+ $(LN_S) mysql-test-run.pl mtr
SUFFIXES = .sh
diff --git a/mysql-test/lib/mtr_cases.pl b/mysql-test/lib/mtr_cases.pl
index b0ba27e6736..cfd07abb9e0 100644
--- a/mysql-test/lib/mtr_cases.pl
+++ b/mysql-test/lib/mtr_cases.pl
@@ -102,7 +102,7 @@ sub collect_test_cases ($) {
if ( $mysqld_test_exists and $im_test_exists )
{
- mtr_error("Ambiguos test case name ($tname)");
+ mtr_error("Ambiguous test case name ($tname)");
}
elsif ( ! $mysqld_test_exists and ! $im_test_exists )
{
@@ -157,34 +157,38 @@ sub collect_test_cases ($) {
if ( $::opt_reorder )
{
- @$cases = sort {
- if ( ! $a->{'master_restart'} and ! $b->{'master_restart'} )
- {
- return $a->{'name'} cmp $b->{'name'};
- }
- if ( $a->{'master_restart'} and $b->{'master_restart'} )
- {
- my $cmp= mtr_cmp_opts($a->{'master_opt'}, $b->{'master_opt'});
- if ( $cmp == 0 )
- {
- return $a->{'name'} cmp $b->{'name'};
- }
- else
- {
- return $cmp;
- }
- }
+ my %sort_criteria;
+ my $tinfo;
- if ( $a->{'master_restart'} )
- {
- return 1; # Is greater
- }
- else
- {
- return -1; # Is less
- }
- } @$cases;
+ # Make a mapping of test name to a string that represents how that test
+ # should be sorted among the other tests. Put the most important criterion
+ # first, then a sub-criterion, then sub-sub-criterion, et c.
+ foreach $tinfo (@$cases)
+ {
+ my @this_criteria = ();
+
+ # Append the criteria for sorting, in order of importance.
+ push(@this_criteria, join("!", sort @{$tinfo->{'master_opt'}}) . "~"); # Ending with "~" makes empty sort later than filled
+ push(@this_criteria, "ndb=" . ($tinfo->{'ndb_test'} ? "1" : "0"));
+ push(@this_criteria, "restart=" . ($tinfo->{'master_restart'} ? "1" : "0"));
+ push(@this_criteria, "big_test=" . ($tinfo->{'big_test'} ? "1" : "0"));
+ push(@this_criteria, join("|", sort keys %{$tinfo})); # Group similar things together. The values may differ substantially. FIXME?
+ push(@this_criteria, $tinfo->{'name'}); # Finally, order by the name
+
+ $sort_criteria{$tinfo->{"name"}} = join(" ", @this_criteria);
+ }
+
+ @$cases = sort { $sort_criteria{$a->{"name"}} cmp $sort_criteria{$b->{"name"}}; } @$cases;
+
+### For debugging the sort-order
+# foreach $tinfo (@$cases)
+# {
+# print $sort_criteria{$tinfo->{"name"}};
+# print " -> \t";
+# print $tinfo->{"name"};
+# print "\n";
+# }
}
return $cases;
@@ -469,14 +473,6 @@ sub collect_one_test_case($$$$$$$) {
{
mtr_options_from_test_file($tinfo,"$testdir/${tname}.test");
- if ( ! $tinfo->{'innodb_test'} )
- {
- # mtr_verbose("Adding '--skip-innodb' to $tinfo->{'name'}");
- # FIXME activate the --skip-innodb only when running with
- # selected test cases
- # push(@{$tinfo->{'master_opt'}}, "--skip-innodb");
- }
-
if ( $tinfo->{'big_test'} and ! $::opt_big_test )
{
$tinfo->{'skip'}= 1;
diff --git a/mysql-test/lib/mtr_misc.pl b/mysql-test/lib/mtr_misc.pl
index 0ab09a40b37..dd9d24ebc8e 100644
--- a/mysql-test/lib/mtr_misc.pl
+++ b/mysql-test/lib/mtr_misc.pl
@@ -139,6 +139,8 @@ sub mtr_copy_dir($$) {
my $from_dir= shift;
my $to_dir= shift;
+# mtr_verbose("Copying from $from_dir to $to_dir");
+
mkpath("$to_dir");
opendir(DIR, "$from_dir")
or mtr_error("Can't find $from_dir$!");
diff --git a/mysql-test/lib/mtr_process.pl b/mysql-test/lib/mtr_process.pl
index 42dd8f8d331..ab2af8c4ccf 100644
--- a/mysql-test/lib/mtr_process.pl
+++ b/mysql-test/lib/mtr_process.pl
@@ -115,6 +115,8 @@ sub spawn_impl ($$$$$$$$) {
my $pid_file= shift; # FIXME
my $spawn_opts= shift;
+ mtr_error("Can't spawn with empty \"path\"") unless defined $path;
+
if ( $::opt_script_debug )
{
print STDERR "\n";
@@ -702,7 +704,7 @@ sub mtr_check_stop_servers ($) {
}
else
{
- mtr_verbose("All ports where free, continuing");
+ mtr_verbose("All ports were free, continuing");
}
}
}
@@ -975,6 +977,7 @@ sub check_expected_crash_and_restart($)
sub mtr_record_dead_children () {
+ my $process_died= 0;
my $ret_pid;
# Wait without blockinng to see if any processes had died
@@ -983,7 +986,9 @@ sub mtr_record_dead_children () {
{
mtr_warning("mtr_record_dead_children: $ret_pid");
mark_process_dead($ret_pid);
+ $process_died= 1;
}
+ return $process_died;
}
sub start_reap_all {
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index 90f7c258c91..bbf2a9e2cca 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -216,7 +216,7 @@ our $opt_embedded_server;
our $opt_extern;
our $opt_fast;
our $opt_force;
-our $opt_reorder;
+our $opt_reorder= 0;
our $opt_enable_disabled;
our $opt_gcov;
@@ -258,6 +258,7 @@ our $opt_result_ext;
our $opt_skip;
our $opt_skip_rpl;
our $use_slaves;
+our $use_innodb;
our $opt_skip_test;
our $opt_skip_im;
@@ -359,9 +360,11 @@ sub run_benchmarks ($);
sub initialize_servers ();
sub mysql_install_db ();
sub install_db ($$);
+sub copy_install_db ($$);
sub run_testcase ($);
-sub run_testcase_stop_servers ($);
+sub run_testcase_stop_servers ($$$);
sub run_testcase_start_servers ($);
+sub run_testcase_check_skip_test($);
sub report_failure_and_restart ($);
sub do_before_start_master ($$);
sub do_before_start_slave ($$);
@@ -426,6 +429,7 @@ sub main () {
$need_ndbcluster||= $test->{ndb_test};
$need_im||= $test->{component_id} eq 'im';
$use_slaves||= $test->{slave_num};
+ $use_innodb||= $test->{'innodb_test'};
}
$opt_skip_ndbcluster= $opt_skip_ndbcluster_slave= 1
unless $need_ndbcluster;
@@ -1234,8 +1238,7 @@ sub executable_setup () {
"/usr/bin/false");
$path_ndb_tools_dir= mtr_path_exists("$glob_basedir/storage/ndb/tools");
$path_ndb_examples_dir= mtr_path_exists("$glob_basedir/storage/ndb/ndbapi-examples");
- $exe_ndb_example= mtr_exe_exists("$path_ndb_examples_dir/ndbapi_simple/ndbapi_simple",
- $exe_mysqld);
+ $exe_ndb_example= mtr_file_exists("$path_ndb_examples_dir/ndbapi_simple/ndbapi_simple");
$exe_ndb_mgm= "$glob_basedir/storage/ndb/src/mgmclient/ndb_mgm";
$exe_ndb_waiter= "$glob_basedir/storage/ndb/tools/ndb_waiter";
$exe_ndbd= "$glob_basedir/storage/ndb/src/kernel/ndbd";
@@ -1314,9 +1317,19 @@ sub executable_setup () {
}
+sub generate_cmdline_mysqldump ($) {
+ my($mysqld) = @_;
+ return
+ "$exe_mysqldump --no-defaults -uroot " .
+ "--port=$mysqld->{'port'} " .
+ "--socket=$mysqld->{'path_sock'} --password=";
+}
+
+
##############################################################################
#
-# Set environment to be used by childs of this process
+# Set environment to be used by childs of this process for
+# things that are constant duting the whole lifetime of mysql-test-run.pl
#
##############################################################################
@@ -1324,16 +1337,18 @@ sub executable_setup () {
sub environment_setup () {
- my $extra_ld_library_paths;
umask(022);
+ my $extra_ld_library_paths;
+
# --------------------------------------------------------------------------
# Setup LD_LIBRARY_PATH so the libraries from this distro/clone
# are used in favor of the system installed ones
# --------------------------------------------------------------------------
if ( $opt_source_dist )
{
- $extra_ld_library_paths= "$glob_basedir/libmysql/.libs/";
+ $extra_ld_library_paths= "$glob_basedir/libmysql/.libs/" .
+ ":$glob_basedir/libmysql_r/.libs/";
}
else
{
@@ -1346,31 +1361,26 @@ sub environment_setup () {
$extra_ld_library_paths .= ":" .
($lib_udf_example ? dirname($lib_udf_example) : "");
- $ENV{'LD_LIBRARY_PATH'}=
- "$extra_ld_library_paths" .
- ($ENV{'LD_LIBRARY_PATH'} ? ":$ENV{'LD_LIBRARY_PATH'}" : "");
- $ENV{'DYLD_LIBRARY_PATH'}=
- "$extra_ld_library_paths" .
- ($ENV{'DYLD_LIBRARY_PATH'} ? ":$ENV{'DYLD_LIBRARY_PATH'}" : "");
# --------------------------------------------------------------------------
# Add the path where libndbclient can be found
# --------------------------------------------------------------------------
- $ENV{'LD_LIBRARY_PATH'}=
- (mtr_path_exists("$glob_basedir/storage/ndb/src/.libs") ? "$glob_basedir/storage/ndb/src/.libs" : "") .
- ($ENV{'LD_LIBRARY_PATH'} ? ":$ENV{'LD_LIBRARY_PATH'}" : "");
+ if ( $opt_ndbcluster_supported )
+ {
+ $extra_ld_library_paths .= ":$glob_basedir/storage/ndb/src/.libs";
+ }
- # --------------------------------------------------------------------------
- # Add the path where libmysqlclient can be found
- # --------------------------------------------------------------------------
$ENV{'LD_LIBRARY_PATH'}=
- (mtr_path_exists("$glob_basedir/libmysql_r/.libs") ? "$glob_basedir/libmysql_r/.libs" : "") .
+ "$extra_ld_library_paths" .
($ENV{'LD_LIBRARY_PATH'} ? ":$ENV{'LD_LIBRARY_PATH'}" : "");
-
+ $ENV{'DYLD_LIBRARY_PATH'}=
+ "$extra_ld_library_paths" .
+ ($ENV{'DYLD_LIBRARY_PATH'} ? ":$ENV{'DYLD_LIBRARY_PATH'}" : "");
# --------------------------------------------------------------------------
# Also command lines in .opt files may contain env vars
# --------------------------------------------------------------------------
+ $ENV{'CHARSETSDIR'}= $path_charsetsdir;
$ENV{'UMASK'}= "0660"; # The octal *string*
$ENV{'UMASK_DIR'}= "0770"; # The octal *string*
$ENV{'LC_COLLATE'}= "C";
@@ -1389,10 +1399,31 @@ sub environment_setup () {
# $ENV{'MYSQL_TCP_PORT'}= '@MYSQL_TCP_PORT@'; # FIXME
$ENV{'MYSQL_TCP_PORT'}= 3306;
- $ENV{'NDBCLUSTER_PORT'}= $opt_ndbcluster_port;
- $ENV{'NDBCLUSTER_PORT_SLAVE'}=$opt_ndbcluster_port_slave;
- $ENV{'NDB_STATUS_OK'}= "YES";
+ $ENV{MTR_BUILD_THREAD}= 0 unless $ENV{MTR_BUILD_THREAD}; # Set if not set
+
+ # ----------------------------------------------------
+ # Setup env for NDB
+ # ----------------------------------------------------
+ $ENV{'NDB_MGM'}= $exe_ndb_mgm;
+
+ $ENV{'NDBCLUSTER_PORT'}= $opt_ndbcluster_port;
+ $ENV{'NDBCLUSTER_PORT_SLAVE'}= $opt_ndbcluster_port_slave;
+
+ $ENV{'NDB_EXTRA_TEST'}= $opt_ndb_extra_test;
+
+ $ENV{'NDB_BACKUP_DIR'}= $clusters->[0]->{'data_dir'};
+ $ENV{'NDB_DATA_DIR'}= $clusters->[0]->{'data_dir'};
+ $ENV{'NDB_TOOLS_DIR'}= $path_ndb_tools_dir;
+ $ENV{'NDB_TOOLS_OUTPUT'}= $file_ndb_testrun_log;
+ $ENV{'NDB_CONNECTSTRING'}= $opt_ndbconnectstring;
+
+ $ENV{'NDB_EXAMPLES_DIR'}= $path_ndb_examples_dir;
+ $ENV{'MY_NDB_EXAMPLES_BINARY'}= $exe_ndb_example;
+ $ENV{'NDB_EXAMPLES_OUTPUT'}= $file_ndb_testrun_log;
+ # ----------------------------------------------------
+ # Setup env for IM
+ # ----------------------------------------------------
$ENV{'IM_EXE'}= $exe_im;
$ENV{'IM_PATH_PID'}= $instance_manager->{path_pid};
$ENV{'IM_PATH_ANGEL_PID'}= $instance_manager->{path_angel_pid};
@@ -1407,9 +1438,174 @@ sub environment_setup () {
$ENV{'IM_MYSQLD2_PORT'}= $instance_manager->{instances}->[1]->{port};
$ENV{'IM_MYSQLD2_PATH_PID'}=$instance_manager->{instances}->[1]->{path_pid};
- $ENV{MTR_BUILD_THREAD}= 0 unless $ENV{MTR_BUILD_THREAD}; # Set if not set
+ # ----------------------------------------------------
+ # Setup env so childs can execute mysqlcheck
+ # ----------------------------------------------------
+ my $cmdline_mysqlcheck=
+ "$exe_mysqlcheck --no-defaults -uroot " .
+ "--port=$master->[0]->{'port'} " .
+ "--socket=$master->[0]->{'path_sock'} --password=";
+
+ if ( $opt_debug )
+ {
+ $cmdline_mysqlcheck .=
+ " --debug=d:t:A,$opt_vardir_trace/log/mysqlcheck.trace";
+ }
+ $ENV{'MYSQL_CHECK'}= $cmdline_mysqlcheck;
+
+ # ----------------------------------------------------
+ # Setup env to childs can execute myqldump
+ # ----------------------------------------------------
+ my $cmdline_mysqldump= generate_cmdline_mysqldump($master->[0]);
+ my $cmdline_mysqldumpslave= generate_cmdline_mysqldump($slave->[0]);
+
+ if ( $opt_debug )
+ {
+ $cmdline_mysqldump .=
+ " --debug=d:t:A,$opt_vardir_trace/log/mysqldump-master.trace";
+ $cmdline_mysqldumpslave .=
+ " --debug=d:t:A,$opt_vardir_trace/log/mysqldump-slave.trace";
+ }
+ $ENV{'MYSQL_DUMP'}= $cmdline_mysqldump;
+ $ENV{'MYSQL_DUMP_SLAVE'}= $cmdline_mysqldumpslave;
+
+
+ # ----------------------------------------------------
+ # Setup env so childs can execute mysqlslap
+ # ----------------------------------------------------
+ unless ( $glob_win32 )
+ {
+ my $cmdline_mysqlslap=
+ "$exe_mysqlslap -uroot " .
+ "--port=$master->[0]->{'port'} " .
+ "--socket=$master->[0]->{'path_sock'} --password= " .
+ "--lock-directory=$opt_tmpdir";
+
+ if ( $opt_debug )
+ {
+ $cmdline_mysqlslap .=
+ " --debug=d:t:A,$opt_vardir_trace/log/mysqlslap.trace";
+ }
+ $ENV{'MYSQL_SLAP'}= $cmdline_mysqlslap;
+ }
+
+ # ----------------------------------------------------
+ # Setup env so childs can execute mysqlimport
+ # ----------------------------------------------------
+ my $cmdline_mysqlimport=
+ "$exe_mysqlimport -uroot " .
+ "--port=$master->[0]->{'port'} " .
+ "--socket=$master->[0]->{'path_sock'} --password=";
+
+ if ( $opt_debug )
+ {
+ $cmdline_mysqlimport .=
+ " --debug=d:t:A,$opt_vardir_trace/log/mysqlimport.trace";
+ }
+ $ENV{'MYSQL_IMPORT'}= $cmdline_mysqlimport;
+
+
+ # ----------------------------------------------------
+ # Setup env so childs can execute mysqlshow
+ # ----------------------------------------------------
+ my $cmdline_mysqlshow=
+ "$exe_mysqlshow -uroot " .
+ "--port=$master->[0]->{'port'} " .
+ "--socket=$master->[0]->{'path_sock'} --password=";
+
+ if ( $opt_debug )
+ {
+ $cmdline_mysqlshow .=
+ " --debug=d:t:A,$opt_vardir_trace/log/mysqlshow.trace";
+ }
+ $ENV{'MYSQL_SHOW'}= $cmdline_mysqlshow;
+
+ # ----------------------------------------------------
+ # Setup env so childs can execute mysqlbinlog
+ # ----------------------------------------------------
+ my $cmdline_mysqlbinlog=
+ "$exe_mysqlbinlog" .
+ " --no-defaults --local-load=$opt_tmpdir" .
+ " --character-sets-dir=$path_charsetsdir";
+
+ if ( $opt_debug )
+ {
+ $cmdline_mysqlbinlog .=
+ " --debug=d:t:A,$opt_vardir_trace/log/mysqlbinlog.trace";
+ }
+ $ENV{'MYSQL_BINLOG'}= $cmdline_mysqlbinlog;
+
+ # ----------------------------------------------------
+ # Setup env so childs can execute mysql
+ # ----------------------------------------------------
+ my $cmdline_mysql=
+ "$exe_mysql --no-defaults --host=localhost --user=root --password= " .
+ "--port=$master->[0]->{'port'} " .
+ "--socket=$master->[0]->{'path_sock'}";
+
+ $ENV{'MYSQL'}= $cmdline_mysql;
+
+ # ----------------------------------------------------
+ # Setup env so childs can execute mysql_client_test
+ # ----------------------------------------------------
+ my $cmdline_mysql_client_test=
+ "$exe_mysql_client_test --no-defaults --testcase --user=root --silent " .
+ "--port=$master->[0]->{'port'} " .
+ "--vardir=$opt_vardir " .
+ "--socket=$master->[0]->{'path_sock'}";
+
+ if ( $opt_debug )
+ {
+ $cmdline_mysql_client_test .=
+ " --debug=d:t:A,$opt_vardir_trace/log/mysql_client_test.trace";
+ }
+
+ if ( $glob_use_embedded_server )
+ {
+ $cmdline_mysql_client_test.=
+ " -A --language=$path_language" .
+ " -A --datadir=$slave->[0]->{'path_myddir'}" .
+ " -A --character-sets-dir=$path_charsetsdir";
+ }
+ $ENV{'MYSQL_CLIENT_TEST'}= $cmdline_mysql_client_test;
+
+
+ # ----------------------------------------------------
+ # Setup env so childs can execute mysql_fix_system_tables
+ # ----------------------------------------------------
+ my $cmdline_mysql_fix_system_tables=
+ "$exe_mysql_fix_system_tables --no-defaults --host=localhost --user=root --password= " .
+ "--basedir=$glob_basedir --bindir=$path_client_bindir --verbose " .
+ "--port=$master->[0]->{'port'} " .
+ "--socket=$master->[0]->{'path_sock'}";
+ $ENV{'MYSQL_FIX_SYSTEM_TABLES'}= $cmdline_mysql_fix_system_tables;
+
+ # ----------------------------------------------------
+ # Setup env so childs can execute my_print_defaults
+ # ----------------------------------------------------
+ $ENV{'MYSQL_MY_PRINT_DEFAULTS'}= $exe_my_print_defaults;
+
+
+ # ----------------------------------------------------
+ # Setup env so childs can execute perror
+ # ----------------------------------------------------
+ $ENV{'MY_PERROR'}= $exe_perror;
+
+ # ----------------------------------------------------
+ # Add the path where mysqld will find udf_example.so
+ # ----------------------------------------------------
+ $ENV{'UDF_EXAMPLE_LIB'}=
+ ($lib_udf_example ? basename($lib_udf_example) : "");
+
+ $ENV{'LD_LIBRARY_PATH'}=
+ ($lib_udf_example ? dirname($lib_udf_example) : "") .
+ ($ENV{'LD_LIBRARY_PATH'} ? ":$ENV{'LD_LIBRARY_PATH'}" : "");
+
+
+ # ----------------------------------------------------
# We are nice and report a bit about our settings
+ # ----------------------------------------------------
if (!$opt_extern)
{
print "Using MTR_BUILD_THREAD = $ENV{MTR_BUILD_THREAD}\n";
@@ -1777,6 +1973,23 @@ sub mysqld_wait_started($){
}
+sub ndb_mgmd_wait_started($) {
+ my ($cluster)= @_;
+
+ my $retries= 100;
+ while (ndbcluster_wait_started($cluster, "--no-contact") and
+ $retries)
+ {
+ # Millisceond sleep emulated with select
+ select(undef, undef, undef, (0.1));
+
+ $retries--;
+ }
+
+ return $retries == 0;
+
+}
+
sub ndb_mgmd_start ($) {
my $cluster= shift;
@@ -1797,13 +2010,12 @@ sub ndb_mgmd_start ($) {
"",
{ append_log_file => 1 });
-
# FIXME Should not be needed
# Unfortunately the cluster nodes will fail to start
# if ndb_mgmd has not started properly
- while (ndbcluster_wait_started($cluster, "--no-contact"))
+ if (ndb_mgmd_wait_started($cluster))
{
- select(undef, undef, undef, 0.1);
+ mtr_error("Failed to wait for start of ndb_mgmd");
}
# Remember pid of ndb_mgmd
@@ -1868,7 +2080,7 @@ sub ndbcluster_start ($$) {
mtr_error("Cluster '$cluster->{'name'}' already started");
}
- my $pid= ndb_mgmd_start($cluster);
+ ndb_mgmd_start($cluster);
for ( my $idx= 0; $idx < $cluster->{'nodes'}; $idx++ )
{
@@ -1979,6 +2191,11 @@ sub run_suite () {
foreach my $tinfo ( @$tests )
{
+ if (run_testcase_check_skip_test($tinfo))
+ {
+ next;
+ }
+
mtr_timer_start($glob_timers,"testcase", 60 * $opt_testcase_timeout);
run_testcase($tinfo);
mtr_timer_stop($glob_timers,"testcase");
@@ -2034,9 +2251,10 @@ sub initialize_servers () {
sub mysql_install_db () {
- # FIXME not exactly true I think, needs improvements
install_db('master', $master->[0]->{'path_myddir'});
- install_db('master', $master->[1]->{'path_myddir'});
+
+ # FIXME check if testcase really is using second master
+ copy_install_db('master', $master->[1]->{'path_myddir'});
if ( $use_slaves )
{
@@ -2050,10 +2268,8 @@ sub mysql_install_db () {
im_prepare_env($instance_manager);
}
-
my $cluster_started_ok= 1; # Assume it can be started
-
if (ndbcluster_start_install($clusters->[0]) ||
$use_slaves && ndbcluster_start_install($clusters->[1]))
{
@@ -2061,7 +2277,6 @@ sub mysql_install_db () {
$cluster_started_ok= 0;
}
-
foreach my $cluster (@{$clusters})
{
@@ -2079,6 +2294,9 @@ sub mysql_install_db () {
}
}
+ $ENV{'NDB_STATUS_OK'}= $clusters->[0]->{'installed_ok'};
+ $ENV{'NDB_SLAVE_STATUS_OK'}= $clusters->[1]->{'installed_ok'};;
+
if ( ! $cluster_started_ok )
{
if ( $opt_force)
@@ -2098,6 +2316,18 @@ sub mysql_install_db () {
}
+sub copy_install_db ($$) {
+ my $type= shift;
+ my $data_dir= shift;
+
+ mtr_report("Installing \u$type Database");
+
+ # Just copy the installed db from first master
+ mtr_copy_dir($master->[0]->{'path_myddir'}, $data_dir);
+
+}
+
+
sub install_db ($$) {
my $type= shift;
my $data_dir= shift;
@@ -2252,38 +2482,15 @@ sub im_prepare_data_dir($) {
foreach my $instance (@{$instance_manager->{'instances'}})
{
- install_db(
+ copy_install_db(
'im_mysqld_' . $instance->{'server_id'},
$instance->{'path_datadir'});
}
}
-
-##############################################################################
-#
-# Run a single test case
-#
-##############################################################################
-
-# When we get here, we have already filtered out test cases that doesn't
-# apply to the current setup, for example if we use a running server, test
-# cases that restart the server are dropped. So this function should mostly
-# be about doing things, not a lot of logic.
-
-# We don't start and kill the servers for each testcase. But some
-# testcases needs a restart, because they specify options to start
-# mysqld with. After that testcase, we need to restart again, to set
-# back the normal options.
-
-sub run_testcase ($) {
- my $tinfo= shift;
-
- my $tname= $tinfo->{'name'};
-
- mtr_tonewfile($path_current_test_log,"$tname\n"); # Always tell where we are
-
- # output current test to ndbcluster log file to enable diagnostics
- mtr_tofile($file_ndb_testrun_log,"CURRENT TEST $tname\n");
+sub run_testcase_check_skip_test($)
+{
+ my ($tinfo)= @_;
# ----------------------------------------------------------------------
# If marked to skip, just print out and return.
@@ -2296,7 +2503,7 @@ sub run_testcase ($) {
{
mtr_report_test_name($tinfo);
mtr_report_test_skipped($tinfo);
- return;
+ return 1;
}
# If test needs cluster, check that master installed ok
@@ -2304,7 +2511,7 @@ sub run_testcase ($) {
{
mtr_report_test_name($tinfo);
mtr_report_test_failed($tinfo);
- return;
+ return 1;
}
# If test needs slave cluster, check that it installed ok
@@ -2313,65 +2520,103 @@ sub run_testcase ($) {
{
mtr_report_test_name($tinfo);
mtr_report_test_failed($tinfo);
- return;
+ return 1;
}
- run_testcase_stop_servers($tinfo);
+ return 0;
+}
- # ----------------------------------------------------------------------
- # Prepare to start masters. Even if we use embedded, we want to run
- # the preparation.
- # ----------------------------------------------------------------------
- $ENV{'TZ'}= $tinfo->{'timezone'};
+sub do_before_run_mysqltest($)
+{
+ my $tinfo= shift;
+ my $tname= $tinfo->{'name'};
+
+ # Remove old reject file
+ if ( $opt_suite eq "main" )
+ {
+ unlink("r/$tname.reject");
+ }
+ else
+ {
+ unlink("suite/$opt_suite/r/$tname.reject");
+ }
+
+
+# MASV cleanup...
+ mtr_tonewfile($path_current_test_log,"$tname\n"); # Always tell where we are
+
+ # output current test to ndbcluster log file to enable diagnostics
+ mtr_tofile($file_ndb_testrun_log,"CURRENT TEST $tname\n");
mtr_tofile($master->[0]->{'path_myerr'},"CURRENT_TEST: $tname\n");
if ( $master->[1]->{'pid'} )
{
mtr_tofile($master->[1]->{'path_myerr'},"CURRENT_TEST: $tname\n");
}
+}
- # ----------------------------------------------------------------------
- # If any mysqld servers running died, we have to know
- # ----------------------------------------------------------------------
+sub do_after_run_mysqltest($)
+{
+ my $tinfo= shift;
+ my $tname= $tinfo->{'name'};
+
+ #MASV cleanup
+ # Save info from this testcase run to mysqltest.log
+ my $testcase_log= mtr_fromfile($path_timefile) if -f $path_timefile;
+ mtr_tofile($path_mysqltest_log,"CURRENT TEST $tname\n");
+ mtr_tofile($path_mysqltest_log, $testcase_log);
+ }
- mtr_record_dead_children();
- # ----------------------------------------------------------------------
- # Start masters needed by the testcase
- # ----------------------------------------------------------------------
- run_testcase_start_servers($tinfo);
+##############################################################################
+#
+# Run a single test case
+#
+##############################################################################
+
+# When we get here, we have already filtered out test cases that doesn't
+# apply to the current setup, for example if we use a running server, test
+# cases that restart the server are dropped. So this function should mostly
+# be about doing things, not a lot of logic.
+
+# We don't start and kill the servers for each testcase. But some
+# testcases needs a restart, because they specify options to start
+# mysqld with. After that testcase, we need to restart again, to set
+# back the normal options.
+
+sub run_testcase ($) {
+ my $tinfo= shift;
+
+ my $master_restart= run_testcase_need_master_restart($tinfo);
+ my $slave_restart= run_testcase_need_slave_restart($tinfo);
+
+ if ($master_restart or $slave_restart)
+ {
+ run_testcase_stop_servers($tinfo, $master_restart, $slave_restart);
+ }
+
+ my $died= mtr_record_dead_children();
+ if ($died or $master_restart or $slave_restart)
+ {
+ run_testcase_start_servers($tinfo);
+ }
# ----------------------------------------------------------------------
# If --start-and-exit or --start-dirty given, stop here to let user manually
# run tests
# ----------------------------------------------------------------------
-
if ( $opt_start_and_exit or $opt_start_dirty )
{
mtr_report("\nServers started, exiting");
exit(0);
}
- # ----------------------------------------------------------------------
- # Run the test case
- # ----------------------------------------------------------------------
-
- mtr_report_test_name($tinfo);
-
{
- # remove the old reject file
- if ( $opt_suite eq "main" )
- {
- unlink("r/$tname.reject");
- }
- else
- {
- unlink("suite/$opt_suite/r/$tname.reject");
- }
- unlink($path_timefile);
+ do_before_run_mysqltest($tinfo);
my $res= run_mysqltest($tinfo);
+ mtr_report_test_name($tinfo);
if ( $res == 0 )
{
mtr_report_test_passed($tinfo);
@@ -2383,7 +2628,8 @@ sub run_testcase ($) {
# Try to get reason from mysqltest.log
my $last_line= mtr_lastlinefromfile($path_timefile) if -f $path_timefile;
my $reason= mtr_match_prefix($last_line, "reason: ");
- $tinfo->{'comment'}= defined $reason ? $reason : "Detected by testcase(reason unknown) ";
+ $tinfo->{'comment'}=
+ defined $reason ? $reason : "Detected by testcase(reason unknown) ";
mtr_report_test_skipped($tinfo);
}
elsif ( $res == 63 )
@@ -2403,10 +2649,8 @@ sub run_testcase ($) {
report_failure_and_restart($tinfo);
}
- # Save info from this testcase run to mysqltest.log
- my $testcase_log= mtr_fromfile($path_timefile) if -f $path_timefile;
- mtr_tofile($path_mysqltest_log,"CURRENT TEST $tname\n");
- mtr_tofile($path_mysqltest_log, $testcase_log);
+
+ do_after_run_mysqltest($tinfo);
}
# ----------------------------------------------------------------------
@@ -2671,7 +2915,7 @@ sub mysqld_arguments ($$$$$) {
mtr_add_arg($args, "%s--datadir=%s", $prefix,
$master->[$idx]->{'path_myddir'});
- if ( $idx > 0 )
+ if ( $idx > 0 or !$use_innodb)
{
mtr_add_arg($args, "%s--skip-innodb", $prefix);
}
@@ -3020,24 +3264,9 @@ sub stop_all_servers () {
}
-# ----------------------------------------------------------------------
-# If not using a running servers we may need to stop and restart.
-# We restart in the case we have initiation scripts, server options
-# etc to run. But we also restart again after the test first restart
-# and test is run, to get back to normal server settings.
-#
-# To make the code a bit more clean, we actually only stop servers
-# here, and mark this to be done. Then a generic "start" part will
-# start up the needed servers again.
-# ----------------------------------------------------------------------
-
-sub run_testcase_stop_servers($) {
- my $tinfo= shift;
-
- if ( $glob_use_running_server || $glob_use_embedded_server )
- {
- return;
- }
+sub run_testcase_need_master_restart($)
+{
+ my ($tinfo)= @_;
# We try to find out if we are to restart the master(s)
my $do_restart= 0; # Assumes we don't have to
@@ -3094,6 +3323,91 @@ sub run_testcase_stop_servers($) {
join(" ", @{$master->[0]->{'start_opts'}}) . "'" );
}
+ return $do_restart;
+}
+
+sub run_testcase_need_slave_restart($)
+{
+ my ($tinfo)= @_;
+
+ # We try to find out if we are to restart the slaves
+ my $do_slave_restart= 0; # Assumes we don't have to
+
+ # FIXME only restart slave when necessary
+ $do_slave_restart= 1;
+
+# if ( ! $slave->[0]->{'pid'} )
+# {
+# # mtr_verbose("Slave not started, no need to check slave restart");
+# }
+# elsif ( $do_restart )
+# {
+# $do_slave_restart= 1; # Always restart if master restart
+# mtr_verbose("Restart slave because: Master restart");
+# }
+# elsif ( $tinfo->{'slave_sh'} )
+# {
+# $do_slave_restart= 1; # Always restart if script to run
+# mtr_verbose("Restart slave because: Always restart if script to run");
+# }
+# elsif ( ! $opt_skip_ndbcluster_slave and
+# $tinfo->{'ndb_test'} == 0 and
+# $clusters->[1]->{'pid'} != 0 )
+# {
+# $do_slave_restart= 1; # Restart without slave cluster
+# mtr_verbose("Restart slave because: Test does not need slave cluster");
+# }
+# elsif ( ! $opt_with_ndbcluster_slave and
+# $tinfo->{'ndb_test'} == 1 and
+# $clusters->[1]->{'pid'} == 0 )
+# {
+# $do_slave_restart= 1; # Restart with slave cluster
+# mtr_verbose("Restart slave because: Test need slave cluster");
+# }
+# elsif ( $tinfo->{'slave_restart'} )
+# {
+# $do_slave_restart= 1;
+# mtr_verbose("Restart slave because: slave_restart");
+# }
+# elsif ( $slave->[0]->{'running_slave_is_special'} )
+# {
+# $do_slave_restart= 1;
+# mtr_verbose("Restart slave because: running_slave_is_special");
+# }
+# # Check that running slave was started with same options
+# # as the current test requires
+# elsif (! mtr_same_opts($slave->[0]->{'start_opts'},
+# $tinfo->{'slave_opt'}) )
+# {
+# $do_slave_restart= 1;
+# mtr_verbose("Restart slave because: running with different options '" .
+# join(" ", @{$tinfo->{'slave_opt'}}) . "' != '" .
+# join(" ", @{$slave->[0]->{'start_opts'}}) . "'" );
+# }
+
+ return $do_slave_restart;
+
+}
+
+# ----------------------------------------------------------------------
+# If not using a running servers we may need to stop and restart.
+# We restart in the case we have initiation scripts, server options
+# etc to run. But we also restart again after the test first restart
+# and test is run, to get back to normal server settings.
+#
+# To make the code a bit more clean, we actually only stop servers
+# here, and mark this to be done. Then a generic "start" part will
+# start up the needed servers again.
+# ----------------------------------------------------------------------
+
+sub run_testcase_stop_servers($$$) {
+ my ($tinfo, $do_restart, $do_slave_restart)= @_;
+
+ if ( $glob_use_running_server || $glob_use_embedded_server )
+ {
+ return;
+ }
+
my $pid;
my %admin_pids; # hash of admin processes that requests shutdown
my @kill_pids; # list of processes to shutdown/kill
@@ -3151,62 +3465,7 @@ sub run_testcase_stop_servers($) {
}
}
- # We try to find out if we are to restart the slaves
- my $do_slave_restart= 0; # Assumes we don't have to
-
- # FIXME only restaret when necessary
- $do_slave_restart= 1;
-
-# if ( ! $slave->[0]->{'pid'} )
-# {
-# # mtr_verbose("Slave not started, no need to check slave restart");
-# }
-# elsif ( $do_restart )
-# {
-# $do_slave_restart= 1; # Always restart if master restart
-# mtr_verbose("Restart slave because: Master restart");
-# }
-# elsif ( $tinfo->{'slave_sh'} )
-# {
-# $do_slave_restart= 1; # Always restart if script to run
-# mtr_verbose("Restart slave because: Always restart if script to run");
-# }
-# elsif ( ! $opt_skip_ndbcluster_slave and
-# $tinfo->{'ndb_test'} == 0 and
-# $clusters->[1]->{'pid'} != 0 )
-# {
-# $do_slave_restart= 1; # Restart without slave cluster
-# mtr_verbose("Restart slave because: Test does not need slave cluster");
-# }
-# elsif ( ! $opt_with_ndbcluster_slave and
-# $tinfo->{'ndb_test'} == 1 and
-# $clusters->[1]->{'pid'} == 0 )
-# {
-# $do_slave_restart= 1; # Restart with slave cluster
-# mtr_verbose("Restart slave because: Test need slave cluster");
-# }
-# elsif ( $tinfo->{'slave_restart'} )
-# {
-# $do_slave_restart= 1;
-# mtr_verbose("Restart slave because: slave_restart");
-# }
-# elsif ( $slave->[0]->{'running_slave_is_special'} )
-# {
-# $do_slave_restart= 1;
-# mtr_verbose("Restart slave because: running_slave_is_special");
-# }
-# # Check that running slave was started with same options
-# # as the current test requires
-# elsif (! mtr_same_opts($slave->[0]->{'start_opts'},
-# $tinfo->{'slave_opt'}) )
-# {
-# $do_slave_restart= 1;
-# mtr_verbose("Restart slave because: running with different options '" .
-# join(" ", @{$tinfo->{'slave_opt'}}) . "' != '" .
-# join(" ", @{$slave->[0]->{'start_opts'}}) . "'" );
-# }
-
- if ( $do_slave_restart )
+ if ( $do_restart || $do_slave_restart )
{
delete $slave->[0]->{'running_slave_is_special'}; # Forget history
@@ -3460,139 +3719,9 @@ sub run_check_testcase ($$) {
}
-sub generate_cmdline_mysqldump ($) {
- my($info) = @_;
- return
- "$exe_mysqldump --no-defaults -uroot " .
- "--port=$info->[0]->{'port'} " .
- "--socket=$info->[0]->{'path_sock'} --password=";
-}
sub run_mysqltest ($) {
- my $tinfo= shift;
- my $cmdline_mysqlcheck= "$exe_mysqlcheck --no-defaults -uroot " .
- "--port=$master->[0]->{'port'} " .
- "--socket=$master->[0]->{'path_sock'} --password=";
- if ( $opt_debug )
- {
- $cmdline_mysqlcheck .=
- " --debug=d:t:A,$opt_vardir_trace/log/mysqlcheck.trace";
- }
-
- my $cmdline_mysqldump= generate_cmdline_mysqldump $master;
- my $cmdline_mysqldumpslave= generate_cmdline_mysqldump $slave;
-
- if ( $opt_debug )
- {
- $cmdline_mysqldump .=
- " --debug=d:t:A,$opt_vardir_trace/log/mysqldump-master.trace";
- $cmdline_mysqldumpslave .=
- " --debug=d:t:A,$opt_vardir_trace/log/mysqldump-slave.trace";
- }
-
- my $cmdline_mysqlslap;
-
- unless ( $glob_win32 )
- {
- $cmdline_mysqlslap= "$exe_mysqlslap -uroot " .
- "--port=$master->[0]->{'port'} " .
- "--socket=$master->[0]->{'path_sock'} --password= " .
- "--lock-directory=$opt_tmpdir";
- if ( $opt_debug )
- {
- $cmdline_mysqlslap .=
- " --debug=d:t:A,$opt_vardir_trace/log/mysqlslap.trace";
- }
- }
-
- my $cmdline_mysqlimport= "$exe_mysqlimport -uroot " .
- "--port=$master->[0]->{'port'} " .
- "--socket=$master->[0]->{'path_sock'} --password=";
- if ( $opt_debug )
- {
- $cmdline_mysqlimport .=
- " --debug=d:t:A,$opt_vardir_trace/log/mysqlimport.trace";
- }
-
- my $cmdline_mysqlshow= "$exe_mysqlshow -uroot " .
- "--port=$master->[0]->{'port'} " .
- "--socket=$master->[0]->{'path_sock'} --password=";
- if ( $opt_debug )
- {
- $cmdline_mysqlshow .=
- " --debug=d:t:A,$opt_vardir_trace/log/mysqlshow.trace";
- }
-
- my $cmdline_mysqlbinlog=
- "$exe_mysqlbinlog" .
- " --no-defaults --local-load=$opt_tmpdir" .
- " --character-sets-dir=$path_charsetsdir";
-
- if ( $opt_debug )
- {
- $cmdline_mysqlbinlog .=
- " --debug=d:t:A,$opt_vardir_trace/log/mysqlbinlog.trace";
- }
-
- my $cmdline_mysql=
- "$exe_mysql --no-defaults --host=localhost --user=root --password= " .
- "--port=$master->[0]->{'port'} " .
- "--socket=$master->[0]->{'path_sock'}";
-
- my $cmdline_mysql_client_test=
- "$exe_mysql_client_test --no-defaults --testcase --user=root --silent " .
- "--port=$master->[0]->{'port'} " .
- "--vardir=$opt_vardir " .
- "--socket=$master->[0]->{'path_sock'}";
-
- if ( $opt_debug )
- {
- $cmdline_mysql_client_test .=
- " --debug=d:t:A,$opt_vardir_trace/log/mysql_client_test.trace";
- }
-
- if ( $glob_use_embedded_server )
- {
- $cmdline_mysql_client_test.=
- " -A --language=$path_language" .
- " -A --datadir=$slave->[0]->{'path_myddir'}" .
- " -A --character-sets-dir=$path_charsetsdir";
- }
-
- my $cmdline_mysql_fix_system_tables=
- "$exe_mysql_fix_system_tables --no-defaults --host=localhost --user=root --password= " .
- "--basedir=$glob_basedir --bindir=$path_client_bindir --verbose " .
- "--port=$master->[0]->{'port'} " .
- "--socket=$master->[0]->{'path_sock'}";
-
- $ENV{'MYSQL'}= $cmdline_mysql;
- $ENV{'MYSQL_CHECK'}= $cmdline_mysqlcheck;
- $ENV{'MYSQL_DUMP'}= $cmdline_mysqldump;
- $ENV{'MYSQL_SLAP'}= $cmdline_mysqlslap unless $glob_win32;
- $ENV{'MYSQL_IMPORT'}= $cmdline_mysqlimport;
- $ENV{'MYSQL_DUMP_SLAVE'}= $cmdline_mysqldumpslave;
- $ENV{'MYSQL_SHOW'}= $cmdline_mysqlshow;
- $ENV{'MYSQL_BINLOG'}= $cmdline_mysqlbinlog;
- $ENV{'MYSQL_FIX_SYSTEM_TABLES'}= $cmdline_mysql_fix_system_tables;
- $ENV{'MYSQL_CLIENT_TEST'}= $cmdline_mysql_client_test;
- $ENV{'CHARSETSDIR'}= $path_charsetsdir;
- $ENV{'MYSQL_MY_PRINT_DEFAULTS'}= $exe_my_print_defaults;
- $ENV{'UDF_EXAMPLE_LIB'}=
- ($lib_udf_example ? basename($lib_udf_example) : "");
- $ENV{'MY_PERROR'}= $exe_perror;
-
- $ENV{'NDB_STATUS_OK'}= $clusters->[0]->{'installed_ok'};
- $ENV{'NDB_SLAVE_STATUS_OK'}= $clusters->[0]->{'installed_ok'};;
- $ENV{'NDB_EXTRA_TEST'}= $opt_ndb_extra_test;
- $ENV{'NDB_MGM'}= $exe_ndb_mgm;
- $ENV{'NDB_BACKUP_DIR'}= $clusters->[0]->{'data_dir'};
- $ENV{'NDB_DATA_DIR'}= $clusters->[0]->{'data_dir'};
- $ENV{'NDB_TOOLS_DIR'}= $path_ndb_tools_dir;
- $ENV{'NDB_EXAMPLES_DIR'}= $path_ndb_examples_dir;
- $ENV{'MY_NDB_EXAMPLES_BINARY'}= ($exe_ndb_example eq "$path_ndb_examples_dir/ndbapi_simple/ndbapi_simple")?$exe_ndb_example:"";
- $ENV{'NDB_TOOLS_OUTPUT'}= $file_ndb_testrun_log;
- $ENV{'NDB_EXAMPLES_OUTPUT'}= $file_ndb_testrun_log;
- $ENV{'NDB_CONNECTSTRING'}= $opt_ndbconnectstring;
+ my ($tinfo)= @_;
my $exe= $exe_mysqltest;
my $args;
@@ -3671,7 +3800,8 @@ sub run_mysqltest ($) {
if ( $opt_debug )
{
- mtr_add_arg($args, "--debug=d:t:A,%s/log/mysqltest.trace", $opt_vardir_trace);
+ mtr_add_arg($args, "--debug=d:t:A,%s/log/mysqltest.trace",
+ $opt_vardir_trace);
}
if ( $opt_ssl_supported )
@@ -3684,9 +3814,9 @@ sub run_mysqltest ($) {
$glob_mysql_test_dir);
}
- # Turn on SSL for all test cases
if ( $opt_ssl )
{
+ # Turn on SSL for _all_ test cases if option --ssl was used
mtr_add_arg($args, "--ssl",
$glob_mysql_test_dir);
}
@@ -3768,6 +3898,11 @@ sub run_mysqltest ($) {
}
}
+ # -------------------------------------------------------
+ # Init variables that change for each testcase
+ # -------------------------------------------------------
+ $ENV{'TZ'}= $tinfo->{'timezone'};
+
my $res = mtr_run_test($exe,$args,"","",$path_timefile,"");
if ( $opt_check_testcases )
diff --git a/mysql-test/r/auto_increment.result b/mysql-test/r/auto_increment.result
index 1f13264ee55..54c2df34a7f 100644
--- a/mysql-test/r/auto_increment.result
+++ b/mysql-test/r/auto_increment.result
@@ -446,52 +446,6 @@ INSERT INTO t1 VALUES(1, 1);
ALTER TABLE t1 CHANGE t1 t1 INT(10) auto_increment;
ERROR 23000: ALTER TABLE causes auto_increment resequencing, resulting in duplicate entry '1' for key 'PRIMARY'
DROP TABLE t1;
-CREATE TABLE `t2` (
-`k` int(11) NOT NULL auto_increment,
-`a` int(11) default NULL,
-`c` int(11) default NULL,
-PRIMARY KEY (`k`),
-UNIQUE KEY `idx_1` (`a`)
-) ENGINE=InnoDB;
-insert into t2 ( a ) values ( 6 ) on duplicate key update c =
-ifnull( c,
-0 ) + 1;
-insert into t2 ( a ) values ( 7 ) on duplicate key update c =
-ifnull( c,
-0 ) + 1;
-select last_insert_id();
-last_insert_id()
-2
-select * from t2;
-k a c
-1 6 NULL
-2 7 NULL
-insert into t2 ( a ) values ( 6 ) on duplicate key update c =
-ifnull( c,
-0 ) + 1;
-select last_insert_id();
-last_insert_id()
-1
-select * from t2;
-k a c
-1 6 1
-2 7 NULL
-insert ignore into t2 values (null,6,1),(10,8,1);
-select last_insert_id();
-last_insert_id()
-1
-insert ignore into t2 values (null,6,1),(null,8,1),(null,15,1),(null,20,1);
-select last_insert_id();
-last_insert_id()
-11
-select * from t2;
-k a c
-1 6 1
-2 7 NULL
-10 8 1
-11 15 1
-12 20 1
-drop table t2;
create table t1 (a int primary key auto_increment, b int, c int, d timestamp default current_timestamp, unique(b),unique(c));
insert into t1 values(null,1,1,now());
insert into t1 values(null,0,0,null);
diff --git a/mysql-test/r/ctype_recoding.result b/mysql-test/r/ctype_recoding.result
index 2042767c042..d0087b03c17 100644
--- a/mysql-test/r/ctype_recoding.result
+++ b/mysql-test/r/ctype_recoding.result
@@ -248,3 +248,14 @@ select rpad(c1,3,'ö'), rpad('ö',3,c1) from t1;
rpad(c1,3,'ö') rpad('ö',3,c1)
ßöö ößß
drop table t1;
+set names koi8r;
+create table t1(a char character set cp1251 default _koi8r 0xFF);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` char(1) CHARACTER SET cp1251 DEFAULT 'ÿ'
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1(a char character set latin1 default _cp1251 0xFF);
+ERROR 42000: Invalid default value for 'a'
+End of 4.1 tests
diff --git a/mysql-test/r/ctype_ucs.result b/mysql-test/r/ctype_ucs.result
index dc2bb4c6c73..0d8975c94c7 100644
--- a/mysql-test/r/ctype_ucs.result
+++ b/mysql-test/r/ctype_ucs.result
@@ -730,6 +730,45 @@ id MIN(s)
1 ZZZ
2 ZZZ
DROP TABLE t1;
+drop table if exists bug20536;
+set names latin1;
+create table bug20536 (id bigint not null auto_increment primary key, name
+varchar(255) character set ucs2 not null);
+insert into `bug20536` (`id`,`name`) values (1, _latin1 x'7465737431'), (2, "'test\\_2'");
+select md5(name) from bug20536;
+md5(name)
+f4b7ce8b45a20e3c4e84bef515d1525c
+48d95db0d8305c2fe11548a3635c9385
+select sha1(name) from bug20536;
+sha1(name)
+e0b52f38deddb9f9e8d5336b153592794cb49baf
+677d4d505355eb5b0549b865fcae4b7f0c28aef5
+select make_set(3, name, upper(name)) from bug20536;
+make_set(3, name, upper(name))
+test1,TEST1
+'test\_2','TEST\_2'
+select export_set(5, name, upper(name)) from bug20536;
+export_set(5, name, upper(name))
+test1,TEST1,test1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1
+'test\_2','TEST\_2','test\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2'
+select export_set(5, name, upper(name), ",", 5) from bug20536;
+export_set(5, name, upper(name), ",", 5)
+test1,TEST1,test1,TEST1,TEST1
+'test\_2','TEST\_2','test\_2','TEST\_2','TEST\_2'
+select password(name) from bug20536;
+password(name)
+????????????????????
+????????????????????
+select old_password(name) from bug20536;
+old_password(name)
+????????
+????????
+select quote(name) from bug20536;
+quote(name)
+????????
+????????????????
+drop table bug20536;
+End of 4.1 tests
CREATE TABLE t1 (a varchar(64) character set ucs2, b decimal(10,3));
INSERT INTO t1 VALUES ("1.1", 0), ("2.1", 0);
update t1 set b=a;
@@ -765,3 +804,4 @@ blob 65535 65535
text 65535 65535
text 65535 32767
drop table t1;
+End of 5.0 tests
diff --git a/mysql-test/r/ctype_utf8.result b/mysql-test/r/ctype_utf8.result
index c4c322ae2d0..2b9602215fb 100644
--- a/mysql-test/r/ctype_utf8.result
+++ b/mysql-test/r/ctype_utf8.result
@@ -924,6 +924,37 @@ NULL
select ifnull(NULL, _utf8'string');
ifnull(NULL, _utf8'string')
string
+set names utf8;
+create table t1 (s1 char(5) character set utf8 collate utf8_lithuanian_ci);
+insert into t1 values ('I'),('K'),('Y');
+select * from t1 where s1 < 'K' and s1 = 'Y';
+s1
+I
+Y
+select * from t1 where 'K' > s1 and s1 = 'Y';
+s1
+I
+Y
+drop table t1;
+create table t1 (s1 char(5) character set utf8 collate utf8_czech_ci);
+insert into t1 values ('c'),('d'),('h'),('ch'),('CH'),('cH'),('Ch'),('i');
+select * from t1 where s1 > 'd' and s1 = 'CH';
+s1
+ch
+CH
+Ch
+select * from t1 where 'd' < s1 and s1 = 'CH';
+s1
+ch
+CH
+Ch
+select * from t1 where s1 = 'cH' and s1 <> 'ch';
+s1
+cH
+select * from t1 where 'cH' = s1 and s1 <> 'ch';
+s1
+cH
+drop table t1;
create table t1 (a varchar(255)) default character set utf8;
insert into t1 values (1.0);
drop table t1;
diff --git a/mysql-test/r/func_misc.result b/mysql-test/r/func_misc.result
index 10d20c001f1..f383a717a85 100644
--- a/mysql-test/r/func_misc.result
+++ b/mysql-test/r/func_misc.result
@@ -87,6 +87,10 @@ SELECT IS_USED_LOCK('bug16501');
IS_USED_LOCK('bug16501')
NULL
DROP TABLE t1;
+select export_set(3, _latin1'foo', _utf8'bar', ',', 4);
+export_set(3, _latin1'foo', _utf8'bar', ',', 4)
+foo,foo,bar,bar
+End of 4.1 tests
create table t1 as select uuid(), length(uuid());
show create table t1;
Table Create Table
@@ -130,3 +134,4 @@ timediff(b, a) >= '00:00:03'
drop table t2;
drop table t1;
set global query_cache_size=default;
+End of 5.0 tests
diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result
index ad806b7ea64..cfb675652f2 100644
--- a/mysql-test/r/func_time.result
+++ b/mysql-test/r/func_time.result
@@ -911,6 +911,18 @@ union
(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 HOUR)),'%k') As H);
H
5
+SET NAMES latin1;
+SET character_set_results = NULL;
+SHOW VARIABLES LIKE 'character_set_results';
+Variable_name Value
+character_set_results
+CREATE TABLE testBug8868 (field1 DATE, field2 VARCHAR(32) CHARACTER SET BINARY);
+INSERT INTO testBug8868 VALUES ('2006-09-04', 'abcd');
+SELECT DATE_FORMAT(field1,'%b-%e %l:%i%p') as fmtddate, field2 FROM testBug8868;
+fmtddate field2
+Sep-4 12:00AM abcd
+DROP TABLE testBug8868;
+SET NAMES DEFAULT;
End of 4.1 tests
explain extended select timestampdiff(SQL_TSI_WEEK, '2001-02-01', '2001-05-01') as a1,
timestampdiff(SQL_TSI_FRAC_SECOND, '2001-02-01 12:59:59.120000', '2001-05-01 12:58:58.119999') as a2;
diff --git a/mysql-test/r/heap_btree.result b/mysql-test/r/heap_btree.result
index 32c8028679f..fd789a39d88 100644
--- a/mysql-test/r/heap_btree.result
+++ b/mysql-test/r/heap_btree.result
@@ -294,3 +294,4 @@ DROP TABLE t1;
CREATE TABLE t1 (a INT, UNIQUE USING BTREE(a)) ENGINE=MEMORY;
INSERT INTO t1 VALUES(NULL),(NULL);
DROP TABLE t1;
+End of 5.0 tests
diff --git a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result
index 3034fc2035e..e26e6fb271a 100644
--- a/mysql-test/r/innodb.result
+++ b/mysql-test/r/innodb.result
@@ -1295,24 +1295,16 @@ insert into t2 (a) select b from t1;
insert into t1 (a) select b from t2;
insert into t2 (a) select b from t1;
insert into t1 (a) select b from t2;
-insert into t2 (a) select b from t1;
-insert into t1 (a) select b from t2;
-insert into t2 (a) select b from t1;
-insert into t1 (a) select b from t2;
-insert into t2 (a) select b from t1;
-insert into t1 (a) select b from t2;
-insert into t2 (a) select b from t1;
-insert into t1 (a) select b from t2;
select count(*) from t1;
count(*)
-29267
+623
explain select * from t1 where c between 1 and 2500;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 5 NULL # Using where
update t1 set c=a;
explain select * from t1 where c between 1 and 2500;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 5 NULL # Using where
+1 SIMPLE t1 ALL c NULL NULL NULL # Using where
drop table t1,t2;
create table t1 (id int primary key auto_increment, fk int, index index_fk (fk)) engine=innodb;
insert into t1 (id) values (null),(null),(null),(null),(null);
@@ -1786,10 +1778,10 @@ Variable_name Value
Innodb_rows_deleted 2070
show status like "Innodb_rows_inserted";
Variable_name Value
-Innodb_rows_inserted 31727
+Innodb_rows_inserted 3083
show status like "Innodb_rows_updated";
Variable_name Value
-Innodb_rows_updated 29530
+Innodb_rows_updated 886
show status like "Innodb_row_lock_waits";
Variable_name Value
Innodb_row_lock_waits 0
diff --git a/mysql-test/r/innodb_mysql.result b/mysql-test/r/innodb_mysql.result
index b1336b35f1e..98e03239567 100644
--- a/mysql-test/r/innodb_mysql.result
+++ b/mysql-test/r/innodb_mysql.result
@@ -407,3 +407,71 @@ Warnings:
Warning 1071 Specified key was too long; max key length is 765 bytes
insert into t1 values('aaa');
drop table t1;
+CREATE TABLE `t2` (
+`k` int(11) NOT NULL auto_increment,
+`a` int(11) default NULL,
+`c` int(11) default NULL,
+PRIMARY KEY (`k`),
+UNIQUE KEY `idx_1` (`a`)
+) ENGINE=InnoDB;
+insert into t2 ( a ) values ( 6 ) on duplicate key update c =
+ifnull( c,
+0 ) + 1;
+insert into t2 ( a ) values ( 7 ) on duplicate key update c =
+ifnull( c,
+0 ) + 1;
+select last_insert_id();
+last_insert_id()
+2
+select * from t2;
+k a c
+1 6 NULL
+2 7 NULL
+insert into t2 ( a ) values ( 6 ) on duplicate key update c =
+ifnull( c,
+0 ) + 1;
+select last_insert_id();
+last_insert_id()
+2
+select last_insert_id(0);
+last_insert_id(0)
+0
+insert into t2 ( a ) values ( 6 ) on duplicate key update c =
+ifnull( c,
+0 ) + 1;
+select last_insert_id();
+last_insert_id()
+0
+select * from t2;
+k a c
+1 6 2
+2 7 NULL
+insert ignore into t2 values (null,6,1),(10,8,1);
+select last_insert_id();
+last_insert_id()
+0
+insert ignore into t2 values (null,6,1),(null,8,1),(null,15,1),(null,20,1);
+select last_insert_id();
+last_insert_id()
+11
+select * from t2;
+k a c
+1 6 2
+2 7 NULL
+10 8 1
+11 15 1
+12 20 1
+insert into t2 ( a ) values ( 6 ) on duplicate key update c =
+ifnull( c,
+0 ) + 1, k=last_insert_id(k);
+select last_insert_id();
+last_insert_id()
+1
+select * from t2;
+k a c
+1 6 3
+2 7 NULL
+10 8 1
+11 15 1
+12 20 1
+drop table t2;
diff --git a/mysql-test/r/mysql.result b/mysql-test/r/mysql.result
index ba4e9daf7cb..99633f5e12a 100644
--- a/mysql-test/r/mysql.result
+++ b/mysql-test/r/mysql.result
@@ -59,16 +59,16 @@ database()
test
unlock tables;
drop table t1;
-ソ
-ソ
+ƒ\
+ƒ\
c_cp932
+ƒ\
+ƒ\
+ƒ\
ソ
ソ
-ソ
-ソ
-ソ
-ソ
-ソ
+ƒ\
+ƒ\
+----------------------+------------+--------+
| concat('>',col1,'<') | col2 | col3 |
+----------------------+------------+--------+
diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result
index 3b4f223afbf..1e1456bd81a 100644
--- a/mysql-test/r/mysqldump.result
+++ b/mysql-test/r/mysqldump.result
@@ -1404,92 +1404,6 @@ UNLOCK TABLES;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
DROP TABLE t1;
-create database db1;
-use db1;
-CREATE TABLE t2 (
-a varchar(30) default NULL,
-KEY a (a(5))
-);
-INSERT INTO t2 VALUES ('alfred');
-INSERT INTO t2 VALUES ('angie');
-INSERT INTO t2 VALUES ('bingo');
-INSERT INTO t2 VALUES ('waffle');
-INSERT INTO t2 VALUES ('lemon');
-create view v2 as select * from t2 where a like 'a%' with check option;
-
-/*!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 */;
-/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
-/*!40103 SET TIME_ZONE='+00:00' */;
-/*!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 `t2`;
-CREATE TABLE `t2` (
- `a` varchar(30) DEFAULT NULL,
- KEY `a` (`a`(5))
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-
-LOCK TABLES `t2` WRITE;
-/*!40000 ALTER TABLE `t2` DISABLE KEYS */;
-INSERT INTO `t2` VALUES ('alfred'),('angie'),('bingo'),('waffle'),('lemon');
-/*!40000 ALTER TABLE `t2` ENABLE KEYS */;
-UNLOCK TABLES;
-DROP TABLE IF EXISTS `v2`;
-/*!50001 DROP VIEW IF EXISTS `v2`*/;
-/*!50001 CREATE TABLE `v2` (
- `a` varchar(30)
-) */;
-/*!50001 DROP TABLE IF EXISTS `v2`*/;
-/*!50001 DROP VIEW IF EXISTS `v2`*/;
-/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
-/*!50001 VIEW `v2` AS select `t2`.`a` AS `a` from `t2` where (`t2`.`a` like _latin1'a%') */
-/*!50002 WITH CASCADED CHECK OPTION */;
-/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
-
-/*!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 t2;
-drop view v2;
-drop database db1;
-create database db2;
-use db2;
-create table t1 (a int);
-create table t2 (a int, b varchar(10), primary key(a));
-insert into t2 values (1, "on"), (2, "off"), (10, "pol"), (12, "meg");
-insert into t1 values (289), (298), (234), (456), (789);
-create view v1 as select * from t2;
-create view v2 as select * from t1;
-drop table t1, t2;
-drop view v1, v2;
-drop database db2;
-create database db1;
-use db1;
-show tables;
-Tables_in_db1
-t1
-t2
-v1
-v2
-select * from t2 order by a;
-a b
-1 on
-2 off
-10 pol
-12 meg
-drop table t1, t2;
-drop database db1;
---fields-optionally-enclosed-by="
CREATE DATABASE mysqldump_test_db;
USE mysqldump_test_db;
CREATE TABLE t1 ( a INT );
@@ -1682,6 +1596,7 @@ select * from t1;
a b
Osnabrück Köln
drop table t1;
+--fields-optionally-enclosed-by="
create table `t1` (
t1_name varchar(255) default null,
t1_id int(10) unsigned not null auto_increment,
@@ -1756,8 +1671,9 @@ CREATE TABLE `t2` (
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
drop table t1, t2, t3;
-create table t1 (a binary(1), b blob);
-insert into t1 values ('','');
+create table t1 (a int);
+mysqldump: Couldn't execute 'SELECT /*!40001 SQL_NO_CACHE */ * FROM `t1` WHERE xx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx': 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 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' at line 1 (1064)
+mysqldump: Got error: 1064: 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 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' at line 1 when retrieving data from server
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
@@ -1771,15 +1687,9 @@ insert into t1 values ('','');
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
- `a` binary(1) DEFAULT NULL,
- `b` blob
+ `a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-LOCK TABLES `t1` WRITE;
-/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
-INSERT INTO `t1` VALUES (0x00,'');
-/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
-UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
@@ -1790,6 +1700,20 @@ UNLOCK TABLES;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
+drop table t1;
+End of 4.1 tests
+create database db1;
+use db1;
+CREATE TABLE t2 (
+a varchar(30) default NULL,
+KEY a (a(5))
+);
+INSERT INTO t2 VALUES ('alfred');
+INSERT INTO t2 VALUES ('angie');
+INSERT INTO t2 VALUES ('bingo');
+INSERT INTO t2 VALUES ('waffle');
+INSERT INTO t2 VALUES ('lemon');
+create view v2 as select * from t2 where a like 'a%' with check option;
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
@@ -1801,17 +1725,28 @@ UNLOCK TABLES;
/*!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` binary(1) DEFAULT NULL,
- `b` blob
+DROP TABLE IF EXISTS `t2`;
+CREATE TABLE `t2` (
+ `a` varchar(30) DEFAULT NULL,
+ KEY `a` (`a`(5))
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-LOCK TABLES `t1` WRITE;
-/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
-INSERT INTO `t1` VALUES (0x00,'');
-/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
+LOCK TABLES `t2` WRITE;
+/*!40000 ALTER TABLE `t2` DISABLE KEYS */;
+INSERT INTO `t2` VALUES ('alfred'),('angie'),('bingo'),('waffle'),('lemon');
+/*!40000 ALTER TABLE `t2` ENABLE KEYS */;
UNLOCK TABLES;
+DROP TABLE IF EXISTS `v2`;
+/*!50001 DROP VIEW IF EXISTS `v2`*/;
+/*!50001 CREATE TABLE `v2` (
+ `a` varchar(30)
+) */;
+/*!50001 DROP TABLE IF EXISTS `v2`*/;
+/*!50001 DROP VIEW IF EXISTS `v2`*/;
+/*!50001 CREATE ALGORITHM=UNDEFINED */
+/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50001 VIEW `v2` AS select `t2`.`a` AS `a` from `t2` where (`t2`.`a` like _latin1'a%') */
+/*!50002 WITH CASCADED CHECK OPTION */;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
@@ -1822,7 +1757,39 @@ UNLOCK TABLES;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-drop table t1;
+drop table t2;
+drop view v2;
+drop database db1;
+use test;
+create database db2;
+use db2;
+create table t1 (a int);
+create table t2 (a int, b varchar(10), primary key(a));
+insert into t2 values (1, "on"), (2, "off"), (10, "pol"), (12, "meg");
+insert into t1 values (289), (298), (234), (456), (789);
+create view v1 as select * from t2;
+create view v2 as select * from t1;
+drop table t1, t2;
+drop view v1, v2;
+drop database db2;
+use test;
+create database db1;
+use db1;
+show tables;
+Tables_in_db1
+t1
+t2
+v1
+v2
+select * from t2 order by a;
+a b
+1 on
+2 off
+10 pol
+12 meg
+drop table t1, t2;
+drop database db1;
+use test;
create table t1(a int);
create view v1 as select * from t1;
@@ -2605,11 +2572,15 @@ drop view v2;
drop view v0;
drop view v1;
drop table t1;
-drop table if exists t1;
-CREATE TABLE t1(a int, b int);
-INSERT INTO t1 VALUES (1,1);
-INSERT INTO t1 VALUES (2,3);
-INSERT INTO t1 VALUES (3,4), (4,5);
+SET @old_sql_mode = @@SQL_MODE;
+SET SQL_MODE = IGNORE_SPACE;
+CREATE TABLE t1 (a INT);
+CREATE TRIGGER tr1 BEFORE INSERT ON t1
+FOR EACH ROW
+BEGIN
+SET new.a = 0;
+END|
+SET SQL_MODE = @old_sql_mode;
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
@@ -2621,17 +2592,29 @@ INSERT INTO t1 VALUES (3,4), (4,5);
/*!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` (
- `a` int(11) DEFAULT NULL,
- `b` int(11) DEFAULT NULL
+ `a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
-REPLACE INTO `t1` VALUES (1,1),(2,3),(3,4),(4,5);
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
UNLOCK TABLES;
+
+/*!50003 SET @OLD_SQL_MODE=@@SQL_MODE*/;
+DELIMITER ;;
+/*!50003 SET SESSION SQL_MODE="IGNORE_SPACE" */;;
+/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `tr1` BEFORE INSERT ON `t1` FOR EACH ROW BEGIN
+SET new.a = 0;
+END */;;
+
+DELIMITER ;
+/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE */;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
@@ -2642,16 +2625,10 @@ UNLOCK TABLES;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
+DROP TRIGGER tr1;
DROP TABLE t1;
-SET @old_sql_mode = @@SQL_MODE;
-SET SQL_MODE = IGNORE_SPACE;
-CREATE TABLE t1 (a INT);
-CREATE TRIGGER tr1 BEFORE INSERT ON t1
-FOR EACH ROW
-BEGIN
-SET new.a = 0;
-END|
-SET SQL_MODE = @old_sql_mode;
+create table t1 (a binary(1), b blob);
+insert into t1 values ('','');
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
@@ -2663,29 +2640,49 @@ SET SQL_MODE = @old_sql_mode;
/*!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` (
- `a` int(11) DEFAULT NULL
+ `a` binary(1) DEFAULT NULL,
+ `b` blob
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
+INSERT INTO `t1` VALUES (0x00,'');
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
UNLOCK TABLES;
+/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
-/*!50003 SET @OLD_SQL_MODE=@@SQL_MODE*/;
-DELIMITER ;;
-/*!50003 SET SESSION SQL_MODE="IGNORE_SPACE" */;;
-/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `tr1` BEFORE INSERT ON `t1` FOR EACH ROW BEGIN
-SET new.a = 0;
-END */;;
+/*!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 */;
-DELIMITER ;
-/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE */;
+
+/*!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 */;
+/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
+/*!40103 SET TIME_ZONE='+00:00' */;
+/*!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` binary(1) DEFAULT NULL,
+ `b` blob
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+
+LOCK TABLES `t1` WRITE;
+/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
+INSERT INTO `t1` VALUES (0x00,'');
+/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
+UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
@@ -2696,9 +2693,7 @@ DELIMITER ;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-DROP TRIGGER tr1;
-DROP TABLE t1;
-End of 4.1 tests
+drop table t1;
create table t1 (a int);
insert into t1 values (289), (298), (234), (456), (789);
create definer = CURRENT_USER view v1 as select * from t1;
@@ -2925,7 +2920,60 @@ mysqldump: Couldn't execute 'SHOW MASTER STATUS': Access denied; you need the SU
grant REPLICATION CLIENT on *.* to mysqltest_1@localhost;
drop table t1;
drop user mysqltest_1@localhost;
+create database mysqldump_myDB;
+use mysqldump_myDB;
+create user myDB_User;
+grant create view, select on mysqldump_myDB.* to myDB_User@localhost;
+create table t1 (c1 int);
+insert into t1 values (3);
+use mysqldump_myDB;
+create view v1 (c1) as select * from t1;
+use mysqldump_myDB;
+drop view v1;
+drop table t1;
+revoke all privileges on mysqldump_myDB.* from myDB_User@localhost;
+drop user myDB_User;
+drop database mysqldump_myDB;
+use test;
End of 5.0 tests
+drop table if exists t1;
+CREATE TABLE t1(a int, b int);
+INSERT INTO t1 VALUES (1,1);
+INSERT INTO t1 VALUES (2,3);
+INSERT INTO t1 VALUES (3,4), (4,5);
+
+/*!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 */;
+/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
+/*!40103 SET TIME_ZONE='+00:00' */;
+/*!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
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+
+LOCK TABLES `t1` WRITE;
+/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
+REPLACE INTO `t1` VALUES (1,1),(2,3),(3,4),(4,5);
+/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
+UNLOCK TABLES;
+/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
+
+/*!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;
create table t1 (a text , b text);
create table t2 (a text , b text);
insert t1 values ("Duck, Duck", "goose");
diff --git a/mysql-test/r/ndb_dd_advance.result b/mysql-test/r/ndb_dd_advance.result
index 09fe75805d5..64c30aab9ab 100644
--- a/mysql-test/r/ndb_dd_advance.result
+++ b/mysql-test/r/ndb_dd_advance.result
@@ -226,7 +226,7 @@ t1 CREATE TABLE `t1` (
`b` int(11) NOT NULL,
`c` int(11) NOT NULL,
PRIMARY KEY (`pk1`)
-) TABLESPACE table_space1 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1
+) /*!50100 TABLESPACE table_space1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
ALTER TABLE test.t2 TABLESPACE table_space1 STORAGE DISK
ENGINE=NDB;
SHOW CREATE TABLE test.t2;
@@ -236,7 +236,7 @@ t2 CREATE TABLE `t2` (
`b2` int(11) NOT NULL,
`c2` int(11) NOT NULL,
PRIMARY KEY (`pk2`)
-) TABLESPACE table_space1 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1
+) /*!50100 TABLESPACE table_space1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
ALTER TABLE test.t1 ENGINE=NDBCLUSTER;
SHOW CREATE TABLE test.t1;
Table Create Table
@@ -331,7 +331,7 @@ t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL,
`b` int(11) DEFAULT NULL,
PRIMARY KEY (`a`)
-) TABLESPACE ts1 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1
+) /*!50100 TABLESPACE ts1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
@@ -931,7 +931,7 @@ t1 CREATE TABLE `t1` (
`a1` int(11) DEFAULT NULL,
`a2` blob,
`a3` text
-) TABLESPACE ts STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1
+) /*!50100 TABLESPACE ts STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
DROP TABLE test.t1;
CREATE TABLE test.t1 (a1 INT, a2 BLOB, a3 TEXT) ENGINE=MyISAM;
SHOW CREATE TABLE test.t1;
@@ -950,7 +950,7 @@ t1 CREATE TABLE `t1` (
`a1` int(11) DEFAULT NULL,
`a2` blob,
`a3` text
-) TABLESPACE ts STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1
+) /*!50100 TABLESPACE ts STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
DROP TABLE test.t1;
CREATE TABLE test.t1 (a1 INT PRIMARY KEY, a2 BLOB, a3 TEXT) TABLESPACE ts STORAGE DISK ENGINE=NDB;
SHOW CREATE TABLE test.t1;
@@ -960,7 +960,7 @@ t1 CREATE TABLE `t1` (
`a2` blob,
`a3` text,
PRIMARY KEY (`a1`)
-) TABLESPACE ts STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1
+) /*!50100 TABLESPACE ts STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
ALTER TABLE test.t1 ENGINE=InnoDB;
SHOW CREATE TABLE test.t1;
Table Create Table
@@ -980,7 +980,7 @@ t1 CREATE TABLE `t1` (
`a1` int(11) DEFAULT NULL,
`a2` blob,
`a3` text
-) TABLESPACE ts STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1
+) /*!50100 TABLESPACE ts STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
ALTER TABLE test.t1 ENGINE=MyISAM;
SHOW CREATE TABLE test.t1;
Table Create Table
diff --git a/mysql-test/r/ndb_dd_advance2.result b/mysql-test/r/ndb_dd_advance2.result
index c7fcda650e6..86dc8df3b15 100644
--- a/mysql-test/r/ndb_dd_advance2.result
+++ b/mysql-test/r/ndb_dd_advance2.result
@@ -30,7 +30,7 @@ t1 CREATE TABLE `t1` (
`a2` varchar(256) DEFAULT NULL,
`a3` blob,
PRIMARY KEY (`a1`)
-) TABLESPACE ts1 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1
+) /*!50100 TABLESPACE ts1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
SHOW CREATE TABLE test.t2;
Table Create Table
t2 CREATE TABLE `t2` (
@@ -38,7 +38,7 @@ t2 CREATE TABLE `t2` (
`a2` varchar(256) DEFAULT NULL,
`a3` blob,
PRIMARY KEY (`a1`)
-) TABLESPACE ts2 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1
+) /*!50100 TABLESPACE ts2 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
INSERT INTO test.t1 VALUES (1,'111111','aaaaaaaa');
INSERT INTO test.t1 VALUES (2,'222222','bbbbbbbb');
SELECT * FROM test.t1 ORDER BY a1;
@@ -93,7 +93,7 @@ t1 CREATE TABLE `t1` (
`a2` varchar(5000) DEFAULT NULL,
`a3` blob,
PRIMARY KEY (`a1`)
-) TABLESPACE ts1 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1
+) /*!50100 TABLESPACE ts1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
SHOW CREATE TABLE test.t2;
Table Create Table
t2 CREATE TABLE `t2` (
@@ -101,7 +101,7 @@ t2 CREATE TABLE `t2` (
`a2` varchar(5000) DEFAULT NULL,
`a3` blob,
PRIMARY KEY (`a1`)
-) TABLESPACE ts2 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1
+) /*!50100 TABLESPACE ts2 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
INSERT INTO test.t1 VALUES (1,@vc1,@d1);
INSERT INTO test.t1 VALUES (2,@vc2,@b1);
INSERT INTO test.t1 VALUES (3,@vc3,@d2);
diff --git a/mysql-test/r/ndb_dd_backuprestore.result b/mysql-test/r/ndb_dd_backuprestore.result
index 705881ee20a..3c0815cbec8 100644
--- a/mysql-test/r/ndb_dd_backuprestore.result
+++ b/mysql-test/r/ndb_dd_backuprestore.result
@@ -175,7 +175,7 @@ t1 CREATE TABLE `t1` (
`c3` int(11) NOT NULL,
`c4` bit(1) NOT NULL,
PRIMARY KEY (`pk1`,`c3`)
-) TABLESPACE table_space1 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c3) PARTITIONS 4 */
+) /*!50100 TABLESPACE table_space1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c3) PARTITIONS 4 */
SHOW CREATE TABLE test.t2;
Table Create Table
t2 CREATE TABLE `t2` (
@@ -184,7 +184,7 @@ t2 CREATE TABLE `t2` (
`c3` int(11) NOT NULL,
`c4` bit(1) NOT NULL,
PRIMARY KEY (`pk1`,`c3`)
-) TABLESPACE table_space2 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (c3) (PARTITION p0 ENGINE = ndbcluster, PARTITION p1 ENGINE = ndbcluster) */
+) /*!50100 TABLESPACE table_space2 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (c3) (PARTITION p0 ENGINE = ndbcluster, PARTITION p1 ENGINE = ndbcluster) */
SHOW CREATE TABLE test.t3;
Table Create Table
t3 CREATE TABLE `t3` (
@@ -193,7 +193,7 @@ t3 CREATE TABLE `t3` (
`c3` int(11) NOT NULL,
`c4` bit(1) NOT NULL,
PRIMARY KEY (`pk1`,`c3`)
-) TABLESPACE table_space2 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (c3) (PARTITION x1 VALUES LESS THAN (105) ENGINE = ndbcluster, PARTITION x2 VALUES LESS THAN (333) ENGINE = ndbcluster, PARTITION x3 VALUES LESS THAN (720) ENGINE = ndbcluster) */
+) /*!50100 TABLESPACE table_space2 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (c3) (PARTITION x1 VALUES LESS THAN (105) ENGINE = ndbcluster, PARTITION x2 VALUES LESS THAN (333) ENGINE = ndbcluster, PARTITION x3 VALUES LESS THAN (720) ENGINE = ndbcluster) */
SHOW CREATE TABLE test.t4;
Table Create Table
t4 CREATE TABLE `t4` (
@@ -341,7 +341,7 @@ t1 CREATE TABLE `t1` (
`c3` int(11) NOT NULL,
`c4` bit(1) NOT NULL,
PRIMARY KEY (`pk1`,`c3`)
-) TABLESPACE table_space1 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c3) PARTITIONS 4 */
+) /*!50100 TABLESPACE table_space1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c3) PARTITIONS 4 */
SHOW CREATE TABLE test.t2;
Table Create Table
t2 CREATE TABLE `t2` (
@@ -350,7 +350,7 @@ t2 CREATE TABLE `t2` (
`c3` int(11) NOT NULL,
`c4` bit(1) NOT NULL,
PRIMARY KEY (`pk1`,`c3`)
-) TABLESPACE table_space2 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (c3) (PARTITION p0 ENGINE = ndbcluster, PARTITION p1 ENGINE = ndbcluster) */
+) /*!50100 TABLESPACE table_space2 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (c3) (PARTITION p0 ENGINE = ndbcluster, PARTITION p1 ENGINE = ndbcluster) */
SHOW CREATE TABLE test.t3;
Table Create Table
t3 CREATE TABLE `t3` (
@@ -359,7 +359,7 @@ t3 CREATE TABLE `t3` (
`c3` int(11) NOT NULL,
`c4` bit(1) NOT NULL,
PRIMARY KEY (`pk1`,`c3`)
-) TABLESPACE table_space2 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (c3) (PARTITION x1 VALUES LESS THAN (105) ENGINE = ndbcluster, PARTITION x2 VALUES LESS THAN (333) ENGINE = ndbcluster, PARTITION x3 VALUES LESS THAN (720) ENGINE = ndbcluster) */
+) /*!50100 TABLESPACE table_space2 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (c3) (PARTITION x1 VALUES LESS THAN (105) ENGINE = ndbcluster, PARTITION x2 VALUES LESS THAN (333) ENGINE = ndbcluster, PARTITION x3 VALUES LESS THAN (720) ENGINE = ndbcluster) */
SHOW CREATE TABLE test.t4;
Table Create Table
t4 CREATE TABLE `t4` (
diff --git a/mysql-test/r/ndb_dd_basic.result b/mysql-test/r/ndb_dd_basic.result
index 6c10fbe63b3..5a7e70e796d 100644
--- a/mysql-test/r/ndb_dd_basic.result
+++ b/mysql-test/r/ndb_dd_basic.result
@@ -49,7 +49,7 @@ t1 CREATE TABLE `t1` (
`b` int(11) NOT NULL,
`c` int(11) NOT NULL,
PRIMARY KEY (`pk1`)
-) TABLESPACE ts1 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1
+) /*!50100 TABLESPACE ts1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES (0, 0, 0);
SELECT * FROM t1;
pk1 b c
diff --git a/mysql-test/r/ndb_dd_disk2memory.result b/mysql-test/r/ndb_dd_disk2memory.result
index bd5bbda42f3..9084ddc3e16 100644
--- a/mysql-test/r/ndb_dd_disk2memory.result
+++ b/mysql-test/r/ndb_dd_disk2memory.result
@@ -226,7 +226,7 @@ t1 CREATE TABLE `t1` (
`b` int(11) NOT NULL,
`c` int(11) NOT NULL,
PRIMARY KEY (`pk1`)
-) TABLESPACE table_space1 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1
+) /*!50100 TABLESPACE table_space1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
ALTER TABLE test.t2 TABLESPACE table_space1 STORAGE DISK
ENGINE=NDB;
SHOW CREATE TABLE test.t2;
@@ -236,7 +236,7 @@ t2 CREATE TABLE `t2` (
`b2` int(11) NOT NULL,
`c2` int(11) NOT NULL,
PRIMARY KEY (`pk2`)
-) TABLESPACE table_space1 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1
+) /*!50100 TABLESPACE table_space1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
ALTER TABLE test.t1 ENGINE=NDBCLUSTER;
SHOW CREATE TABLE test.t1;
Table Create Table
diff --git a/mysql-test/r/partition.result b/mysql-test/r/partition.result
index 2e2af07bfdc..d8d433ef216 100644
--- a/mysql-test/r/partition.result
+++ b/mysql-test/r/partition.result
@@ -1134,12 +1134,12 @@ partition by range (a)
subpartition by hash (a)
(partition p0 VALUES LESS THAN (1) DATA DIRECTORY = 'hello/master-data/tmpdata' INDEX DIRECTORY = 'hello/master-data/tmpinx'
(SUBPARTITION subpart00, SUBPARTITION subpart01));
+hello/master-data/test/t1.frm
+hello/master-data/test/t1.par
hello/master-data/test/t1#P#p0#SP#subpart00.MYD
hello/master-data/test/t1#P#p0#SP#subpart00.MYI
hello/master-data/test/t1#P#p0#SP#subpart01.MYD
hello/master-data/test/t1#P#p0#SP#subpart01.MYI
-hello/master-data/test/t1.frm
-hello/master-data/test/t1.par
hello/master-data/tmpdata/t1#P#p0#SP#subpart00.MYD
hello/master-data/tmpdata/t1#P#p0#SP#subpart01.MYD
hello/master-data/tmpinx/t1#P#p0#SP#subpart00.MYI
@@ -1149,6 +1149,8 @@ ALTER TABLE t1 REORGANIZE PARTITION p0 INTO
(SUBPARTITION subpart10, SUBPARTITION subpart11),
partition p2 VALUES LESS THAN (2) DATA DIRECTORY = 'hello/master-data/tmpdata' INDEX DIRECTORY = 'hello/master-data/tmpinx'
(SUBPARTITION subpart20, SUBPARTITION subpart21));
+hello/master-data/test/t1.frm
+hello/master-data/test/t1.par
hello/master-data/test/t1#P#p1#SP#subpart10.MYD
hello/master-data/test/t1#P#p1#SP#subpart10.MYI
hello/master-data/test/t1#P#p1#SP#subpart11.MYD
@@ -1157,8 +1159,6 @@ hello/master-data/test/t1#P#p2#SP#subpart20.MYD
hello/master-data/test/t1#P#p2#SP#subpart20.MYI
hello/master-data/test/t1#P#p2#SP#subpart21.MYD
hello/master-data/test/t1#P#p2#SP#subpart21.MYI
-hello/master-data/test/t1.frm
-hello/master-data/test/t1.par
hello/master-data/tmpdata/t1#P#p1#SP#subpart10.MYD
hello/master-data/tmpdata/t1#P#p1#SP#subpart11.MYD
hello/master-data/tmpdata/t1#P#p2#SP#subpart20.MYD
diff --git a/mysql-test/r/show_check.result b/mysql-test/r/show_check.result
index 7759a6f1f7f..b473bbac923 100644
--- a/mysql-test/r/show_check.result
+++ b/mysql-test/r/show_check.result
@@ -695,4 +695,19 @@ Level Code Message
Warning 1541 The syntax 'SHOW PLUGIN' is deprecated and will be removed in MySQL 5.2. Please use 'SHOW PLUGINS' instead
show plugin;
show plugins;
+create database `mysqlttest\1`;
+create table `mysqlttest\1`.`a\b` (a int);
+show tables from `mysqlttest\1`;
+Tables_in_mysqlttest\1
+a\b
+show fields from `mysqlttest\1`.`a\b`;
+Field Type Null Key Default Extra
+a int(11) YES NULL
+show columns from `a\b` from `mysqlttest\1`;
+Field Type Null Key Default Extra
+a int(11) YES NULL
+show keys from `mysqlttest\1`.`a\b`;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+drop table `mysqlttest\1`.`a\b`;
+drop database `mysqlttest\1`;
End of 5.1 tests
diff --git a/mysql-test/r/variables.result b/mysql-test/r/variables.result
index 3b6bfc60a80..b55d8d9ef5a 100644
--- a/mysql-test/r/variables.result
+++ b/mysql-test/r/variables.result
@@ -689,6 +689,12 @@ select @@log_queries_not_using_indexes;
show variables like 'log_queries_not_using_indexes';
Variable_name Value
log_queries_not_using_indexes OFF
+select @@"";
+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 '""' at line 1
+select @@&;
+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 '&' at line 1
+select @@@;
+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 '@' at line 1
End of 5.0 tests
set global binlog_cache_size =@my_binlog_cache_size;
set global connect_timeout =@my_connect_timeout;
diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result
index 08f51494e20..7e14874a3e6 100644
--- a/mysql-test/r/view.result
+++ b/mysql-test/r/view.result
@@ -2849,6 +2849,36 @@ SHOW TABLES;
Tables_in_test
t1
DROP TABLE t1;
+DROP VIEW IF EXISTS v1;
+CREATE DATABASE bug21261DB;
+USE bug21261DB;
+CREATE TABLE t1 (x INT);
+CREATE SQL SECURITY INVOKER VIEW v1 AS SELECT x FROM t1;
+GRANT INSERT, UPDATE ON v1 TO 'user21261'@'localhost';
+GRANT INSERT, UPDATE ON t1 TO 'user21261'@'localhost';
+CREATE TABLE t2 (y INT);
+GRANT SELECT ON t2 TO 'user21261'@'localhost';
+INSERT INTO v1 (x) VALUES (5);
+UPDATE v1 SET x=1;
+GRANT SELECT ON v1 TO 'user21261'@'localhost';
+GRANT SELECT ON t1 TO 'user21261'@'localhost';
+UPDATE v1,t2 SET x=1 WHERE x=y;
+SELECT * FROM t1;
+x
+1
+REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'user21261'@'localhost';
+DROP USER 'user21261'@'localhost';
+DROP VIEW v1;
+DROP TABLE t1;
+DROP DATABASE bug21261DB;
+USE test;
+create table t1 (f1 datetime);
+create view v1 as select * from t1 where f1 between now() and now() + interval 1 minute;
+show create view v1;
+View Create View
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`f1` AS `f1` from `t1` where (`t1`.`f1` between now() and (now() + interval 1 minute))
+drop view v1;
+drop table t1;
DROP TABLE IF EXISTS t1;
DROP VIEW IF EXISTS v1;
DROP VIEW IF EXISTS v2;
@@ -2887,32 +2917,3 @@ DROP FUNCTION f2;
DROP VIEW v1, v2;
DROP TABLE t1;
End of 5.0 tests.
-CREATE DATABASE bug21261DB;
-USE bug21261DB;
-CREATE TABLE t1 (x INT);
-CREATE SQL SECURITY INVOKER VIEW v1 AS SELECT x FROM t1;
-GRANT INSERT, UPDATE ON v1 TO 'user21261'@'localhost';
-GRANT INSERT, UPDATE ON t1 TO 'user21261'@'localhost';
-CREATE TABLE t2 (y INT);
-GRANT SELECT ON t2 TO 'user21261'@'localhost';
-INSERT INTO v1 (x) VALUES (5);
-UPDATE v1 SET x=1;
-GRANT SELECT ON v1 TO 'user21261'@'localhost';
-GRANT SELECT ON t1 TO 'user21261'@'localhost';
-UPDATE v1,t2 SET x=1 WHERE x=y;
-SELECT * FROM t1;
-x
-1
-REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'user21261'@'localhost';
-DROP USER 'user21261'@'localhost';
-DROP VIEW v1;
-DROP TABLE t1;
-DROP DATABASE bug21261DB;
-USE test;
-create table t1 (f1 datetime);
-create view v1 as select * from t1 where f1 between now() and now() + interval 1 minute;
-show create view v1;
-View Create View
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`f1` AS `f1` from `t1` where (`t1`.`f1` between now() and (now() + interval 1 minute))
-drop view v1;
-drop table t1;
diff --git a/mysql-test/r/windows.result b/mysql-test/r/windows.result
index 039c5b1476e..e3241daf719 100644
--- a/mysql-test/r/windows.result
+++ b/mysql-test/r/windows.result
@@ -6,3 +6,31 @@ use prn;
ERROR 42000: Unknown database 'prn'
create table nu (a int);
drop table nu;
+CREATE TABLE `t1` (
+`TIM` datetime NOT NULL,
+`VAL` double default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+CREATE TABLE `t2` (
+`TIM` datetime NOT NULL,
+`VAL` double default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+CREATE TABLE `mt` (
+`TIM` datetime NOT NULL,
+`VAL` double default NULL
+) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=LAST
+UNION=(`t1`,`t2`);
+INSERT INTO mt VALUES ('2006-01-01',0);
+ALTER TABLE `t2` RENAME TO `t`;
+INSERT INTO mt VALUES ('2006-01-01',0);
+ERROR HY000: Can't lock file (errno: 155)
+select * from mt;
+ERROR HY000: Can't lock file (errno: 155)
+FLUSH TABLES;
+select * from mt;
+ERROR HY000: Can't find file: 'mt' (errno: 2)
+ALTER TABLE `t` RENAME TO `t2`;
+INSERT INTO mt VALUES ('2006-01-01',0);
+select * from mt;
+TIM VAL
+2006-01-01 00:00:00 0
+2006-01-01 00:00:00 0
diff --git a/mysql-test/t/auto_increment.test b/mysql-test/t/auto_increment.test
index 7cef1bad784..f869dc06187 100644
--- a/mysql-test/t/auto_increment.test
+++ b/mysql-test/t/auto_increment.test
@@ -304,42 +304,6 @@ INSERT INTO t1 VALUES(1, 1);
ALTER TABLE t1 CHANGE t1 t1 INT(10) auto_increment;
DROP TABLE t1;
-# Fix for BUG#19243 "wrong LAST_INSERT_ID() after ON DUPLICATE KEY
-# UPDATE": now LAST_INSERT_ID() will return the id of the updated
-# row.
-CREATE TABLE `t2` (
- `k` int(11) NOT NULL auto_increment,
- `a` int(11) default NULL,
- `c` int(11) default NULL,
- PRIMARY KEY (`k`),
- UNIQUE KEY `idx_1` (`a`)
-) ENGINE=InnoDB;
- insert into t2 ( a ) values ( 6 ) on duplicate key update c =
-ifnull( c,
-0 ) + 1;
-insert into t2 ( a ) values ( 7 ) on duplicate key update c =
-ifnull( c,
-0 ) + 1;
-select last_insert_id();
-select * from t2;
-insert into t2 ( a ) values ( 6 ) on duplicate key update c =
-ifnull( c,
-0 ) + 1;
-select last_insert_id();
-select * from t2;
-
-# Test of LAST_INSERT_ID() when autogenerated will fail:
-# last_insert_id() should not change
-insert ignore into t2 values (null,6,1),(10,8,1);
-select last_insert_id();
-# First and second autogenerated will fail, last_insert_id() should
-# point to third
-insert ignore into t2 values (null,6,1),(null,8,1),(null,15,1),(null,20,1);
-select last_insert_id();
-select * from t2;
-
-drop table t2;
-
# Test of REPLACE when it does INSERT+DELETE and not UPDATE:
# see if it sets LAST_INSERT_ID() ok
create table t1 (a int primary key auto_increment, b int, c int, d timestamp default current_timestamp, unique(b),unique(c));
diff --git a/mysql-test/t/crash_commit_before.test b/mysql-test/t/crash_commit_before.test
index 4a0453901bc..c46340d44dc 100644
--- a/mysql-test/t/crash_commit_before.test
+++ b/mysql-test/t/crash_commit_before.test
@@ -1,4 +1,5 @@
--source include/have_debug.inc
+--source include/have_innodb.inc
CREATE TABLE t1(a int) engine=innodb;
START TRANSACTION;
diff --git a/mysql-test/t/ctype_recoding.test b/mysql-test/t/ctype_recoding.test
index 2d6b55600b1..c18c46b6b08 100644
--- a/mysql-test/t/ctype_recoding.test
+++ b/mysql-test/t/ctype_recoding.test
@@ -187,4 +187,16 @@ select rpad(c1,3,'ö'), rpad('ö',3,c1) from t1;
#select case c1 when 'ß' then 'ß' when 'ö' then 'ö' else 'c' end from t1;
#select export_set(5,c1,'ö'), export_set(5,'ö',c1) from t1;
drop table t1;
-# End of 4.1 tests
+
+#
+# Bug 20695: problem with field default value's character set
+#
+
+set names koi8r;
+create table t1(a char character set cp1251 default _koi8r 0xFF);
+show create table t1;
+drop table t1;
+--error 1067
+create table t1(a char character set latin1 default _cp1251 0xFF);
+
+--echo End of 4.1 tests
diff --git a/mysql-test/t/ctype_ucs.test b/mysql-test/t/ctype_ucs.test
index eea0b06b224..8116d39e3db 100644
--- a/mysql-test/t/ctype_ucs.test
+++ b/mysql-test/t/ctype_ucs.test
@@ -465,7 +465,51 @@ INSERT INTO t1 VALUES (1, 'ZZZZZ'), (1, 'ZZZ'), (2, 'ZZZ'), (2, 'ZZZZZ');
SELECT id, MIN(s) FROM t1 GROUP BY id;
DROP TABLE t1;
-# End of 4.1 tests
+
+#
+# Bug #20536: md5() with GROUP BY and UCS2 return different results on myisam/innodb
+#
+
+--disable_warnings
+drop table if exists bug20536;
+--enable_warnings
+
+set names latin1;
+create table bug20536 (id bigint not null auto_increment primary key, name
+varchar(255) character set ucs2 not null);
+insert into `bug20536` (`id`,`name`) values (1, _latin1 x'7465737431'), (2, "'test\\_2'");
+select md5(name) from bug20536;
+select sha1(name) from bug20536;
+select make_set(3, name, upper(name)) from bug20536;
+select export_set(5, name, upper(name)) from bug20536;
+select export_set(5, name, upper(name), ",", 5) from bug20536;
+
+# Some broken functions: add these tests just to document current behavior.
+
+# PASSWORD and OLD_PASSWORD don't work with UCS2 strings, but to fix it would
+# not be backwards compatible in all cases, so it's best to leave it alone
+select password(name) from bug20536;
+select old_password(name) from bug20536;
+
+# Disable test case as encrypt relies on 'crypt' function.
+# "decrypt" is noramlly tested in func_crypt.test which have a
+# "have_crypt.inc" test
+--disable_parsing
+# ENCRYPT relies on OS function crypt() which takes a NUL-terminated string; it
+# doesn't return good results for strings with embedded 0 bytes. It won't be
+# fixed unless we choose to re-implement the crypt() function ourselves to take
+# an extra size_t string_length argument.
+select encrypt(name, 'SALT') from bug20536;
+--enable_parsing
+
+# QUOTE doesn't work with UCS2 data. It would require a total rewrite
+# of Item_func_quote::val_str(), which isn't worthwhile until UCS2 is
+# supported fully as a client character set.
+select quote(name) from bug20536;
+
+drop table bug20536;
+
+--echo End of 4.1 tests
#
# Conversion from an UCS2 string to a decimal column
@@ -497,3 +541,5 @@ create table t1(a blob, b text charset utf8, c text charset ucs2);
select data_type, character_octet_length, character_maximum_length
from information_schema.columns where table_name='t1';
drop table t1;
+
+--echo End of 5.0 tests
diff --git a/mysql-test/t/ctype_utf8.test b/mysql-test/t/ctype_utf8.test
index 6c4bc4fff1a..5e3a3f640b1 100644
--- a/mysql-test/t/ctype_utf8.test
+++ b/mysql-test/t/ctype_utf8.test
@@ -728,6 +728,24 @@ select repeat(_utf8'+',3) as h union select NULL;
select ifnull(NULL, _utf8'string');
#
+# Bug#9509 Optimizer: wrong result after AND with comparisons
+#
+set names utf8;
+create table t1 (s1 char(5) character set utf8 collate utf8_lithuanian_ci);
+insert into t1 values ('I'),('K'),('Y');
+select * from t1 where s1 < 'K' and s1 = 'Y';
+select * from t1 where 'K' > s1 and s1 = 'Y';
+drop table t1;
+
+create table t1 (s1 char(5) character set utf8 collate utf8_czech_ci);
+insert into t1 values ('c'),('d'),('h'),('ch'),('CH'),('cH'),('Ch'),('i');
+select * from t1 where s1 > 'd' and s1 = 'CH';
+select * from t1 where 'd' < s1 and s1 = 'CH';
+select * from t1 where s1 = 'cH' and s1 <> 'ch';
+select * from t1 where 'cH' = s1 and s1 <> 'ch';
+drop table t1;
+
+#
# Bug#10714: Inserting double value into utf8 column crashes server
#
create table t1 (a varchar(255)) default character set utf8;
diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def
index f37ceb10e37..6d58f1a22f9 100644
--- a/mysql-test/t/disabled.def
+++ b/mysql-test/t/disabled.def
@@ -31,7 +31,6 @@ rpl_ndb_innodb2ndb : Bug #19710 Cluster replication to partition table fa
#rpl_ndb_log : BUG#18947 2006-03-21 tomas CRBR: order in binlog of create table and insert (on different table) not determ
rpl_ndb_myisam2ndb : Bug #19710 Cluster replication to partition table fails on DELETE FROM statement
rpl_row_blob_innodb : BUG#18980 2006-04-10 kent Test fails randomly
-rpl_row_func003 : BUG#19074 2006-13-04 andrei test failed
rpl_sp : BUG#16456 2006-02-16 jmiller
rpl_sp_effects : BUG#19862 2006-06-15 mkindahl
diff --git a/mysql-test/t/func_misc.test b/mysql-test/t/func_misc.test
index 0475dd4bdb6..52a5512d070 100644
--- a/mysql-test/t/func_misc.test
+++ b/mysql-test/t/func_misc.test
@@ -78,7 +78,13 @@ connection default;
DROP TABLE t1;
-# End of 4.1 tests
+#
+# Bug #21531: EXPORT_SET() doesn't accept args with coercible character sets
+#
+select export_set(3, _latin1'foo', _utf8'bar', ',', 4);
+
+--echo End of 4.1 tests
+
#
# Test for BUG#9535
@@ -87,7 +93,9 @@ create table t1 as select uuid(), length(uuid());
show create table t1;
drop table t1;
+#
# Bug #6760: Add SLEEP() function
+#
create table t1 (a timestamp default '2005-05-05 01:01:01',
b timestamp default '2005-05-05 01:01:01');
insert into t1 set a = now();
@@ -117,4 +125,4 @@ drop table t2;
drop table t1;
set global query_cache_size=default;
-# End of 5.0 tests
+--echo End of 5.0 tests
diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test
index 7306d7cae12..7ca1b3e5433 100644
--- a/mysql-test/t/func_time.test
+++ b/mysql-test/t/func_time.test
@@ -464,6 +464,24 @@ union
union
(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 HOUR)),'%k') As H);
+#
+# 21913: DATE_FORMAT() Crashes mysql server if I use it through
+# mysql-connector-j driver.
+#
+
+SET NAMES latin1;
+SET character_set_results = NULL;
+SHOW VARIABLES LIKE 'character_set_results';
+
+CREATE TABLE testBug8868 (field1 DATE, field2 VARCHAR(32) CHARACTER SET BINARY);
+INSERT INTO testBug8868 VALUES ('2006-09-04', 'abcd');
+
+SELECT DATE_FORMAT(field1,'%b-%e %l:%i%p') as fmtddate, field2 FROM testBug8868;
+
+DROP TABLE testBug8868;
+
+SET NAMES DEFAULT;
+
--echo End of 4.1 tests
explain extended select timestampdiff(SQL_TSI_WEEK, '2001-02-01', '2001-05-01') as a1,
diff --git a/mysql-test/t/grant.test b/mysql-test/t/grant.test
index d3689a07237..d3781d58780 100644
--- a/mysql-test/t/grant.test
+++ b/mysql-test/t/grant.test
@@ -682,8 +682,6 @@ drop table t2;
drop table t1;
-
-
#
# Bug#20214: Incorrect error when user calls SHOW CREATE VIEW on non
# privileged view
diff --git a/mysql-test/t/heap_btree.test b/mysql-test/t/heap_btree.test
index e74e9723ca6..03ba8661a3c 100644
--- a/mysql-test/t/heap_btree.test
+++ b/mysql-test/t/heap_btree.test
@@ -204,3 +204,4 @@ CREATE TABLE t1 (a INT, UNIQUE USING BTREE(a)) ENGINE=MEMORY;
INSERT INTO t1 VALUES(NULL),(NULL);
DROP TABLE t1;
+--echo End of 5.0 tests
diff --git a/mysql-test/t/innodb.test b/mysql-test/t/innodb.test
index d00c5499ef9..1a2afad3b44 100644
--- a/mysql-test/t/innodb.test
+++ b/mysql-test/t/innodb.test
@@ -904,14 +904,6 @@ insert into t2 (a) select b from t1;
insert into t1 (a) select b from t2;
insert into t2 (a) select b from t1;
insert into t1 (a) select b from t2;
-insert into t2 (a) select b from t1;
-insert into t1 (a) select b from t2;
-insert into t2 (a) select b from t1;
-insert into t1 (a) select b from t2;
-insert into t2 (a) select b from t1;
-insert into t1 (a) select b from t2;
-insert into t2 (a) select b from t1;
-insert into t1 (a) select b from t2;
select count(*) from t1;
--replace_column 9 #
explain select * from t1 where c between 1 and 2500;
diff --git a/mysql-test/t/innodb_mysql.test b/mysql-test/t/innodb_mysql.test
index 58557507d9b..73c642cd334 100644
--- a/mysql-test/t/innodb_mysql.test
+++ b/mysql-test/t/innodb_mysql.test
@@ -367,3 +367,55 @@ create table t1(f1 varchar(800) binary not null, key(f1)) engine = innodb
character set utf8 collate utf8_general_ci;
insert into t1 values('aaa');
drop table t1;
+
+# Fix for BUG#19243 "wrong LAST_INSERT_ID() after ON DUPLICATE KEY
+# UPDATE": if the row is updated, it's like a regular UPDATE:
+# LAST_INSERT_ID() is not affected.
+CREATE TABLE `t2` (
+ `k` int(11) NOT NULL auto_increment,
+ `a` int(11) default NULL,
+ `c` int(11) default NULL,
+ PRIMARY KEY (`k`),
+ UNIQUE KEY `idx_1` (`a`)
+) ENGINE=InnoDB;
+ insert into t2 ( a ) values ( 6 ) on duplicate key update c =
+ifnull( c,
+0 ) + 1;
+insert into t2 ( a ) values ( 7 ) on duplicate key update c =
+ifnull( c,
+0 ) + 1;
+select last_insert_id();
+select * from t2;
+insert into t2 ( a ) values ( 6 ) on duplicate key update c =
+ifnull( c,
+0 ) + 1;
+select last_insert_id();
+# test again when last_insert_id() is 0 initially
+select last_insert_id(0);
+insert into t2 ( a ) values ( 6 ) on duplicate key update c =
+ifnull( c,
+0 ) + 1;
+select last_insert_id();
+select * from t2;
+
+# Test of LAST_INSERT_ID() when autogenerated will fail:
+# last_insert_id() should not change
+insert ignore into t2 values (null,6,1),(10,8,1);
+select last_insert_id();
+# First and second autogenerated will fail, last_insert_id() should
+# point to third
+insert ignore into t2 values (null,6,1),(null,8,1),(null,15,1),(null,20,1);
+select last_insert_id();
+select * from t2;
+
+# Test of the workaround which enables people to know the id of the
+# updated row in INSERT ON DUPLICATE KEY UPDATE, by using
+# LAST_INSERT_ID(autoinc_col) in the UPDATE clause.
+
+insert into t2 ( a ) values ( 6 ) on duplicate key update c =
+ifnull( c,
+0 ) + 1, k=last_insert_id(k);
+select last_insert_id();
+select * from t2;
+
+drop table t2;
diff --git a/mysql-test/t/mysql.test b/mysql-test/t/mysql.test
index 385c59d1503..cf4e6f4047c 100644
--- a/mysql-test/t/mysql.test
+++ b/mysql-test/t/mysql.test
@@ -52,8 +52,8 @@ drop table t1;
--exec $MYSQL --default-character-set=cp932 test -e "charset utf8;"
# its usage to switch internally in mysql to requested charset
---exec $MYSQL --default-character-set=utf8 test -e "charset cp932; set @@session.character_set_client= cp932; select 'ƒ\'; create table t1 (c_cp932 TEXT CHARACTER SET cp932); insert into t1 values('ƒ\'); select * from t1; drop table t1;"
---exec $MYSQL --default-character-set=utf8 test -e "charset cp932; set character_set_client= cp932; select 'ƒ\'"
+--exec $MYSQL --default-character-set=utf8 test -e "charset cp932; select 'ƒ\'; create table t1 (c_cp932 TEXT CHARACTER SET cp932); insert into t1 values('ƒ\'); select * from t1; drop table t1;"
+--exec $MYSQL --default-character-set=utf8 test -e "charset cp932; select 'ƒ\'"
--exec $MYSQL --default-character-set=utf8 test -e "/*charset cp932 */; set character_set_client= cp932; select 'ƒ\'"
--exec $MYSQL --default-character-set=utf8 test -e "/*!\C cp932 */; set character_set_client= cp932; select 'ƒ\'"
diff --git a/mysql-test/t/mysqldump.test b/mysql-test/t/mysqldump.test
index 1f31c84ba68..f66b07d66ba 100644
--- a/mysql-test/t/mysqldump.test
+++ b/mysql-test/t/mysqldump.test
@@ -548,71 +548,6 @@ INSERT INTO t1 VALUES (1),(2),(3);
--exec $MYSQL_DUMP --add-drop-database --skip-comments --databases test
DROP TABLE t1;
-
-#
-# Bug #10213 mysqldump crashes when dumping VIEWs(on MacOS X)
-#
-
-create database db1;
-use db1;
-
-CREATE TABLE t2 (
- a varchar(30) default NULL,
- KEY a (a(5))
-);
-
-INSERT INTO t2 VALUES ('alfred');
-INSERT INTO t2 VALUES ('angie');
-INSERT INTO t2 VALUES ('bingo');
-INSERT INTO t2 VALUES ('waffle');
-INSERT INTO t2 VALUES ('lemon');
-create view v2 as select * from t2 where a like 'a%' with check option;
---exec $MYSQL_DUMP --skip-comments db1
-drop table t2;
-drop view v2;
-drop database db1;
-
-#
-# Bug 10713 mysqldump includes database in create view and referenced tables
-#
-
-# create table and views in db2
-create database db2;
-use db2;
-create table t1 (a int);
-create table t2 (a int, b varchar(10), primary key(a));
-insert into t2 values (1, "on"), (2, "off"), (10, "pol"), (12, "meg");
-insert into t1 values (289), (298), (234), (456), (789);
-create view v1 as select * from t2;
-create view v2 as select * from t1;
-
-# dump tables and view from db2
---exec $MYSQL_DUMP db2 > $MYSQLTEST_VARDIR/tmp/bug10713.sql
-
-# drop the db, tables and views
-drop table t1, t2;
-drop view v1, v2;
-drop database db2;
-
-# create db1 and reload dump
-create database db1;
-use db1;
---exec $MYSQL db1 < $MYSQLTEST_VARDIR/tmp/bug10713.sql
-
-# check that all tables and views could be created
-show tables;
-select * from t2 order by a;
-
-drop table t1, t2;
-drop database db1;
-
-#
-# BUG#15328 Segmentation fault occured if my.cnf is invalid for escape sequence
-#
-
---exec $MYSQL_MY_PRINT_DEFAULTS --defaults-file=$MYSQL_TEST_DIR/std_data/bug15328.cnf mysqldump
-
-
#
# Bug #9558 mysqldump --no-data db t1 t2 format still dumps data
#
@@ -720,6 +655,12 @@ select * from t1;
drop table t1;
#
+# BUG#15328 Segmentation fault occured if my.cnf is invalid for escape sequence
+#
+
+--exec $MYSQL_MY_PRINT_DEFAULTS --config-file=$MYSQL_TEST_DIR/std_data/bug15328.cnf mysqldump
+
+#
# BUG #19025 mysqldump doesn't correctly dump "auto_increment = [int]"
#
create table `t1` (
@@ -760,14 +701,74 @@ create table t3(a int);
drop table t1, t2, t3;
#
-# Bug #13318: Bad result with empty field and --hex-blob
-#
-create table t1 (a binary(1), b blob);
-insert into t1 values ('','');
---exec $MYSQL_DUMP --skip-comments --skip-extended-insert --hex-blob test t1
---exec $MYSQL_DUMP --skip-comments --hex-blob test t1
+# Bug #21288: mysqldump segmentation fault when using --where
+#
+create table t1 (a int);
+--error 2
+--exec $MYSQL_DUMP --skip-comments --force test t1 --where='xx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' 2>&1
drop table t1;
+--echo End of 4.1 tests
+
+#
+# Bug #10213 mysqldump crashes when dumping VIEWs(on MacOS X)
+#
+
+create database db1;
+use db1;
+
+CREATE TABLE t2 (
+ a varchar(30) default NULL,
+ KEY a (a(5))
+);
+
+INSERT INTO t2 VALUES ('alfred');
+INSERT INTO t2 VALUES ('angie');
+INSERT INTO t2 VALUES ('bingo');
+INSERT INTO t2 VALUES ('waffle');
+INSERT INTO t2 VALUES ('lemon');
+create view v2 as select * from t2 where a like 'a%' with check option;
+--exec $MYSQL_DUMP --skip-comments db1
+drop table t2;
+drop view v2;
+drop database db1;
+use test;
+
+#
+# Bug 10713 mysqldump includes database in create view and referenced tables
+#
+
+# create table and views in db2
+create database db2;
+use db2;
+create table t1 (a int);
+create table t2 (a int, b varchar(10), primary key(a));
+insert into t2 values (1, "on"), (2, "off"), (10, "pol"), (12, "meg");
+insert into t1 values (289), (298), (234), (456), (789);
+create view v1 as select * from t2;
+create view v2 as select * from t1;
+
+# dump tables and view from db2
+--exec $MYSQL_DUMP db2 > $MYSQLTEST_VARDIR/tmp/bug10713.sql
+
+# drop the db, tables and views
+drop table t1, t2;
+drop view v1, v2;
+drop database db2;
+use test;
+
+# create db1 and reload dump
+create database db1;
+use db1;
+--exec $MYSQL db1 < $MYSQLTEST_VARDIR/tmp/bug10713.sql
+
+# check that all tables and views could be created
+show tables;
+select * from t2 order by a;
+
+drop table t1, t2;
+drop database db1;
+use test;
#
# dump of view
@@ -832,6 +833,7 @@ 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;
+
#
# Test for dumping triggers
#
@@ -1057,20 +1059,6 @@ drop view v0;
drop view v1;
drop table t1;
-# Check new --replace option
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-CREATE TABLE t1(a int, b int);
-INSERT INTO t1 VALUES (1,1);
-INSERT INTO t1 VALUES (2,3);
-INSERT INTO t1 VALUES (3,4), (4,5);
---exec $MYSQL_DUMP --replace --skip-comments test t1
-DROP TABLE t1;
-
-
#
# BUG#14554 - mysqldump does not separate words "ROW" and "BEGIN"
# for tables with trigger created in the IGNORE_SPACE sql mode.
@@ -1095,7 +1083,14 @@ SET SQL_MODE = @old_sql_mode;
DROP TRIGGER tr1;
DROP TABLE t1;
---echo End of 4.1 tests
+#
+# Bug #13318: Bad result with empty field and --hex-blob
+#
+create table t1 (a binary(1), b blob);
+insert into t1 values ('','');
+--exec $MYSQL_DUMP --skip-comments --skip-extended-insert --hex-blob test t1
+--exec $MYSQL_DUMP --skip-comments --hex-blob test t1
+drop table t1;
#
# Bug 14871 Invalid view dump output
@@ -1126,7 +1121,6 @@ select * from v3 order by a;
drop table t1;
drop view v1, v2, v3, v4, v5;
-
#
# Bug #16878 dump of trigger
#
@@ -1281,10 +1275,11 @@ use mysqldump_dbb;
drop view v1;
drop table t1;
drop database mysqldump_dbb;
+use test;
+
#
# Bug#21215 mysqldump creating incomplete backups without warning
#
-use test;
# Create user without sufficient privs to perform the requested operation
create user mysqltest_1@localhost;
@@ -1326,8 +1321,52 @@ grant REPLICATION CLIENT on *.* to mysqltest_1@localhost;
drop table t1;
drop user mysqltest_1@localhost;
+#
+# Bug #21527 mysqldump incorrectly tries to LOCK TABLES on the
+# information_schema database.
+#
+connect (root,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK);
+connection root;
+create database mysqldump_myDB;
+use mysqldump_myDB;
+create user myDB_User;
+grant create view, select on mysqldump_myDB.* to myDB_User@localhost;
+create table t1 (c1 int);
+insert into t1 values (3);
+
+connect (user1,localhost,myDB_User,,mysqldump_myDB,$MASTER_MYPORT,$MASTER_MYSOCK);
+connection user1;
+use mysqldump_myDB;
+create view v1 (c1) as select * from t1;
+
+# Backup should not fail.
+--exec $MYSQL_DUMP --all-databases --add-drop-table > $MYSQLTEST_VARDIR/tmp/bug21527.sql
+
+# Clean up
+connection root;
+use mysqldump_myDB;
+drop view v1;
+drop table t1;
+revoke all privileges on mysqldump_myDB.* from myDB_User@localhost;
+drop user myDB_User;
+drop database mysqldump_myDB;
+use test;
+
--echo End of 5.0 tests
+# Check new --replace option
+
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+CREATE TABLE t1(a int, b int);
+INSERT INTO t1 VALUES (1,1);
+INSERT INTO t1 VALUES (2,3);
+INSERT INTO t1 VALUES (3,4), (4,5);
+--exec $MYSQL_DUMP --replace --skip-comments test t1
+DROP TABLE t1;
+
#
# Added for use-thread option
#
diff --git a/mysql-test/t/partition.test b/mysql-test/t/partition.test
index 532a63b0d24..928d855f9f4 100644
--- a/mysql-test/t/partition.test
+++ b/mysql-test/t/partition.test
@@ -1340,11 +1340,13 @@ subpartition by hash (a)
(SUBPARTITION subpart00, SUBPARTITION subpart01));
--replace_result $MYSQLTEST_VARDIR "hello"
---exec ls $MYSQLTEST_VARDIR/master-data/test/t1* || true
+--exec ls $MYSQLTEST_VARDIR/master-data/test/t1.* || true
--replace_result $MYSQLTEST_VARDIR "hello"
---exec ls $MYSQLTEST_VARDIR/master-data/tmpdata/t1* || true
+--exec ls $MYSQLTEST_VARDIR/master-data/test/t1#* || true
--replace_result $MYSQLTEST_VARDIR "hello"
---exec ls $MYSQLTEST_VARDIR/master-data/tmpinx/t1* || true
+--exec ls $MYSQLTEST_VARDIR/master-data/tmpdata/t1#* || true
+--replace_result $MYSQLTEST_VARDIR "hello"
+--exec ls $MYSQLTEST_VARDIR/master-data/tmpinx/t1#* || true
--replace_result $MYSQLTEST_VARDIR "hello"
eval ALTER TABLE t1 REORGANIZE PARTITION p0 INTO
@@ -1354,11 +1356,13 @@ eval ALTER TABLE t1 REORGANIZE PARTITION p0 INTO
(SUBPARTITION subpart20, SUBPARTITION subpart21));
--replace_result $MYSQLTEST_VARDIR "hello"
---exec ls $MYSQLTEST_VARDIR/master-data/test/t1* || true
+--exec ls $MYSQLTEST_VARDIR/master-data/test/t1.* || true
+--replace_result $MYSQLTEST_VARDIR "hello"
+--exec ls $MYSQLTEST_VARDIR/master-data/test/t1#* || true
--replace_result $MYSQLTEST_VARDIR "hello"
---exec ls $MYSQLTEST_VARDIR/master-data/tmpdata/t1* || true
+--exec ls $MYSQLTEST_VARDIR/master-data/tmpdata/t1#* || true
--replace_result $MYSQLTEST_VARDIR "hello"
---exec ls $MYSQLTEST_VARDIR/master-data/tmpinx/t1* || true
+--exec ls $MYSQLTEST_VARDIR/master-data/tmpinx/t1#* || true
drop table t1;
--exec rmdir $MYSQLTEST_VARDIR/master-data/tmpdata || true
diff --git a/mysql-test/t/partition_mgm.test b/mysql-test/t/partition_mgm.test
index f1a89b28443..8458d47d634 100644
--- a/mysql-test/t/partition_mgm.test
+++ b/mysql-test/t/partition_mgm.test
@@ -24,11 +24,15 @@ PARTITION BY HASH(CAST(YEAR(f_date) AS SIGNED INTEGER)) PARTITIONS 2;
SHOW CREATE TABLE t1;
--replace_result $MYSQLTEST_VARDIR "hello"
---exec ls $MYSQLTEST_VARDIR/master-data/test/t1*
+--exec ls $MYSQLTEST_VARDIR/master-data/test/t1#*
+--replace_result $MYSQLTEST_VARDIR "hello"
+--exec ls $MYSQLTEST_VARDIR/master-data/test/t1.*
ALTER TABLE t1 COALESCE PARTITION 1;
SHOW CREATE TABLE t1;
--replace_result $MYSQLTEST_VARDIR "hello"
---exec ls $MYSQLTEST_VARDIR/master-data/test/t1*
+--exec ls $MYSQLTEST_VARDIR/master-data/test/t1#*
+--replace_result $MYSQLTEST_VARDIR "hello"
+--exec ls $MYSQLTEST_VARDIR/master-data/test/t1.*
drop table t1;
#
# Bug 20767: REORGANIZE partition crashes
diff --git a/mysql-test/t/show_check.test b/mysql-test/t/show_check.test
index e99387bf695..553b3d9059b 100644
--- a/mysql-test/t/show_check.test
+++ b/mysql-test/t/show_check.test
@@ -539,4 +539,17 @@ show plugin;
show plugins;
--enable_result_log
+#
+# Bug #19874: SHOW COLUMNS and SHOW KEYS handle identifiers containing
+# \ incorrectly
+#
+create database `mysqlttest\1`;
+create table `mysqlttest\1`.`a\b` (a int);
+show tables from `mysqlttest\1`;
+show fields from `mysqlttest\1`.`a\b`;
+show columns from `a\b` from `mysqlttest\1`;
+show keys from `mysqlttest\1`.`a\b`;
+drop table `mysqlttest\1`.`a\b`;
+drop database `mysqlttest\1`;
+
--echo End of 5.1 tests
diff --git a/mysql-test/t/system_mysql_db_fix.test b/mysql-test/t/system_mysql_db_fix.test
index 14132f5af11..daba3b6ff86 100644
--- a/mysql-test/t/system_mysql_db_fix.test
+++ b/mysql-test/t/system_mysql_db_fix.test
@@ -1,6 +1,9 @@
# Embedded server doesn't support external clients
--source include/not_embedded.inc
+# Windows doesn't support execution of shell scripts (to fix!!)
+--source include/not_windows.inc
+
# check that CSV engine was compiled in, as the test relies on the presence
# of the log tables (which are CSV-based)
--source include/have_csv.inc
diff --git a/mysql-test/t/variables.test b/mysql-test/t/variables.test
index 771a4ad3ed3..9985ed4f7f5 100644
--- a/mysql-test/t/variables.test
+++ b/mysql-test/t/variables.test
@@ -585,6 +585,16 @@ show variables like 'ssl%';
select @@log_queries_not_using_indexes;
show variables like 'log_queries_not_using_indexes';
+#
+# Bug#20908: Crash if select @@""
+#
+--error ER_PARSE_ERROR
+select @@"";
+--error ER_PARSE_ERROR
+select @@&;
+--error ER_PARSE_ERROR
+select @@@;
+
--echo End of 5.0 tests
# This is at the very after the versioned tests, since it involves doing
@@ -620,3 +630,4 @@ set global server_id =@my_server_id;
set global slow_launch_time =@my_slow_launch_time;
set global storage_engine =@my_storage_engine;
set global thread_cache_size =@my_thread_cache_size;
+
diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test
index 9f818a4c9f2..ee9c3b2ed45 100644
--- a/mysql-test/t/view.test
+++ b/mysql-test/t/view.test
@@ -2720,8 +2720,51 @@ DROP VIEW t1,v1;
SHOW TABLES;
DROP TABLE t1;
+--disable_warnings
+DROP VIEW IF EXISTS v1;
+--enable_warnings
+
+#
+# Bug #21261: Wrong access rights was required for an insert to a view
+#
+CREATE DATABASE bug21261DB;
+USE bug21261DB;
+CONNECT (root,localhost,root,,bug21261DB);
+CONNECTION root;
+CREATE TABLE t1 (x INT);
+CREATE SQL SECURITY INVOKER VIEW v1 AS SELECT x FROM t1;
+GRANT INSERT, UPDATE ON v1 TO 'user21261'@'localhost';
+GRANT INSERT, UPDATE ON t1 TO 'user21261'@'localhost';
+CREATE TABLE t2 (y INT);
+GRANT SELECT ON t2 TO 'user21261'@'localhost';
+CONNECT (user21261, localhost, user21261,, bug21261DB);
+CONNECTION user21261;
+INSERT INTO v1 (x) VALUES (5);
+UPDATE v1 SET x=1;
+CONNECTION root;
+GRANT SELECT ON v1 TO 'user21261'@'localhost';
+GRANT SELECT ON t1 TO 'user21261'@'localhost';
+CONNECTION user21261;
+UPDATE v1,t2 SET x=1 WHERE x=y;
+CONNECTION root;
+SELECT * FROM t1;
+REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'user21261'@'localhost';
+DROP USER 'user21261'@'localhost';
+DROP VIEW v1;
+DROP TABLE t1;
+DROP DATABASE bug21261DB;
+USE test;
+
+#
+# Bug #15950: NOW() optimized away in VIEWs
+#
+create table t1 (f1 datetime);
+create view v1 as select * from t1 where f1 between now() and now() + interval 1 minute;
+show create view v1;
+drop view v1;
+drop table t1;
#
# Test for BUG#16899: Possible buffer overflow in handling of DEFINER-clause.
#
@@ -2797,45 +2840,3 @@ DROP TABLE t1;
--echo End of 5.0 tests.
-
-#
-# Bug #21261: Wrong access rights was required for an insert to a view
-#
-CREATE DATABASE bug21261DB;
-USE bug21261DB;
-CONNECT (root,localhost,root,,bug21261DB);
-CONNECTION root;
-
-CREATE TABLE t1 (x INT);
-CREATE SQL SECURITY INVOKER VIEW v1 AS SELECT x FROM t1;
-GRANT INSERT, UPDATE ON v1 TO 'user21261'@'localhost';
-GRANT INSERT, UPDATE ON t1 TO 'user21261'@'localhost';
-CREATE TABLE t2 (y INT);
-GRANT SELECT ON t2 TO 'user21261'@'localhost';
-
-CONNECT (user21261, localhost, user21261,, bug21261DB);
-CONNECTION user21261;
-INSERT INTO v1 (x) VALUES (5);
-UPDATE v1 SET x=1;
-CONNECTION root;
-GRANT SELECT ON v1 TO 'user21261'@'localhost';
-GRANT SELECT ON t1 TO 'user21261'@'localhost';
-CONNECTION user21261;
-UPDATE v1,t2 SET x=1 WHERE x=y;
-CONNECTION root;
-SELECT * FROM t1;
-REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'user21261'@'localhost';
-DROP USER 'user21261'@'localhost';
-DROP VIEW v1;
-DROP TABLE t1;
-DROP DATABASE bug21261DB;
-USE test;
-
-#
-# Bug #15950: NOW() optimized away in VIEWs
-#
-create table t1 (f1 datetime);
-create view v1 as select * from t1 where f1 between now() and now() + interval 1 minute;
-show create view v1;
-drop view v1;
-drop table t1;
diff --git a/mysql-test/t/windows.test b/mysql-test/t/windows.test
index d6bcfeb8cb3..79517df6517 100644
--- a/mysql-test/t/windows.test
+++ b/mysql-test/t/windows.test
@@ -18,3 +18,42 @@ create table nu (a int);
drop table nu;
# End of 4.1 tests
+
+#
+# Bug #20789: Merge Subtable Rename Causes Crash
+#
+CREATE TABLE `t1` (
+ `TIM` datetime NOT NULL,
+ `VAL` double default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+CREATE TABLE `t2` (
+ `TIM` datetime NOT NULL,
+ `VAL` double default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+CREATE TABLE `mt` (
+ `TIM` datetime NOT NULL,
+ `VAL` double default NULL
+) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=LAST
+UNION=(`t1`,`t2`);
+
+# insert into the merge table and thus open it.
+INSERT INTO mt VALUES ('2006-01-01',0);
+
+# Alter one of the tables that are part of the merge table
+ALTER TABLE `t2` RENAME TO `t`;
+
+# Insert into the merge table that has just been altered
+--error 1015
+INSERT INTO mt VALUES ('2006-01-01',0);
+--error 1015
+select * from mt;
+
+FLUSH TABLES;
+--error 1017
+select * from mt;
+
+# Alter one of the tables that are part of the merge table
+ALTER TABLE `t` RENAME TO `t2`;
+INSERT INTO mt VALUES ('2006-01-01',0);
+select * from mt;
+