diff options
Diffstat (limited to 'mysql-test')
163 files changed, 3387 insertions, 644 deletions
diff --git a/mysql-test/Makefile.am b/mysql-test/Makefile.am index e8f00902a33..aa5c2106e8b 100644 --- a/mysql-test/Makefile.am +++ b/mysql-test/Makefile.am @@ -66,6 +66,7 @@ dist-hook: $(INSTALL_DATA) $(srcdir)/std_data/des_key_file $(distdir)/std_data $(INSTALL_DATA) $(srcdir)/std_data/*.pem $(distdir)/std_data $(INSTALL_DATA) $(srcdir)/std_data/*.frm $(distdir)/std_data + $(INSTALL_DATA) $(srcdir)/std_data/*.MY* $(distdir)/std_data $(INSTALL_DATA) $(srcdir)/std_data/*.cnf $(distdir)/std_data $(INSTALL_DATA) $(srcdir)/std_data/ndb_backup50/BACKUP* $(distdir)/std_data/ndb_backup50 $(INSTALL_DATA) $(srcdir)/std_data/ndb_backup51/BACKUP* $(distdir)/std_data/ndb_backup51 @@ -107,6 +108,7 @@ install-data-local: $(INSTALL_DATA) $(srcdir)/std_data/Moscow_leap $(DESTDIR)$(testdir)/std_data $(INSTALL_DATA) $(srcdir)/std_data/*.pem $(DESTDIR)$(testdir)/std_data $(INSTALL_DATA) $(srcdir)/std_data/*.frm $(DESTDIR)$(testdir)/std_data + $(INSTALL_DATA) $(srcdir)/std_data/*.MY* $(distdir)/std_data $(INSTALL_DATA) $(srcdir)/std_data/*.cnf $(DESTDIR)$(testdir)/std_data $(INSTALL_DATA) $(srcdir)/std_data/ndb_backup50/BACKUP* $(DESTDIR)$(testdir)/std_data/ndb_backup50 $(INSTALL_DATA) $(srcdir)/std_data/ndb_backup51/BACKUP* $(DESTDIR)$(testdir)/std_data/ndb_backup51 diff --git a/mysql-test/extra/rpl_tests/rpl_deadlock.test b/mysql-test/extra/rpl_tests/rpl_deadlock.test index 526925d6a83..236a5f801b0 100644 --- a/mysql-test/extra/rpl_tests/rpl_deadlock.test +++ b/mysql-test/extra/rpl_tests/rpl_deadlock.test @@ -101,7 +101,7 @@ show slave status; # Now we repeat 2), but with BEGIN in the same relay log as # COMMIT (to see if seeking into hot log is ok). - +set @my_max_relay_log_size= @@global.max_relay_log_size; set global max_relay_log_size=0; # This is really copy-paste of 2) of above @@ -126,5 +126,6 @@ show slave status; connection master; drop table t1,t2,t3,t4; sync_slave_with_master; +set global max_relay_log_size= @my_max_relay_log_size; --echo End of 5.1 tests diff --git a/mysql-test/extra/rpl_tests/rpl_max_relay_size.test b/mysql-test/extra/rpl_tests/rpl_max_relay_size.test index 50325f83358..5b995374ba0 100644 --- a/mysql-test/extra/rpl_tests/rpl_max_relay_size.test +++ b/mysql-test/extra/rpl_tests/rpl_max_relay_size.test @@ -34,6 +34,7 @@ reset slave; --echo # Test 1 --echo # +set @my_max_binlog_size= @@global.max_binlog_size; set global max_binlog_size=8192; set global max_relay_log_size=8192-1; # mapped to 4096 select @@global.max_relay_log_size; @@ -130,6 +131,10 @@ flush logs; -- replace_column 3 <Binlog_Ignore_DB> show master status; +# Restore max_binlog_size +connection slave; +set global max_binlog_size= @my_max_binlog_size; + --echo # --echo # End of 4.1 tests --echo # diff --git a/mysql-test/include/ndb_setup_slave.inc b/mysql-test/include/ndb_setup_slave.inc index 3cda48755b9..5ee55150550 100644 --- a/mysql-test/include/ndb_setup_slave.inc +++ b/mysql-test/include/ndb_setup_slave.inc @@ -1,13 +1,13 @@ # # now setup replication to continue from last epoch -# 1. get apply_status epoch from slave +# 1. get ndb_apply_status epoch from slave # 2. get corresponding _next_ binlog postition from master # 3. change master on slave # 1. --connection slave --replace_column 1 <the_epoch> -SELECT @the_epoch:=MAX(epoch) FROM mysql.apply_status; +SELECT @the_epoch:=MAX(epoch) FROM mysql.ndb_apply_status; --let $the_epoch= `select @the_epoch` # 2. @@ -15,7 +15,7 @@ SELECT @the_epoch:=MAX(epoch) FROM mysql.apply_status; --replace_result $the_epoch <the_epoch> --replace_column 1 <the_pos> eval SELECT @the_pos:=Position,@the_file:=SUBSTRING_INDEX(FILE, '/', -1) - FROM mysql.binlog_index WHERE epoch > $the_epoch ORDER BY epoch ASC LIMIT 1; + FROM mysql.ndb_binlog_index WHERE epoch > $the_epoch ORDER BY epoch ASC LIMIT 1; --let $the_pos= `SELECT @the_pos` --let $the_file= `SELECT @the_file` diff --git a/mysql-test/lib/init_db.sql b/mysql-test/lib/init_db.sql index 6941b980776..c50b25ccdae 100644 --- a/mysql-test/lib/init_db.sql +++ b/mysql-test/lib/init_db.sql @@ -648,4 +648,4 @@ CREATE TABLE event ( PRIMARY KEY (db, name) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT 'Events'; -CREATE TABLE IF NOT EXISTS mysql.binlog_index (Position BIGINT UNSIGNED NOT NULL, File VARCHAR(255) NOT NULL, epoch BIGINT UNSIGNED NOT NULL, inserts BIGINT UNSIGNED NOT NULL, updates BIGINT UNSIGNED NOT NULL, deletes BIGINT UNSIGNED NOT NULL, schemaops BIGINT UNSIGNED NOT NULL, PRIMARY KEY(epoch)) ENGINE=MYISAM; +CREATE TABLE IF NOT EXISTS mysql.ndb_binlog_index (Position BIGINT UNSIGNED NOT NULL, File VARCHAR(255) NOT NULL, epoch BIGINT UNSIGNED NOT NULL, inserts BIGINT UNSIGNED NOT NULL, updates BIGINT UNSIGNED NOT NULL, deletes BIGINT UNSIGNED NOT NULL, schemaops BIGINT UNSIGNED NOT NULL, PRIMARY KEY(epoch)) ENGINE=MYISAM; diff --git a/mysql-test/lib/mtr_cases.pl b/mysql-test/lib/mtr_cases.pl index d270d72d526..9e943fec9ef 100644 --- a/mysql-test/lib/mtr_cases.pl +++ b/mysql-test/lib/mtr_cases.pl @@ -593,6 +593,10 @@ sub mtr_options_from_test_file($$) { while ( my $line= <$F> ) { + + # Skip line if it start's with # + next if ( $line =~ /^#/ ); + # Match this line against tag in "tags" array foreach my $tag (@tags) { diff --git a/mysql-test/lib/mtr_io.pl b/mysql-test/lib/mtr_io.pl index 5be1d2ffddb..842dc09413d 100644 --- a/mysql-test/lib/mtr_io.pl +++ b/mysql-test/lib/mtr_io.pl @@ -13,6 +13,8 @@ sub mtr_tofile ($@); sub mtr_tonewfile($@); sub mtr_lastlinefromfile($); sub mtr_appendfile_to_file ($$); +sub mtr_grab_file($); + ############################################################################## # @@ -129,6 +131,7 @@ sub unspace { return "$quote$string$quote"; } +# Read a whole file, stripping leading and trailing whitespace. sub mtr_fromfile ($) { my $file= shift; @@ -182,5 +185,16 @@ sub mtr_appendfile_to_file ($$) { close TOFILE; } +# Read a whole file verbatim. +sub mtr_grab_file($) { + my $file= shift; + open(FILE, '<', $file) + or return undef; + local $/= undef; + my $data= scalar(<FILE>); + close FILE; + return $data; +} + 1; diff --git a/mysql-test/lib/mtr_misc.pl b/mysql-test/lib/mtr_misc.pl index 846ca25b725..f28e25e5966 100644 --- a/mysql-test/lib/mtr_misc.pl +++ b/mysql-test/lib/mtr_misc.pl @@ -134,6 +134,7 @@ sub mtr_exe_maybe_exists (@) { my @path= @_; map {$_.= ".exe"} @path if $::glob_win32; + map {$_.= ".nlm"} @path if $::glob_netware; foreach my $path ( @path ) { if($::glob_win32) diff --git a/mysql-test/lib/mtr_process.pl b/mysql-test/lib/mtr_process.pl index 79285de88a7..330dfddf1d3 100644 --- a/mysql-test/lib/mtr_process.pl +++ b/mysql-test/lib/mtr_process.pl @@ -708,7 +708,7 @@ sub mtr_wait_blocking($) { } } -# Start "mysqladmin shutdown" for a specific mysqld +# Start "mysqladmin <command>" for a specific mysqld sub mtr_mysqladmin_start($$$) { my $srv= shift; my $command= shift; @@ -738,9 +738,8 @@ sub mtr_mysqladmin_start($$$) { # Shutdown time must be high as slave may be in reconnect mtr_add_arg($args, "--shutdown_timeout=$adm_shutdown_tmo"); mtr_add_arg($args, "$command"); - my $path_mysqladmin_log= "$::opt_vardir/log/mysqladmin.log"; my $pid= mtr_spawn($::exe_mysqladmin, $args, - "", $path_mysqladmin_log, $path_mysqladmin_log, "", + "", "", "", "", { append_log_file => 1 }); mtr_verbose("mtr_mysqladmin_start, pid: $pid"); return $pid; @@ -1059,7 +1058,7 @@ sub sleep_until_file_created ($$$) { # Print extra message every 60 seconds my $seconds= ($loop * $sleeptime) / 1000; - if ( $seconds > 1 and int($seconds) % 60 == 0 ) + if ( $seconds > 1 and int($seconds * 10) % 600 == 0 ) { my $left= $timeout - $seconds; mtr_warning("Waited $seconds seconds for $pidfile to be created, " . diff --git a/mysql-test/lib/mtr_report.pl b/mysql-test/lib/mtr_report.pl index abf9cd066b1..f840c1275d3 100644 --- a/mysql-test/lib/mtr_report.pl +++ b/mysql-test/lib/mtr_report.pl @@ -34,7 +34,12 @@ sub mtr_verbose (@); # We can't use diff -u or diff -a as these are not portable sub mtr_show_failed_diff ($) { - my $tname= shift; + my $result_file_name= shift; + + # The reject and log files have been dumped to + # to filenames based on the result_file's name + my $tname= basename($result_file_name); + $tname=~ s/\..*$//; my $reject_file= "r/$tname.reject"; my $result_file= "r/$tname.result"; diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 6ec55c5f4d6..73755cd2df9 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -103,7 +103,6 @@ our $glob_mysql_bench_dir= undef; our $glob_hostname= undef; our $glob_scriptname= undef; our $glob_timers= undef; -our $glob_use_running_server= 0; our $glob_use_running_ndbcluster= 0; our $glob_use_running_ndbcluster_slave= 0; our $glob_use_embedded_server= 0; @@ -141,6 +140,7 @@ our $opt_verbose= 0; # Verbose output, enable with --verbose our $exe_master_mysqld; our $exe_mysql; our $exe_mysqladmin; +our $exe_mysql_upgrade; our $exe_mysqlbinlog; our $exe_mysql_client_test; our $exe_mysqld; @@ -150,6 +150,7 @@ our $exe_mysqlslap; our $exe_mysqlimport; our $exe_mysqlshow; our $exe_mysql_fix_system_tables; +our $file_mysql_fix_privilege_tables; our $exe_mysqltest; our $exe_ndbd; our $exe_ndb_mgmd; @@ -162,7 +163,7 @@ our $exe_libtool; our $opt_bench= 0; our $opt_small_bench= 0; -our $opt_big_test= 0; # Send --big-test to mysqltest +our $opt_big_test= 0; our @opt_extra_mysqld_opt; @@ -179,7 +180,10 @@ our $opt_debug; our $opt_do_test; our @opt_cases; # The test cases names in argv our $opt_embedded_server; -our $opt_extern; + +our $opt_extern= 0; +our $opt_socket; + our $opt_fast; our $opt_force; our $opt_reorder= 0; @@ -224,8 +228,8 @@ our $opt_ndbcluster_port_slave; our $opt_ndbconnectstring_slave; our $opt_record; +my $opt_report_features; our $opt_check_testcases; -my $opt_report_features; our $opt_skip; our $opt_skip_rpl; @@ -236,17 +240,11 @@ our $opt_skip_im; our $opt_sleep; -our $opt_sleep_time_after_restart= 1; -our $opt_sleep_time_for_delete= 10; our $opt_testcase_timeout; our $opt_suite_timeout; my $default_testcase_timeout= 15; # 15 min max my $default_suite_timeout= 180; # 3 hours max -our $opt_socket; - -our $opt_source_dist; - our $opt_start_and_exit; our $opt_start_dirty; our $opt_start_from; @@ -256,7 +254,6 @@ our $opt_strace_client; our $opt_timer= 1; our $opt_user; -our $opt_user_test; our $opt_valgrind= 0; our $opt_valgrind_mysqld= 0; @@ -278,7 +275,6 @@ our $opt_stress_test_file= ""; our $opt_wait_for_master; our $opt_wait_for_slave; -our $opt_wait_timeout= 10; our $opt_warnings; @@ -308,6 +304,8 @@ our $glob_tot_real_time= 0; our %mysqld_variables; +my $source_dist= 0; + ###################################################################### # @@ -319,11 +317,12 @@ sub main (); sub initial_setup (); sub command_line_setup (); sub set_mtr_build_thread_ports($); -sub datadir_setup (); +sub datadir_list_setup (); sub executable_setup (); sub environment_setup (); sub kill_running_servers (); -sub cleanup_stale_files (); +sub remove_stale_vardir (); +sub setup_vardir (); sub check_ssl_support ($); sub check_running_as_root(); sub check_ndbcluster_support ($); @@ -467,6 +466,15 @@ sub command_line_setup () { $im_port= 9312; $im_mysqld1_port= 9313; $im_mysqld2_port= 9314; + + # If so requested, we try to avail ourselves of a unique build thread number. + if ( $ENV{'MTR_BUILD_THREAD'} ) { + if ( lc($ENV{'MTR_BUILD_THREAD'}) eq 'auto' ) { + print "Requesting build thread... "; + $ENV{'MTR_BUILD_THREAD'} = mtr_require_unique_id_and_wait("/tmp/mysql-test-ports", 200, 299); + print "got ".$ENV{'MTR_BUILD_THREAD'}."\n"; + } + } if ( $ENV{'MTR_BUILD_THREAD'} ) { @@ -574,7 +582,7 @@ sub command_line_setup () { 'tmpdir=s' => \$opt_tmpdir, 'vardir=s' => \$opt_vardir, 'benchdir=s' => \$glob_mysql_bench_dir, - 'mem:s' => \$opt_mem, + 'mem' => \$opt_mem, # Misc 'report-features' => \$opt_report_features, @@ -591,9 +599,7 @@ sub command_line_setup () { 'start-and-exit' => \$opt_start_and_exit, 'timer!' => \$opt_timer, 'unified-diff|udiff' => \$opt_udiff, - 'user-test=s' => \$opt_user_test, 'user=s' => \$opt_user, - 'wait-timeout=i' => \$opt_wait_timeout, 'testcase-timeout=i' => \$opt_testcase_timeout, 'suite-timeout=i' => \$opt_suite_timeout, 'warnings|log-warnings' => \$opt_warnings, @@ -625,7 +631,7 @@ sub command_line_setup () { if ( -d "../sql" ) { - $opt_source_dist= 1; + $source_dist= 1; } $glob_hostname= mtr_short_hostname(); @@ -649,7 +655,7 @@ sub command_line_setup () { # directory. And we install "/usr/share/mysql-test". Moving up one # more directory relative to "mysql-test" gives us a usable base # directory for RPM installs. - if ( ! $opt_source_dist and ! -d "$glob_basedir/bin" ) + if ( ! $source_dist and ! -d "$glob_basedir/bin" ) { $glob_basedir= dirname($glob_basedir); } @@ -661,7 +667,7 @@ sub command_line_setup () { unless -d $glob_mysql_bench_dir; $path_my_basedir= - $opt_source_dist ? $glob_mysql_test_dir : $glob_basedir; + $source_dist ? $glob_mysql_test_dir : $glob_basedir; $glob_timers= mtr_init_timers(); @@ -670,10 +676,10 @@ sub command_line_setup () { # number as early as possible # - # Look for the client binaries - $path_client_bindir= mtr_path_exists(vs_config_dirs('client', ''), - "$glob_basedir/client_release", + # Look for the client binaries directory + $path_client_bindir= mtr_path_exists("$glob_basedir/client_release", "$glob_basedir/client_debug", + vs_config_dirs('client', ''), "$glob_basedir/client", "$glob_basedir/bin"); @@ -804,13 +810,6 @@ sub command_line_setup () { $opt_vardir= "$glob_mysql_test_dir/$opt_vardir"; } - # Ensure a proper error message - mkpath("$opt_vardir"); - unless ( -d $opt_vardir and -w $opt_vardir ) - { - mtr_error("Writable 'var' directory is needed, use the '--vardir' option"); - } - # -------------------------------------------------------------------------- # Set tmpdir # -------------------------------------------------------------------------- @@ -818,14 +817,6 @@ sub command_line_setup () { $opt_tmpdir =~ s,/+$,,; # Remove ending slash if any # -------------------------------------------------------------------------- - # Set socket - # -------------------------------------------------------------------------- - if (!$opt_socket) - { - $opt_socket= $mysqld_variables{'socket'}; - } - - # -------------------------------------------------------------------------- # Check im suport # -------------------------------------------------------------------------- if ( $mysql_version_id < 50000 ) @@ -922,17 +913,17 @@ sub command_line_setup () { } # -------------------------------------------------------------------------- - # Sleep flag + # Big test flags # -------------------------------------------------------------------------- - if ( $opt_sleep ) - { - $opt_sleep_time_after_restart= $opt_sleep; - } + if ( $opt_big_test ) + { + $ENV{'BIG_TEST'}= 1; + } # -------------------------------------------------------------------------- # Gcov flag # -------------------------------------------------------------------------- - if ( $opt_gcov and ! $opt_source_dist ) + if ( $opt_gcov and ! $source_dist ) { mtr_error("Coverage test needs the source - please use source dist"); } @@ -946,8 +937,6 @@ sub command_line_setup () { { # Indicate that we are using debugger $glob_debugger= 1; - # Increase timeouts - $opt_wait_timeout= 300; if ( $opt_extern ) { mtr_error("Can't use --extern when using debugger"); @@ -1013,16 +1002,9 @@ sub command_line_setup () { $opt_suite_timeout*= 6 if $opt_valgrind; } - # Increase times to wait for executables to start if using valgrind - if ( $opt_valgrind ) - { - $opt_sleep_time_after_restart= 10; - $opt_sleep_time_for_delete= 60; - } - if ( ! $opt_user ) { - if ( $glob_use_running_server ) + if ( $opt_extern ) { $opt_user= "test"; } @@ -1204,9 +1186,17 @@ sub command_line_setup () { if ( $opt_extern ) { - $glob_use_running_server= 1; - $opt_skip_rpl= 1; # We don't run rpl test cases - $master->[0]->{'path_sock'}= $opt_socket; + # Turn off features not supported when running with extern server + $opt_skip_rpl= 1; + + # Setup master->[0] with the settings for the extern server + $master->[0]->{'path_sock'}= $opt_socket if $opt_socket; + mtr_report("Using extern server at '$master->[0]->{path_sock}'"); + } + else + { + mtr_error("--socket can only be used in combination with --extern") + if $opt_socket; } $path_timefile= "$opt_vardir/log/mysqltest-time"; @@ -1236,6 +1226,12 @@ sub command_line_setup () { sub set_mtr_build_thread_ports($) { my $mtr_build_thread= shift; + if ( lc($mtr_build_thread) eq 'auto' ) { + print "Requesting build thread... "; + $ENV{'MTR_BUILD_THREAD'} = $mtr_build_thread = mtr_require_unique_id_and_wait("/tmp/mysql-test-ports", 200, 299); + print "got ".$mtr_build_thread."\n"; + } + # Up to two masters, up to three slaves $opt_master_myport= $mtr_build_thread * 10 + 10000; # and 1 $opt_slave_myport= $opt_master_myport + 2; # and 3 4 @@ -1254,7 +1250,7 @@ sub set_mtr_build_thread_ports($) { } -sub datadir_setup () { +sub datadir_list_setup () { # Make a list of all data_dirs @data_dir_lst = ( @@ -1284,26 +1280,15 @@ sub datadir_setup () { sub collect_mysqld_features () { - # - # Execute "mysqld --no-defaults --help --verbose", that will - # print out version and a list of all features and settings - # my $found_variable_list_start= 0; - my $spec_file= "$glob_mysql_test_dir/mysqld.spec.$$"; - if ( mtr_run($exe_mysqld, - ["--no-defaults", - "--verbose", - "--help"], - "", "$spec_file", "$spec_file", "") != 0 ) - { - mtr_error("Failed to get version and list of features from %s", - $exe_mysqld); - } - my $F= IO::File->new($spec_file) or - mtr_error("can't open file \"$spec_file\": $!"); + # + # Execute "mysqld --no-defaults --help --verbose" to get a + # of all features and settings + # + my $list= `$exe_mysqld --no-defaults --verbose --help`; - while ( my $line= <$F> ) + foreach my $line (split('\n', $list)) { # First look for version if ( !$mysql_version_id ) @@ -1356,7 +1341,7 @@ sub collect_mysqld_features () { } } } - unlink($spec_file); + mtr_error("Could not find version of MySQL") unless $mysql_version_id; mtr_error("Could not find variabes list") unless $found_variable_list_start; @@ -1459,7 +1444,15 @@ sub executable_setup () { $exe_mysql= mtr_exe_exists("$path_client_bindir/mysql"); if ( $mysql_version_id >= 50100 ) { - $exe_mysqlslap= mtr_exe_exists("$path_client_bindir/mysqlslap"); + $exe_mysqlslap= mtr_exe_exists("$path_client_bindir/mysqlslap"); + } + if ( $mysql_version_id >= 50000 and !$glob_use_embedded_server ) + { + $exe_mysql_upgrade= mtr_exe_exists("$path_client_bindir/mysql_upgrade") + } + else + { + $exe_mysql_upgrade= ""; } if ( ! $glob_win32 ) @@ -1470,6 +1463,10 @@ sub executable_setup () { "$path_client_bindir/mysql_fix_privilege_tables"); } + # Look for mysql_fix_privilege_tables.sql script + $file_mysql_fix_privilege_tables= + mtr_file_exists("$glob_basedir/scripts/mysql_fix_privilege_tables.sql", + "$glob_basedir/share/mysql_fix_privilege_tables.sql"); if ( ! $opt_skip_ndbcluster and executable_setup_ndb()) { @@ -1500,13 +1497,13 @@ sub executable_setup () { if ( $glob_use_embedded_server ) { $exe_mysqltest= - mtr_exe_exists(vs_config_dirs('libmysqld/examples', 'mysqltest_embedded'), - "$glob_basedir/libmysqld/examples/mysqltest_embedded", + mtr_exe_exists(vs_config_dirs('libmysqld/examples','mysqltest_embedded'), + "$glob_basedir/libmysqld/examples/mysqltest_embedded", "$path_client_bindir/mysqltest_embedded"); } else { - $exe_mysqltest= mtr_exe_exists("$path_client_bindir/mysqltest"); + $exe_mysqltest= mtr_exe_exists("$path_client_bindir/mysqltest"); } # Look for mysql_client_test executable which may _not_ exist in @@ -1585,6 +1582,33 @@ sub mysql_client_test_arguments() return join(" ", $exe, @$args); } +sub mysql_upgrade_arguments() +{ + my $exe= $exe_mysql_upgrade; + + my $args; + mtr_init_args(\$args); +# if ( $opt_valgrind_mysql_ugrade ) +# { +# valgrind_arguments($args, \$exe); +# } + + mtr_add_arg($args, "--no-defaults"); + mtr_add_arg($args, "--user=root"); + mtr_add_arg($args, "--port=$master->[0]->{'port'}"); + mtr_add_arg($args, "--socket=$master->[0]->{'path_sock'}"); + mtr_add_arg($args, "--datadir=$master->[0]->{'path_myddir'}"); + mtr_add_arg($args, "--basedir=$glob_basedir"); + + if ( $opt_debug ) + { + mtr_add_arg($args, + "--debug=d:t:A,$path_vardir_trace/log/mysql_upgrade.trace"); + } + + return join(" ", $exe, @$args); +} + # Note that some env is setup in spawn/run, in "mtr_process.pl" sub environment_setup () { @@ -1597,7 +1621,7 @@ sub environment_setup () { # Setup LD_LIBRARY_PATH so the libraries from this distro/clone # are used in favor of the system installed ones # -------------------------------------------------------------------------- - if ( $opt_source_dist ) + if ( $source_dist ) { push(@ld_library_paths, "$glob_basedir/libmysql/.libs/", "$glob_basedir/libmysql_r/.libs/", @@ -1629,9 +1653,17 @@ sub environment_setup () { # impossible to add correct supressions, that means if "/usr/lib/debug" # is available, it should be added to # LD_LIBRARY_PATH + # + # But pthread is broken in libc6-dbg on Debian <= 3.1 (see Debian + # bug 399035, http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=399035), + # so don't change LD_LIBRARY_PATH on that platform. # -------------------------------------------------------------------------- my $debug_libraries_path= "/usr/lib/debug"; - if ( $opt_valgrind and -d $debug_libraries_path ) + my $deb_version; + if ( $opt_valgrind and -d $debug_libraries_path and + (! -e '/etc/debian_version' or + ($deb_version= mtr_grab_file('/etc/debian_version')) == 0 or + $deb_version > 3.1 ) ) { push(@ld_library_paths, $debug_libraries_path); } @@ -1655,7 +1687,7 @@ sub environment_setup () { $ENV{'UMASK'}= "0660"; # The octal *string* $ENV{'UMASK_DIR'}= "0770"; # The octal *string* $ENV{'LC_COLLATE'}= "C"; - $ENV{'USE_RUNNING_SERVER'}= $glob_use_running_server; + $ENV{'USE_RUNNING_SERVER'}= $opt_extern; $ENV{'MYSQL_TEST_DIR'}= $glob_mysql_test_dir; $ENV{'MYSQLTEST_VARDIR'}= $opt_vardir; $ENV{'MYSQL_TMP_DIR'}= $opt_tmpdir; @@ -1668,6 +1700,7 @@ sub environment_setup () { $ENV{'SLAVE_MYPORT1'}= $slave->[1]->{'port'}; $ENV{'SLAVE_MYPORT2'}= $slave->[2]->{'port'}; $ENV{'MYSQL_TCP_PORT'}= $mysqld_variables{'port'}; + $ENV{'DEFAULT_MASTER_PORT'}= $mysqld_variables{'master-port'}; $ENV{'IM_PATH_SOCK'}= $instance_manager->{path_sock}; $ENV{'IM_USERNAME'}= $instance_manager->{admin_login}; @@ -1846,6 +1879,14 @@ sub environment_setup () { $ENV{'MYSQL_CLIENT_TEST'}= mysql_client_test_arguments(); # ---------------------------------------------------- + # Setup env so childs can execute mysql_upgrade + # ---------------------------------------------------- + if ( $mysql_version_id >= 50000 ) + { + $ENV{'MYSQL_UPGRADE'}= mysql_upgrade_arguments(); + } + + # ---------------------------------------------------- # Setup env so childs can execute mysql_fix_system_tables # ---------------------------------------------------- if ( ! $glob_win32 ) @@ -1858,12 +1899,17 @@ sub environment_setup () { "--socket=$master->[0]->{'path_sock'}"; $ENV{'MYSQL_FIX_SYSTEM_TABLES'}= $cmdline_mysql_fix_system_tables; } + $ENV{'MYSQL_FIX_PRIVILEGE_TABLES'}= $file_mysql_fix_privilege_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 mysqladmin + # ---------------------------------------------------- + $ENV{'MYSQLADMIN'}= $exe_mysqladmin; # ---------------------------------------------------- # Setup env so childs can execute perror @@ -1884,7 +1930,7 @@ sub environment_setup () { # ---------------------------------------------------- # We are nice and report a bit about our settings # ---------------------------------------------------- - if (!$opt_extern && $opt_verbose) + if (!$opt_extern) { print "Using MTR_BUILD_THREAD = $ENV{MTR_BUILD_THREAD}\n"; print "Using MASTER_MYPORT = $ENV{MASTER_MYPORT}\n"; @@ -1958,29 +2004,23 @@ sub kill_running_servers () { # This is different from terminating processes we have # started from this run of the script, this is terminating # leftovers from previous runs. - - if ( ! -d $opt_vardir ) - { - if ( -l $opt_vardir and ! -d readlink($opt_vardir) ) - { - mtr_report("Removing $opt_vardir symlink without destination"); - unlink($opt_vardir); - } - # The "var" dir does not exist already - # the processes that mtr_kill_leftovers start will write - # their log files to var/log so it should be created - mkpath("$opt_vardir/log"); - } mtr_kill_leftovers(); } } -sub cleanup_stale_files () { - - my $created_by_mem_file= "$glob_mysql_test_dir/var/created_by_mem"; +# +# Remove var and any directories in var/ created by previous +# tests +# +sub remove_stale_vardir () { mtr_report("Removing Stale Files"); + # Safety! + mtr_error("No, don't remove the vardir when running with --extern") + if $opt_extern; + + mtr_verbose("opt_vardir: $opt_vardir"); if ( $opt_vardir eq $default_vardir ) { # @@ -1989,29 +2029,47 @@ sub cleanup_stale_files () { if ( -l $opt_vardir) { # var is a symlink - if (-f $created_by_mem_file) + + if ( $opt_mem and readlink($opt_vardir) eq $opt_mem ) { # Remove the directory which the link points at + mtr_verbose("Removing " . readlink($opt_vardir)); rmtree(readlink($opt_vardir)); - # Remove the entire "var" dir - rmtree("$opt_vardir/"); + # Remove the "var" symlink + mtr_verbose("unlink($opt_vardir)"); + unlink($opt_vardir); + } + elsif ( $opt_mem ) + { + # Just remove the "var" symlink + mtr_report("WARNING: Removing '$opt_vardir' symlink it's wrong"); + + mtr_verbose("unlink($opt_vardir)"); unlink($opt_vardir); } else { # Some users creates a soft link in mysql-test/var to another area - # - allow it + # - allow it, but remove all files in it + mtr_report("WARNING: Using the 'mysql-test/var' symlink"); - rmtree("$opt_vardir/log"); - rmtree("$opt_vardir/ndbcluster-$opt_ndbcluster_port"); - rmtree("$opt_vardir/run"); - rmtree("$opt_vardir/tmp"); + + # Make sure the directory where it points exist + mtr_error("The destination for symlink $opt_vardir does not exist") + if ! -d readlink($opt_vardir); + + foreach my $bin ( glob("$opt_vardir/*") ) + { + mtr_verbose("Removing bin $bin"); + rmtree($bin); + } } } else { # Remove the entire "var" dir + mtr_verbose("Removing $opt_vardir/"); rmtree("$opt_vardir/"); } } @@ -2023,21 +2081,56 @@ sub cleanup_stale_files () { # Remove the var/ dir in mysql-test dir if any # this could be an old symlink that shouldn't be there + mtr_verbose("Removing $default_vardir"); rmtree($default_vardir); # Remove the "var" dir + mtr_verbose("Removing $opt_vardir/"); rmtree("$opt_vardir/"); } +} + +# +# Create var and the directories needed in var +# +sub setup_vardir() { + mtr_report("Creating Directories"); + + if ( $opt_vardir eq $default_vardir ) + { + # + # Running with "var" in mysql-test dir + # + if ( -l $opt_vardir ) + { + # it's a symlink + + # Make sure the directory where it points exist + mtr_error("The destination for symlink $opt_vardir does not exist") + if ! -d readlink($opt_vardir); + } + elsif ( $opt_mem ) + { + # Runinng with "var" as a link to some "memory" location, normally tmpfs + mtr_verbose("Creating $opt_mem"); + mkpath($opt_mem); + + mtr_report("Symlinking 'var' to '$opt_mem'"); + symlink($opt_mem, $opt_vardir); + } + } + + if ( ! -d $opt_vardir ) + { + mtr_verbose("Creating $opt_vardir"); + mkpath($opt_vardir); + } - if ( $opt_mem ) + # Ensure a proper error message if vardir couldn't be created + unless ( -d $opt_vardir and -w $opt_vardir ) { - # Runinng with var as a link to some "memory" location, normally tmpfs - rmtree($opt_mem); - mkpath($opt_mem); - mtr_report("Creating symlink from $opt_vardir to $opt_mem"); - symlink($opt_mem, $opt_vardir); - # Put a small file to recognize this dir was created by --mem - mtr_tofile($created_by_mem_file, $opt_mem); + mtr_error("Writable 'var' directory is needed, use the " . + "'--vardir=<path>' option"); } mkpath("$opt_vardir/log"); @@ -2045,10 +2138,9 @@ sub cleanup_stale_files () { mkpath("$opt_vardir/tmp"); mkpath($opt_tmpdir) if $opt_tmpdir ne "$opt_vardir/tmp"; - # Remove old and create new data dirs + # Create new data dirs foreach my $data_dir (@data_dir_lst) { - rmtree("$data_dir"); mkpath("$data_dir/mysql"); mkpath("$data_dir/test"); } @@ -2456,8 +2548,8 @@ sub ndbcluster_start ($$) { sub rm_ndbcluster_tables ($) { my $dir= shift; - foreach my $bin ( glob("$dir/mysql/apply_status*"), - glob("$dir/mysql/schema*")) + foreach my $bin ( glob("$dir/mysql/ndb_apply_status*"), + glob("$dir/mysql/ndb_schema*")) { unlink($bin); } @@ -2562,7 +2654,7 @@ sub run_suite () { mtr_print_line(); if ( ! $glob_debugger and - ! $glob_use_running_server and + ! $opt_extern and ! $glob_use_embedded_server ) { stop_all_servers(); @@ -2591,28 +2683,41 @@ sub run_suite () { sub initialize_servers () { - datadir_setup(); + datadir_list_setup(); - if ( ! $glob_use_running_server ) + if ( $opt_extern ) + { + # Running against an already started server, if the specified + # vardir does not already exist it should be created + if ( ! -d $opt_vardir ) + { + mtr_report("Creating '$opt_vardir'"); + setup_vardir(); + } + else + { + mtr_report("No need to create '$opt_vardir' it already exists"); + } + } + else { kill_running_servers(); if ( ! $opt_start_dirty ) { - cleanup_stale_files(); + remove_stale_vardir(); + setup_vardir(); + mysql_install_db(); if ( $opt_force ) { + # Save a snapshot of the freshly installed db + # to make it possible to restore to a known point in time save_installed_db(); } } - check_running_as_root(); - } - else - { - # We have to create the 'var' and related directories - cleanup_stale_files(); } + check_running_as_root(); } sub mysql_install_db () { @@ -2979,29 +3084,15 @@ sub do_before_run_mysqltest($) unlink("$result_dir/$tname.log"); unlink("$result_dir/$tname.warnings"); - if (!$opt_extern) - { - 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($path_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 ( $mysql_version_id < 50000 ) { - # Set envirnoment variable NDB_STATUS_OK to 1 + # Set environment variable NDB_STATUS_OK to 1 # if script decided to run mysqltest cluster _is_ installed ok $ENV{'NDB_STATUS_OK'} = "1"; } elsif ( $mysql_version_id < 50100 ) { - # Set envirnoment variable NDB_STATUS_OK to YES + # Set environment variable NDB_STATUS_OK to YES # if script decided to run mysqltest cluster _is_ installed ok $ENV{'NDB_STATUS_OK'} = "YES"; } @@ -3012,14 +3103,34 @@ sub do_after_run_mysqltest($) my $tinfo= shift; my $tname= $tinfo->{'name'}; - mtr_tofile($path_mysqltest_log,"CURRENT TEST $tname\n"); - # Save info from this testcase run to mysqltest.log + mtr_appendfile_to_file($path_current_test_log, $path_mysqltest_log) + if -f $path_current_test_log; mtr_appendfile_to_file($path_timefile, $path_mysqltest_log) if -f $path_timefile; } +sub run_testcase_mark_logs($) +{ + my ($log_msg)= @_; + + # Write a marker to all log files + + # The file indicating current test name + mtr_tonewfile($path_current_test_log, $log_msg); + + # each mysqld's .err file + foreach my $mysqld (@{$master}, @{$slave}) + { + mtr_tofile($mysqld->{path_myerr}, $log_msg); + } + + # ndbcluster log file + mtr_tofile($path_ndb_testrun_log, $log_msg); + +} + sub find_testcase_skipped_reason($) { my ($tinfo)= @_; @@ -3121,7 +3232,7 @@ sub run_testcase ($) { # ------------------------------------------------------- $ENV{'TZ'}= $tinfo->{'timezone'}; - mtr_verbose("Starting server with timezone: $tinfo->{'timezone'}"); + mtr_verbose("Setting timezone: $tinfo->{'timezone'}"); my $master_restart= run_testcase_need_master_restart($tinfo); my $slave_restart= run_testcase_need_slave_restart($tinfo); @@ -3129,7 +3240,7 @@ sub run_testcase ($) { if ($master_restart or $slave_restart) { # Can't restart a running server that may be in use - if ( $glob_use_running_server ) + if ( $opt_extern ) { mtr_report_test_name($tinfo); $tinfo->{comment}= "Can't restart a running server"; @@ -3139,6 +3250,10 @@ sub run_testcase ($) { run_testcase_stop_servers($tinfo, $master_restart, $slave_restart); } + + # Write to all log files to indicate start of testcase + run_testcase_mark_logs("CURRENT_TEST: $tinfo->{name}\n"); + my $died= mtr_record_dead_children(); if ($died or $master_restart or $slave_restart) { @@ -3295,7 +3410,7 @@ sub report_failure_and_restart ($) { my $tinfo= shift; mtr_report_test_failed($tinfo); - mtr_show_failed_diff($tinfo->{'name'}); + mtr_show_failed_diff($tinfo->{'result_file'}); print "\n"; if ( $opt_force ) { @@ -3312,7 +3427,7 @@ sub report_failure_and_restart ($) { print "Aborting: $tinfo->{'name'} failed in $test_mode mode. "; print "To continue, re-run with '--force'.\n"; if ( ! $glob_debugger and - ! $glob_use_running_server and + ! $opt_extern and ! $glob_use_embedded_server ) { stop_all_servers(); @@ -3484,6 +3599,17 @@ sub mysqld_arguments ($$$$$) { mtr_add_arg($args, "%s--ndb-extra-logging", $prefix); } } + + if ( $mysql_version_id <= 50106 ) + { + # Force mysqld to use log files up until 5.1.6 + mtr_add_arg($args, "%s--log=%s", $prefix, $master->[0]->{'path_mylog'}); + } + else + { + # Turn on logging, will be sent to tables + mtr_add_arg($args, "%s--log=", $prefix); + } } if ( $type eq 'slave' ) @@ -3501,8 +3627,6 @@ sub mysqld_arguments ($$$$$) { mtr_add_arg($args, "%s--log-slave-updates", $prefix); } - mtr_add_arg($args, "%s--log=%s", $prefix, - $slave->[$idx]->{'path_mylog'}); mtr_add_arg($args, "%s--master-retry-count=10", $prefix); mtr_add_arg($args, "%s--pid-file=%s", $prefix, $slave->[$idx]->{'path_pid'}); @@ -3563,6 +3687,18 @@ sub mysqld_arguments ($$$$$) { mtr_add_arg($args, "%s--ndb-extra-logging", $prefix); } } + + if ( $mysql_version_id <= 50106 ) + { + # Force mysqld to use log files up until 5.1.6 + mtr_add_arg($args, "%s--log=%s", $prefix, $master->[0]->{'path_mylog'}); + } + else + { + # Turn on logging, will be sent to tables + mtr_add_arg($args, "%s--log=", $prefix); + } + } # end slave if ( $opt_debug ) @@ -3639,7 +3775,6 @@ sub mysqld_arguments ($$$$$) { elsif ( $type eq 'master' ) { mtr_add_arg($args, "%s--open-files-limit=1024", $prefix); - mtr_add_arg($args, "%s--log=%s", $prefix, $master->[0]->{'path_mylog'}); } return $args; @@ -3888,10 +4023,17 @@ sub run_testcase_need_master_restart($) } elsif( ! $master->[0]->{'pid'} ) { - $do_restart= 1; - mtr_verbose("Restart master: master is not started"); + if ( $opt_extern ) + { + $do_restart= 0; + mtr_verbose("No restart: using extern master"); + } + else + { + $do_restart= 1; + mtr_verbose("Restart master: master is not started"); + } } - return $do_restart; } @@ -4012,6 +4154,7 @@ sub run_testcase_stop_servers($$$) { if ( $do_restart || $do_slave_restart ) { + delete $slave->[0]->{'running_slave_options'}; # Forget history # Start shutdown of all started slaves @@ -4127,17 +4270,15 @@ sub run_testcase_start_servers($) { # tables ok FIXME This is a workaround so that only one mysqld # create the tables if ( ! sleep_until_file_created( - "$master->[0]->{'path_myddir'}/mysql/apply_status.ndb", + "$master->[0]->{'path_myddir'}/mysql/ndb_apply_status.ndb", $master->[0]->{'start_timeout'}, $master->[0]->{'pid'})) { - $tinfo->{'comment'}= "Failed to create 'mysql/apply_status' table"; + $tinfo->{'comment'}= "Failed to create 'mysql/ndb_apply_status' table"; return 1; } } - mtr_tofile($master->[1]->{'path_myerr'},"CURRENT_TEST: $tname\n"); - mysqld_start($master->[1],$tinfo->{'master_opt'},[]); } @@ -4165,8 +4306,6 @@ sub run_testcase_start_servers($) { # ---------------------------------------------------------------------- if ( $tinfo->{'slave_num'} ) { - mtr_tofile($slave->[0]->{'path_myerr'},"CURRENT_TEST: $tname\n"); - restore_slave_databases($tinfo->{'slave_num'}); do_before_start_slave($tinfo); @@ -4382,11 +4521,6 @@ sub run_mysqltest ($) { mtr_add_arg($args, "--timer-file=%s/log/timer", $opt_vardir); } - if ( $opt_big_test ) - { - mtr_add_arg($args, "--big-test"); - } - if ( $opt_compress ) { mtr_add_arg($args, "--compress"); @@ -4507,6 +4641,7 @@ sub run_mysqltest ($) { } return $res; + } @@ -4756,9 +4891,9 @@ Options to control directories to use vardir=DIR The directory where files generated from the test run is stored (default: ./var). Specifying a ramdisk or tmpfs will speed up tests. - mem[=DIR] Run testsuite in "memory" using tmpfs or ramdisk - Attempts to use DIR first if specified else - uses as builtin list of standard locations + mem Run testsuite in "memory" using tmpfs or ramdisk + Attempts to find a suitable location + using a builtin list of standard locations for tmpfs (/dev/shm) The option can also be set using environment variable MTR_MEM=[DIR] @@ -4776,9 +4911,8 @@ Options to control what test suites or cases to run skip-rpl Skip the replication test cases. skip-im Don't start IM, and skip the IM test cases skip-test=PREFIX Skip test cases which name are prefixed with PREFIX - big-test Pass "--big-test" to mysqltest which will set the - environment variable BIG_TEST, which can be checked - from test cases. + big-test Set the environment variable BIG_TEST, which can be + checked from test cases. Options that specify ports @@ -4800,10 +4934,11 @@ Options that pass on options Options to run test on running server - extern Use running server for tests FIXME DANGEROUS + extern Use running server for tests ndb-connectstring=STR Use running cluster, and connect using STR ndb-connectstring-slave=STR Use running slave cluster, and connect using STR - user=USER User for connect to server + user=USER User for connection to extern server + socket=PATH Socket for connection to extern server Options for debugging the product @@ -4852,23 +4987,15 @@ Misc options unified-diff | udiff When presenting differences, use unified diff testcase-timeout=MINUTES Max test case run time (default $default_testcase_timeout) - suite-timeout=MINUTES Max test suite run time (default $default_suite_timeout) + suite-timeout=MINUTES Max test suite run time (default $default_suite_timeout) + warnings | log-warnings Pass --log-warnings to mysqld + sleep=SECONDS Passed to mysqltest, will be used as fixed sleep time Deprecated options with-openssl Deprecated option for ssl -Options not yet described, or that I want to look into more - local - netware - sleep=SECONDS - socket=PATH - user-test=s - wait-timeout=SECONDS - warnings - log-warnings - HERE mtr_exit(1); diff --git a/mysql-test/r/1st.result b/mysql-test/r/1st.result index f167ce2a1ac..60190629dd0 100644 --- a/mysql-test/r/1st.result +++ b/mysql-test/r/1st.result @@ -5,7 +5,6 @@ mysql test show tables in mysql; Tables_in_mysql -binlog_index columns_priv db event @@ -16,6 +15,7 @@ help_keyword help_relation help_topic host +ndb_binlog_index plugin proc procs_priv diff --git a/mysql-test/r/alter_table.result b/mysql-test/r/alter_table.result index d3657d84678..ebc8342c8ce 100644 --- a/mysql-test/r/alter_table.result +++ b/mysql-test/r/alter_table.result @@ -541,6 +541,127 @@ create table t1 ( a timestamp ); alter table t1 add unique ( a(1) ); ERROR HY000: Incorrect sub part key; the used key part isn't a string, the used length is longer than the key part, or the storage engine doesn't support unique sub keys drop table t1; +drop table if exists t1; +create table t1 (a int, key(a)); +show indexes from t1; +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment +t1 1 a 1 a A NULL NULL NULL YES BTREE +"this used not to disable the index" +alter table t1 modify a int, disable keys; +show indexes from t1; +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment +t1 1 a 1 a A NULL NULL NULL YES BTREE disabled +alter table t1 enable keys; +show indexes from t1; +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment +t1 1 a 1 a A NULL NULL NULL YES BTREE +alter table t1 modify a bigint, disable keys; +show indexes from t1; +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment +t1 1 a 1 a A NULL NULL NULL YES BTREE disabled +alter table t1 enable keys; +show indexes from t1; +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment +t1 1 a 1 a A NULL NULL NULL YES BTREE +alter table t1 add b char(10), disable keys; +show indexes from t1; +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment +t1 1 a 1 a A NULL NULL NULL YES BTREE disabled +alter table t1 add c decimal(10,2), enable keys; +show indexes from t1; +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment +t1 1 a 1 a A NULL NULL NULL YES BTREE +"this however did" +alter table t1 disable keys; +show indexes from t1; +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment +t1 1 a 1 a A NULL NULL NULL YES BTREE disabled +desc t1; +Field Type Null Key Default Extra +a bigint(20) YES MUL NULL +b char(10) YES NULL +c decimal(10,2) YES NULL +alter table t1 add d decimal(15,5); +"The key should still be disabled" +show indexes from t1; +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment +t1 1 a 1 a A NULL NULL NULL YES BTREE disabled +drop table t1; +"Now will test with one unique index" +create table t1(a int, b char(10), unique(a)); +show indexes from t1; +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment +t1 0 a 1 a A NULL NULL NULL YES BTREE +alter table t1 disable keys; +show indexes from t1; +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment +t1 0 a 1 a A NULL NULL NULL YES BTREE +alter table t1 enable keys; +"If no copy on noop change, this won't touch the data file" +"Unique index, no change" +alter table t1 modify a int, disable keys; +show indexes from t1; +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment +t1 0 a 1 a A NULL NULL NULL YES BTREE +"Change the type implying data copy" +"Unique index, no change" +alter table t1 modify a bigint, disable keys; +show indexes from t1; +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment +t1 0 a 1 a A NULL NULL NULL YES BTREE +alter table t1 modify a bigint; +show indexes from t1; +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment +t1 0 a 1 a A NULL NULL NULL YES BTREE +alter table t1 modify a int; +show indexes from t1; +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment +t1 0 a 1 a A NULL NULL NULL YES BTREE +drop table t1; +"Now will test with one unique and one non-unique index" +create table t1(a int, b char(10), unique(a), key(b)); +show indexes from t1; +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment +t1 0 a 1 a A NULL NULL NULL YES BTREE +t1 1 b 1 b A NULL NULL NULL YES BTREE +alter table t1 disable keys; +show indexes from t1; +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment +t1 0 a 1 a A NULL NULL NULL YES BTREE +t1 1 b 1 b A NULL NULL NULL YES BTREE disabled +alter table t1 enable keys; +"If no copy on noop change, this won't touch the data file" +"The non-unique index will be disabled" +alter table t1 modify a int, disable keys; +show indexes from t1; +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment +t1 0 a 1 a A NULL NULL NULL YES BTREE +t1 1 b 1 b A NULL NULL NULL YES BTREE disabled +alter table t1 enable keys; +show indexes from t1; +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment +t1 0 a 1 a A NULL NULL NULL YES BTREE +t1 1 b 1 b A NULL NULL NULL YES BTREE +"Change the type implying data copy" +"The non-unique index will be disabled" +alter table t1 modify a bigint, disable keys; +show indexes from t1; +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment +t1 0 a 1 a A NULL NULL NULL YES BTREE +t1 1 b 1 b A NULL NULL NULL YES BTREE disabled +"Change again the type, but leave the indexes as_is" +alter table t1 modify a int; +show indexes from t1; +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment +t1 0 a 1 a A NULL NULL NULL YES BTREE +t1 1 b 1 b A NULL NULL NULL YES BTREE disabled +"Try the same. When data is no copied on similar tables, this is noop" +alter table t1 modify a int; +show indexes from t1; +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment +t1 0 a 1 a A NULL NULL NULL YES BTREE +t1 1 b 1 b A NULL NULL NULL YES BTREE disabled +drop table t1; create database mysqltest; create table t1 (c1 int); alter table t1 rename mysqltest.t1; @@ -556,6 +677,17 @@ ERROR 3D000: No database selected alter table test.t1 rename test.t1; use test; drop table t1; +DROP TABLE IF EXISTS bug24219; +DROP TABLE IF EXISTS bug24219_2; +CREATE TABLE bug24219 (a INT, INDEX(a)); +SHOW INDEX FROM bug24219; +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment +bug24219 1 a 1 a A NULL NULL NULL YES BTREE +ALTER TABLE bug24219 RENAME TO bug24219_2, DISABLE KEYS; +SHOW INDEX FROM bug24219_2; +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment +bug24219_2 1 a 1 a A NULL NULL NULL YES BTREE disabled +DROP TABLE bug24219_2; create table t1 (mycol int(10) not null); alter table t1 alter column mycol set default 0; desc t1; @@ -722,3 +854,45 @@ Table Create Table `c1` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE `#sql2`, `@0023sql1`; +DROP TABLE IF EXISTS t1; +DROP TABLE IF EXISTS t2; +CREATE TABLE t1 ( +int_field INTEGER UNSIGNED NOT NULL, +char_field CHAR(10), +INDEX(`int_field`) +); +DESCRIBE t1; +Field Type Null Key Default Extra +int_field int(10) unsigned NO MUL +char_field char(10) YES NULL +SHOW INDEXES FROM t1; +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment +t1 1 int_field 1 int_field A NULL NULL NULL BTREE +INSERT INTO t1 VALUES (1, "edno"), (1, "edno"), (2, "dve"), (3, "tri"), (5, "pet"); +"Non-copy data change - new frm, but old data and index files" +ALTER TABLE t1 +CHANGE int_field unsigned_int_field INTEGER UNSIGNED NOT NULL, +RENAME t2; +SELECT * FROM t1 ORDER BY int_field; +ERROR 42S02: Table 'test.t1' doesn't exist +SELECT * FROM t2 ORDER BY unsigned_int_field; +unsigned_int_field char_field +1 edno +1 edno +2 dve +3 tri +5 pet +DESCRIBE t2; +Field Type Null Key Default Extra +unsigned_int_field int(10) unsigned NO MUL +char_field char(10) YES NULL +DESCRIBE t2; +Field Type Null Key Default Extra +unsigned_int_field int(10) unsigned NO MUL +char_field char(10) YES NULL +ALTER TABLE t2 MODIFY unsigned_int_field BIGINT UNSIGNED NOT NULL; +DESCRIBE t2; +Field Type Null Key Default Extra +unsigned_int_field bigint(20) unsigned NO MUL +char_field char(10) YES NULL +DROP TABLE t2; diff --git a/mysql-test/r/bigint.result b/mysql-test/r/bigint.result index c27ce18cfd3..d8f78cd5103 100644 --- a/mysql-test/r/bigint.result +++ b/mysql-test/r/bigint.result @@ -341,3 +341,14 @@ select * from t1 where bigint_col='17666000000000000000'; bigint_col 17666000000000000000 drop table t1; + +bug 19955 -- mod is signed with bigint +select cast(10000002383263201056 as unsigned) mod 50 as result; +result +6 +create table t1 (c1 bigint unsigned); +insert into t1 values (10000002383263201056); +select c1 mod 50 as result from t1; +result +6 +drop table t1; diff --git a/mysql-test/r/compare.result b/mysql-test/r/compare.result index da0ca8ddba1..c141b255716 100644 --- a/mysql-test/r/compare.result +++ b/mysql-test/r/compare.result @@ -46,6 +46,10 @@ create table t1 (a tinyint(1),b binary(1)); insert into t1 values (0x01,0x01); select * from t1 where a=b; a b +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '' select * from t1 where a=b and b=0x01; a b +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '' drop table if exists t1; diff --git a/mysql-test/r/connect.result b/mysql-test/r/connect.result index 47c5a6822bd..25cf4f90e6d 100644 --- a/mysql-test/r/connect.result +++ b/mysql-test/r/connect.result @@ -1,7 +1,6 @@ drop table if exists t1,t2; show tables; Tables_in_mysql -binlog_index columns_priv db event @@ -12,6 +11,7 @@ help_keyword help_relation help_topic host +ndb_binlog_index plugin proc procs_priv @@ -34,7 +34,6 @@ grant ALL on *.* to test@localhost identified by "gambling"; grant ALL on *.* to test@127.0.0.1 identified by "gambling"; show tables; Tables_in_mysql -binlog_index columns_priv db event @@ -45,6 +44,7 @@ help_keyword help_relation help_topic host +ndb_binlog_index plugin proc procs_priv @@ -75,7 +75,6 @@ ERROR HY000: Password hash should be a 41-digit hexadecimal number set password=old_password('gambling3'); show tables; Tables_in_mysql -binlog_index columns_priv db event @@ -86,6 +85,7 @@ help_keyword help_relation help_topic host +ndb_binlog_index plugin proc procs_priv diff --git a/mysql-test/r/date_formats.result b/mysql-test/r/date_formats.result index 017631bf8d1..cf3495ef26d 100644 --- a/mysql-test/r/date_formats.result +++ b/mysql-test/r/date_formats.result @@ -189,12 +189,12 @@ date format datetime 2003-01-02 02:11:12.12345AM %Y-%m-%d %h:%i:%S.%f %p 2003-01-02 02:11:12.123450 2003-01-02 12:11:12.12345 am %Y-%m-%d %h:%i:%S.%f%p 2003-01-02 00:11:12.123450 2003-01-02 11:11:12Pm %Y-%m-%d %h:%i:%S%p 2003-01-02 23:11:12 -10:20:10 %H:%i:%s 0000-00-00 10:20:10 -10:20:10 %h:%i:%s.%f 0000-00-00 10:20:10 -10:20:10 %T 0000-00-00 10:20:10 -10:20:10AM %h:%i:%s%p 0000-00-00 10:20:10 -10:20:10AM %r 0000-00-00 10:20:10 -10:20:10.44AM %h:%i:%s.%f%p 0000-00-00 10:20:10.440000 +10:20:10 %H:%i:%s 0000-00-00 00:00:00 +10:20:10 %h:%i:%s.%f 0000-00-00 00:00:00 +10:20:10 %T 0000-00-00 00:00:00 +10:20:10AM %h:%i:%s%p 0000-00-00 00:00:00 +10:20:10AM %r 0000-00-00 00:00:00 +10:20:10.44AM %h:%i:%s.%f%p 0000-00-00 00:00:00 15-01-2001 12:59:58 %d-%m-%Y %H:%i:%S 2001-01-15 12:59:58 15 September 2001 %d %M %Y 2001-09-15 00:00:00 15 SEPTEMB 2001 %d %M %Y 2001-09-15 00:00:00 @@ -211,6 +211,13 @@ Tuesday 52 2001 %W %V %X 2002-01-01 00:00:00 15-01-2001 %d-%m-%Y %H:%i:%S 2001-01-15 00:00:00 15-01-20 %d-%m-%y 2020-01-15 00:00:00 15-2001-1 %d-%Y-%c 2001-01-15 00:00:00 +Warnings: +Warning 1292 Incorrect datetime value: '0000-00-00 10:20:10' +Warning 1292 Incorrect datetime value: '0000-00-00 10:20:10' +Warning 1292 Incorrect datetime value: '0000-00-00 10:20:10' +Warning 1292 Incorrect datetime value: '0000-00-00 10:20:10' +Warning 1292 Incorrect datetime value: '0000-00-00 10:20:10' +Warning 1292 Incorrect datetime value: '0000-00-00 10:20:10.440000' select date,format,DATE(str_to_date(date, format)) as date2 from t1; date format date2 2003-01-02 10:11:12 %Y-%m-%d %H:%i:%S 2003-01-02 @@ -251,12 +258,12 @@ date format time 2003-01-02 02:11:12.12345AM %Y-%m-%d %h:%i:%S.%f %p 02:11:12.123450 2003-01-02 12:11:12.12345 am %Y-%m-%d %h:%i:%S.%f%p 00:11:12.123450 2003-01-02 11:11:12Pm %Y-%m-%d %h:%i:%S%p 23:11:12 -10:20:10 %H:%i:%s 10:20:10 -10:20:10 %h:%i:%s.%f 10:20:10 -10:20:10 %T 10:20:10 -10:20:10AM %h:%i:%s%p 10:20:10 -10:20:10AM %r 10:20:10 -10:20:10.44AM %h:%i:%s.%f%p 10:20:10.440000 +10:20:10 %H:%i:%s NULL +10:20:10 %h:%i:%s.%f NULL +10:20:10 %T NULL +10:20:10AM %h:%i:%s%p NULL +10:20:10AM %r NULL +10:20:10.44AM %h:%i:%s.%f%p NULL 15-01-2001 12:59:58 %d-%m-%Y %H:%i:%S 12:59:58 15 September 2001 %d %M %Y 00:00:00 15 SEPTEMB 2001 %d %M %Y 00:00:00 @@ -273,6 +280,13 @@ Tuesday 52 2001 %W %V %X 00:00:00 15-01-2001 %d-%m-%Y %H:%i:%S 00:00:00 15-01-20 %d-%m-%y 00:00:00 15-2001-1 %d-%Y-%c 00:00:00 +Warnings: +Warning 1292 Truncated incorrect time value: '0000-00-00 10:20:10' +Warning 1292 Truncated incorrect time value: '0000-00-00 10:20:10' +Warning 1292 Truncated incorrect time value: '0000-00-00 10:20:10' +Warning 1292 Truncated incorrect time value: '0000-00-00 10:20:10' +Warning 1292 Truncated incorrect time value: '0000-00-00 10:20:10' +Warning 1292 Truncated incorrect time value: '0000-00-00 10:20:10.440000' select date,format,concat(TIME(str_to_date(date, format))) as time2 from t1; date format time2 2003-01-02 10:11:12 %Y-%m-%d %H:%i:%S 10:11:12 @@ -282,12 +296,12 @@ date format time2 2003-01-02 02:11:12.12345AM %Y-%m-%d %h:%i:%S.%f %p 02:11:12.123450 2003-01-02 12:11:12.12345 am %Y-%m-%d %h:%i:%S.%f%p 00:11:12.123450 2003-01-02 11:11:12Pm %Y-%m-%d %h:%i:%S%p 23:11:12 -10:20:10 %H:%i:%s 10:20:10 -10:20:10 %h:%i:%s.%f 10:20:10 -10:20:10 %T 10:20:10 -10:20:10AM %h:%i:%s%p 10:20:10 -10:20:10AM %r 10:20:10 -10:20:10.44AM %h:%i:%s.%f%p 10:20:10.440000 +10:20:10 %H:%i:%s NULL +10:20:10 %h:%i:%s.%f NULL +10:20:10 %T NULL +10:20:10AM %h:%i:%s%p NULL +10:20:10AM %r NULL +10:20:10.44AM %h:%i:%s.%f%p NULL 15-01-2001 12:59:58 %d-%m-%Y %H:%i:%S 12:59:58 15 September 2001 %d %M %Y 00:00:00 15 SEPTEMB 2001 %d %M %Y 00:00:00 @@ -304,6 +318,13 @@ Tuesday 52 2001 %W %V %X 00:00:00 15-01-2001 %d-%m-%Y %H:%i:%S 00:00:00 15-01-20 %d-%m-%y 00:00:00 15-2001-1 %d-%Y-%c 00:00:00 +Warnings: +Warning 1292 Truncated incorrect time value: '0000-00-00 10:20:10' +Warning 1292 Truncated incorrect time value: '0000-00-00 10:20:10' +Warning 1292 Truncated incorrect time value: '0000-00-00 10:20:10' +Warning 1292 Truncated incorrect time value: '0000-00-00 10:20:10' +Warning 1292 Truncated incorrect time value: '0000-00-00 10:20:10' +Warning 1292 Truncated incorrect time value: '0000-00-00 10:20:10.440000' select concat('',str_to_date('8:11:2.123456 03-01-02','%H:%i:%S.%f %y-%m-%d')); concat('',str_to_date('8:11:2.123456 03-01-02','%H:%i:%S.%f %y-%m-%d')) 2003-01-02 08:11:02.123456 @@ -574,4 +595,13 @@ DATE_FORMAT('%Y-%m-%d %H:%i:%s', 1151414896) NULL Warnings: Warning 1292 Incorrect datetime value: '%Y-%m-%d %H:%i:%s' +select str_to_date('04 /30/2004', '%m /%d/%Y'); +str_to_date('04 /30/2004', '%m /%d/%Y') +2004-04-30 +select str_to_date('04/30 /2004', '%m /%d /%Y'); +str_to_date('04/30 /2004', '%m /%d /%Y') +2004-04-30 +select str_to_date('04/30/2004 ', '%m/%d/%Y '); +str_to_date('04/30/2004 ', '%m/%d/%Y ') +2004-04-30 "End of 4.1 tests" diff --git a/mysql-test/r/default.result b/mysql-test/r/default.result index 697b0976cee..9bef2e2fdbf 100644 --- a/mysql-test/r/default.result +++ b/mysql-test/r/default.result @@ -104,3 +104,95 @@ a b c d e f g h i j k l m n o p q r s t u v w x y z a1 b1 1 0000 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL drop table t1; drop table t2; +create table bug20691 (i int, d datetime NOT NULL, dn datetime not null default '0000-00-00 00:00:00'); +insert into bug20691 values (1, DEFAULT, DEFAULT), (1, '1975-07-10 07:10:03', '1978-01-13 14:08:51'), (1, DEFAULT, DEFAULT); +Warnings: +Warning 1364 Field 'd' doesn't have a default value +Warning 1364 Field 'd' doesn't have a default value +insert into bug20691 (i) values (2); +Warnings: +Warning 1364 Field 'd' doesn't have a default value +desc bug20691; +Field Type Null Key Default Extra +i int(11) YES NULL +d datetime NO +dn datetime NO 0000-00-00 00:00:00 +insert into bug20691 values (3, DEFAULT, DEFAULT), (3, '1975-07-10 07:10:03', '1978-01-13 14:08:51'), (3, DEFAULT, DEFAULT); +Warnings: +Warning 1364 Field 'd' doesn't have a default value +Warning 1364 Field 'd' doesn't have a default value +insert into bug20691 (i) values (4); +Warnings: +Warning 1364 Field 'd' doesn't have a default value +insert into bug20691 values (5, DEFAULT, DEFAULT), (5, '1975-07-10 07:10:03', '1978-01-13 14:08:51'), (5, DEFAULT, DEFAULT); +Warnings: +Warning 1364 Field 'd' doesn't have a default value +Warning 1364 Field 'd' doesn't have a default value +SET sql_mode = 'ALLOW_INVALID_DATES'; +insert into bug20691 values (6, DEFAULT, DEFAULT), (6, '1975-07-10 07:10:03', '1978-01-13 14:08:51'), (6, DEFAULT, DEFAULT); +Warnings: +Warning 1364 Field 'd' doesn't have a default value +Warning 1364 Field 'd' doesn't have a default value +SET sql_mode = 'STRICT_ALL_TABLES'; +insert into bug20691 values (7, DEFAULT, DEFAULT), (7, '1975-07-10 07:10:03', '1978-01-13 14:08:51'), (7, DEFAULT, DEFAULT); +ERROR HY000: Field 'd' doesn't have a default value +select * from bug20691 order by i asc; +i d dn +1 0000-00-00 00:00:00 0000-00-00 00:00:00 +1 1975-07-10 07:10:03 1978-01-13 14:08:51 +1 0000-00-00 00:00:00 0000-00-00 00:00:00 +2 0000-00-00 00:00:00 0000-00-00 00:00:00 +3 0000-00-00 00:00:00 0000-00-00 00:00:00 +3 1975-07-10 07:10:03 1978-01-13 14:08:51 +3 0000-00-00 00:00:00 0000-00-00 00:00:00 +4 0000-00-00 00:00:00 0000-00-00 00:00:00 +5 0000-00-00 00:00:00 0000-00-00 00:00:00 +5 1975-07-10 07:10:03 1978-01-13 14:08:51 +5 0000-00-00 00:00:00 0000-00-00 00:00:00 +6 0000-00-00 00:00:00 0000-00-00 00:00:00 +6 1975-07-10 07:10:03 1978-01-13 14:08:51 +6 0000-00-00 00:00:00 0000-00-00 00:00:00 +drop table bug20691; +SET sql_mode = ''; +create table bug20691 ( +a set('one', 'two', 'three') not null, +b enum('small', 'medium', 'large', 'enormous', 'ellisonego') not null, +c time not null, +d date not null, +e int not null, +f long not null, +g blob not null, +h datetime not null, +i decimal not null, +x int); +insert into bug20691 values (2, 3, 5, '0007-01-01', 11, 13, 17, '0019-01-01 00:00:00', 23, 1); +insert into bug20691 (x) values (2); +Warnings: +Warning 1364 Field 'a' doesn't have a default value +Warning 1364 Field 'c' doesn't have a default value +Warning 1364 Field 'd' doesn't have a default value +Warning 1364 Field 'e' doesn't have a default value +Warning 1364 Field 'f' doesn't have a default value +Warning 1364 Field 'g' doesn't have a default value +Warning 1364 Field 'h' doesn't have a default value +Warning 1364 Field 'i' doesn't have a default value +insert into bug20691 values (2, 3, 5, '0007-01-01', 11, 13, 17, '0019-01-01 00:00:00', 23, 3); +insert into bug20691 values (DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, 4); +Warnings: +Warning 1364 Field 'a' doesn't have a default value +Warning 1364 Field 'b' doesn't have a default value +Warning 1364 Field 'c' doesn't have a default value +Warning 1364 Field 'd' doesn't have a default value +Warning 1364 Field 'e' doesn't have a default value +Warning 1364 Field 'f' doesn't have a default value +Warning 1364 Field 'g' doesn't have a default value +Warning 1364 Field 'h' doesn't have a default value +Warning 1364 Field 'i' doesn't have a default value +select * from bug20691 order by x asc; +a b c d e f g h i x +two large 00:00:05 0007-01-01 11 13 17 0019-01-01 00:00:00 23 1 + small 00:00:00 0000-00-00 0 0000-00-00 00:00:00 0 2 +two large 00:00:05 0007-01-01 11 13 17 0019-01-01 00:00:00 23 3 + small 00:00:00 0000-00-00 0 0000-00-00 00:00:00 0 4 +drop table bug20691; +End of 5.0 tests. diff --git a/mysql-test/r/fix_priv_tables.result b/mysql-test/r/fix_priv_tables.result new file mode 100644 index 00000000000..e54330a5520 --- /dev/null +++ b/mysql-test/r/fix_priv_tables.result @@ -0,0 +1,36 @@ +drop table if exists t1,t1aa,t2aa; +DROP DATABASE IF EXISTS testdb; +CREATE DATABASE testdb; +CREATE TABLE testdb.t1 ( +c1 INT, +c3 INT NOT NULL AUTO_INCREMENT PRIMARY KEY); +CREATE VIEW testdb.v1 AS +SELECT * FROM testdb.t1; +GRANT CREATE VIEW, SHOW VIEW ON testdb.v1 TO 'show_view_tbl'@'localhost'; +SHOW GRANTS FOR 'show_view_tbl'@'localhost'; +Grants for show_view_tbl@localhost +GRANT USAGE ON *.* TO 'show_view_tbl'@'localhost' +GRANT CREATE VIEW, SHOW VIEW ON `testdb`.`v1` TO 'show_view_tbl'@'localhost' + +GRANT SELECT(c1) on testdb.v1 to 'select_only_c1'@localhost; +SHOW GRANTS FOR 'select_only_c1'@'localhost'; +Grants for select_only_c1@localhost +GRANT USAGE ON *.* TO 'select_only_c1'@'localhost' +GRANT SELECT (c1) ON `testdb`.`v1` TO 'select_only_c1'@'localhost' + +"after fix privs" +SHOW GRANTS FOR 'show_view_tbl'@'localhost'; +Grants for show_view_tbl@localhost +GRANT USAGE ON *.* TO 'show_view_tbl'@'localhost' +GRANT CREATE VIEW, SHOW VIEW ON `testdb`.`v1` TO 'show_view_tbl'@'localhost' + +SHOW GRANTS FOR 'select_only_c1'@'localhost'; +Grants for select_only_c1@localhost +GRANT USAGE ON *.* TO 'select_only_c1'@'localhost' +GRANT SELECT (c1) ON `testdb`.`v1` TO 'select_only_c1'@'localhost' + +DROP USER 'show_view_tbl'@'localhost'; +DROP USER 'select_only_c1'@'localhost'; +DROP VIEW testdb.v1; +DROP TABLE testdb.t1; +DROP DATABASE testdb; diff --git a/mysql-test/r/fix_priv_tabs.result b/mysql-test/r/fix_priv_tabs.result new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/mysql-test/r/fix_priv_tabs.result diff --git a/mysql-test/r/flush2.result b/mysql-test/r/flush2.result new file mode 100644 index 00000000000..7c94219fd71 --- /dev/null +++ b/mysql-test/r/flush2.result @@ -0,0 +1,24 @@ +flush logs; +set global expire_logs_days = 3; +show variables like 'log%'; +Variable_name Value +log ON +log_bin OFF +log_bin_trust_function_creators ON +log_error +log_queries_not_using_indexes OFF +log_slave_updates OFF +log_slow_queries OFF +log_warnings 1 +flush logs; +show variables like 'log%'; +Variable_name Value +log ON +log_bin OFF +log_bin_trust_function_creators ON +log_error +log_queries_not_using_indexes OFF +log_slave_updates OFF +log_slow_queries OFF +log_warnings 1 +set global expire_logs_days = 0; diff --git a/mysql-test/r/func_in.result b/mysql-test/r/func_in.result index 6578af7cd8b..16f285f0275 100644 --- a/mysql-test/r/func_in.result +++ b/mysql-test/r/func_in.result @@ -358,16 +358,22 @@ select f1 from t1 where f1 in ('a',1); f1 a 1 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'b' select f1, case f1 when 'a' then '+' when 1 then '-' end from t1; f1 case f1 when 'a' then '+' when 1 then '-' end a + b NULL 1 - +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'b' create index t1f1_idx on t1(f1); select f1 from t1 where f1 in ('a',1); f1 1 a +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'b' explain select f1 from t1 where f1 in ('a',1); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index NULL t1f1_idx 2 NULL 3 Using where; Using index @@ -381,6 +387,9 @@ id select_type table type possible_keys key key_len ref rows Extra select f1 from t1 where f1 in (2,1); f1 1 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'a' +Warning 1292 Truncated incorrect DOUBLE value: 'b' explain select f1 from t1 where f1 in (2,1); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index t1f1_idx t1f1_idx 2 NULL 3 Using where; Using index diff --git a/mysql-test/r/func_misc.result b/mysql-test/r/func_misc.result index 3ebf071a5bb..84974f845c5 100644 --- a/mysql-test/r/func_misc.result +++ b/mysql-test/r/func_misc.result @@ -134,4 +134,11 @@ timediff(b, a) >= '00:00:03' drop table t2; drop table t1; set global query_cache_size=default; +create table t1 select INET_ATON('255.255.0.1') as `a`; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` bigint(21) unsigned DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; End of 5.0 tests diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result index d7f65e84462..1f52076f3d2 100644 --- a/mysql-test/r/func_time.result +++ b/mysql-test/r/func_time.result @@ -1047,6 +1047,9 @@ union (select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 HOUR)),'%k') As H); H 5 +select last_day('0000-00-00'); +last_day('0000-00-00') +NULL 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; @@ -1057,6 +1060,7 @@ Note 1003 select timestampdiff(WEEK,_latin1'2001-02-01',_latin1'2001-05-01') AS select time_format('100:00:00', '%H %k %h %I %l'); time_format('100:00:00', '%H %k %h %I %l') 100 100 04 04 4 +SET GLOBAL log_bin_trust_function_creators = 1; create table t1 (a timestamp default '2005-05-05 01:01:01', b timestamp default '2005-05-05 01:01:01'); drop function if exists t_slow_sysdate; @@ -1080,6 +1084,7 @@ a != b drop trigger t_before; drop function t_slow_sysdate; drop table t1; +SET GLOBAL log_bin_trust_function_creators = 0; create table t1 (a datetime, i int, b datetime); insert into t1 select sysdate(), sleep(1), sysdate() from dual; select a != b from t1; @@ -1175,6 +1180,9 @@ id day id day 3 2005-07-01 3 2005-07-15 DROP TABLE t1,t2; set time_zone= @@global.time_zone; +select str_to_date('10:00 PM', '%h:%i %p') + INTERVAL 10 MINUTE; +str_to_date('10:00 PM', '%h:%i %p') + INTERVAL 10 MINUTE +NULL End of 5.0 tests select date_sub("0050-01-01 00:00:01",INTERVAL 2 SECOND); date_sub("0050-01-01 00:00:01",INTERVAL 2 SECOND) diff --git a/mysql-test/r/gis.result b/mysql-test/r/gis.result index 6a90ad27625..3848368fedd 100644 --- a/mysql-test/r/gis.result +++ b/mysql-test/r/gis.result @@ -679,10 +679,11 @@ insert into t1 values (null,null); ERROR 23000: Column 's1' cannot be null drop table t1; drop procedure if exists fn3; -create function fn3 () returns point return GeomFromText("point(1 1)"); +create function fn3 () returns point deterministic return GeomFromText("point(1 1)"); show create function fn3; Function sql_mode Create Function fn3 CREATE DEFINER=`root`@`localhost` FUNCTION `fn3`() RETURNS point + DETERMINISTIC return GeomFromText("point(1 1)") select astext(fn3()); astext(fn3()) diff --git a/mysql-test/r/grant.result b/mysql-test/r/grant.result index 5dbbfbd9ab8..13f9950a337 100644 --- a/mysql-test/r/grant.result +++ b/mysql-test/r/grant.result @@ -948,6 +948,71 @@ DROP USER 'mysqltest_1'@'localhost'; use test; create user mysqltest1_thisisreallytoolong; ERROR HY000: String 'mysqltest1_thisisreallytoolong' is too long for user name (should be no longer than 16) +CREATE DATABASE mysqltest1; +CREATE TABLE mysqltest1.t1 ( +int_field INTEGER UNSIGNED NOT NULL, +char_field CHAR(10), +INDEX(`int_field`) +); +CREATE TABLE mysqltest1.t2 (int_field INT); +"Now check that we require equivalent grants for " +"RENAME TABLE and ALTER TABLE" +CREATE USER mysqltest_1@localhost; +GRANT SELECT ON mysqltest1.t1 TO mysqltest_1@localhost; +SELECT USER(); +USER() +mysqltest_1@localhost +SHOW GRANTS; +Grants for mysqltest_1@localhost +GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' +GRANT SELECT ON `mysqltest1`.`t1` TO 'mysqltest_1'@'localhost' +RENAME TABLE t1 TO t2; +ERROR 42000: ALTER command denied to user 'mysqltest_1'@'localhost' for table 't1' +ALTER TABLE t1 RENAME TO t2; +ERROR 42000: DROP,ALTER command denied to user 'mysqltest_1'@'localhost' for table 't1' +GRANT DROP ON mysqltest1.t1 TO mysqltest_1@localhost; +RENAME TABLE t1 TO t2; +ERROR 42000: ALTER command denied to user 'mysqltest_1'@'localhost' for table 't1' +ALTER TABLE t1 RENAME TO t2; +ERROR 42000: ALTER command denied to user 'mysqltest_1'@'localhost' for table 't1' +GRANT ALTER ON mysqltest1.t1 TO mysqltest_1@localhost; +SHOW GRANTS; +Grants for mysqltest_1@localhost +GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' +GRANT SELECT, DROP, ALTER ON `mysqltest1`.`t1` TO 'mysqltest_1'@'localhost' +RENAME TABLE t1 TO t2; +ERROR 42000: INSERT,CREATE command denied to user 'mysqltest_1'@'localhost' for table 't2' +ALTER TABLE t1 RENAME TO t2; +ERROR 42000: INSERT,CREATE command denied to user 'mysqltest_1'@'localhost' for table 't2' +GRANT INSERT, CREATE ON mysqltest1.t1 TO mysqltest_1@localhost; +SHOW GRANTS; +Grants for mysqltest_1@localhost +GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' +GRANT SELECT, INSERT, CREATE, DROP, ALTER ON `mysqltest1`.`t1` TO 'mysqltest_1'@'localhost' +GRANT INSERT, SELECT, CREATE, ALTER, DROP ON mysqltest1.t2 TO mysqltest_1@localhost; +DROP TABLE mysqltest1.t2; +SHOW GRANTS; +Grants for mysqltest_1@localhost +GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' +GRANT SELECT, INSERT, CREATE, DROP, ALTER ON `mysqltest1`.`t2` TO 'mysqltest_1'@'localhost' +GRANT SELECT, INSERT, CREATE, DROP, ALTER ON `mysqltest1`.`t1` TO 'mysqltest_1'@'localhost' +RENAME TABLE t1 TO t2; +RENAME TABLE t2 TO t1; +ALTER TABLE t1 RENAME TO t2; +ALTER TABLE t2 RENAME TO t1; +REVOKE DROP, INSERT ON mysqltest1.t1 FROM mysqltest_1@localhost; +REVOKE DROP, INSERT ON mysqltest1.t2 FROM mysqltest_1@localhost; +SHOW GRANTS; +Grants for mysqltest_1@localhost +GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' +GRANT SELECT, CREATE, ALTER ON `mysqltest1`.`t2` TO 'mysqltest_1'@'localhost' +GRANT SELECT, CREATE, ALTER ON `mysqltest1`.`t1` TO 'mysqltest_1'@'localhost' +RENAME TABLE t1 TO t2; +ERROR 42000: INSERT command denied to user 'mysqltest_1'@'localhost' for table 't2' +ALTER TABLE t1 RENAME TO t2; +ERROR 42000: DROP command denied to user 'mysqltest_1'@'localhost' for table 't1' +DROP USER mysqltest_1@localhost; +DROP DATABASE mysqltest1; GRANT CREATE ON mysqltest.* TO 1234567890abcdefGHIKL@localhost; ERROR HY000: String '1234567890abcdefGHIKL' is too long for user name (should be no longer than 16) GRANT CREATE ON mysqltest.* TO some_user_name@1234567890abcdefghij1234567890abcdefghij1234567890abcdefghijQWERTY; diff --git a/mysql-test/r/grant2.result b/mysql-test/r/grant2.result index 4b089c1d5e9..03019bd5c1f 100644 --- a/mysql-test/r/grant2.result +++ b/mysql-test/r/grant2.result @@ -365,13 +365,14 @@ insert into mysql.user select * from t1; drop table t1, t2; drop database TESTDB; flush privileges; +SET GLOBAL log_bin_trust_function_creators = 1; grant all privileges on test.* to `a@`@localhost; grant execute on * to `a@`@localhost; create table t2 (s1 int); insert into t2 values (1); drop function if exists f2; -create function f2 () returns int begin declare v int; select s1 from t2 -into v; return v; end// +create function f2 () returns int +begin declare v int; select s1 from t2 into v; return v; end// select f2(); f2() 1 @@ -379,3 +380,4 @@ drop function f2; drop table t2; REVOKE ALL PRIVILEGES, GRANT OPTION FROM `a@`@localhost; drop user `a@`@localhost; +SET GLOBAL log_bin_trust_function_creators = 0; diff --git a/mysql-test/r/group_min_max.result b/mysql-test/r/group_min_max.result index 5485db73fbb..dcaf249e9c4 100644 --- a/mysql-test/r/group_min_max.result +++ b/mysql-test/r/group_min_max.result @@ -2182,3 +2182,127 @@ SELECT MIN(c) FROM t2 WHERE b = 2 and a = 1 and c > 1 GROUP BY a; MIN(c) 2 DROP TABLE t1,t2; +CREATE TABLE t1 (a INT, b INT, INDEX (a,b)); +INSERT INTO t1 (a, b) VALUES (1,1), (1,2), (1,3), (1,4), (1,5), +(2,2), (2,3), (2,1), (3,1), (4,1), (4,2), (4,3), (4,4), (4,5), (4,6); +EXPLAIN SELECT max(b), a FROM t1 GROUP BY a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range NULL a 5 NULL 8 Using index for group-by +FLUSH STATUS; +SELECT max(b), a FROM t1 GROUP BY a; +max(b) a +5 1 +3 2 +1 3 +6 4 +SHOW STATUS LIKE 'handler_read__e%'; +Variable_name Value +Handler_read_key 8 +Handler_read_next 0 +EXPLAIN SELECT max(b), a FROM t1 GROUP BY a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range NULL a 5 NULL 8 Using index for group-by +FLUSH STATUS; +CREATE TABLE t2 SELECT max(b), a FROM t1 GROUP BY a; +SHOW STATUS LIKE 'handler_read__e%'; +Variable_name Value +Handler_read_key 8 +Handler_read_next 0 +FLUSH STATUS; +SELECT * FROM (SELECT max(b), a FROM t1 GROUP BY a) b; +max(b) a +5 1 +3 2 +1 3 +6 4 +SHOW STATUS LIKE 'handler_read__e%'; +Variable_name Value +Handler_read_key 8 +Handler_read_next 0 +FLUSH STATUS; +(SELECT max(b), a FROM t1 GROUP BY a) UNION +(SELECT max(b), a FROM t1 GROUP BY a); +max(b) a +5 1 +3 2 +1 3 +6 4 +SHOW STATUS LIKE 'handler_read__e%'; +Variable_name Value +Handler_read_key 16 +Handler_read_next 0 +EXPLAIN (SELECT max(b), a FROM t1 GROUP BY a) UNION +(SELECT max(b), a FROM t1 GROUP BY a); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 range NULL a 5 NULL 8 Using index for group-by +2 UNION t1 range NULL a 5 NULL 8 Using index for group-by +NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL +EXPLAIN SELECT (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2) x +FROM t1 AS t1_outer; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1_outer index NULL a 10 NULL 15 Using index +2 SUBQUERY t1 range NULL a 5 NULL 8 Using index for group-by +EXPLAIN SELECT 1 FROM t1 AS t1_outer WHERE EXISTS +(SELECT max(b) FROM t1 GROUP BY a HAVING a < 2); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1_outer index NULL a 10 NULL 15 Using index +2 SUBQUERY t1 index NULL a 10 NULL 15 Using index +EXPLAIN SELECT 1 FROM t1 AS t1_outer WHERE +(SELECT max(b) FROM t1 GROUP BY a HAVING a < 2) > 12; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY t1 range NULL a 5 NULL 8 Using index for group-by +EXPLAIN SELECT 1 FROM t1 AS t1_outer WHERE +a IN (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1_outer index NULL a 10 NULL 15 Using where; Using index +2 DEPENDENT SUBQUERY t1 index NULL a 10 NULL 15 Using index +EXPLAIN SELECT 1 FROM t1 AS t1_outer GROUP BY a HAVING +a > (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1_outer range NULL a 5 NULL 8 Using index for group-by +2 SUBQUERY t1 range NULL a 5 NULL 8 Using index for group-by +EXPLAIN SELECT 1 FROM t1 AS t1_outer1 JOIN t1 AS t1_outer2 +ON t1_outer1.a = (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2) +AND t1_outer1.b = t1_outer2.b; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1_outer1 ref a a 5 const 1 Using where; Using index +1 PRIMARY t1_outer2 index NULL a 10 NULL 15 Using where; Using index +2 SUBQUERY t1 range NULL a 5 NULL 8 Using index for group-by +EXPLAIN SELECT (SELECT (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2) x +FROM t1 AS t1_outer) x2 FROM t1 AS t1_outer2; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1_outer2 index NULL a 10 NULL 15 Using index +2 SUBQUERY t1_outer index NULL a 10 NULL 15 Using index +3 SUBQUERY t1 range NULL a 5 NULL 8 Using index for group-by +CREATE TABLE t3 LIKE t1; +FLUSH STATUS; +INSERT INTO t3 SELECT a,MAX(b) FROM t1 GROUP BY a; +SHOW STATUS LIKE 'handler_read__e%'; +Variable_name Value +Handler_read_key 8 +Handler_read_next 0 +DELETE FROM t3; +FLUSH STATUS; +INSERT INTO t3 SELECT 1, (SELECT MAX(b) FROM t1 GROUP BY a HAVING a < 2) +FROM t1 LIMIT 1; +SHOW STATUS LIKE 'handler_read__e%'; +Variable_name Value +Handler_read_key 8 +Handler_read_next 0 +FLUSH STATUS; +DELETE FROM t3 WHERE (SELECT MAX(b) FROM t1 GROUP BY a HAVING a < 2) > 10000; +SHOW STATUS LIKE 'handler_read__e%'; +Variable_name Value +Handler_read_key 8 +Handler_read_next 0 +FLUSH STATUS; +DELETE FROM t3 WHERE (SELECT (SELECT MAX(b) FROM t1 GROUP BY a HAVING a < 2) x +FROM t1) > 10000; +Warnings: +Error 1242 Subquery returns more than 1 row +SHOW STATUS LIKE 'handler_read__e%'; +Variable_name Value +Handler_read_key 8 +Handler_read_next 1 +DROP TABLE t1,t2,t3; diff --git a/mysql-test/r/have_mysql_upgrade.result b/mysql-test/r/have_mysql_upgrade.result new file mode 100644 index 00000000000..952bea420f9 --- /dev/null +++ b/mysql-test/r/have_mysql_upgrade.result @@ -0,0 +1,2 @@ +have_mysql_upgrade +1 diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result index 84226196bcc..e8599241cc0 100644 --- a/mysql-test/r/information_schema.result +++ b/mysql-test/r/information_schema.result @@ -33,7 +33,7 @@ create table t3(a int, KEY a_data (a)); create table mysqltest.t4(a int); create table t5 (id int auto_increment primary key); insert into t5 values (10); -create view v1 (c) as select table_name from information_schema.TABLES where table_name<>'binlog_index' AND table_name<>'apply_status'; +create view v1 (c) as select table_name from information_schema.TABLES where table_name<>'ndb_binlog_index' AND table_name<>'ndb_apply_status'; select * from v1; c CHARACTER_SETS @@ -850,7 +850,7 @@ VIEWS TABLE_NAME select delete from mysql.user where user='mysqltest_4'; delete from mysql.db where user='mysqltest_4'; flush privileges; -SELECT table_schema, count(*) FROM information_schema.TABLES where table_name<>'binlog_index' AND table_name<>'apply_status' GROUP BY TABLE_SCHEMA; +SELECT table_schema, count(*) FROM information_schema.TABLES where table_name<>'ndb_binlog_index' AND table_name<>'ndb_apply_status' GROUP BY TABLE_SCHEMA; table_schema count(*) information_schema 27 mysql 22 @@ -1078,7 +1078,7 @@ CREATE PROCEDURE p1 () BEGIN SELECT 'foo' FROM DUAL; END | -ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' +ERROR 42000: Unknown database 'information_schema' select ROUTINE_NAME from routines; ROUTINE_NAME grant all on information_schema.* to 'user1'@'localhost'; diff --git a/mysql-test/r/information_schema_part.result b/mysql-test/r/information_schema_part.result index 6ba980e0f21..df3abdbee0a 100644 --- a/mysql-test/r/information_schema_part.result +++ b/mysql-test/r/information_schema_part.result @@ -28,18 +28,18 @@ partitions 3; select * from information_schema.partitions where table_schema="test" and table_name="t3"; TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME -NULL test t3 p0 NULL 1 NULL HASH NULL month(f1) NULL NULL 0 0 0 # 1024 0 # # NULL NULL default default default -NULL test t3 p1 NULL 2 NULL HASH NULL month(f1) NULL NULL 0 0 0 # 1024 0 # # NULL NULL default default default -NULL test t3 p2 NULL 3 NULL HASH NULL month(f1) NULL NULL 0 0 0 # 1024 0 # # NULL NULL default default default +NULL test t3 p0 NULL 1 NULL HASH NULL month(f1) NULL NULL 0 0 0 # 1024 0 # # NULL NULL default default NULL +NULL test t3 p1 NULL 2 NULL HASH NULL month(f1) NULL NULL 0 0 0 # 1024 0 # # NULL NULL default default NULL +NULL test t3 p2 NULL 3 NULL HASH NULL month(f1) NULL NULL 0 0 0 # 1024 0 # # NULL NULL default default NULL create table t4 (f1 date, f2 int) partition by key(f1,f2) partitions 3; select * from information_schema.partitions where table_schema="test" and table_name="t4"; TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME -NULL test t4 p0 NULL 1 NULL KEY NULL f1,f2 NULL NULL 0 0 0 # 1024 0 # # NULL NULL default default default -NULL test t4 p1 NULL 2 NULL KEY NULL f1,f2 NULL NULL 0 0 0 # 1024 0 # # NULL NULL default default default -NULL test t4 p2 NULL 3 NULL KEY NULL f1,f2 NULL NULL 0 0 0 # 1024 0 # # NULL NULL default default default +NULL test t4 p0 NULL 1 NULL KEY NULL f1,f2 NULL NULL 0 0 0 # 1024 0 # # NULL NULL default default NULL +NULL test t4 p1 NULL 2 NULL KEY NULL f1,f2 NULL NULL 0 0 0 # 1024 0 # # NULL NULL default default NULL +NULL test t4 p2 NULL 3 NULL KEY NULL f1,f2 NULL NULL 0 0 0 # 1024 0 # # NULL NULL default default NULL drop table t1,t2,t3,t4; create table t1 (a int not null,b int not null,c int not null,primary key (a,b)) partition by range (a) @@ -99,7 +99,7 @@ drop table t1; create table t1(f1 int, f2 int); select * from information_schema.partitions where table_schema="test"; TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME -NULL test t1 NULL NULL NULL NULL NULL NULL NULL NULL NULL 0 0 0 # 1024 0 # # NULL NULL +NULL test t1 NULL NULL NULL NULL NULL NULL NULL NULL NULL 0 0 0 # 1024 0 # # NULL NULL NULL drop table t1; create table t1 (f1 date) partition by linear hash(month(f1)) @@ -107,9 +107,9 @@ partitions 3; select * from information_schema.partitions where table_schema="test" and table_name="t1"; TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME -NULL test t1 p0 NULL 1 NULL LINEAR HASH NULL month(f1) NULL NULL 0 0 0 # 1024 0 # # NULL NULL default default default -NULL test t1 p1 NULL 2 NULL LINEAR HASH NULL month(f1) NULL NULL 0 0 0 # 1024 0 # # NULL NULL default default default -NULL test t1 p2 NULL 3 NULL LINEAR HASH NULL month(f1) NULL NULL 0 0 0 # 1024 0 # # NULL NULL default default default +NULL test t1 p0 NULL 1 NULL LINEAR HASH NULL month(f1) NULL NULL 0 0 0 # 1024 0 # # NULL NULL default default NULL +NULL test t1 p1 NULL 2 NULL LINEAR HASH NULL month(f1) NULL NULL 0 0 0 # 1024 0 # # NULL NULL default default NULL +NULL test t1 p2 NULL 3 NULL LINEAR HASH NULL month(f1) NULL NULL 0 0 0 # 1024 0 # # NULL NULL default default NULL drop table t1; create table t1 (a int) PARTITION BY RANGE (a) diff --git a/mysql-test/r/init_connect.result b/mysql-test/r/init_connect.result index f90ee5913a1..f5ec0bdc932 100644 --- a/mysql-test/r/init_connect.result +++ b/mysql-test/r/init_connect.result @@ -132,7 +132,7 @@ x 17 19 drop trigger trg1; -set global init_connect=default; +set global init_connect="set @a='a\\0c'"; revoke all privileges, grant option from mysqltest1@localhost; drop user mysqltest1@localhost; drop table t1, t2; diff --git a/mysql-test/r/innodb_notembedded.result b/mysql-test/r/innodb_notembedded.result index cc13a429dfc..36714eb62fb 100644 --- a/mysql-test/r/innodb_notembedded.result +++ b/mysql-test/r/innodb_notembedded.result @@ -1,4 +1,5 @@ drop table if exists t1; +SET GLOBAL log_bin_trust_function_creators = 1; create table t1 (col1 integer primary key, col2 integer) engine=innodb; insert t1 values (1,100); create function f1 () returns integer begin @@ -18,3 +19,4 @@ rollback; rollback; drop table t1; drop function f1; +SET GLOBAL log_bin_trust_function_creators = 0; diff --git a/mysql-test/r/key_cache.result b/mysql-test/r/key_cache.result index 406a92b9a08..a1bf3d0e128 100644 --- a/mysql-test/r/key_cache.result +++ b/mysql-test/r/key_cache.result @@ -284,12 +284,15 @@ insert t1 values ('aaabbb'); check table t1; Table Op Msg_type Msg_text test.t1 check status OK +set @my_key_cache_block_size= @@global.key_cache_block_size; set GLOBAL key_cache_block_size=2048; check table t1; Table Op Msg_type Msg_text test.t1 check status OK drop table t1; +set global key_cache_block_size= @my_key_cache_block_size; CREATE TABLE t1(a int NOT NULL AUTO_INCREMENT PRIMARY KEY); +SET @my_key_cache_block_size= @@global.key_cache_block_size; SET GLOBAL key_cache_block_size=1536; INSERT INTO t1 VALUES (1); SELECT @@key_cache_block_size; @@ -331,6 +334,7 @@ CHECK TABLE t1; Table Op Msg_type Msg_text test.t1 check status OK DROP TABLE t1,t2; +set global key_cache_block_size= @my_key_cache_block_size; set @@global.key_buffer_size=0; Warnings: Warning 1438 Cannot drop default keycache diff --git a/mysql-test/r/limit.result b/mysql-test/r/limit.result index be2776ef533..ac96ac8ff17 100644 --- a/mysql-test/r/limit.result +++ b/mysql-test/r/limit.result @@ -90,3 +90,4 @@ id select_type table type possible_keys key key_len ref rows Extra select sum(a) c FROM t1 WHERE a > 0 ORDER BY c LIMIT 3; c 28 +drop table t1; diff --git a/mysql-test/r/log_tables.result b/mysql-test/r/log_tables.result index d9d754c91e6..3e8b7d32e88 100644 --- a/mysql-test/r/log_tables.result +++ b/mysql-test/r/log_tables.result @@ -280,9 +280,9 @@ create table general_log_new like general_log; create table slow_log_new like slow_log; show tables like "%log%"; Tables_in_mysql (%log%) -binlog_index general_log general_log_new +ndb_binlog_index slow_log slow_log_new drop table slow_log_new, general_log_new; diff --git a/mysql-test/r/lowercase_fs_off.result b/mysql-test/r/lowercase_fs_off.result index f610b959a47..ecb21261987 100644 --- a/mysql-test/r/lowercase_fs_off.result +++ b/mysql-test/r/lowercase_fs_off.result @@ -8,4 +8,5 @@ create database d2; ERROR 42000: Access denied for user 'sample'@'localhost' to database 'd2' create database D1; ERROR 42000: Access denied for user 'sample'@'localhost' to database 'D1' +drop user 'sample'@'localhost'; drop database if exists d1; diff --git a/mysql-test/r/mysql.result b/mysql-test/r/mysql.result index 3b0c61a1bf4..a36bb5aec15 100644 --- a/mysql-test/r/mysql.result +++ b/mysql-test/r/mysql.result @@ -36,6 +36,8 @@ Tables_in_test t1 t2 t3 +Tables_in_test +t1 _ Test delimiter : from command line a @@ -178,4 +180,8 @@ Too long dbname ERROR 1049 (42000) at line 1: Unknown database 'test_really_long_dbnamexxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' Too long hostname ERROR 2005 (HY000) at line 1: Unknown MySQL server host 'cyrils_superlonghostnameXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' (errno) +1 +1 +ERROR at line 1: DELIMITER cannot contain a backslash character +ERROR at line 1: DELIMITER cannot contain a backslash character End of 5.0 tests diff --git a/mysql-test/r/mysql_upgrade.result b/mysql-test/r/mysql_upgrade.result new file mode 100644 index 00000000000..a031b440b17 --- /dev/null +++ b/mysql-test/r/mysql_upgrade.result @@ -0,0 +1,173 @@ +Run mysql_upgrade once +mysql.columns_priv OK +mysql.db OK +mysql.event OK +mysql.func OK +mysql.general_log OK +mysql.help_category OK +mysql.help_keyword OK +mysql.help_relation OK +mysql.help_topic OK +mysql.host OK +mysql.ndb_binlog_index OK +mysql.plugin OK +mysql.proc OK +mysql.procs_priv OK +mysql.slow_log OK +mysql.tables_priv OK +mysql.time_zone OK +mysql.time_zone_leap_second OK +mysql.time_zone_name OK +mysql.time_zone_transition OK +mysql.time_zone_transition_type OK +mysql.user OK +@hadGrantPriv:=1 +1 +1 +1 +1 +1 +@hadShowDbPriv:=1 +1 +1 +1 +1 +1 +@hadCreateViewPriv:=1 +1 +1 +1 +1 +1 +@hadCreateRoutinePriv:=1 +1 +1 +1 +1 +1 +@hadCreateUserPriv:=1 +1 +1 +1 +1 +1 +@hadEventPriv :=1 +1 +1 +1 +1 +1 +@hadTriggerPriv :=1 +1 +1 +1 +1 +1 +Run it again - should say already completed +@hadGrantPriv:=1 +1 +1 +1 +1 +1 +@hadShowDbPriv:=1 +1 +1 +1 +1 +1 +@hadCreateViewPriv:=1 +1 +1 +1 +1 +1 +@hadCreateRoutinePriv:=1 +1 +1 +1 +1 +1 +@hadCreateUserPriv:=1 +1 +1 +1 +1 +1 +@hadEventPriv :=1 +1 +1 +1 +1 +1 +@hadTriggerPriv :=1 +1 +1 +1 +1 +1 +Force should run it regardless of wheter it's been run before +mysql.columns_priv OK +mysql.db OK +mysql.event OK +mysql.func OK +mysql.general_log OK +mysql.help_category OK +mysql.help_keyword OK +mysql.help_relation OK +mysql.help_topic OK +mysql.host OK +mysql.ndb_binlog_index OK +mysql.plugin OK +mysql.proc OK +mysql.procs_priv OK +mysql.slow_log OK +mysql.tables_priv OK +mysql.time_zone OK +mysql.time_zone_leap_second OK +mysql.time_zone_name OK +mysql.time_zone_transition OK +mysql.time_zone_transition_type OK +mysql.user OK +@hadGrantPriv:=1 +1 +1 +1 +1 +1 +@hadShowDbPriv:=1 +1 +1 +1 +1 +1 +@hadCreateViewPriv:=1 +1 +1 +1 +1 +1 +@hadCreateRoutinePriv:=1 +1 +1 +1 +1 +1 +@hadCreateUserPriv:=1 +1 +1 +1 +1 +1 +@hadEventPriv :=1 +1 +1 +1 +1 +1 +@hadTriggerPriv :=1 +1 +1 +1 +1 +1 diff --git a/mysql-test/r/mysqladmin.result b/mysql-test/r/mysqladmin.result new file mode 100644 index 00000000000..57927f8aa67 --- /dev/null +++ b/mysql-test/r/mysqladmin.result @@ -0,0 +1,4 @@ +mysqld is alive +mysqladmin: unknown variable 'database=db1' +Warning: mysqladmin: unknown variable 'loose-database=db2' +mysqld is alive diff --git a/mysql-test/r/mysqlcheck.result b/mysql-test/r/mysqlcheck.result index 06bfd1c09c5..c664932f2bb 100644 --- a/mysql-test/r/mysqlcheck.result +++ b/mysql-test/r/mysqlcheck.result @@ -2,7 +2,6 @@ drop database if exists client_test_db; DROP SCHEMA test; CREATE SCHEMA test; use test; -mysql.binlog_index OK mysql.columns_priv OK mysql.db OK mysql.event OK @@ -14,6 +13,7 @@ mysql.help_keyword OK mysql.help_relation OK mysql.help_topic OK mysql.host OK +mysql.ndb_binlog_index OK mysql.plugin OK mysql.proc OK mysql.procs_priv OK @@ -27,7 +27,6 @@ mysql.time_zone_name OK mysql.time_zone_transition OK mysql.time_zone_transition_type OK mysql.user OK -mysql.binlog_index OK mysql.columns_priv OK mysql.db OK mysql.event OK @@ -39,6 +38,7 @@ mysql.help_keyword OK mysql.help_relation OK mysql.help_topic OK mysql.host OK +mysql.ndb_binlog_index OK mysql.plugin OK mysql.proc OK mysql.procs_priv OK diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result index 54c68701f78..4ac1dfc938f 100644 --- a/mysql-test/r/mysqldump.result +++ b/mysql-test/r/mysqldump.result @@ -3088,7 +3088,7 @@ drop user mysqltest_1@localhost; # create database mysqldump_myDB; use mysqldump_myDB; -create user myDB_User; +create user myDB_User@localhost; grant create, create view, select, insert on mysqldump_myDB.* to myDB_User@localhost; create table t1 (c1 int); insert into t1 values (3); @@ -3101,7 +3101,7 @@ drop view v1; drop table t1; drop table u1; revoke all privileges on mysqldump_myDB.* from myDB_User@localhost; -drop user myDB_User; +drop user myDB_User@localhost; drop database mysqldump_myDB; flush privileges; # Bug #21424 continues from here. @@ -3119,7 +3119,7 @@ drop view v1; drop table t1; drop table u1; revoke all privileges on mysqldump_myDB.* from myDB_User@localhost; -drop user myDB_User; +drop user myDB_User@localhost; drop database mysqldump_myDB; use test; # diff --git a/mysql-test/r/mysqltest.result b/mysql-test/r/mysqltest.result index 1cfc482416e..12a35fcf48b 100644 --- a/mysql-test/r/mysqltest.result +++ b/mysql-test/r/mysqltest.result @@ -512,6 +512,12 @@ mysqltest: At line 1: End of line junk detected: "write_file filename "; mysqltest: At line 1: Missing required argument 'filename' to command 'file_exists' mysqltest: At line 1: Missing required argument 'from_file' to command 'copy_file' mysqltest: At line 1: Missing required argument 'to_file' to command 'copy_file' +mysqltest: At line 1: Missing required argument 'mode' to command 'chmod' +mysqltest: At line 1: You must write a 4 digit octal number for mode +mysqltest: At line 1: You must write a 4 digit octal number for mode +mysqltest: At line 1: Missing required argument 'file' to command 'chmod' +mysqltest: At line 1: You must write a 4 digit octal number for mode +mysqltest: At line 1: You must write a 4 digit octal number for mode hello hello hello diff --git a/mysql-test/r/ndb_basic.result b/mysql-test/r/ndb_basic.result index e0255ddb9e7..b7e893faf29 100644 --- a/mysql-test/r/ndb_basic.result +++ b/mysql-test/r/ndb_basic.result @@ -758,4 +758,19 @@ c VARCHAR(255) NOT NULL, CONSTRAINT pk_b_c_id PRIMARY KEY (b,c), CONSTRAINT fk_a FOREIGN KEY(a) REFERENCES t1(a))engine=ndb; drop table t1, t2; +create table t1 (a int not null primary key, b int) engine=ndb; +insert into t1 values(1,1),(2,2),(3,3); +create table t2 like t1; +insert into t2 select * from t1; +select * from t1 order by a; +a b +1 1 +2 2 +3 3 +select * from t2 order by a; +a b +1 1 +2 2 +3 3 +drop table t1, t2; End of 5.1 tests diff --git a/mysql-test/r/ndb_binlog_basic.result b/mysql-test/r/ndb_binlog_basic.result index 43c19278d2c..931d01dbebe 100644 --- a/mysql-test/r/ndb_binlog_basic.result +++ b/mysql-test/r/ndb_binlog_basic.result @@ -6,7 +6,7 @@ drop database mysqltest; use test; create table t1 (a int primary key) engine=ndb; insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); -select @max_epoch:=max(epoch)-1 from mysql.binlog_index; +select @max_epoch:=max(epoch)-1 from mysql.ndb_binlog_index; @max_epoch:=max(epoch)-1 # delete from t1; @@ -19,19 +19,19 @@ update t2 set b=1 where a=3; delete from t2 where a=4; commit; drop table t2; -select inserts from mysql.binlog_index where epoch > @max_epoch and inserts > 5; +select inserts from mysql.ndb_binlog_index where epoch > @max_epoch and inserts > 5; inserts 10 -select deletes from mysql.binlog_index where epoch > @max_epoch and deletes > 5; +select deletes from mysql.ndb_binlog_index where epoch > @max_epoch and deletes > 5; deletes 10 select inserts,updates,deletes from -mysql.binlog_index where epoch > @max_epoch and updates > 0; +mysql.ndb_binlog_index where epoch > @max_epoch and updates > 0; inserts updates deletes 2 1 1 flush logs; purge master logs before now(); -select count(*) from mysql.binlog_index; +select count(*) from mysql.ndb_binlog_index; count(*) 0 create table t1 (a int primary key, b int) engine=ndb; @@ -40,12 +40,12 @@ use mysqltest; create table t1 (c int, d int primary key) engine=ndb; use test; insert into mysqltest.t1 values (2,1),(2,2); -select @max_epoch:=max(epoch)-1 from mysql.binlog_index; +select @max_epoch:=max(epoch)-1 from mysql.ndb_binlog_index; @max_epoch:=max(epoch)-1 # drop table t1; drop database mysqltest; select inserts,updates,deletes from -mysql.binlog_index where epoch > @max_epoch and inserts > 0; +mysql.ndb_binlog_index where epoch > @max_epoch and inserts > 0; inserts updates deletes 2 0 0 diff --git a/mysql-test/r/ndb_binlog_ddl_multi.result b/mysql-test/r/ndb_binlog_ddl_multi.result index ff9c3bdc3e4..eff91eca236 100644 --- a/mysql-test/r/ndb_binlog_ddl_multi.result +++ b/mysql-test/r/ndb_binlog_ddl_multi.result @@ -44,7 +44,7 @@ show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info master-bin1.000001 # Query # # BEGIN master-bin1.000001 # Table_map # # table_id: # (test.t2) -master-bin1.000001 # Table_map # # table_id: # (mysql.apply_status) +master-bin1.000001 # Table_map # # table_id: # (mysql.ndb_apply_status) master-bin1.000001 # Write_rows # # table_id: # master-bin1.000001 # Write_rows # # table_id: # flags: STMT_END_F master-bin1.000001 # Query # # COMMIT @@ -180,14 +180,14 @@ Log_name Pos Event_type Server_id End_log_pos Info master-bin1.000001 # Query # # use `test`; create table t1 (a int key) engine=ndb master-bin1.000001 # Query # # BEGIN master-bin1.000001 # Table_map # # table_id: # (test.t1) -master-bin1.000001 # Table_map # # table_id: # (mysql.apply_status) +master-bin1.000001 # Table_map # # table_id: # (mysql.ndb_apply_status) master-bin1.000001 # Write_rows # # table_id: # master-bin1.000001 # Write_rows # # table_id: # flags: STMT_END_F master-bin1.000001 # Query # # COMMIT master-bin1.000001 # Query # # use `test`; rename table `test.t1` to `test.t2` master-bin1.000001 # Query # # BEGIN master-bin1.000001 # Table_map # # table_id: # (test.t2) -master-bin1.000001 # Table_map # # table_id: # (mysql.apply_status) +master-bin1.000001 # Table_map # # table_id: # (mysql.ndb_apply_status) master-bin1.000001 # Write_rows # # table_id: # master-bin1.000001 # Write_rows # # table_id: # flags: STMT_END_F master-bin1.000001 # Query # # COMMIT diff --git a/mysql-test/r/ndb_binlog_multi.result b/mysql-test/r/ndb_binlog_multi.result index ffd0b44484b..3a84c89a7a4 100644 --- a/mysql-test/r/ndb_binlog_multi.result +++ b/mysql-test/r/ndb_binlog_multi.result @@ -11,7 +11,7 @@ Log_name Pos Event_type Server_id End_log_pos Info master-bin1.000001 # Query # # use `test`; CREATE TABLE t2 (a INT PRIMARY KEY, b int) ENGINE = NDB master-bin1.000001 # Query # # BEGIN master-bin1.000001 # Table_map # # table_id: # (test.t2) -master-bin1.000001 # Table_map # # table_id: # (mysql.apply_status) +master-bin1.000001 # Table_map # # table_id: # (mysql.ndb_apply_status) master-bin1.000001 # Write_rows # # table_id: # master-bin1.000001 # Write_rows # # table_id: # flags: STMT_END_F master-bin1.000001 # Query # # COMMIT @@ -20,7 +20,7 @@ a b 1 1 2 2 SELECT @the_epoch:=epoch,inserts,updates,deletes,schemaops FROM -mysql.binlog_index ORDER BY epoch DESC LIMIT 1; +mysql.ndb_binlog_index ORDER BY epoch DESC LIMIT 1; @the_epoch:=epoch inserts updates deletes schemaops <the_epoch> 2 0 0 0 SELECT * FROM t2 ORDER BY a; @@ -33,13 +33,13 @@ Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # use `test`; CREATE TABLE t2 (a INT PRIMARY KEY, b int) ENGINE = NDB master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.t2) -master-bin.000001 # Table_map # # table_id: # (mysql.apply_status) +master-bin.000001 # Table_map # # table_id: # (mysql.ndb_apply_status) master-bin.000001 # Write_rows # # table_id: # master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # use `test`; DROP TABLE t2 SELECT inserts,updates,deletes,schemaops FROM -mysql.binlog_index WHERE epoch=<the_epoch>; +mysql.ndb_binlog_index WHERE epoch=<the_epoch>; inserts updates deletes schemaops 2 0 0 0 reset master; @@ -51,16 +51,16 @@ Log_name Pos Event_type Server_id End_log_pos Info master-bin1.000001 # Query # # use `test`; CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE = NDB master-bin1.000001 # Query # # BEGIN master-bin1.000001 # Table_map # # table_id: # (test.t1) -master-bin1.000001 # Table_map # # table_id: # (mysql.apply_status) +master-bin1.000001 # Table_map # # table_id: # (mysql.ndb_apply_status) master-bin1.000001 # Write_rows # # table_id: # master-bin1.000001 # Write_rows # # table_id: # flags: STMT_END_F master-bin1.000001 # Query # # COMMIT SELECT @the_epoch2:=epoch,inserts,updates,deletes,schemaops FROM -mysql.binlog_index ORDER BY epoch DESC LIMIT 1; +mysql.ndb_binlog_index ORDER BY epoch DESC LIMIT 1; @the_epoch2:=epoch inserts updates deletes schemaops <the_epoch2> 2 0 0 0 SELECT inserts,updates,deletes,schemaops FROM -mysql.binlog_index WHERE epoch > <the_epoch> AND epoch <= <the_epoch2>; +mysql.ndb_binlog_index WHERE epoch > <the_epoch> AND epoch <= <the_epoch2>; inserts updates deletes schemaops 2 0 0 0 drop table t1; @@ -69,12 +69,12 @@ Log_name Pos Event_type Server_id End_log_pos Info master-bin1.000001 # Query # # use `test`; CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE = NDB master-bin1.000001 # Query # # BEGIN master-bin1.000001 # Table_map # # table_id: # (test.t1) -master-bin1.000001 # Table_map # # table_id: # (mysql.apply_status) +master-bin1.000001 # Table_map # # table_id: # (mysql.ndb_apply_status) master-bin1.000001 # Write_rows # # table_id: # master-bin1.000001 # Write_rows # # table_id: # flags: STMT_END_F master-bin1.000001 # Query # # COMMIT master-bin1.000001 # Query # # use `test`; drop table t1 SELECT inserts,updates,deletes,schemaops FROM -mysql.binlog_index WHERE epoch > <the_epoch> AND epoch <= <the_epoch2>; +mysql.ndb_binlog_index WHERE epoch > <the_epoch> AND epoch <= <the_epoch2>; inserts updates deletes schemaops 2 0 0 0 diff --git a/mysql-test/r/ndb_dd_backuprestore.result b/mysql-test/r/ndb_dd_backuprestore.result index 3c0815cbec8..1dd609b932d 100644 --- a/mysql-test/r/ndb_dd_backuprestore.result +++ b/mysql-test/r/ndb_dd_backuprestore.result @@ -223,31 +223,31 @@ t6 CREATE TABLE `t6` ( ) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (pk1) (PARTITION x1 VALUES LESS THAN (333) ENGINE = ndbcluster, PARTITION x2 VALUES LESS THAN (720) ENGINE = ndbcluster) */ SELECT * FROM information_schema.partitions WHERE table_name= 't1'; TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME -NULL test t1 p0 NULL 1 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default default default -NULL test t1 p1 NULL 2 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default default default -NULL test t1 p2 NULL 3 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default default default -NULL test t1 p3 NULL 4 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default default default +NULL test t1 p0 NULL 1 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default default table_space1 +NULL test t1 p1 NULL 2 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default default table_space1 +NULL test t1 p2 NULL 3 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default default table_space1 +NULL test t1 p3 NULL 4 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default default table_space1 SELECT * FROM information_schema.partitions WHERE table_name= 't2'; TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME -NULL test t2 p0 NULL 1 NULL KEY NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default default default -NULL test t2 p1 NULL 2 NULL KEY NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default default default +NULL test t2 p0 NULL 1 NULL KEY NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default default table_space2 +NULL test t2 p1 NULL 2 NULL KEY NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default default table_space2 SELECT * FROM information_schema.partitions WHERE table_name= 't3'; TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME -NULL test t3 x1 NULL 1 NULL RANGE NULL c3 NULL 105 0 0 0 NULL 0 0 NULL NULL NULL NULL default default default -NULL test t3 x2 NULL 2 NULL RANGE NULL c3 NULL 333 0 0 0 NULL 0 0 NULL NULL NULL NULL default default default -NULL test t3 x3 NULL 3 NULL RANGE NULL c3 NULL 720 0 0 0 NULL 0 0 NULL NULL NULL NULL default default default +NULL test t3 x1 NULL 1 NULL RANGE NULL c3 NULL 105 0 0 0 NULL 0 0 NULL NULL NULL NULL default default table_space2 +NULL test t3 x2 NULL 2 NULL RANGE NULL c3 NULL 333 0 0 0 NULL 0 0 NULL NULL NULL NULL default default table_space2 +NULL test t3 x3 NULL 3 NULL RANGE NULL c3 NULL 720 0 0 0 NULL 0 0 NULL NULL NULL NULL default default table_space2 SELECT * FROM information_schema.partitions WHERE table_name= 't4'; TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME -NULL test t4 p0 NULL 1 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default default default -NULL test t4 p1 NULL 2 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default default default +NULL test t4 p0 NULL 1 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default default NULL +NULL test t4 p1 NULL 2 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default default NULL SELECT * FROM information_schema.partitions WHERE table_name= 't5'; TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME -NULL test t5 p0 NULL 1 NULL KEY NULL pk1 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default default default -NULL test t5 p1 NULL 2 NULL KEY NULL pk1 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default default default +NULL test t5 p0 NULL 1 NULL KEY NULL pk1 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default default NULL +NULL test t5 p1 NULL 2 NULL KEY NULL pk1 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default default NULL SELECT * FROM information_schema.partitions WHERE table_name= 't6'; TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME -NULL test t6 x1 NULL 1 NULL RANGE NULL pk1 NULL 333 0 0 0 NULL 0 0 NULL NULL NULL NULL default default default -NULL test t6 x2 NULL 2 NULL RANGE NULL pk1 NULL 720 0 0 0 NULL 0 0 NULL NULL NULL NULL default default default +NULL test t6 x1 NULL 1 NULL RANGE NULL pk1 NULL 333 0 0 0 NULL 0 0 NULL NULL NULL NULL default default NULL +NULL test t6 x2 NULL 2 NULL RANGE NULL pk1 NULL 720 0 0 0 NULL 0 0 NULL NULL NULL NULL default default NULL SELECT COUNT(*) FROM test.t1; COUNT(*) 250 @@ -389,31 +389,31 @@ t6 CREATE TABLE `t6` ( ) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (pk1) (PARTITION x1 VALUES LESS THAN (333) ENGINE = ndbcluster, PARTITION x2 VALUES LESS THAN (720) ENGINE = ndbcluster) */ SELECT * FROM information_schema.partitions WHERE table_name= 't1'; TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME -NULL test t1 p0 NULL 1 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default default default -NULL test t1 p1 NULL 2 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default default default -NULL test t1 p2 NULL 3 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default default default -NULL test t1 p3 NULL 4 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default default default +NULL test t1 p0 NULL 1 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default default table_space1 +NULL test t1 p1 NULL 2 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default default table_space1 +NULL test t1 p2 NULL 3 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default default table_space1 +NULL test t1 p3 NULL 4 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default default table_space1 SELECT * FROM information_schema.partitions WHERE table_name= 't2'; TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME -NULL test t2 p0 NULL 1 NULL KEY NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default default default -NULL test t2 p1 NULL 2 NULL KEY NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default default default +NULL test t2 p0 NULL 1 NULL KEY NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default default table_space2 +NULL test t2 p1 NULL 2 NULL KEY NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default default table_space2 SELECT * FROM information_schema.partitions WHERE table_name= 't3'; TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME -NULL test t3 x1 NULL 1 NULL RANGE NULL c3 NULL 105 0 0 0 NULL 0 0 NULL NULL NULL NULL default default default -NULL test t3 x2 NULL 2 NULL RANGE NULL c3 NULL 333 0 0 0 NULL 0 0 NULL NULL NULL NULL default default default -NULL test t3 x3 NULL 3 NULL RANGE NULL c3 NULL 720 0 0 0 NULL 0 0 NULL NULL NULL NULL default default default +NULL test t3 x1 NULL 1 NULL RANGE NULL c3 NULL 105 0 0 0 NULL 0 0 NULL NULL NULL NULL default default table_space2 +NULL test t3 x2 NULL 2 NULL RANGE NULL c3 NULL 333 0 0 0 NULL 0 0 NULL NULL NULL NULL default default table_space2 +NULL test t3 x3 NULL 3 NULL RANGE NULL c3 NULL 720 0 0 0 NULL 0 0 NULL NULL NULL NULL default default table_space2 SELECT * FROM information_schema.partitions WHERE table_name= 't4'; TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME -NULL test t4 p0 NULL 1 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default default default -NULL test t4 p1 NULL 2 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default default default +NULL test t4 p0 NULL 1 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default default NULL +NULL test t4 p1 NULL 2 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default default NULL SELECT * FROM information_schema.partitions WHERE table_name= 't5'; TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME -NULL test t5 p0 NULL 1 NULL KEY NULL pk1 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default default default -NULL test t5 p1 NULL 2 NULL KEY NULL pk1 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default default default +NULL test t5 p0 NULL 1 NULL KEY NULL pk1 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default default NULL +NULL test t5 p1 NULL 2 NULL KEY NULL pk1 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default default NULL SELECT * FROM information_schema.partitions WHERE table_name= 't6'; TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME -NULL test t6 x1 NULL 1 NULL RANGE NULL pk1 NULL 333 0 0 0 NULL 0 0 NULL NULL NULL NULL default default default -NULL test t6 x2 NULL 2 NULL RANGE NULL pk1 NULL 720 0 0 0 NULL 0 0 NULL NULL NULL NULL default default default +NULL test t6 x1 NULL 1 NULL RANGE NULL pk1 NULL 333 0 0 0 NULL 0 0 NULL NULL NULL NULL default default NULL +NULL test t6 x2 NULL 2 NULL RANGE NULL pk1 NULL 720 0 0 0 NULL 0 0 NULL NULL NULL NULL default default NULL SELECT COUNT(*) FROM test.t1; COUNT(*) 250 diff --git a/mysql-test/r/ndb_index_ordered.result b/mysql-test/r/ndb_index_ordered.result index 3b8415b9267..788c0d68259 100644 --- a/mysql-test/r/ndb_index_ordered.result +++ b/mysql-test/r/ndb_index_ordered.result @@ -796,3 +796,42 @@ Variable_name Value ndb_index_stat_cache_entries 32 ndb_index_stat_enable OFF ndb_index_stat_update_freq 20 +create table t1 (a int primary key) engine = ndb; +insert into t1 values (1), (2), (3); +begin; +delete from t1 where a > 1; +rollback; +select * from t1 order by a; +a +1 +2 +3 +begin; +delete from t1 where a > 1; +rollback; +begin; +select * from t1 order by a; +a +1 +2 +3 +delete from t1 where a > 2; +select * from t1 order by a; +a +1 +2 +delete from t1 where a > 1; +select * from t1 order by a; +a +1 +delete from t1 where a > 0; +select * from t1 order by a; +a +rollback; +select * from t1 order by a; +a +1 +2 +3 +delete from t1; +drop table t1; diff --git a/mysql-test/r/ndb_index_unique.result b/mysql-test/r/ndb_index_unique.result index 563024a8800..fbc3a2bb915 100644 --- a/mysql-test/r/ndb_index_unique.result +++ b/mysql-test/r/ndb_index_unique.result @@ -144,7 +144,40 @@ b int unsigned not null, c int unsigned, UNIQUE (b, c) USING HASH ) engine=ndbcluster; -ERROR 42000: Table handler doesn't support NULL in given index. Please change column 'c' to be NOT NULL or use another handler +Warnings: +Warning 1121 Ndb does not support unique index on NULL valued attributes, index access with NULL value will become full table scan +insert t2 values(1,1,NULL),(2,2,2),(3,3,NULL),(4,4,4),(5,5,NULL),(6,6,6),(7,7,NULL),(8,3,NULL),(9,3,NULL); +select * from t2 where c IS NULL order by a; +a b c +1 1 NULL +3 3 NULL +5 5 NULL +7 7 NULL +8 3 NULL +9 3 NULL +select * from t2 where b = 3 AND c IS NULL order by a; +a b c +3 3 NULL +8 3 NULL +9 3 NULL +select * from t2 where (b = 3 OR b = 5) AND c IS NULL order by a; +a b c +3 3 NULL +5 5 NULL +8 3 NULL +9 3 NULL +set @old_ecpd = @@session.engine_condition_pushdown; +set engine_condition_pushdown = true; +explain select * from t2 where (b = 3 OR b = 5) AND c IS NULL AND a < 9 order by a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 range PRIMARY,b PRIMARY 4 NULL 1 Using where with pushed condition +select * from t2 where (b = 3 OR b = 5) AND c IS NULL AND a < 9 order by a; +a b c +3 3 NULL +5 5 NULL +8 3 NULL +set engine_condition_pushdown = @old_ecpd; +drop table t2; CREATE TABLE t3 ( a int unsigned NOT NULL, b int unsigned not null, diff --git a/mysql-test/r/ndb_multi.result b/mysql-test/r/ndb_multi.result index 1c9633589e0..2bc49bf9b45 100644 --- a/mysql-test/r/ndb_multi.result +++ b/mysql-test/r/ndb_multi.result @@ -97,3 +97,27 @@ c1 3 5 drop table t1; +create database db; +use db; +create table t1(x int) engine=ndb; +use db; +show tables; +Tables_in_db +t1 +drop database db; +show tables; +ERROR 42000: Unknown database 'db' +create database db; +use db; +create table t1(x int) engine=ndb; +use db; +create table t2(x int) engine=myisam; +show tables; +Tables_in_db +t1 +t2 +drop database db; +show tables; +Tables_in_db +t2 +drop database db; diff --git a/mysql-test/r/ndb_partition_range.result b/mysql-test/r/ndb_partition_range.result index f4bae479239..8057ac59613 100644 --- a/mysql-test/r/ndb_partition_range.result +++ b/mysql-test/r/ndb_partition_range.result @@ -17,9 +17,9 @@ INSERT into t1 values (10, 1, 1); INSERT into t1 values (15, 1, 1); select * from information_schema.partitions where table_name= 't1'; TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME -NULL test t1 x1 NULL 1 NULL RANGE NULL a NULL 5 0 0 0 # 0 0 # # NULL NULL default default default -NULL test t1 x2 NULL 2 NULL RANGE NULL a NULL 10 0 0 0 # 0 0 # # NULL NULL default default default -NULL test t1 x3 NULL 3 NULL RANGE NULL a NULL 20 0 0 0 # 0 0 # # NULL NULL default default default +NULL test t1 x1 NULL 1 NULL RANGE NULL a NULL 5 0 0 0 # 0 0 # # NULL NULL default default NULL +NULL test t1 x2 NULL 2 NULL RANGE NULL a NULL 10 0 0 0 # 0 0 # # NULL NULL default default NULL +NULL test t1 x3 NULL 3 NULL RANGE NULL a NULL 20 0 0 0 # 0 0 # # NULL NULL default default NULL select * from t1 order by a; a b c 1 1 1 diff --git a/mysql-test/r/ndb_restore_compat.result b/mysql-test/r/ndb_restore_compat.result index 595c582e3b7..f580f680687 100644 --- a/mysql-test/r/ndb_restore_compat.result +++ b/mysql-test/r/ndb_restore_compat.result @@ -44,7 +44,7 @@ SELECT * FROM SYSTEM_VALUES ORDER BY SYSTEM_VALUES_ID; SYSTEM_VALUES_ID VALUE 0 2039 1 3 -SELECT * FROM mysql.apply_status WHERE server_id=0; +SELECT * FROM mysql.ndb_apply_status WHERE server_id=0; server_id epoch 0 151 TRUNCATE GL; @@ -98,7 +98,7 @@ SELECT * FROM SYSTEM_VALUES ORDER BY SYSTEM_VALUES_ID; SYSTEM_VALUES_ID VALUE 0 2297 1 5 -SELECT * FROM mysql.apply_status WHERE server_id=0; +SELECT * FROM mysql.ndb_apply_status WHERE server_id=0; server_id epoch 0 331 DROP DATABASE BANK; diff --git a/mysql-test/r/ndb_update.result b/mysql-test/r/ndb_update.result index 8166a554084..919b8c44a40 100644 --- a/mysql-test/r/ndb_update.result +++ b/mysql-test/r/ndb_update.result @@ -17,8 +17,17 @@ pk1 b c 0 0 0 2 2 2 4 1 1 +UPDATE t1 set pk1 = 4 where pk1 = 2; +ERROR 23000: Duplicate entry '4' for key 'PRIMARY' +UPDATE IGNORE t1 set pk1 = 4 where pk1 = 2; +select * from t1 order by pk1; +pk1 b c +0 0 0 +2 2 2 +4 1 1 UPDATE t1 set pk1 = 1, c = 2 where pk1 = 4; ERROR 23000: Duplicate entry '' for key '*UNKNOWN*' +UPDATE IGNORE t1 set pk1 = 1, c = 2 where pk1 = 4; select * from t1 order by pk1; pk1 b c 0 0 0 diff --git a/mysql-test/r/parser.result b/mysql-test/r/parser.result index df446e01601..49008eb818b 100644 --- a/mysql-test/r/parser.result +++ b/mysql-test/r/parser.result @@ -373,3 +373,104 @@ select yearweek(); ERROR 42000: Incorrect parameter count in the call to native function 'yearweek' select yearweek(1, 2, 3); ERROR 42000: Incorrect parameter count in the call to native function 'yearweek' +select abs(3); +abs(3) +3 +select abs(3 AS three); +ERROR 42000: Incorrect parameters in the call to native function 'abs' +select abs(3 three); +ERROR 42000: Incorrect parameters in the call to native function 'abs' +select abs(3 AS "three"); +ERROR 42000: Incorrect parameters in the call to native function 'abs' +select abs(3 "three"); +ERROR 42000: Incorrect parameters in the call to native function 'abs' +set @bar="bar"; +set @foobar="foobar"; +select instr("foobar", "bar"); +instr("foobar", "bar") +4 +select instr("foobar" AS p1, "bar"); +ERROR 42000: Incorrect parameters in the call to native function 'instr' +select instr("foobar" p1, "bar"); +ERROR 42000: Incorrect parameters in the call to native function 'instr' +select instr("foobar" AS "p1", "bar"); +ERROR 42000: Incorrect parameters in the call to native function 'instr' +select instr("foobar" "p1", "bar"); +instr("foobar" "p1", "bar") +4 +select instr(@foobar "p1", "bar"); +ERROR 42000: Incorrect parameters in the call to native function 'instr' +select instr("foobar", "bar" AS p2); +ERROR 42000: Incorrect parameters in the call to native function 'instr' +select instr("foobar", "bar" p2); +ERROR 42000: Incorrect parameters in the call to native function 'instr' +select instr("foobar", "bar" AS "p2"); +ERROR 42000: Incorrect parameters in the call to native function 'instr' +select instr("foobar", "bar" "p2"); +instr("foobar", "bar" "p2") +0 +select instr("foobar", @bar "p2"); +ERROR 42000: Incorrect parameters in the call to native function 'instr' +select instr("foobar" AS p1, "bar" AS p2); +ERROR 42000: Incorrect parameters in the call to native function 'instr' +select conv(255, 10, 16); +conv(255, 10, 16) +FF +select conv(255 AS p1, 10, 16); +ERROR 42000: Incorrect parameters in the call to native function 'conv' +select conv(255 p1, 10, 16); +ERROR 42000: Incorrect parameters in the call to native function 'conv' +select conv(255 AS "p1", 10, 16); +ERROR 42000: Incorrect parameters in the call to native function 'conv' +select conv(255 "p1", 10, 16); +ERROR 42000: Incorrect parameters in the call to native function 'conv' +select conv(255, 10 AS p2, 16); +ERROR 42000: Incorrect parameters in the call to native function 'conv' +select conv(255, 10 p2, 16); +ERROR 42000: Incorrect parameters in the call to native function 'conv' +select conv(255, 10 AS "p2", 16); +ERROR 42000: Incorrect parameters in the call to native function 'conv' +select conv(255, 10 "p2", 16); +ERROR 42000: Incorrect parameters in the call to native function 'conv' +select conv(255, 10, 16 AS p3); +ERROR 42000: Incorrect parameters in the call to native function 'conv' +select conv(255, 10, 16 p3); +ERROR 42000: Incorrect parameters in the call to native function 'conv' +select conv(255, 10, 16 AS "p3"); +ERROR 42000: Incorrect parameters in the call to native function 'conv' +select conv(255, 10, 16 "p3"); +ERROR 42000: Incorrect parameters in the call to native function 'conv' +select conv(255 AS p1, 10 AS p2, 16 AS p3); +ERROR 42000: Incorrect parameters in the call to native function 'conv' +select atan(10); +atan(10) +1.4711276743037 +select atan(10 AS p1); +ERROR 42000: Incorrect parameters in the call to native function 'atan' +select atan(10 p1); +ERROR 42000: Incorrect parameters in the call to native function 'atan' +select atan(10 AS "p1"); +ERROR 42000: Incorrect parameters in the call to native function 'atan' +select atan(10 "p1"); +ERROR 42000: Incorrect parameters in the call to native function 'atan' +select atan(10, 20); +atan(10, 20) +0.46364760900081 +select atan(10 AS p1, 20); +ERROR 42000: Incorrect parameters in the call to native function 'atan' +select atan(10 p1, 20); +ERROR 42000: Incorrect parameters in the call to native function 'atan' +select atan(10 AS "p1", 20); +ERROR 42000: Incorrect parameters in the call to native function 'atan' +select atan(10 "p1", 20); +ERROR 42000: Incorrect parameters in the call to native function 'atan' +select atan(10, 20 AS p2); +ERROR 42000: Incorrect parameters in the call to native function 'atan' +select atan(10, 20 p2); +ERROR 42000: Incorrect parameters in the call to native function 'atan' +select atan(10, 20 AS "p2"); +ERROR 42000: Incorrect parameters in the call to native function 'atan' +select atan(10, 20 "p2"); +ERROR 42000: Incorrect parameters in the call to native function 'atan' +select atan(10 AS p1, 20 AS p2); +ERROR 42000: Incorrect parameters in the call to native function 'atan' diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result index e968d3de6e9..4988b1139e9 100644 --- a/mysql-test/r/ps.result +++ b/mysql-test/r/ps.result @@ -1486,6 +1486,24 @@ i 1 DEALLOCATE PREPARE stmt; DROP TABLE t1, t2; +CREATE TABLE t1 (i INT); +CREATE VIEW v1 AS SELECT * FROM t1; +INSERT INTO t1 VALUES (1), (2); +SELECT t1.i FROM t1 JOIN v1 ON t1.i = v1.i +WHERE EXISTS (SELECT * FROM t1 WHERE v1.i = 1); +i +1 +PREPARE stmt FROM "SELECT t1.i FROM t1 JOIN v1 ON t1.i = v1.i +WHERE EXISTS (SELECT * FROM t1 WHERE v1.i = 1)"; +EXECUTE stmt; +i +1 +EXECUTE stmt; +i +1 +DEALLOCATE PREPARE stmt; +DROP VIEW v1; +DROP TABLE t1; DROP PROCEDURE IF EXISTS p1; flush status; prepare sq from 'show status like "slow_queries"'; @@ -1509,9 +1527,9 @@ create procedure proc_1() reset query cache; call proc_1(); call proc_1(); call proc_1(); -create function func_1() returns int begin reset query cache; return 1; end| +create function func_1() returns int deterministic begin reset query cache; return 1; end| ERROR 0A000: RESET is not allowed in stored function or trigger -create function func_1() returns int begin call proc_1(); return 1; end| +create function func_1() returns int deterministic begin call proc_1(); return 1; end| select func_1(), func_1(), func_1() from dual; ERROR 0A000: RESET is not allowed in stored function or trigger drop function func_1; diff --git a/mysql-test/r/query_cache.result b/mysql-test/r/query_cache.result index fac026047de..54b35827cea 100644 --- a/mysql-test/r/query_cache.result +++ b/mysql-test/r/query_cache.result @@ -1077,10 +1077,12 @@ create procedure `p1`() begin select a, f1() from t1; end// +SET GLOBAL log_bin_trust_function_creators = 1; call p1()// a f1() 1 2 2 2 +SET GLOBAL log_bin_trust_function_creators = 0; drop procedure p1// drop function f1// drop table t1// diff --git a/mysql-test/r/query_cache_notembedded.result b/mysql-test/r/query_cache_notembedded.result index 8e5df012cfb..05ef28a3180 100644 --- a/mysql-test/r/query_cache_notembedded.result +++ b/mysql-test/r/query_cache_notembedded.result @@ -314,6 +314,7 @@ drop procedure f2; drop procedure f3; drop procedure f4; drop table t1; +SET GLOBAL log_bin_trust_function_creators = 1; reset query cache; drop function if exists f1; create table t1 (id int); @@ -345,3 +346,4 @@ id drop table t1; drop function f1; set GLOBAL query_cache_size=0; +SET GLOBAL log_bin_trust_function_creators = 0; diff --git a/mysql-test/r/read_only.result b/mysql-test/r/read_only.result index 1a1991a6255..69d25fbef6f 100644 --- a/mysql-test/r/read_only.result +++ b/mysql-test/r/read_only.result @@ -39,6 +39,11 @@ delete t1 from t1,t3 where t1.a=t3.a; drop table t1; insert into t1 values(1); ERROR HY000: The MySQL server is running with the --read-only option so it cannot execute this statement +drop temporary table ttt; +ERROR 42S02: Unknown table 'ttt' +drop temporary table if exists ttt; +Warnings: +Note 1051 Unknown table 'ttt' drop table t1,t2; drop user test@localhost; set global read_only=0; diff --git a/mysql-test/r/rpl_000015.result b/mysql-test/r/rpl_000015.result index a2763d4f023..a53750f82ad 100644 --- a/mysql-test/r/rpl_000015.result +++ b/mysql-test/r/rpl_000015.result @@ -8,7 +8,7 @@ Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File change master to master_host='127.0.0.1'; show slave status; Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master -# 127.0.0.1 test MASTER_PORT 7 4 # # No No 0 0 0 # None 0 No # +# 127.0.0.1 test DEFAULT_MASTER_PORT 7 4 # # No No 0 0 0 # None 0 No # change master to master_host='127.0.0.1',master_user='root', master_password='',master_port=MASTER_PORT; show slave status; diff --git a/mysql-test/r/rpl_deadlock_innodb.result b/mysql-test/r/rpl_deadlock_innodb.result index 9a67391cd4d..caf040c0997 100644 --- a/mysql-test/r/rpl_deadlock_innodb.result +++ b/mysql-test/r/rpl_deadlock_innodb.result @@ -132,6 +132,7 @@ Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master # +set @my_max_relay_log_size= @@global.max_relay_log_size; set global max_relay_log_size=0; stop slave; delete from t3; @@ -191,4 +192,5 @@ Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master # drop table t1,t2,t3,t4; +set global max_relay_log_size= @my_max_relay_log_size; End of 5.1 tests diff --git a/mysql-test/r/rpl_drop_db.result b/mysql-test/r/rpl_drop_db.result index 51d6d71ca95..c0efdf5290d 100644 --- a/mysql-test/r/rpl_drop_db.result +++ b/mysql-test/r/rpl_drop_db.result @@ -31,7 +31,8 @@ use test; select * from t1; n 1234 -DROP DATABASE mysqltest1; stop slave; +drop database mysqltest1; +drop database mysqltest1; use test; drop table t1; diff --git a/mysql-test/r/rpl_ignore_revoke.result b/mysql-test/r/rpl_ignore_revoke.result index 42625119f28..b1ccd2f0442 100644 --- a/mysql-test/r/rpl_ignore_revoke.result +++ b/mysql-test/r/rpl_ignore_revoke.result @@ -27,3 +27,4 @@ select_priv Y revoke select on *.* FROM 'user_foo'; delete from mysql.user where user="user_foo"; +delete from mysql.user where user="user_foo"; diff --git a/mysql-test/r/rpl_init_slave.result b/mysql-test/r/rpl_init_slave.result index 83d0a3289a2..740c918976c 100644 --- a/mysql-test/r/rpl_init_slave.result +++ b/mysql-test/r/rpl_init_slave.result @@ -16,9 +16,12 @@ Variable_name Value init_slave show variables like 'max_connections'; Variable_name Value -max_connections 100 +max_connections 151 +set @my_global_init_connect= @@global.init_connect; set global init_connect="set @c=1"; show variables like 'init_connect'; Variable_name Value init_connect set @c=1 stop slave; +set global init_connect= @my_global_init_connect; +set global max_connections= default; diff --git a/mysql-test/r/rpl_ndb_dd_basic.result b/mysql-test/r/rpl_ndb_dd_basic.result index 75323767427..245be1cc0a9 100644 --- a/mysql-test/r/rpl_ndb_dd_basic.result +++ b/mysql-test/r/rpl_ndb_dd_basic.result @@ -57,7 +57,7 @@ tablespace ts1 storage disk engine ndb master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.t1) -master-bin.000001 # Table_map # # table_id: # (mysql.apply_status) +master-bin.000001 # Table_map # # table_id: # (mysql.ndb_apply_status) master-bin.000001 # Write_rows # # table_id: # master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Query # # COMMIT diff --git a/mysql-test/r/rpl_ndb_idempotent.result b/mysql-test/r/rpl_ndb_idempotent.result index e8a96aec137..982cab33482 100644 --- a/mysql-test/r/rpl_ndb_idempotent.result +++ b/mysql-test/r/rpl_ndb_idempotent.result @@ -9,14 +9,14 @@ INSERT INTO t1 VALUES ("row1","will go away",1); SELECT * FROM t1 ORDER BY c3; c1 c2 c3 row1 will go away 1 -SELECT @the_epoch:=MAX(epoch) FROM mysql.apply_status; +SELECT @the_epoch:=MAX(epoch) FROM mysql.ndb_apply_status; @the_epoch:=MAX(epoch) <the_epoch> SELECT * FROM t1 ORDER BY c3; c1 c2 c3 row1 will go away 1 SELECT @the_pos:=Position,@the_file:=SUBSTRING_INDEX(FILE, '/', -1) -FROM mysql.binlog_index WHERE epoch = <the_epoch> ; +FROM mysql.ndb_binlog_index WHERE epoch = <the_epoch> ; @the_pos:=Position @the_file:=SUBSTRING_INDEX(FILE, '/', -1) <the_pos> master-bin.000001 INSERT INTO t1 VALUES ("row2","will go away",2),("row3","will change",3),("row4","D",4); diff --git a/mysql-test/r/rpl_ndb_log.result b/mysql-test/r/rpl_ndb_log.result index a594fa6c1dc..66db8c24bb2 100644 --- a/mysql-test/r/rpl_ndb_log.result +++ b/mysql-test/r/rpl_ndb_log.result @@ -22,7 +22,7 @@ master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4 master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=NDB master-bin.000001 # Query 1 # BEGIN master-bin.000001 # Table_map 1 # table_id: # (test.t1) -master-bin.000001 # Table_map 1 # table_id: # (mysql.apply_status) +master-bin.000001 # Table_map 1 # table_id: # (mysql.ndb_apply_status) master-bin.000001 # Write_rows 1 # table_id: # master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 # Query 1 # COMMIT @@ -30,7 +30,7 @@ master-bin.000001 # Query 1 # use `test`; drop table t1 master-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=NDB master-bin.000001 # Query 1 # BEGIN master-bin.000001 # Table_map 1 # table_id: # (test.t1) -master-bin.000001 # Table_map 1 # table_id: # (mysql.apply_status) +master-bin.000001 # Table_map 1 # table_id: # (mysql.ndb_apply_status) master-bin.000001 # Write_rows 1 # table_id: # master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 # Query 1 # COMMIT @@ -61,7 +61,7 @@ master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4 master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=NDB master-bin.000001 # Query 1 # BEGIN master-bin.000001 # Table_map 1 # table_id: # (test.t1) -master-bin.000001 # Table_map 1 # table_id: # (mysql.apply_status) +master-bin.000001 # Table_map 1 # table_id: # (mysql.ndb_apply_status) master-bin.000001 # Write_rows 1 # table_id: # master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 # Query 1 # COMMIT @@ -69,7 +69,7 @@ master-bin.000001 # Query 1 # use `test`; drop table t1 master-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=NDB master-bin.000001 # Query 1 # BEGIN master-bin.000001 # Table_map 1 # table_id: # (test.t1) -master-bin.000001 # Table_map 1 # table_id: # (mysql.apply_status) +master-bin.000001 # Table_map 1 # table_id: # (mysql.ndb_apply_status) master-bin.000001 # Write_rows 1 # table_id: # master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 # Query 1 # COMMIT @@ -81,18 +81,18 @@ master-bin.000002 # Query 1 # use `test`; create table t3 (a int)ENGINE=NDB master-bin.000002 # Query 1 # use `test`; create table t2 (n int)ENGINE=NDB master-bin.000002 # Query 1 # BEGIN master-bin.000002 # Table_map 1 # table_id: # (test.t2) -master-bin.000002 # Table_map 1 # table_id: # (mysql.apply_status) +master-bin.000002 # Table_map 1 # table_id: # (mysql.ndb_apply_status) master-bin.000002 # Write_rows 1 # table_id: # master-bin.000002 # Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000002 # Query 1 # COMMIT show binary logs; Log_name File_size -master-bin.000001 1694 -master-bin.000002 589 +master-bin.000001 1702 +master-bin.000002 593 start slave; show binary logs; Log_name File_size -slave-bin.000001 1789 +slave-bin.000001 1797 slave-bin.000002 198 show binlog events in 'slave-bin.000001' from 4; Log_name Pos Event_type Server_id End_log_pos Info @@ -100,7 +100,7 @@ slave-bin.000001 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4 slave-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=NDB slave-bin.000001 # Query 2 # BEGIN slave-bin.000001 # Table_map 2 # table_id: # (test.t1) -slave-bin.000001 # Table_map 2 # table_id: # (mysql.apply_status) +slave-bin.000001 # Table_map 2 # table_id: # (mysql.ndb_apply_status) slave-bin.000001 # Write_rows 2 # table_id: # slave-bin.000001 # Write_rows 2 # table_id: # flags: STMT_END_F slave-bin.000001 # Query 2 # COMMIT @@ -108,7 +108,7 @@ slave-bin.000001 # Query 1 # use `test`; drop table t1 slave-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=NDB slave-bin.000001 # Query 2 # BEGIN slave-bin.000001 # Table_map 2 # table_id: # (test.t1) -slave-bin.000001 # Table_map 2 # table_id: # (mysql.apply_status) +slave-bin.000001 # Table_map 2 # table_id: # (mysql.ndb_apply_status) slave-bin.000001 # Write_rows 2 # table_id: # slave-bin.000001 # Write_rows 2 # table_id: # flags: STMT_END_F slave-bin.000001 # Query 2 # COMMIT @@ -120,13 +120,13 @@ slave-bin.000002 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4 slave-bin.000002 # Query 1 # use `test`; create table t2 (n int)ENGINE=NDB slave-bin.000002 # Query 2 # BEGIN slave-bin.000002 # Table_map 2 # table_id: # (test.t2) -slave-bin.000002 # Table_map 2 # table_id: # (mysql.apply_status) +slave-bin.000002 # Table_map 2 # table_id: # (mysql.ndb_apply_status) slave-bin.000002 # Write_rows 2 # table_id: # slave-bin.000002 # Write_rows 2 # table_id: # flags: STMT_END_F slave-bin.000002 # Query 2 # COMMIT show slave status; Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master -# 127.0.0.1 root MASTER_PORT 1 master-bin.000002 589 # # master-bin.000002 Yes Yes # 0 0 589 # None 0 No # +# 127.0.0.1 root MASTER_PORT 1 master-bin.000002 593 # # master-bin.000002 Yes Yes # 0 0 593 # None 0 No # show binlog events in 'slave-bin.000005' from 4; ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log DROP TABLE t1; diff --git a/mysql-test/r/rpl_ndb_multi.result b/mysql-test/r/rpl_ndb_multi.result index 74e06b5ff38..66819c2c9c8 100644 --- a/mysql-test/r/rpl_ndb_multi.result +++ b/mysql-test/r/rpl_ndb_multi.result @@ -16,7 +16,7 @@ row1 will go away 1 SELECT * FROM t1 ORDER BY c3; c1 c2 c3 row1 will go away 1 -SELECT @the_epoch:=MAX(epoch) FROM mysql.apply_status; +SELECT @the_epoch:=MAX(epoch) FROM mysql.ndb_apply_status; @the_epoch:=MAX(epoch) <the_epoch> SELECT * FROM t1 ORDER BY c3; @@ -24,7 +24,7 @@ c1 c2 c3 row1 will go away 1 stop slave; SELECT @the_pos:=Position,@the_file:=SUBSTRING_INDEX(FILE, '/', -1) -FROM mysql.binlog_index WHERE epoch = <the_epoch> ; +FROM mysql.ndb_binlog_index WHERE epoch = <the_epoch> ; @the_pos:=Position @the_file:=SUBSTRING_INDEX(FILE, '/', -1) 102 master-bin1.000001 CHANGE MASTER TO diff --git a/mysql-test/r/rpl_row_max_relay_size.result b/mysql-test/r/rpl_row_max_relay_size.result index 163e8231de5..8bb10ffb080 100644 --- a/mysql-test/r/rpl_row_max_relay_size.result +++ b/mysql-test/r/rpl_row_max_relay_size.result @@ -16,6 +16,7 @@ reset slave; # # Test 1 # +set @my_max_binlog_size= @@global.max_binlog_size; set global max_binlog_size=8192; set global max_relay_log_size=8192-1; select @@global.max_relay_log_size; @@ -268,6 +269,7 @@ File master-bin.000002 Position 102 Binlog_Do_DB <Binlog_Ignore_DB> Binlog_Ignore_DB +set global max_binlog_size= @my_max_binlog_size; # # End of 4.1 tests # diff --git a/mysql-test/r/rpl_sf.result b/mysql-test/r/rpl_sf.result new file mode 100644 index 00000000000..46defc6908a --- /dev/null +++ b/mysql-test/r/rpl_sf.result @@ -0,0 +1,23 @@ +set global log_bin_trust_function_creators=0; +set binlog_format=STATEMENT; +create function fn16456() +returns int +begin +return unix_timestamp(); +end| +ERROR HY000: This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable) +set global log_bin_trust_function_creators=1; +create function fn16456() +returns int +begin +return unix_timestamp(); +end| +set global log_bin_trust_function_creators=0; +set binlog_format=ROW; +select fn16456(); +fn16456() +timestamp +set binlog_format=STATEMENT; +select fn16456(); +ERROR HY000: Slave running with --log-slave-updates must use row-based binary logging to be able to replicate row-based binary log events +drop function fn16456; diff --git a/mysql-test/r/rpl_sp.result b/mysql-test/r/rpl_sp.result index 261e7cb072c..fe54b1cbeb4 100644 --- a/mysql-test/r/rpl_sp.result +++ b/mysql-test/r/rpl_sp.result @@ -104,10 +104,10 @@ begin insert into t2 values(20),(20); end| call foo4(); -ERROR 23000: Duplicate entry '20' for key 1 +ERROR 23000: Duplicate entry '20' for key 'a' show warnings; Level Code Message -Error 1062 Duplicate entry '20' for key 1 +Error 1062 Duplicate entry '20' for key 'a' select * from t2; a 20 @@ -181,7 +181,7 @@ end| ERROR HY000: You do not have the SUPER privilege and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable) set global log_bin_trust_routine_creators=1; Warnings: -Warning 1287 'log_bin_trust_routine_creators' is deprecated; use 'log_bin_trust_function_creators' instead +Warning 1541 The syntax 'log_bin_trust_routine_creators' is deprecated and will be removed in MySQL 5.2. Please use 'log_bin_trust_function_creators' instead set global log_bin_trust_function_creators=0; set global log_bin_trust_function_creators=1; set global log_bin_trust_function_creators=1; @@ -241,9 +241,9 @@ return 10; end| do fn1(100); Warnings: -Error 1062 Duplicate entry '100' for key 1 +Error 1062 Duplicate entry '100' for key 'a' select fn1(20); -ERROR 23000: Duplicate entry '20' for key 1 +ERROR 23000: Duplicate entry '20' for key 'a' select * from t2; a 20 @@ -253,7 +253,7 @@ a 20 100 create trigger trg before insert on t1 for each row set new.a= 10; -ERROR 42000: Access denied; you need the SUPER privilege for this operation +ERROR 42000: TRIGGER command denied to user 'zedjzlcsjhd'@'localhost' for table 't1' delete from t1; create trigger trg before insert on t1 for each row set new.a= 10; insert into t1 values (1); @@ -465,3 +465,29 @@ RETURN 0 DROP PROCEDURE p1; DROP FUNCTION f1; drop table t1; +set global log_bin_trust_function_creators=0; +set global log_bin_trust_function_creators=0; +End of 5.0 tests +reset master; +drop database if exists mysqltest; +drop database if exists mysqltest2; +create database mysqltest; +create database mysqltest2; +use mysqltest2; +create table t ( t integer ); +create procedure mysqltest.test() begin end; +insert into t values ( 1 ); +show binlog events in 'master-bin.000001' from 102; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 102 Query 1 203 drop database if exists mysqltest +master-bin.000001 203 Query 1 306 drop database if exists mysqltest2 +master-bin.000001 306 Query 1 399 create database mysqltest +master-bin.000001 399 Query 1 494 create database mysqltest2 +master-bin.000001 494 Query 1 591 use `mysqltest2`; create table t ( t integer ) +master-bin.000001 591 Query 1 730 use `mysqltest2`; CREATE DEFINER=`root`@`localhost` procedure mysqltest.test() begin end +master-bin.000001 730 Query 1 825 use `mysqltest2`; insert into t values ( 1 ) +create procedure `\\`.test() begin end; +ERROR 42000: Unknown database '\\' +drop database mysqltest; +drop database mysqltest2; +End of 5.1 tests diff --git a/mysql-test/r/rpl_sp_effects.result b/mysql-test/r/rpl_sp_effects.result index b42fe64e603..c2c44b06972 100644 --- a/mysql-test/r/rpl_sp_effects.result +++ b/mysql-test/r/rpl_sp_effects.result @@ -10,6 +10,7 @@ drop function if exists f1; drop table if exists t1,t2; drop view if exists v1; create table t1 (a int); +SET GLOBAL log_bin_trust_function_creators = 1; create procedure p1() begin declare spv int default 0; @@ -234,3 +235,4 @@ drop table t1; drop function f1; drop function f2; drop procedure p1; +SET GLOBAL log_bin_trust_function_creators = 0; diff --git a/mysql-test/r/rpl_stm_max_relay_size.result b/mysql-test/r/rpl_stm_max_relay_size.result index 7882bd1aa46..c4a9a5bd3ff 100644 --- a/mysql-test/r/rpl_stm_max_relay_size.result +++ b/mysql-test/r/rpl_stm_max_relay_size.result @@ -14,6 +14,7 @@ reset slave; # # Test 1 # +set @my_max_binlog_size= @@global.max_binlog_size; set global max_binlog_size=8192; set global max_relay_log_size=8192-1; select @@global.max_relay_log_size; @@ -266,6 +267,7 @@ File master-bin.000002 Position 102 Binlog_Do_DB <Binlog_Ignore_DB> Binlog_Ignore_DB +set global max_binlog_size= @my_max_binlog_size; # # End of 4.1 tests # diff --git a/mysql-test/r/rpl_timezone.result b/mysql-test/r/rpl_timezone.result index 4ad6afa8c94..47ef16b9d49 100644 --- a/mysql-test/r/rpl_timezone.result +++ b/mysql-test/r/rpl_timezone.result @@ -4,6 +4,7 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; +set @my_time_zone= @@global.time_zone; set timestamp=100000000; create table t1 (t timestamp, n int not null auto_increment, PRIMARY KEY(n)); create table t2 (t char(32), n int not null auto_increment, PRIMARY KEY(n)); @@ -103,3 +104,4 @@ t n 2003-12-31 23:00:00 16 2005-01-01 08:00:00 17 drop table t1, t2; +set global time_zone= @my_time_zone; diff --git a/mysql-test/r/rpl_truncate_7ndb.result b/mysql-test/r/rpl_truncate_7ndb.result index c57eb2e1dae..63d4b0f9411 100644 --- a/mysql-test/r/rpl_truncate_7ndb.result +++ b/mysql-test/r/rpl_truncate_7ndb.result @@ -33,12 +33,12 @@ master-bin.000001 4 Format_desc 1 102 Server ver: SERVER_VERSION, Binlog ver: 4 master-bin.000001 102 Query 1 219 use `test`; CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB master-bin.000001 219 Query 1 283 BEGIN master-bin.000001 283 Table_map 1 40 table_id: # (test.t1) -master-bin.000001 323 Table_map 1 91 table_id: # (mysql.apply_status) -master-bin.000001 374 Write_rows 1 133 table_id: # -master-bin.000001 416 Write_rows 1 180 table_id: # flags: STMT_END_F -master-bin.000001 463 Query 1 528 COMMIT -master-bin.000001 528 Query 1 608 use `test`; TRUNCATE TABLE t1 -master-bin.000001 608 Query 1 684 use `test`; DROP TABLE t1 +master-bin.000001 323 Table_map 1 95 table_id: # (mysql.ndb_apply_status) +master-bin.000001 378 Write_rows 1 137 table_id: # +master-bin.000001 420 Write_rows 1 184 table_id: # flags: STMT_END_F +master-bin.000001 467 Query 1 532 COMMIT +master-bin.000001 532 Query 1 612 use `test`; TRUNCATE TABLE t1 +master-bin.000001 612 Query 1 688 use `test`; DROP TABLE t1 **** On Master **** CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB; INSERT INTO t1 VALUES (1,1), (2,2); @@ -69,23 +69,23 @@ master-bin.000001 4 Format_desc 1 102 Server ver: SERVER_VERSION, Binlog ver: 4 master-bin.000001 102 Query 1 219 use `test`; CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB master-bin.000001 219 Query 1 283 BEGIN master-bin.000001 283 Table_map 1 40 table_id: # (test.t1) -master-bin.000001 323 Table_map 1 91 table_id: # (mysql.apply_status) -master-bin.000001 374 Write_rows 1 133 table_id: # -master-bin.000001 416 Write_rows 1 180 table_id: # flags: STMT_END_F -master-bin.000001 463 Query 1 528 COMMIT -master-bin.000001 528 Query 1 608 use `test`; TRUNCATE TABLE t1 -master-bin.000001 608 Query 1 684 use `test`; DROP TABLE t1 -master-bin.000001 684 Query 1 801 use `test`; CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB -master-bin.000001 801 Query 1 865 BEGIN -master-bin.000001 865 Table_map 1 40 table_id: # (test.t1) -master-bin.000001 905 Table_map 1 91 table_id: # (mysql.apply_status) -master-bin.000001 956 Write_rows 1 133 table_id: # -master-bin.000001 998 Write_rows 1 180 table_id: # flags: STMT_END_F -master-bin.000001 1045 Query 1 1110 COMMIT -master-bin.000001 1110 Query 1 1174 BEGIN -master-bin.000001 1174 Table_map 1 40 table_id: # (test.t1) -master-bin.000001 1214 Table_map 1 91 table_id: # (mysql.apply_status) -master-bin.000001 1265 Write_rows 1 133 table_id: # -master-bin.000001 1307 Delete_rows 1 172 table_id: # flags: STMT_END_F -master-bin.000001 1346 Query 1 1411 COMMIT -master-bin.000001 1411 Query 1 1487 use `test`; DROP TABLE t1 +master-bin.000001 323 Table_map 1 95 table_id: # (mysql.ndb_apply_status) +master-bin.000001 378 Write_rows 1 137 table_id: # +master-bin.000001 420 Write_rows 1 184 table_id: # flags: STMT_END_F +master-bin.000001 467 Query 1 532 COMMIT +master-bin.000001 532 Query 1 612 use `test`; TRUNCATE TABLE t1 +master-bin.000001 612 Query 1 688 use `test`; DROP TABLE t1 +master-bin.000001 688 Query 1 805 use `test`; CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB +master-bin.000001 805 Query 1 869 BEGIN +master-bin.000001 869 Table_map 1 40 table_id: # (test.t1) +master-bin.000001 909 Table_map 1 95 table_id: # (mysql.ndb_apply_status) +master-bin.000001 964 Write_rows 1 137 table_id: # +master-bin.000001 1006 Write_rows 1 184 table_id: # flags: STMT_END_F +master-bin.000001 1053 Query 1 1118 COMMIT +master-bin.000001 1118 Query 1 1182 BEGIN +master-bin.000001 1182 Table_map 1 40 table_id: # (test.t1) +master-bin.000001 1222 Table_map 1 95 table_id: # (mysql.ndb_apply_status) +master-bin.000001 1277 Write_rows 1 137 table_id: # +master-bin.000001 1319 Delete_rows 1 176 table_id: # flags: STMT_END_F +master-bin.000001 1358 Query 1 1423 COMMIT +master-bin.000001 1423 Query 1 1499 use `test`; DROP TABLE t1 diff --git a/mysql-test/r/rpl_variables.result b/mysql-test/r/rpl_variables.result index bbfe8373a46..605a48859a0 100644 --- a/mysql-test/r/rpl_variables.result +++ b/mysql-test/r/rpl_variables.result @@ -4,6 +4,7 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; +set @my_slave_net_timeout =@@global.slave_net_timeout; set global slave_net_timeout=100; set global sql_slave_skip_counter=100; show variables like 'slave_compressed_protocol'; diff --git a/mysql-test/r/show_check.result b/mysql-test/r/show_check.result index 2ce49a38568..516355839b5 100644 --- a/mysql-test/r/show_check.result +++ b/mysql-test/r/show_check.result @@ -334,7 +334,7 @@ SET sql_quote_show_create= @old_sql_quote_show_create; SET sql_mode= @old_sql_mode; select @@max_heap_table_size; @@max_heap_table_size -1047552 +1048576 CREATE TABLE t1 ( a int(11) default NULL, KEY a USING BTREE (a) diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result index ae9de5c9aad..7c5782707a4 100644 --- a/mysql-test/r/sp.result +++ b/mysql-test/r/sp.result @@ -243,7 +243,7 @@ set x = (select sum(t.i) from test.t2 t); insert into test.t1 values (id, x); end| drop procedure if exists sub3| -create function sub3(i int) returns int +create function sub3(i int) returns int deterministic return i+1| call sub1("sub1a", (select 7))| call sub1("sub1b", (select max(i) from t2))| @@ -2710,11 +2710,11 @@ row_count() call bug4905()| select row_count()| row_count() -0 +-1 call bug4905()| select row_count()| row_count() -0 +-1 select * from t3| s1 1 @@ -5735,4 +5735,85 @@ drop function test.current_user; drop function md5; use test; End of 5.1 tests +DROP TABLE IF EXISTS bug23760| +DROP TABLE IF EXISTS bug23760_log| +DROP PROCEDURE IF EXISTS bug23760_update_log| +DROP PROCEDURE IF EXISTS bug23760_test_row_count| +DROP FUNCTION IF EXISTS bug23760_rc_test| +CREATE TABLE bug23760 ( +id INT NOT NULL AUTO_INCREMENT , +num INT NOT NULL , +PRIMARY KEY ( id ) +)| +CREATE TABLE bug23760_log ( +id INT NOT NULL AUTO_INCREMENT , +reason VARCHAR(50)NULL , +ammount INT NOT NULL , +PRIMARY KEY ( id ) +)| +CREATE PROCEDURE bug23760_update_log(r Varchar(50), a INT) +BEGIN +INSERT INTO bug23760_log (reason, ammount) VALUES(r, a); +END| +CREATE PROCEDURE bug23760_test_row_count() +BEGIN +UPDATE bug23760 SET num = num + 1; +CALL bug23760_update_log('Test is working', ROW_COUNT()); +UPDATE bug23760 SET num = num - 1; +END| +CREATE PROCEDURE bug23760_test_row_count2(level INT) +BEGIN +IF level THEN +UPDATE bug23760 SET num = num + 1; +CALL bug23760_update_log('Test2 is working', ROW_COUNT()); +CALL bug23760_test_row_count2(level - 1); +END IF; +END| +CREATE FUNCTION bug23760_rc_test(in_var INT) RETURNS INT RETURN in_var| +INSERT INTO bug23760 (num) VALUES (0), (1), (1), (2), (3), (5), (8)| +SELECT ROW_COUNT()| +ROW_COUNT() +7 +CALL bug23760_test_row_count()| +SELECT * FROM bug23760_log ORDER BY id| +id reason ammount +1 Test is working 7 +SET @save_max_sp_recursion= @@max_sp_recursion_depth| +SELECT @save_max_sp_recursion| +@save_max_sp_recursion +0 +SET max_sp_recursion_depth= 5| +SELECT @@max_sp_recursion_depth| +@@max_sp_recursion_depth +5 +CALL bug23760_test_row_count2(2)| +SELECT ROW_COUNT()| +ROW_COUNT() +1 +SELECT * FROM bug23760_log ORDER BY id| +id reason ammount +1 Test is working 7 +2 Test2 is working 7 +3 Test2 is working 7 +SELECT * FROM bug23760 ORDER by ID| +id num +1 2 +2 3 +3 3 +4 4 +5 5 +6 7 +7 10 +SET max_sp_recursion_depth= @save_max_sp_recursion| +SELECT bug23760_rc_test(123)| +bug23760_rc_test(123) +123 +INSERT INTO bug23760 (num) VALUES (13), (21), (34), (55)| +SELECT bug23760_rc_test(ROW_COUNT())| +bug23760_rc_test(ROW_COUNT()) +4 +DROP TABLE bug23760, bug23760_log| +DROP PROCEDURE bug23760_update_log| +DROP PROCEDURE bug23760_test_row_count| +DROP FUNCTION bug23760_rc_test| drop table t1,t2; diff --git a/mysql-test/r/system_mysql_db.result b/mysql-test/r/system_mysql_db.result index 4166cbc395f..424e9e9c12d 100644 --- a/mysql-test/r/system_mysql_db.result +++ b/mysql-test/r/system_mysql_db.result @@ -1,7 +1,6 @@ drop table if exists t1,t1aa,t2aa; show tables; Tables_in_db -binlog_index columns_priv db event @@ -12,6 +11,7 @@ help_keyword help_relation help_topic host +ndb_binlog_index plugin proc procs_priv diff --git a/mysql-test/r/timezone2.result b/mysql-test/r/timezone2.result index 6fd67d00259..f7631e9657a 100644 --- a/mysql-test/r/timezone2.result +++ b/mysql-test/r/timezone2.result @@ -269,6 +269,7 @@ select * from t1; convert_tz(NULL, NULL, NULL) NULL drop table t1; +SET GLOBAL log_bin_trust_function_creators = 1; create table t1 (ldt datetime, udt datetime); create function f1(i datetime) returns datetime return convert_tz(i, 'UTC', 'Europe/Moscow'); @@ -283,3 +284,4 @@ ldt ldt2 2006-04-19 16:30:00 2006-04-19 16:30:00 drop table t1; drop function f1; +SET GLOBAL log_bin_trust_function_creators = 0; diff --git a/mysql-test/r/type_bit.result b/mysql-test/r/type_bit.result index 5c9b70fadc3..cfd3854c200 100644 --- a/mysql-test/r/type_bit.result +++ b/mysql-test/r/type_bit.result @@ -610,4 +610,12 @@ select hex(a), b from t1; hex(a) b 1 2 drop table t1; +create table t1(bit_field bit(2), int_field int, key a(bit_field)); +insert into t1 values (1,2); +handler t1 open as t1; +handler t1 read a=(1); +bit_field int_field + 2 +handler t1 close; +drop table t1; End of 5.0 tests diff --git a/mysql-test/r/type_float.result b/mysql-test/r/type_float.result index d28131cc456..73f5e54ecc3 100644 --- a/mysql-test/r/type_float.result +++ b/mysql-test/r/type_float.result @@ -264,7 +264,7 @@ a decimal(21,2) NO 0.00 drop table t1,t2,t3; select 1e-308, 1.00000001e-300, 100000000e-300; 1e-308 1.00000001e-300 100000000e-300 -0 1.00000001e-300 1e-292 +1e-308 1.00000001e-300 1e-292 select 10e307; 10e307 1e+308 diff --git a/mysql-test/r/type_varchar.result b/mysql-test/r/type_varchar.result index 9ad3d5bb611..96042a91bae 100644 --- a/mysql-test/r/type_varchar.result +++ b/mysql-test/r/type_varchar.result @@ -453,3 +453,39 @@ id name_id id en cz 2 3 2 en string 2 cz string 2 3 3 3 en string 3 cz string 3 drop table t1, t2, t3; +CREATE TABLE t1 (a CHAR(2)); +INSERT INTO t1 VALUES (10), (50), (30), ('1a'), (60), ('t'); +SELECT a,(a + 0) FROM t1 ORDER BY a; +a (a + 0) +10 10 +1a 1 +30 30 +50 50 +60 60 +t 0 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '1a' +Warning 1292 Truncated incorrect DOUBLE value: 't ' +SELECT a,(a DIV 2) FROM t1 ORDER BY a; +a (a DIV 2) +10 5 +1a 0 +30 15 +50 25 +60 30 +t 0 +Warnings: +Warning 1292 Truncated incorrect INTEGER value: '1a' +Warning 1292 Truncated incorrect INTEGER value: 't ' +SELECT a,CAST(a AS SIGNED) FROM t1 ORDER BY a; +a CAST(a AS SIGNED) +10 10 +1a 1 +30 30 +50 50 +60 60 +t 0 +Warnings: +Warning 1292 Truncated incorrect INTEGER value: '1a' +Warning 1292 Truncated incorrect INTEGER value: 't' +DROP TABLE t1; diff --git a/mysql-test/r/udf.result b/mysql-test/r/udf.result index 1308980ca96..abc654c4b74 100644 --- a/mysql-test/r/udf.result +++ b/mysql-test/r/udf.result @@ -132,9 +132,9 @@ a c 1 1 2 2 SELECT a, fn(MIN(b) xx) as c FROM t1 GROUP BY a; -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 'xx) as c FROM t1 GROUP BY a' at line 1 +ERROR 42000: Incorrect parameters in the call to stored function 'fn' SELECT myfunc_int(fn(MIN(b) xx)) as c FROM t1 GROUP BY a; -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 'xx)) as c FROM t1 GROUP BY a' at line 1 +ERROR 42000: Incorrect parameters in the call to stored function 'fn' SELECT myfunc_int(test.fn(MIN(b) xx)) as c FROM t1 GROUP BY a; 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 'xx)) as c FROM t1 GROUP BY a' at line 1 SELECT myfunc_int(fn(MIN(b)) xx) as c FROM t1 GROUP BY a; @@ -185,6 +185,28 @@ DROP VIEW v1; DROP TABLE t1; DROP FUNCTION fn; End of 5.0 tests. +select myfunc_double(3); +myfunc_double(3) +51.00 +select myfunc_double(3 AS three); +myfunc_double(3 AS three) +51.00 +select myfunc_double(abs(3)); +myfunc_double(abs(3)) +51.00 +select myfunc_double(abs(3) AS named_param); +myfunc_double(abs(3) AS named_param) +51.00 +select abs(myfunc_double(3)); +abs(myfunc_double(3)) +51.00 +select abs(myfunc_double(3 AS three)); +abs(myfunc_double(3 AS three)) +51.00 +select myfunc_double(abs(3 AS wrong)); +ERROR 42000: Incorrect parameters in the call to native function 'abs' +select abs(myfunc_double(3) AS wrong); +ERROR 42000: Incorrect parameters in the call to native function 'abs' drop function if exists pi; CREATE FUNCTION pi RETURNS STRING SONAME "should_not_parse.so"; ERROR HY000: This function 'pi' has the same name as a native function. @@ -210,3 +232,38 @@ DROP FUNCTION sequence; DROP FUNCTION lookup; DROP FUNCTION reverse_lookup; DROP FUNCTION avgcost; +CREATE FUNCTION is_const RETURNS STRING SONAME "UDF_EXAMPLE_LIB"; +select +is_const(3) as const, +is_const(3.14) as const, +is_const('fnord') as const, +is_const(2+3) as const, +is_const(rand()) as 'nc rand()', +is_const(sin(3.14)) as const, +is_const(upper('test')) as const; +const const const const nc rand() const const +const const const const not const const const +create table bug18761 (n int); +insert into bug18761 values (null),(2); +select +is_const(3) as const, +is_const(3.14) as const, +is_const('fnord') as const, +is_const(2+3) as const, +is_const(2+n) as 'nc 2+n ', +is_const(sin(n)) as 'nc sin(n)', +is_const(sin(3.14)) as const, +is_const(upper('test')) as const, +is_const(rand()) as 'nc rand()', +is_const(n) as 'nc n ', +is_const(is_const(n)) as 'nc ic?(n)', +is_const(is_const('c')) as const +from +bug18761; +const const const const nc 2+n nc sin(n) const const nc rand() nc n nc ic?(n) const +const const const const not const not const const const not const not const not const const +const const const const not const not const const const not const not const not const const +drop table bug18761; +select is_const((1,2,3)); +ERROR 21000: Operand should contain 1 column(s) +drop function if exists is_const; diff --git a/mysql-test/r/varbinary.result b/mysql-test/r/varbinary.result index 1841dc9f0a9..e1ac58ecd52 100644 --- a/mysql-test/r/varbinary.result +++ b/mysql-test/r/varbinary.result @@ -26,3 +26,55 @@ select x,xx from t1; x xx 1 2 drop table t1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varbinary(255) DEFAULT NULL, + `b` varchar(255) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +select length(a), length(b) from t1; +length(a) length(b) +255 3 +255 3 +CHECK TABLE t1 FOR UPGRADE; +Table Op Msg_type Msg_text +test.t1 check error Table upgrade required. Please do "REPAIR TABLE `t1`" to fix it! +REPAIR TABLE t1; +Table Op Msg_type Msg_text +test.t1 repair status OK +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varbinary(255) DEFAULT NULL, + `b` varchar(255) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +select length(a), length(b) from t1; +length(a) length(b) +3 3 +3 3 +insert into t1 values("ccc", "ddd"); +select length(a), length(b) from t1; +length(a) length(b) +3 3 +3 3 +3 3 +select hex(a), hex(b) from t1; +hex(a) hex(b) +616161 636363 +626262 646464 +636363 646464 +select concat("'", a, "'"), concat("'", b, "'") from t1; +concat("'", a, "'") concat("'", b, "'") +'aaa' 'ccc' +'bbb' 'ddd' +'ccc' 'ddd' +drop table t1; +create table t1(a varbinary(255)); +insert into t1 values("aaa "); +select length(a) from t1; +length(a) +6 +alter table t1 modify a varchar(255); +select length(a) from t1; +length(a) +6 diff --git a/mysql-test/r/view_grant.result b/mysql-test/r/view_grant.result index f325d1ed7b6..e05a84a8f2d 100644 --- a/mysql-test/r/view_grant.result +++ b/mysql-test/r/view_grant.result @@ -546,13 +546,13 @@ CREATE SQL SECURITY DEFINER VIEW mysqltest1.v_tu AS SELECT * FROM mysqltest1.t1; CREATE SQL SECURITY DEFINER VIEW mysqltest1.v_tus AS SELECT * FROM mysqltest1.t1; CREATE SQL SECURITY DEFINER VIEW mysqltest1.v_td AS SELECT * FROM mysqltest1.t1; CREATE SQL SECURITY DEFINER VIEW mysqltest1.v_tds AS SELECT * FROM mysqltest1.t1; -GRANT SELECT, INSERT, UPDATE, DELETE ON mysqltest1.v_t1 TO readonly; -GRANT SELECT ON mysqltest1.v_ts TO readonly; -GRANT INSERT ON mysqltest1.v_ti TO readonly; -GRANT UPDATE ON mysqltest1.v_tu TO readonly; -GRANT UPDATE,SELECT ON mysqltest1.v_tus TO readonly; -GRANT DELETE ON mysqltest1.v_td TO readonly; -GRANT DELETE,SELECT ON mysqltest1.v_tds TO readonly; +GRANT SELECT, INSERT, UPDATE, DELETE ON mysqltest1.v_t1 TO readonly@localhost; +GRANT SELECT ON mysqltest1.v_ts TO readonly@localhost; +GRANT INSERT ON mysqltest1.v_ti TO readonly@localhost; +GRANT UPDATE ON mysqltest1.v_tu TO readonly@localhost; +GRANT UPDATE,SELECT ON mysqltest1.v_tus TO readonly@localhost; +GRANT DELETE ON mysqltest1.v_td TO readonly@localhost; +GRANT DELETE,SELECT ON mysqltest1.v_tds TO readonly@localhost; SELECT * FROM mysqltest1.v_t1; ERROR HY000: View 'mysqltest1.v_t1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them INSERT INTO mysqltest1.v_t1 VALUES(4); @@ -714,3 +714,22 @@ DROP FUNCTION f1; DROP VIEW v2; DROP VIEW v1; DROP USER mysqltest_u1@localhost; +CREATE DATABASE db17254; +USE db17254; +CREATE TABLE t1 (f1 INT); +INSERT INTO t1 VALUES (10),(20); +CREATE USER def_17254@localhost; +GRANT SELECT ON db17254.* TO def_17254@localhost; +CREATE USER inv_17254@localhost; +GRANT SELECT ON db17254.t1 TO inv_17254@localhost; +GRANT CREATE VIEW ON db17254.* TO def_17254@localhost; +CREATE VIEW v1 AS SELECT * FROM t1; +DROP USER def_17254@localhost; +for a user +SELECT * FROM v1; +ERROR 42000: SELECT command denied to user 'inv_17254'@'localhost' for table 'v1' +for a superuser +SELECT * FROM v1; +ERROR HY000: There is no 'def_17254'@'localhost' registered +DROP USER inv_17254@localhost; +DROP DATABASE db17254; diff --git a/mysql-test/std_data/bug19371.MYD b/mysql-test/std_data/bug19371.MYD Binary files differnew file mode 100644 index 00000000000..1b58a70832f --- /dev/null +++ b/mysql-test/std_data/bug19371.MYD diff --git a/mysql-test/std_data/bug19371.MYI b/mysql-test/std_data/bug19371.MYI Binary files differnew file mode 100644 index 00000000000..06ee5b2d766 --- /dev/null +++ b/mysql-test/std_data/bug19371.MYI diff --git a/mysql-test/std_data/bug19371.frm b/mysql-test/std_data/bug19371.frm Binary files differnew file mode 100644 index 00000000000..7be45d6f8da --- /dev/null +++ b/mysql-test/std_data/bug19371.frm diff --git a/mysql-test/t/alter_table.test b/mysql-test/t/alter_table.test index 78bbd23adf1..6269ff38857 100644 --- a/mysql-test/t/alter_table.test +++ b/mysql-test/t/alter_table.test @@ -101,7 +101,7 @@ create table mysqltest.t1 (name char(15)); insert into mysqltest.t1 (name) values ("mysqltest"); select * from t1; select * from mysqltest.t1; ---error 1050 +--error ER_TABLE_EXISTS_ERROR alter table t1 rename mysqltest.t1; select * from t1; select * from mysqltest.t1; @@ -231,9 +231,9 @@ DROP TABLE t1; # BUG#4717 - check for valid table names # create table t1 (a int); ---error 1103 +--error ER_WRONG_TABLE_NAME alter table t1 rename to ``; ---error 1103 +--error ER_WRONG_TABLE_NAME rename table t1 to ``; drop table t1; @@ -325,14 +325,14 @@ drop table t1; CREATE TABLE t1 (a int PRIMARY KEY, b INT UNIQUE); ALTER TABLE t1 DROP PRIMARY KEY; SHOW CREATE TABLE t1; ---error 1091 +--error ER_CANT_DROP_FIELD_OR_KEY ALTER TABLE t1 DROP PRIMARY KEY; DROP TABLE t1; # BUG#3899 create table t1 (a int, b int, key(a)); insert into t1 values (1,1), (2,2); ---error 1091 +--error ER_CANT_DROP_FIELD_OR_KEY alter table t1 drop key no_such_key; alter table t1 drop key a; drop table t1; @@ -343,7 +343,7 @@ drop table t1; # Some platforms (Mac OS X, Windows) will send the error message using small letters. CREATE TABLE T12207(a int) ENGINE=MYISAM; --replace_result t12207 T12207 ---error 1031 +--error ER_ILLEGAL_HA ALTER TABLE T12207 DISCARD TABLESPACE; DROP TABLE T12207; @@ -367,11 +367,108 @@ drop table t1; # shorter than packed field length. # create table t1 ( a timestamp ); ---error 1089 +--error ER_WRONG_SUB_KEY alter table t1 add unique ( a(1) ); drop table t1; # +# Bug #24395: ALTER TABLE DISABLE KEYS doesn't work when modifying the table +# +# This problem happens if the data change is compatible. +# Changing to the same type is compatible for example. +# +--disable_warnings +drop table if exists t1; +--enable_warnings +create table t1 (a int, key(a)); +show indexes from t1; +--echo "this used not to disable the index" +alter table t1 modify a int, disable keys; +show indexes from t1; + +alter table t1 enable keys; +show indexes from t1; + +alter table t1 modify a bigint, disable keys; +show indexes from t1; + +alter table t1 enable keys; +show indexes from t1; + +alter table t1 add b char(10), disable keys; +show indexes from t1; + +alter table t1 add c decimal(10,2), enable keys; +show indexes from t1; + +--echo "this however did" +alter table t1 disable keys; +show indexes from t1; + +desc t1; + +alter table t1 add d decimal(15,5); +--echo "The key should still be disabled" +show indexes from t1; + +drop table t1; + +--echo "Now will test with one unique index" +create table t1(a int, b char(10), unique(a)); +show indexes from t1; +alter table t1 disable keys; +show indexes from t1; +alter table t1 enable keys; + +--echo "If no copy on noop change, this won't touch the data file" +--echo "Unique index, no change" +alter table t1 modify a int, disable keys; +show indexes from t1; + +--echo "Change the type implying data copy" +--echo "Unique index, no change" +alter table t1 modify a bigint, disable keys; +show indexes from t1; + +alter table t1 modify a bigint; +show indexes from t1; + +alter table t1 modify a int; +show indexes from t1; + +drop table t1; + +--echo "Now will test with one unique and one non-unique index" +create table t1(a int, b char(10), unique(a), key(b)); +show indexes from t1; +alter table t1 disable keys; +show indexes from t1; +alter table t1 enable keys; + + +--echo "If no copy on noop change, this won't touch the data file" +--echo "The non-unique index will be disabled" +alter table t1 modify a int, disable keys; +show indexes from t1; +alter table t1 enable keys; +show indexes from t1; + +--echo "Change the type implying data copy" +--echo "The non-unique index will be disabled" +alter table t1 modify a bigint, disable keys; +show indexes from t1; + +--echo "Change again the type, but leave the indexes as_is" +alter table t1 modify a int; +show indexes from t1; +--echo "Try the same. When data is no copied on similar tables, this is noop" +alter table t1 modify a int; +show indexes from t1; + +drop table t1; + + +# # Bug#11493 - Alter table rename to default database does not work without # db name qualifying # @@ -380,7 +477,7 @@ create table t1 (c1 int); # Move table to other database. alter table t1 rename mysqltest.t1; # Assure that it has moved. ---error 1051 +--error ER_BAD_TABLE_ERROR drop table t1; # Move table back. alter table mysqltest.t1 rename t1; @@ -394,7 +491,7 @@ use mysqltest; # Drop the current db. This de-selects any db. drop database mysqltest; # Now test for correct message. ---error 1046 +--error ER_NO_DB_ERROR alter table test.t1 rename t1; # Check that explicit qualifying works even with no selected db. alter table test.t1 rename test.t1; @@ -402,6 +499,24 @@ alter table test.t1 rename test.t1; use test; drop table t1; +# +# Bug#24219 - ALTER TABLE ... RENAME TO ... , DISABLE KEYS leads to crash +# +--disable_warnings +DROP TABLE IF EXISTS bug24219; +DROP TABLE IF EXISTS bug24219_2; +--enable_warnings + +CREATE TABLE bug24219 (a INT, INDEX(a)); + +SHOW INDEX FROM bug24219; + +ALTER TABLE bug24219 RENAME TO bug24219_2, DISABLE KEYS; + +SHOW INDEX FROM bug24219_2; + +DROP TABLE bug24219_2; + # End of 4.1 tests # @@ -535,3 +650,39 @@ INSERT INTO `@0023sql1` VALUES (2); SHOW CREATE TABLE `#sql2`; SHOW CREATE TABLE `@0023sql1`; DROP TABLE `#sql2`, `@0023sql1`; + +# +# Bug #22369: Alter table rename combined with other alterations causes lost tables +# +# This problem happens if the data change is compatible. +# Changing to the same type is compatible for example. +# +--disable_warnings +DROP TABLE IF EXISTS t1; +DROP TABLE IF EXISTS t2; +--enable_warnings +CREATE TABLE t1 ( + int_field INTEGER UNSIGNED NOT NULL, + char_field CHAR(10), + INDEX(`int_field`) +); + +DESCRIBE t1; + +SHOW INDEXES FROM t1; + +INSERT INTO t1 VALUES (1, "edno"), (1, "edno"), (2, "dve"), (3, "tri"), (5, "pet"); +--echo "Non-copy data change - new frm, but old data and index files" +ALTER TABLE t1 + CHANGE int_field unsigned_int_field INTEGER UNSIGNED NOT NULL, + RENAME t2; + +--error ER_NO_SUCH_TABLE +SELECT * FROM t1 ORDER BY int_field; +SELECT * FROM t2 ORDER BY unsigned_int_field; +DESCRIBE t2; +DESCRIBE t2; +ALTER TABLE t2 MODIFY unsigned_int_field BIGINT UNSIGNED NOT NULL; +DESCRIBE t2; + +DROP TABLE t2; diff --git a/mysql-test/t/bigint.test b/mysql-test/t/bigint.test index 35cda11646a..6c1229db83f 100644 --- a/mysql-test/t/bigint.test +++ b/mysql-test/t/bigint.test @@ -278,4 +278,13 @@ select * from t1 where bigint_col=17666000000000000000; select * from t1 where bigint_col='17666000000000000000'; drop table t1; +--echo +--echo bug 19955 -- mod is signed with bigint + +select cast(10000002383263201056 as unsigned) mod 50 as result; + +create table t1 (c1 bigint unsigned); +insert into t1 values (10000002383263201056); +select c1 mod 50 as result from t1; +drop table t1; diff --git a/mysql-test/t/date_formats.test b/mysql-test/t/date_formats.test index c19ebeb2e28..64bd69c1855 100644 --- a/mysql-test/t/date_formats.test +++ b/mysql-test/t/date_formats.test @@ -329,4 +329,12 @@ SELECT TIME_FORMAT("25:00:00", '%l %p'); # SELECT DATE_FORMAT('%Y-%m-%d %H:%i:%s', 1151414896); +# +# Bug #22029: str_to_date returning NULL +# + +select str_to_date('04 /30/2004', '%m /%d/%Y'); +select str_to_date('04/30 /2004', '%m /%d /%Y'); +select str_to_date('04/30/2004 ', '%m/%d/%Y '); + --echo "End of 4.1 tests" diff --git a/mysql-test/t/default.test b/mysql-test/t/default.test index b5522394d2d..225ddbc3ee2 100644 --- a/mysql-test/t/default.test +++ b/mysql-test/t/default.test @@ -82,3 +82,61 @@ SELECT * from t2; drop table t1; drop table t2; + +# +# Bug#20691: DATETIME col (NOT NULL, NO DEFAULT) may insert garbage when specifying DEFAULT +# +# From the docs: +# If the column can take NULL as a value, the column is defined with an +# explicit DEFAULT NULL clause. This is the same as before 5.0.2. +# +# If the column cannot take NULL as the value, MySQL defines the column with +# no explicit DEFAULT clause. For data entry, if an INSERT or REPLACE +# statement includes no value for the column, MySQL handles the column +# according to the SQL mode in effect at the time: +# +# * If strict SQL mode is not enabled, MySQL sets the column to the +# implicit default value for the column data type. +# +# * If strict mode is enabled, an error occurs for transactional tables and +# the statement is rolled back. For non-transactional tables, an error +# occurs, but if this happens for the second or subsequent row of a +# multiple-row statement, the preceding rows will have been inserted. +# +create table bug20691 (i int, d datetime NOT NULL, dn datetime not null default '0000-00-00 00:00:00'); +insert into bug20691 values (1, DEFAULT, DEFAULT), (1, '1975-07-10 07:10:03', '1978-01-13 14:08:51'), (1, DEFAULT, DEFAULT); +insert into bug20691 (i) values (2); +desc bug20691; +insert into bug20691 values (3, DEFAULT, DEFAULT), (3, '1975-07-10 07:10:03', '1978-01-13 14:08:51'), (3, DEFAULT, DEFAULT); +insert into bug20691 (i) values (4); +insert into bug20691 values (5, DEFAULT, DEFAULT), (5, '1975-07-10 07:10:03', '1978-01-13 14:08:51'), (5, DEFAULT, DEFAULT); +SET sql_mode = 'ALLOW_INVALID_DATES'; +insert into bug20691 values (6, DEFAULT, DEFAULT), (6, '1975-07-10 07:10:03', '1978-01-13 14:08:51'), (6, DEFAULT, DEFAULT); +SET sql_mode = 'STRICT_ALL_TABLES'; +--error 1364 +insert into bug20691 values (7, DEFAULT, DEFAULT), (7, '1975-07-10 07:10:03', '1978-01-13 14:08:51'), (7, DEFAULT, DEFAULT); +select * from bug20691 order by i asc; +drop table bug20691; + +SET sql_mode = ''; +create table bug20691 ( + a set('one', 'two', 'three') not null, + b enum('small', 'medium', 'large', 'enormous', 'ellisonego') not null, + c time not null, + d date not null, + e int not null, + f long not null, + g blob not null, + h datetime not null, + i decimal not null, + x int); +insert into bug20691 values (2, 3, 5, '0007-01-01', 11, 13, 17, '0019-01-01 00:00:00', 23, 1); +insert into bug20691 (x) values (2); +insert into bug20691 values (2, 3, 5, '0007-01-01', 11, 13, 17, '0019-01-01 00:00:00', 23, 3); +insert into bug20691 values (DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, 4); +select * from bug20691 order by x asc; +drop table bug20691; + +### +--echo End of 5.0 tests. + diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def index e48108af9ce..c36ac1bd168 100644 --- a/mysql-test/t/disabled.def +++ b/mysql-test/t/disabled.def @@ -28,7 +28,6 @@ rpl_ndb_ddl : BUG#18946 result file needs update + test needs to ch rpl_ndb_innodb2ndb : Bug #19710 Cluster replication to partition table fails on DELETE FROM statement 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_sp : BUG#16456 2006-02-16 jmiller rpl_multi_engine : BUG#22583 2006-09-23 lars synchronization : Bug#24529 Test 'synchronization' fails on Mac pushbuild; Also on Linux 64 bit. @@ -36,3 +35,6 @@ synchronization : Bug#24529 Test 'synchronization' fails on Mac pushb #ndb_binlog_ddl_multi : BUG#18976 2006-04-10 kent CRBR: multiple binlog, second binlog may miss schema log events ndb_binlog_discover : bug#21806 2006-08-24 ndb_autodiscover3 : bug#21806 + +flush2 : Bug#24805 Pushbuild can't handle test with --disable-log-bin + diff --git a/mysql-test/t/distinct.test b/mysql-test/t/distinct.test index e517380ba9b..b2cc42cc0ff 100644 --- a/mysql-test/t/distinct.test +++ b/mysql-test/t/distinct.test @@ -437,3 +437,70 @@ EXPLAIN SELECT DISTINCT a,a FROM t1 WHERE b < 12 ORDER BY a; SELECT DISTINCT a,a FROM t1 WHERE b < 12 ORDER BY a; DROP TABLE t1; +# The test case for bug#20836 should be re-enabled when bug#16861 is resolved +# The results for the test should be the same as in 4.1. +# +#Bug #20836: Selecting into variables results in wrong results being returned +# +#--disable_warnings +#DROP TABLE IF EXISTS t1; +#--enable_warnings +# +#CREATE TABLE t1 (id INT NOT NULL, fruit_id INT NOT NULL, fruit_name varchar(20) +#default NULL); +# +#INSERT INTO t1 VALUES (1,1,'ORANGE'); +#INSERT INTO t1 VALUES (2,2,'APPLE'); +#INSERT INTO t1 VALUES (3,2,'APPLE'); +#INSERT INTO t1 VALUES (4,3,'PEAR'); +# +#SELECT DISTINCT fruit_id, fruit_name INTO @v1, @v2 FROM t1 WHERE fruit_name = +#'APPLE'; +#SELECT @v1, @v2; +# +#SELECT DISTINCT fruit_id, fruit_name INTO @v3, @v4 FROM t1 GROUP BY fruit_id, +#fruit_name HAVING fruit_name = 'APPLE'; +#SELECT @v3, @v4; +# +#SELECT DISTINCT @v5:= fruit_id, @v6:= fruit_name INTO @v7, @v8 FROM t1 WHERE +#fruit_name = 'APPLE'; +#SELECT @v5, @v6, @v7, @v8; +# +#SELECT DISTINCT @v5 + fruit_id, CONCAT(@v6, fruit_name) INTO @v9, @v10 FROM t1 +#WHERE fruit_name = 'APPLE'; +#SELECT @v5, @v6, @v7, @v8, @v9, @v10; +# +#SELECT DISTINCT @v11:= @v5 + fruit_id, @v12:= CONCAT(@v6, fruit_name) INTO +#@v13, @v14 FROM t1 WHERE fruit_name = 'APPLE'; +#SELECT @v11, @v12, @v13, @v14; +# +#SELECT DISTINCT @v13, @v14 INTO @v15, @v16 FROM t1 WHERE fruit_name = 'APPLE'; +#SELECT @v15, @v16; +# +#SELECT DISTINCT 2 + 2, 'Bob' INTO @v17, @v18 FROM t1 WHERE fruit_name = +#'APPLE'; +#SELECT @v17, @v18; +# +#--disable_warnings +#DROP TABLE IF EXISTS t2; +#--enable_warnings +# +#CREATE TABLE t2 (fruit_id INT NOT NULL, fruit_name varchar(20) +#default NULL); +# +#SELECT DISTINCT fruit_id, fruit_name INTO OUTFILE +#'../tmp/data1.tmp' FROM t1 WHERE fruit_name = 'APPLE'; +#LOAD DATA INFILE '../tmp/data1.tmp' INTO TABLE t2; +#--exec rm $MYSQL_TEST_DIR/var/tmp/data1.tmp +# +#SELECT DISTINCT @v19:= fruit_id, @v20:= fruit_name INTO OUTFILE +#'../tmp/data2.tmp' FROM t1 WHERE fruit_name = 'APPLE'; +#LOAD DATA INFILE '../tmp/data2.tmp' INTO TABLE t2; +#--exec rm $MYSQL_TEST_DIR/var/tmp/data2.tmp +# +#SELECT @v19, @v20; +#SELECT * FROM t2; +# +#DROP TABLE t1; +#DROP TABLE t2; + diff --git a/mysql-test/t/events_bugs.test b/mysql-test/t/events_bugs.test index 81988818809..e9751608a46 100644 --- a/mysql-test/t/events_bugs.test +++ b/mysql-test/t/events_bugs.test @@ -280,7 +280,7 @@ create event e22830_3 on schedule every 1 hour do alter event e22830_3 on schedu create event e22830_4 on schedule every 1 hour do alter event e22830_4 on schedule every (select f22830() from dual) hour; select event_name, event_definition, interval_value, interval_field from information_schema.events order by event_name; set global event_scheduler=on; ---sleep 2.0 +--sleep 4 set global event_scheduler=off; select event_name, event_definition, interval_value, interval_field from information_schema.events order by event_name; drop function f22830; diff --git a/mysql-test/t/fix_priv_tables.test b/mysql-test/t/fix_priv_tables.test new file mode 100644 index 00000000000..3a91f41dfcc --- /dev/null +++ b/mysql-test/t/fix_priv_tables.test @@ -0,0 +1,66 @@ +# Embedded server doesn't support external clients +--source include/not_embedded.inc + +# +# This is the test for mysql_fix_privilege_tables +# It checks that a system tables from mysql 4.1.23 +# can be upgraded to current system table format +# +# Note: If this test fails, don't be confused about the errors reported +# by mysql-test-run This shows warnings generated by +# mysql_fix_system_tables which should be ignored. +# Instead, concentrate on the errors in r/system_mysql_db.reject + +--disable_warnings +drop table if exists t1,t1aa,t2aa; +--enable_warnings + +# +# Bug #20589 Missing some table level privileges after upgrade +# +# Add some grants that should survive the "upgrade" + +--disable_warnings +DROP DATABASE IF EXISTS testdb; +--enable_warnings +CREATE DATABASE testdb; +CREATE TABLE testdb.t1 ( + c1 INT, + c3 INT NOT NULL AUTO_INCREMENT PRIMARY KEY); + +CREATE VIEW testdb.v1 AS + SELECT * FROM testdb.t1; + +GRANT CREATE VIEW, SHOW VIEW ON testdb.v1 TO 'show_view_tbl'@'localhost'; +SHOW GRANTS FOR 'show_view_tbl'@'localhost'; +echo; + +# Some extra GRANTS for more complete test +GRANT SELECT(c1) on testdb.v1 to 'select_only_c1'@localhost; +SHOW GRANTS FOR 'select_only_c1'@'localhost'; +echo; + +-- disable_result_log +-- disable_query_log + +# Run the mysql_fix_privilege_tables.sql using "mysql --force" +--exec $MYSQL --force mysql < $MYSQL_FIX_PRIVILEGE_TABLES > $MYSQLTEST_VARDIR/log/fix_priv_tables.log 2>&1 + +-- enable_query_log +-- enable_result_log + +echo "after fix privs"; + +SHOW GRANTS FOR 'show_view_tbl'@'localhost'; +echo; +SHOW GRANTS FOR 'select_only_c1'@'localhost'; +echo; + +DROP USER 'show_view_tbl'@'localhost'; +DROP USER 'select_only_c1'@'localhost'; + +DROP VIEW testdb.v1; +DROP TABLE testdb.t1; +DROP DATABASE testdb; + +# End of 4.1 tests diff --git a/mysql-test/t/flush2-master.opt b/mysql-test/t/flush2-master.opt new file mode 100644 index 00000000000..ccbd01c91d3 --- /dev/null +++ b/mysql-test/t/flush2-master.opt @@ -0,0 +1 @@ +--disable-log-bin diff --git a/mysql-test/t/flush2.test b/mysql-test/t/flush2.test new file mode 100644 index 00000000000..fc9e88e3141 --- /dev/null +++ b/mysql-test/t/flush2.test @@ -0,0 +1,9 @@ +# +# Bug#17733 Flushing logs causes daily server crash +# +flush logs; +set global expire_logs_days = 3; +show variables like 'log%'; +flush logs; +show variables like 'log%'; +set global expire_logs_days = 0; diff --git a/mysql-test/t/flush_read_lock_kill-master.opt b/mysql-test/t/flush_read_lock_kill-master.opt index 2b2b5eb5ebf..61e2b242351 100644 --- a/mysql-test/t/flush_read_lock_kill-master.opt +++ b/mysql-test/t/flush_read_lock_kill-master.opt @@ -1 +1 @@ ---loose-debug=d,make_global_read_lock_block_commit_loop +--loose-debug=+d,make_global_read_lock_block_commit_loop diff --git a/mysql-test/t/func_gconcat.test b/mysql-test/t/func_gconcat.test index cde9c1fcea3..c141fd370f8 100644 --- a/mysql-test/t/func_gconcat.test +++ b/mysql-test/t/func_gconcat.test @@ -29,8 +29,10 @@ select grp,group_concat(c order by c) from t1 group by grp; select grp,group_concat(c order by c desc) from t1 group by grp; select grp,group_concat(d order by a) from t1 group by grp; select grp,group_concat(d order by a desc) from t1 group by grp; +--disable_warnings select grp,group_concat(a order by a,d+c-ascii(c)-a) from t1 group by grp; select grp,group_concat(a order by d+c-ascii(c),a) from t1 group by grp; +--enable_warnings select grp,group_concat(c order by 1) from t1 group by grp; select grp,group_concat(distinct c order by c) from t1 group by grp; select grp,group_concat(distinct c order by c desc) from t1 group by grp; diff --git a/mysql-test/t/func_group.test b/mysql-test/t/func_group.test index b41f6cd71c8..dae697810e7 100644 --- a/mysql-test/t/func_group.test +++ b/mysql-test/t/func_group.test @@ -29,7 +29,9 @@ select count(distinct a),count(distinct grp) from t1; select sum(all a),count(all a),avg(all a),std(all a),variance(all a),bit_or(all a),bit_and(all a),min(all a),max(all a),min(all c),max(all c) from t1; select grp, sum(a),count(a),avg(a),std(a),variance(a),bit_or(a),bit_and(a),min(a),max(a),min(c),max(c) from t1 group by grp; +--disable_warnings select grp, sum(a)+count(a)+avg(a)+std(a)+variance(a)+bit_or(a)+bit_and(a)+min(a)+max(a)+min(c)+max(c) as sum from t1 group by grp; +--enable_warnings create table t2 (grp int, a bigint unsigned, c char(10)); insert into t2 select grp,max(a)+max(grp),max(c) from t1 group by grp; diff --git a/mysql-test/t/func_misc.test b/mysql-test/t/func_misc.test index 52a5512d070..5cac6c45f65 100644 --- a/mysql-test/t/func_misc.test +++ b/mysql-test/t/func_misc.test @@ -125,4 +125,11 @@ drop table t2; drop table t1; set global query_cache_size=default; +# +# Bug #21466: INET_ATON() returns signed, not unsigned +# + +create table t1 select INET_ATON('255.255.0.1') as `a`; +show create table t1; +drop table t1; --echo End of 5.0 tests diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test index a6cbca61b84..ebaa6d84bd3 100644 --- a/mysql-test/t/func_time.test +++ b/mysql-test/t/func_time.test @@ -565,6 +565,12 @@ union union (select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 HOUR)),'%k') As H); +# +# Bug #23653: crash if last_day('0000-00-00') +# + +select last_day('0000-00-00'); + --echo End of 4.1 tests explain extended select timestampdiff(SQL_TSI_WEEK, '2001-02-01', '2001-05-01') as a1, @@ -580,6 +586,8 @@ select time_format('100:00:00', '%H %k %h %I %l'); # Bug #12562: Make SYSDATE behave like it does in Oracle: always the current # time, regardless of magic to make NOW() always the same for the # entirety of a statement. +SET GLOBAL log_bin_trust_function_creators = 1; + create table t1 (a timestamp default '2005-05-05 01:01:01', b timestamp default '2005-05-05 01:01:01'); delimiter //; @@ -609,6 +617,8 @@ drop trigger t_before; drop function t_slow_sysdate; drop table t1; +SET GLOBAL log_bin_trust_function_creators = 0; + create table t1 (a datetime, i int, b datetime); insert into t1 select sysdate(), sleep(1), sysdate() from dual; select a != b from t1; @@ -676,6 +686,12 @@ DROP TABLE t1,t2; # Restore timezone to default set time_zone= @@global.time_zone; + +# +# Bug #22229: bug in DATE_ADD() +# + +select str_to_date('10:00 PM', '%h:%i %p') + INTERVAL 10 MINUTE; --echo End of 5.0 tests # diff --git a/mysql-test/t/gis.test b/mysql-test/t/gis.test index 7bba34be3ff..4e5a21c6789 100644 --- a/mysql-test/t/gis.test +++ b/mysql-test/t/gis.test @@ -393,7 +393,7 @@ drop table t1; --disable_warnings drop procedure if exists fn3; --enable_warnings -create function fn3 () returns point return GeomFromText("point(1 1)"); +create function fn3 () returns point deterministic return GeomFromText("point(1 1)"); show create function fn3; select astext(fn3()); drop function fn3; diff --git a/mysql-test/t/grant.test b/mysql-test/t/grant.test index 2f5e3dced22..1d8991e92a1 100644 --- a/mysql-test/t/grant.test +++ b/mysql-test/t/grant.test @@ -822,6 +822,82 @@ create user mysqltest1_thisisreallytoolong; # statements. # +# +# Bug #22369: Alter table rename combined with other alterations causes lost tables +# +CREATE DATABASE mysqltest1; +CREATE TABLE mysqltest1.t1 ( + int_field INTEGER UNSIGNED NOT NULL, + char_field CHAR(10), + INDEX(`int_field`) +); +CREATE TABLE mysqltest1.t2 (int_field INT); + +--echo "Now check that we require equivalent grants for " +--echo "RENAME TABLE and ALTER TABLE" +CREATE USER mysqltest_1@localhost; +GRANT SELECT ON mysqltest1.t1 TO mysqltest_1@localhost; + +--connect (conn42,localhost,mysqltest_1,,mysqltest1); +SELECT USER(); +SHOW GRANTS; +--error ER_TABLEACCESS_DENIED_ERROR +RENAME TABLE t1 TO t2; +--error ER_TABLEACCESS_DENIED_ERROR +ALTER TABLE t1 RENAME TO t2; +--disconnect conn42 +--connection default +GRANT DROP ON mysqltest1.t1 TO mysqltest_1@localhost; + +--connect (conn42,localhost,mysqltest_1,,mysqltest1); +--error ER_TABLEACCESS_DENIED_ERROR +RENAME TABLE t1 TO t2; +--error ER_TABLEACCESS_DENIED_ERROR +ALTER TABLE t1 RENAME TO t2; +--disconnect conn42 +--connection default +GRANT ALTER ON mysqltest1.t1 TO mysqltest_1@localhost; + +--connect (conn42,localhost,mysqltest_1,,mysqltest1); +SHOW GRANTS; +--error ER_TABLEACCESS_DENIED_ERROR +RENAME TABLE t1 TO t2; +--error ER_TABLEACCESS_DENIED_ERROR +ALTER TABLE t1 RENAME TO t2; +--disconnect conn42 +--connection default +GRANT INSERT, CREATE ON mysqltest1.t1 TO mysqltest_1@localhost; +--connect (conn42,localhost,mysqltest_1,,mysqltest1); +SHOW GRANTS; +--error ER_TABLEACCESS_DENIED_ERROR +--disconnect conn42 +--connection default +GRANT INSERT, SELECT, CREATE, ALTER, DROP ON mysqltest1.t2 TO mysqltest_1@localhost; +DROP TABLE mysqltest1.t2; + +--connect (conn42,localhost,mysqltest_1,,mysqltest1); +SHOW GRANTS; +RENAME TABLE t1 TO t2; +RENAME TABLE t2 TO t1; +ALTER TABLE t1 RENAME TO t2; +ALTER TABLE t2 RENAME TO t1; +--disconnect conn42 +--connection default +REVOKE DROP, INSERT ON mysqltest1.t1 FROM mysqltest_1@localhost; +REVOKE DROP, INSERT ON mysqltest1.t2 FROM mysqltest_1@localhost; + +--connect (conn42,localhost,mysqltest_1,,mysqltest1); +SHOW GRANTS; +--error ER_TABLEACCESS_DENIED_ERROR +RENAME TABLE t1 TO t2; +--error ER_TABLEACCESS_DENIED_ERROR +ALTER TABLE t1 RENAME TO t2; +--disconnect conn42 +--connection default + +DROP USER mysqltest_1@localhost; +DROP DATABASE mysqltest1; + # Working with database-level privileges. --error ER_WRONG_STRING_LENGTH diff --git a/mysql-test/t/grant2.test b/mysql-test/t/grant2.test index 99da1fa1ee7..a533af995dc 100644 --- a/mysql-test/t/grant2.test +++ b/mysql-test/t/grant2.test @@ -484,6 +484,8 @@ flush privileges; # BUG#13310 incorrect user parsing by SP # +SET GLOBAL log_bin_trust_function_creators = 1; + grant all privileges on test.* to `a@`@localhost; grant execute on * to `a@`@localhost; connect (bug13310,localhost,'a@',,test); @@ -494,11 +496,10 @@ insert into t2 values (1); drop function if exists f2; --enable_warnings delimiter //; -create function f2 () returns int begin declare v int; select s1 from t2 -into v; return v; end// +create function f2 () returns int +begin declare v int; select s1 from t2 into v; return v; end// delimiter ;// select f2(); - drop function f2; drop table t2; disconnect bug13310; @@ -506,3 +507,5 @@ disconnect bug13310; connection default; REVOKE ALL PRIVILEGES, GRANT OPTION FROM `a@`@localhost; drop user `a@`@localhost; + +SET GLOBAL log_bin_trust_function_creators = 0; diff --git a/mysql-test/t/group_min_max.test b/mysql-test/t/group_min_max.test index f9ac3a625cc..7324e8582de 100644 --- a/mysql-test/t/group_min_max.test +++ b/mysql-test/t/group_min_max.test @@ -835,3 +835,63 @@ explain SELECT MIN(c) FROM t2 WHERE b = 2 and a = 1 and c > 1 GROUP BY a; SELECT MIN(c) FROM t2 WHERE b = 2 and a = 1 and c > 1 GROUP BY a; DROP TABLE t1,t2; + +# +# Bug#24156: Loose index scan not used with CREATE TABLE ...SELECT and similar statements +# + +CREATE TABLE t1 (a INT, b INT, INDEX (a,b)); +INSERT INTO t1 (a, b) VALUES (1,1), (1,2), (1,3), (1,4), (1,5), + (2,2), (2,3), (2,1), (3,1), (4,1), (4,2), (4,3), (4,4), (4,5), (4,6); +EXPLAIN SELECT max(b), a FROM t1 GROUP BY a; +FLUSH STATUS; +SELECT max(b), a FROM t1 GROUP BY a; +SHOW STATUS LIKE 'handler_read__e%'; +EXPLAIN SELECT max(b), a FROM t1 GROUP BY a; +FLUSH STATUS; +CREATE TABLE t2 SELECT max(b), a FROM t1 GROUP BY a; +SHOW STATUS LIKE 'handler_read__e%'; +FLUSH STATUS; +SELECT * FROM (SELECT max(b), a FROM t1 GROUP BY a) b; +SHOW STATUS LIKE 'handler_read__e%'; +FLUSH STATUS; +(SELECT max(b), a FROM t1 GROUP BY a) UNION + (SELECT max(b), a FROM t1 GROUP BY a); +SHOW STATUS LIKE 'handler_read__e%'; +EXPLAIN (SELECT max(b), a FROM t1 GROUP BY a) UNION + (SELECT max(b), a FROM t1 GROUP BY a); + +EXPLAIN SELECT (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2) x + FROM t1 AS t1_outer; +EXPLAIN SELECT 1 FROM t1 AS t1_outer WHERE EXISTS + (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2); +EXPLAIN SELECT 1 FROM t1 AS t1_outer WHERE + (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2) > 12; +EXPLAIN SELECT 1 FROM t1 AS t1_outer WHERE + a IN (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2); +EXPLAIN SELECT 1 FROM t1 AS t1_outer GROUP BY a HAVING + a > (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2); +EXPLAIN SELECT 1 FROM t1 AS t1_outer1 JOIN t1 AS t1_outer2 + ON t1_outer1.a = (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2) + AND t1_outer1.b = t1_outer2.b; +EXPLAIN SELECT (SELECT (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2) x + FROM t1 AS t1_outer) x2 FROM t1 AS t1_outer2; + +CREATE TABLE t3 LIKE t1; +FLUSH STATUS; +INSERT INTO t3 SELECT a,MAX(b) FROM t1 GROUP BY a; +SHOW STATUS LIKE 'handler_read__e%'; +DELETE FROM t3; +FLUSH STATUS; +INSERT INTO t3 SELECT 1, (SELECT MAX(b) FROM t1 GROUP BY a HAVING a < 2) + FROM t1 LIMIT 1; +SHOW STATUS LIKE 'handler_read__e%'; +FLUSH STATUS; +DELETE FROM t3 WHERE (SELECT MAX(b) FROM t1 GROUP BY a HAVING a < 2) > 10000; +SHOW STATUS LIKE 'handler_read__e%'; +FLUSH STATUS; +DELETE FROM t3 WHERE (SELECT (SELECT MAX(b) FROM t1 GROUP BY a HAVING a < 2) x + FROM t1) > 10000; +SHOW STATUS LIKE 'handler_read__e%'; + +DROP TABLE t1,t2,t3; diff --git a/mysql-test/t/information_schema.test b/mysql-test/t/information_schema.test index cec140a5e63..6d98e4c4aa9 100644 --- a/mysql-test/t/information_schema.test +++ b/mysql-test/t/information_schema.test @@ -37,7 +37,7 @@ create table t3(a int, KEY a_data (a)); create table mysqltest.t4(a int); create table t5 (id int auto_increment primary key); insert into t5 values (10); -create view v1 (c) as select table_name from information_schema.TABLES where table_name<>'binlog_index' AND table_name<>'apply_status'; +create view v1 (c) as select table_name from information_schema.TABLES where table_name<>'ndb_binlog_index' AND table_name<>'ndb_apply_status'; select * from v1; select c,table_name from v1 @@ -528,7 +528,7 @@ flush privileges; # Bug #9404 information_schema: Weird error messages # with SELECT SUM() ... GROUP BY queries # -SELECT table_schema, count(*) FROM information_schema.TABLES where table_name<>'binlog_index' AND table_name<>'apply_status' GROUP BY TABLE_SCHEMA; +SELECT table_schema, count(*) FROM information_schema.TABLES where table_name<>'ndb_binlog_index' AND table_name<>'ndb_apply_status' GROUP BY TABLE_SCHEMA; # @@ -721,7 +721,7 @@ create temporary table schemata(f1 char(10)); # Bug #10708 SP's can use INFORMATION_SCHEMA as ROUTINE_SCHEMA # delimiter |; ---error 1044 +--error ER_BAD_DB_ERROR CREATE PROCEDURE p1 () BEGIN SELECT 'foo' FROM DUAL; diff --git a/mysql-test/t/init_connect.test b/mysql-test/t/init_connect.test index 31a98df33df..cf98f608982 100644 --- a/mysql-test/t/init_connect.test +++ b/mysql-test/t/init_connect.test @@ -232,7 +232,9 @@ connection con0; disconnect con1; drop trigger trg1; -set global init_connect=default; +# Set init connect back to the value provided in init_connect-master.opt +# doesn't matter as server will be restarted +set global init_connect="set @a='a\\0c'"; revoke all privileges, grant option from mysqltest1@localhost; drop user mysqltest1@localhost; diff --git a/mysql-test/t/innodb_notembedded.test b/mysql-test/t/innodb_notembedded.test index 53332d9fda4..2731f8e33ed 100644 --- a/mysql-test/t/innodb_notembedded.test +++ b/mysql-test/t/innodb_notembedded.test @@ -13,6 +13,7 @@ connect (b,localhost,root,,); # BUG#11238 - in prelocking mode SELECT .. FOR UPDATE is changed to # non-blocking SELECT # +SET GLOBAL log_bin_trust_function_creators = 1; create table t1 (col1 integer primary key, col2 integer) engine=innodb; insert t1 values (1,100); delimiter |; @@ -38,3 +39,4 @@ drop table t1; drop function f1; disconnect a; disconnect b; +SET GLOBAL log_bin_trust_function_creators = 0; diff --git a/mysql-test/t/key_cache.test b/mysql-test/t/key_cache.test index 4001e0df4af..3044964ebc3 100644 --- a/mysql-test/t/key_cache.test +++ b/mysql-test/t/key_cache.test @@ -164,16 +164,19 @@ create table t1 (mytext text, FULLTEXT (mytext)); insert t1 values ('aaabbb'); check table t1; +set @my_key_cache_block_size= @@global.key_cache_block_size; set GLOBAL key_cache_block_size=2048; check table t1; - drop table t1; +# Restore the changed variable value +set global key_cache_block_size= @my_key_cache_block_size; # # Bug #19079: corrupted index when key_cache_block_size is not multiple of # myisam_block_size CREATE TABLE t1(a int NOT NULL AUTO_INCREMENT PRIMARY KEY); +SET @my_key_cache_block_size= @@global.key_cache_block_size; SET GLOBAL key_cache_block_size=1536; INSERT INTO t1 VALUES (1); SELECT @@key_cache_block_size; @@ -206,6 +209,8 @@ SELECT COUNT(*) FROM t1; SELECT @@key_cache_block_size; CHECK TABLE t1; DROP TABLE t1,t2; +# Restore changed variables +set global key_cache_block_size= @my_key_cache_block_size; # # Bug#10473 - Can't set 'key_buffer_size' system variable to ZERO diff --git a/mysql-test/t/limit.test b/mysql-test/t/limit.test index 2eb4e6cbbb2..bc599b20d36 100644 --- a/mysql-test/t/limit.test +++ b/mysql-test/t/limit.test @@ -69,5 +69,5 @@ explain select count(*) c FROM t1 WHERE a > 0 ORDER BY c LIMIT 3; select count(*) c FROM t1 WHERE a > 0 ORDER BY c LIMIT 3; explain select sum(a) c FROM t1 WHERE a > 0 ORDER BY c LIMIT 3; select sum(a) c FROM t1 WHERE a > 0 ORDER BY c LIMIT 3; - +drop table t1; # End of 4.1 tests diff --git a/mysql-test/t/lowercase_fs_off.test b/mysql-test/t/lowercase_fs_off.test index 883315994fe..414027cb485 100644 --- a/mysql-test/t/lowercase_fs_off.test +++ b/mysql-test/t/lowercase_fs_off.test @@ -21,6 +21,7 @@ create database D1; disconnect sample; connection master; +drop user 'sample'@'localhost'; drop database if exists d1; disconnect master; connection default; diff --git a/mysql-test/t/mysql.test b/mysql-test/t/mysql.test index cb4a5593de7..c9fec6deb35 100644 --- a/mysql-test/t/mysql.test +++ b/mysql-test/t/mysql.test @@ -241,4 +241,23 @@ drop table t17583; --error 1 --exec $MYSQL test -e "\r test cyrils_superlonghostnameXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" 2>&1 + +# +# Bug #21412: mysql cmdline client allows backslash(es) +# as delimiter but can't recognize them +# + +# This should work just fine... +--exec echo "DELIMITER /" > $MYSQLTEST_VARDIR/tmp/bug21412.sql +--exec echo "SELECT 1/" >> $MYSQLTEST_VARDIR/tmp/bug21412.sql +--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug21412.sql 2>&1 + +# This should give an error... +--exec echo "DELIMITER \\" > $MYSQLTEST_VARDIR/tmp/bug21412.sql +--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug21412.sql 2>&1 + +# As should this... +--exec echo "DELIMITER \\\\" > $MYSQLTEST_VARDIR/tmp/bug21412.sql +--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug21412.sql 2>&1 + --echo End of 5.0 tests diff --git a/mysql-test/t/mysql_client_test-master.opt b/mysql-test/t/mysql_client_test-master.opt index 3711946168d..2dfcc4a2fb9 100644 --- a/mysql-test/t/mysql_client_test-master.opt +++ b/mysql-test/t/mysql_client_test-master.opt @@ -1 +1 @@ ---log --log-output=FILE +--log=$MYSQLTEST_VARDIR/log/master.log --log-output=FILE diff --git a/mysql-test/t/mysql_delimiter.sql b/mysql-test/t/mysql_delimiter.sql index fa80c980b29..db679c3b06b 100644 --- a/mysql-test/t/mysql_delimiter.sql +++ b/mysql-test/t/mysql_delimiter.sql @@ -49,3 +49,13 @@ delimiter ; # Reset delimiter # Bug #11523: \d works differently than delimiter # source t/mysql_delimiter_source.sql +delimiter ; # Reset delimiter + +# +# Bug #19799: delimiter command not working correctly when sourcing a sql file +# with Windows style line endings. +# +source t/mysql_delimiter_19799.sql +use test// +show tables// +delimiter ; # Reset delimiter diff --git a/mysql-test/t/mysql_delimiter_19799.sql b/mysql-test/t/mysql_delimiter_19799.sql new file mode 100755 index 00000000000..2a3d4378492 --- /dev/null +++ b/mysql-test/t/mysql_delimiter_19799.sql @@ -0,0 +1 @@ +delimiter // diff --git a/mysql-test/t/mysql_upgrade.test b/mysql-test/t/mysql_upgrade.test new file mode 100644 index 00000000000..4200ba844f7 --- /dev/null +++ b/mysql-test/t/mysql_upgrade.test @@ -0,0 +1,20 @@ +# Only run test if "mysql_upgrade" is found +--require r/have_mysql_upgrade.result +--disable_query_log +select LENGTH("$MYSQL_UPGRADE")>0 as have_mysql_upgrade; +--enable_query_log + +# +# Basic test thta we can run mysql_upgrde and that it finds the +# expected binaries it uses. +# +--echo Run mysql_upgrade once +--exec $MYSQL_UPGRADE 2> $MYSQLTEST_VARDIR/log/mysql_upgrade.err + +--echo Run it again - should say already completed +--exec $MYSQL_UPGRADE 2> $MYSQLTEST_VARDIR/log/mysql_upgrade.err + +--echo Force should run it regardless of wheter it's been run before +--exec $MYSQL_UPGRADE --force 2> $MYSQLTEST_VARDIR/log/mysql_upgrade.err + + diff --git a/mysql-test/t/mysqladmin.test b/mysql-test/t/mysqladmin.test new file mode 100644 index 00000000000..850abc1ee69 --- /dev/null +++ b/mysql-test/t/mysqladmin.test @@ -0,0 +1,32 @@ +# +# Test "mysqladmin ping" +# + +--exec $MYSQLADMIN --no-defaults -S $MASTER_MYSOCK -P $MASTER_MYPORT -u root --password= ping 2>&1 + + +# +# Bug#10608 mysqladmin breaks on "database" variable in my.cnf +# + +# When mysqladmin finds database in .cnf file it shall fail +--write_file $MYSQLTEST_VARDIR/tmp/bug10608.cnf +[client] +database=db1 +EOF + +--replace_regex /.*mysqladmin.*: unknown/mysqladmin: unknown/ +--error 7 +--exec $MYSQLADMIN --defaults-file=$MYSQLTEST_VARDIR/tmp/bug10608.cnf -S $MASTER_MYSOCK -P $MASTER_MYPORT -u root --password= ping 2>&1 + + +# When mysqladmin finds "loose-database" in .cnf file it shall print +# a warning and continue +--write_file $MYSQLTEST_VARDIR/tmp/bug10608.cnf +[client] +loose-database=db2 +EOF + +--replace_regex /Warning: .*mysqladmin.*: unknown/Warning: mysqladmin: unknown/ +--exec $MYSQLADMIN --defaults-file=$MYSQLTEST_VARDIR/tmp/bug10608.cnf -S $MASTER_MYSOCK -P $MASTER_MYPORT -u root --password= ping 2>&1 + diff --git a/mysql-test/t/mysqldump.test b/mysql-test/t/mysqldump.test index 05b15cdad17..b7ff8bbdfdb 100644 --- a/mysql-test/t/mysqldump.test +++ b/mysql-test/t/mysqldump.test @@ -1343,7 +1343,7 @@ connect (root,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK); connection root; create database mysqldump_myDB; use mysqldump_myDB; -create user myDB_User; +create user myDB_User@localhost; grant create, create view, select, insert on mysqldump_myDB.* to myDB_User@localhost; create table t1 (c1 int); insert into t1 values (3); @@ -1366,7 +1366,7 @@ drop view v1; drop table t1; drop table u1; revoke all privileges on mysqldump_myDB.* from myDB_User@localhost; -drop user myDB_User; +drop user myDB_User@localhost; drop database mysqldump_myDB; flush privileges; @@ -1391,7 +1391,7 @@ drop view v1; drop table t1; drop table u1; revoke all privileges on mysqldump_myDB.* from myDB_User@localhost; -drop user myDB_User; +drop user myDB_User@localhost; drop database mysqldump_myDB; use test; connection default; diff --git a/mysql-test/t/mysqltest.test b/mysql-test/t/mysqltest.test index 3c20b38722f..c06d51d9d49 100644 --- a/mysql-test/t/mysqltest.test +++ b/mysql-test/t/mysqltest.test @@ -1522,6 +1522,46 @@ remove_file $MYSQLTEST_VARDIR/tmp/file2.tmp; --exec echo "copy_file from_file;" | $MYSQL_TEST 2>&1 # ---------------------------------------------------------------------------- +# test for chmod +# ---------------------------------------------------------------------------- +--write_file $MYSQLTEST_VARDIR/tmp/file1.tmp +file1 +EOF + +chmod 0000 $MYSQLTEST_VARDIR/tmp/file1.tmp; +# The below write fails, but --error is not implemented +# for write_file +#--write_file $MYSQLTEST_VARDIR/tmp/file1.tmp +#test should fail +#EOF + +chmod 0777 $MYSQLTEST_VARDIR/tmp/file1.tmp; +--write_file $MYSQLTEST_VARDIR/tmp/file1.tmp +test2 +EOF + +remove_file $MYSQLTEST_VARDIR/tmp/file1.tmp; + +--error 1 +--exec echo "chmod ;" | $MYSQL_TEST 2>&1 + +--error 1 +--exec echo "chmod 0 from_file;" | $MYSQL_TEST 2>&1 + +--error 1 +--exec echo "chmod 08 from_file;" | $MYSQL_TEST 2>&1 + +--error 1 +--exec echo "chmod from_file;" | $MYSQL_TEST 2>&1 + +--error 1 +--exec echo "chmod ABZD from_file;" | $MYSQL_TEST 2>&1 + +--error 1 +--exec echo "chmod 06789 from_file;" | $MYSQL_TEST 2>&1 + + +# ---------------------------------------------------------------------------- # test for perl # ---------------------------------------------------------------------------- --perl diff --git a/mysql-test/t/ndb_autodiscover3.test b/mysql-test/t/ndb_autodiscover3.test index 4c072ada0ec..ae6d669c3b8 100644 --- a/mysql-test/t/ndb_autodiscover3.test +++ b/mysql-test/t/ndb_autodiscover3.test @@ -41,7 +41,7 @@ select * from t2 order by a limit 3; --exec $NDB_MGM --no-defaults -e "all restart -i" >> $NDB_TOOLS_OUTPUT --exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults >> $NDB_TOOLS_OUTPUT # to ensure mysqld has connected again, and recreated system tables ---exec $NDB_TOOLS_DIR/ndb_desc --no-defaults -r 30 -d cluster apply_status >> $NDB_TOOLS_OUTPUT +--exec $NDB_TOOLS_DIR/ndb_desc --no-defaults -r 30 -d cluster ndb_apply_status >> $NDB_TOOLS_OUTPUT sleep 2; --connection server2 --error ER_NO_SUCH_TABLE @@ -60,7 +60,7 @@ reset master; --exec $NDB_MGM --no-defaults -e "all restart -i" >> $NDB_TOOLS_OUTPUT --exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults >> $NDB_TOOLS_OUTPUT # to ensure mysqld has connected again, and recreated system tables ---exec $NDB_TOOLS_DIR/ndb_desc --no-defaults -r 30 -d cluster apply_status >> $NDB_TOOLS_OUTPUT +--exec $NDB_TOOLS_DIR/ndb_desc --no-defaults -r 30 -d cluster ndb_apply_status >> $NDB_TOOLS_OUTPUT sleep 2; --connection server1 --error ER_NO_SUCH_TABLE diff --git a/mysql-test/t/ndb_basic.test b/mysql-test/t/ndb_basic.test index bbe5d263e36..3348a94c044 100644 --- a/mysql-test/t/ndb_basic.test +++ b/mysql-test/t/ndb_basic.test @@ -738,4 +738,13 @@ CREATE TABLE t2(a VARCHAR(255) NOT NULL, CONSTRAINT fk_a FOREIGN KEY(a) REFERENCES t1(a))engine=ndb; drop table t1, t2; +# bug#24301 +create table t1 (a int not null primary key, b int) engine=ndb; +insert into t1 values(1,1),(2,2),(3,3); +create table t2 like t1; +insert into t2 select * from t1; +select * from t1 order by a; +select * from t2 order by a; +drop table t1, t2; + --echo End of 5.1 tests diff --git a/mysql-test/t/ndb_binlog_basic.test b/mysql-test/t/ndb_binlog_basic.test index c2a36423445..e4642dc3230 100644 --- a/mysql-test/t/ndb_binlog_basic.test +++ b/mysql-test/t/ndb_binlog_basic.test @@ -12,14 +12,14 @@ use test; # # basic insert, update, delete test, alter, rename, drop -# check that binlog_index gets the right info +# check that ndb_binlog_index gets the right info # create table t1 (a int primary key) engine=ndb; insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); save_master_pos; --replace_column 1 # -select @max_epoch:=max(epoch)-1 from mysql.binlog_index; +select @max_epoch:=max(epoch)-1 from mysql.ndb_binlog_index; delete from t1; alter table t1 add (b int); @@ -38,18 +38,18 @@ drop table t2; # (save_master_pos waits for last gcp to complete, ensuring that we have # the expected data in the binlog) save_master_pos; -select inserts from mysql.binlog_index where epoch > @max_epoch and inserts > 5; -select deletes from mysql.binlog_index where epoch > @max_epoch and deletes > 5; +select inserts from mysql.ndb_binlog_index where epoch > @max_epoch and inserts > 5; +select deletes from mysql.ndb_binlog_index where epoch > @max_epoch and deletes > 5; select inserts,updates,deletes from - mysql.binlog_index where epoch > @max_epoch and updates > 0; + mysql.ndb_binlog_index where epoch > @max_epoch and updates > 0; # -# check that purge clears the binlog_index +# check that purge clears the ndb_binlog_index # flush logs; --sleep 1 purge master logs before now(); -select count(*) from mysql.binlog_index; +select count(*) from mysql.ndb_binlog_index; # # several tables in different databases @@ -64,9 +64,9 @@ use test; insert into mysqltest.t1 values (2,1),(2,2); save_master_pos; --replace_column 1 # -select @max_epoch:=max(epoch)-1 from mysql.binlog_index; +select @max_epoch:=max(epoch)-1 from mysql.ndb_binlog_index; drop table t1; drop database mysqltest; select inserts,updates,deletes from - mysql.binlog_index where epoch > @max_epoch and inserts > 0; + mysql.ndb_binlog_index where epoch > @max_epoch and inserts > 0; diff --git a/mysql-test/t/ndb_binlog_multi.test b/mysql-test/t/ndb_binlog_multi.test index 1c6a1063fea..1f04787e27c 100644 --- a/mysql-test/t/ndb_binlog_multi.test +++ b/mysql-test/t/ndb_binlog_multi.test @@ -38,7 +38,7 @@ INSERT INTO t2 VALUES (1,1),(2,2); select * from t2 order by a; --replace_column 1 <the_epoch> SELECT @the_epoch:=epoch,inserts,updates,deletes,schemaops FROM - mysql.binlog_index ORDER BY epoch DESC LIMIT 1; + mysql.ndb_binlog_index ORDER BY epoch DESC LIMIT 1; let $the_epoch= `SELECT @the_epoch`; # see if we got something on server1 @@ -50,7 +50,7 @@ DROP TABLE t2; --source include/show_binlog_events.inc --replace_result $the_epoch <the_epoch> eval SELECT inserts,updates,deletes,schemaops FROM - mysql.binlog_index WHERE epoch=$the_epoch; + mysql.ndb_binlog_index WHERE epoch=$the_epoch; # reset for next test connection server1; @@ -65,12 +65,12 @@ INSERT INTO t1 VALUES (1),(2); --source include/show_binlog_events.inc --replace_column 1 <the_epoch2> SELECT @the_epoch2:=epoch,inserts,updates,deletes,schemaops FROM - mysql.binlog_index ORDER BY epoch DESC LIMIT 1; + mysql.ndb_binlog_index ORDER BY epoch DESC LIMIT 1; let $the_epoch2= `SELECT @the_epoch2`; --replace_result $the_epoch <the_epoch> $the_epoch2 <the_epoch2> eval SELECT inserts,updates,deletes,schemaops FROM - mysql.binlog_index WHERE epoch > $the_epoch AND epoch <= $the_epoch2; + mysql.ndb_binlog_index WHERE epoch > $the_epoch AND epoch <= $the_epoch2; # now see that we have the events on the other server connection server2; @@ -80,4 +80,4 @@ drop table t1; --source include/show_binlog_events.inc --replace_result $the_epoch <the_epoch> $the_epoch2 <the_epoch2> eval SELECT inserts,updates,deletes,schemaops FROM - mysql.binlog_index WHERE epoch > $the_epoch AND epoch <= $the_epoch2; + mysql.ndb_binlog_index WHERE epoch > $the_epoch AND epoch <= $the_epoch2; diff --git a/mysql-test/t/ndb_index_ordered.test b/mysql-test/t/ndb_index_ordered.test index b9a47725b85..bba0c5ca53f 100644 --- a/mysql-test/t/ndb_index_ordered.test +++ b/mysql-test/t/ndb_index_ordered.test @@ -430,3 +430,28 @@ set ndb_index_stat_update_freq = @@global.ndb_index_stat_update_freq; show session variables like 'ndb_index_stat_%'; # End of 4.1 tests + +# bug#24039 + +create table t1 (a int primary key) engine = ndb; +insert into t1 values (1), (2), (3); +begin; +delete from t1 where a > 1; +rollback; +select * from t1 order by a; +begin; +delete from t1 where a > 1; +rollback; + +begin; +select * from t1 order by a; +delete from t1 where a > 2; +select * from t1 order by a; +delete from t1 where a > 1; +select * from t1 order by a; +delete from t1 where a > 0; +select * from t1 order by a; +rollback; +select * from t1 order by a; +delete from t1; +drop table t1; diff --git a/mysql-test/t/ndb_index_unique.test b/mysql-test/t/ndb_index_unique.test index 94bba98662c..a1fd432a29a 100644 --- a/mysql-test/t/ndb_index_unique.test +++ b/mysql-test/t/ndb_index_unique.test @@ -91,7 +91,6 @@ select * from t2 order by a; drop table t2; --- error 1121 CREATE TABLE t2 ( a int unsigned NOT NULL PRIMARY KEY, b int unsigned not null, @@ -99,6 +98,20 @@ CREATE TABLE t2 ( UNIQUE (b, c) USING HASH ) engine=ndbcluster; + +insert t2 values(1,1,NULL),(2,2,2),(3,3,NULL),(4,4,4),(5,5,NULL),(6,6,6),(7,7,NULL),(8,3,NULL),(9,3,NULL); + +select * from t2 where c IS NULL order by a; +select * from t2 where b = 3 AND c IS NULL order by a; +select * from t2 where (b = 3 OR b = 5) AND c IS NULL order by a; +set @old_ecpd = @@session.engine_condition_pushdown; +set engine_condition_pushdown = true; +explain select * from t2 where (b = 3 OR b = 5) AND c IS NULL AND a < 9 order by a; +select * from t2 where (b = 3 OR b = 5) AND c IS NULL AND a < 9 order by a; +set engine_condition_pushdown = @old_ecpd; + +drop table t2; + # # Show use of PRIMARY KEY USING HASH indexes # diff --git a/mysql-test/t/ndb_multi.test b/mysql-test/t/ndb_multi.test index 0f098c96fa8..a50b3ef28ea 100644 --- a/mysql-test/t/ndb_multi.test +++ b/mysql-test/t/ndb_multi.test @@ -87,3 +87,40 @@ connection server1; select * from t1 order by c1; drop table t1; # End of 4.1 tests + +# Check distributed drop of database in 5.1 +create database db; +use db; +create table t1(x int) engine=ndb; + +connection server2; +use db; +show tables; + +connection server1; +drop database db; + +connection server2; +--error 1049 +show tables; + +connection server1; + +# bug#21495 +create database db; +use db; +create table t1(x int) engine=ndb; + +connection server2; +use db; +create table t2(x int) engine=myisam; +show tables; + +connection server1; +drop database db; + +connection server2; +show tables; +drop database db; + +connection server1; diff --git a/mysql-test/t/ndb_restore_compat.test b/mysql-test/t/ndb_restore_compat.test index ee55e827d0e..a95829a4354 100644 --- a/mysql-test/t/ndb_restore_compat.test +++ b/mysql-test/t/ndb_restore_compat.test @@ -21,7 +21,7 @@ SELECT * FROM GL ORDER BY TIME,ACCOUNT_TYPE; SELECT * FROM ACCOUNT ORDER BY ACCOUNT_ID; SELECT COUNT(*) FROM TRANSACTION; SELECT * FROM SYSTEM_VALUES ORDER BY SYSTEM_VALUES_ID; -SELECT * FROM mysql.apply_status WHERE server_id=0; +SELECT * FROM mysql.ndb_apply_status WHERE server_id=0; # # verify restore of 5.0 backup @@ -39,5 +39,5 @@ SELECT * FROM GL ORDER BY TIME,ACCOUNT_TYPE; SELECT * FROM ACCOUNT ORDER BY ACCOUNT_ID; SELECT COUNT(*) FROM TRANSACTION; SELECT * FROM SYSTEM_VALUES ORDER BY SYSTEM_VALUES_ID; -SELECT * FROM mysql.apply_status WHERE server_id=0; +SELECT * FROM mysql.ndb_apply_status WHERE server_id=0; DROP DATABASE BANK; diff --git a/mysql-test/t/ndb_update.test b/mysql-test/t/ndb_update.test index 45e3add4639..ebcc6995d74 100644 --- a/mysql-test/t/ndb_update.test +++ b/mysql-test/t/ndb_update.test @@ -23,8 +23,13 @@ UPDATE t1 set b = c; select * from t1 order by pk1; UPDATE t1 set pk1 = 4 where pk1 = 1; select * from t1 order by pk1; +--error 1062 +UPDATE t1 set pk1 = 4 where pk1 = 2; +UPDATE IGNORE t1 set pk1 = 4 where pk1 = 2; +select * from t1 order by pk1; -- error 1062 UPDATE t1 set pk1 = 1, c = 2 where pk1 = 4; +UPDATE IGNORE t1 set pk1 = 1, c = 2 where pk1 = 4; select * from t1 order by pk1; UPDATE t1 set pk1 = pk1 + 10; select * from t1 order by pk1; diff --git a/mysql-test/t/parser.test b/mysql-test/t/parser.test index 39c8d8e2bf4..13b4338701e 100644 --- a/mysql-test/t/parser.test +++ b/mysql-test/t/parser.test @@ -493,3 +493,113 @@ select yearweek(); -- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT select yearweek(1, 2, 3); +# +# Bug#24736: UDF functions parsed as Stored Functions +# + +# Verify that the syntax for calling UDF : foo(expr AS param, ...) +# can not be used when calling native functions + +# Native function with 1 argument + +select abs(3); +-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT +select abs(3 AS three); +-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT +select abs(3 three); +-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT +select abs(3 AS "three"); +-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT +select abs(3 "three"); + +# Native function with 2 arguments + +set @bar="bar"; +set @foobar="foobar"; + +select instr("foobar", "bar"); +-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT +select instr("foobar" AS p1, "bar"); +-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT +select instr("foobar" p1, "bar"); +-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT +select instr("foobar" AS "p1", "bar"); +## String concatenation, valid syntax +select instr("foobar" "p1", "bar"); +-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT +select instr(@foobar "p1", "bar"); +-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT +select instr("foobar", "bar" AS p2); +-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT +select instr("foobar", "bar" p2); +-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT +select instr("foobar", "bar" AS "p2"); +## String concatenation, valid syntax +select instr("foobar", "bar" "p2"); +-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT +select instr("foobar", @bar "p2"); +-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT +select instr("foobar" AS p1, "bar" AS p2); + +# Native function with 3 arguments + +select conv(255, 10, 16); +-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT +select conv(255 AS p1, 10, 16); +-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT +select conv(255 p1, 10, 16); +-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT +select conv(255 AS "p1", 10, 16); +-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT +select conv(255 "p1", 10, 16); +-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT +select conv(255, 10 AS p2, 16); +-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT +select conv(255, 10 p2, 16); +-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT +select conv(255, 10 AS "p2", 16); +-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT +select conv(255, 10 "p2", 16); +-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT +select conv(255, 10, 16 AS p3); +-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT +select conv(255, 10, 16 p3); +-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT +select conv(255, 10, 16 AS "p3"); +-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT +select conv(255, 10, 16 "p3"); +-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT +select conv(255 AS p1, 10 AS p2, 16 AS p3); + +# Native function with a variable number of arguments + +select atan(10); +-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT +select atan(10 AS p1); +-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT +select atan(10 p1); +-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT +select atan(10 AS "p1"); +-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT +select atan(10 "p1"); + +select atan(10, 20); +-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT +select atan(10 AS p1, 20); +-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT +select atan(10 p1, 20); +-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT +select atan(10 AS "p1", 20); +-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT +select atan(10 "p1", 20); +-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT +select atan(10, 20 AS p2); +-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT +select atan(10, 20 p2); +-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT +select atan(10, 20 AS "p2"); +-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT +select atan(10, 20 "p2"); +-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT +select atan(10 AS p1, 20 AS p2); + diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test index 39e4e65c6bf..15b0a476279 100644 --- a/mysql-test/t/ps.test +++ b/mysql-test/t/ps.test @@ -1520,6 +1520,29 @@ DROP TABLE t1, t2; # +# BUG#20327: Marking of a wrong field leads to a wrong result on select with +# view, prepared statement and subquery. +# +CREATE TABLE t1 (i INT); +CREATE VIEW v1 AS SELECT * FROM t1; + +INSERT INTO t1 VALUES (1), (2); + +let $query = SELECT t1.i FROM t1 JOIN v1 ON t1.i = v1.i + WHERE EXISTS (SELECT * FROM t1 WHERE v1.i = 1); +eval $query; +eval PREPARE stmt FROM "$query"; +# Statement execution should return '1'. +EXECUTE stmt; +# Check re-execution. +EXECUTE stmt; + +DEALLOCATE PREPARE stmt; +DROP VIEW v1; +DROP TABLE t1; + + +# # BUG#21856: Prepared Statments: crash if bad create # --disable_warnings @@ -1564,8 +1587,8 @@ call proc_1(); call proc_1(); delimiter |; --error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG -create function func_1() returns int begin reset query cache; return 1; end| -create function func_1() returns int begin call proc_1(); return 1; end| +create function func_1() returns int deterministic begin reset query cache; return 1; end| +create function func_1() returns int deterministic begin call proc_1(); return 1; end| delimiter ;| --error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG select func_1(), func_1(), func_1() from dual; diff --git a/mysql-test/t/query_cache.test b/mysql-test/t/query_cache.test index cb4e5f97c3a..ad7fd90ed63 100644 --- a/mysql-test/t/query_cache.test +++ b/mysql-test/t/query_cache.test @@ -788,7 +788,9 @@ create procedure `p1`() begin select a, f1() from t1; end// +SET GLOBAL log_bin_trust_function_creators = 1; call p1()// +SET GLOBAL log_bin_trust_function_creators = 0; drop procedure p1// drop function f1// diff --git a/mysql-test/t/query_cache_notembedded.test b/mysql-test/t/query_cache_notembedded.test index 97be9f9f7ca..802022d061b 100644 --- a/mysql-test/t/query_cache_notembedded.test +++ b/mysql-test/t/query_cache_notembedded.test @@ -183,6 +183,8 @@ drop table t1; # # bug#14767: INSERT in SF + concurrent SELECT with query cache # +SET GLOBAL log_bin_trust_function_creators = 1; + reset query cache; --disable_warnings drop function if exists f1; @@ -222,3 +224,4 @@ disconnect con2; connection default; set GLOBAL query_cache_size=0; +SET GLOBAL log_bin_trust_function_creators = 0; diff --git a/mysql-test/t/read_only.test b/mysql-test/t/read_only.test index 175a5bba6fa..8e14b310f4c 100644 --- a/mysql-test/t/read_only.test +++ b/mysql-test/t/read_only.test @@ -101,6 +101,18 @@ drop table t1; --error 1290 insert into t1 values(1); +# +# BUG #22077 "DROP TEMPORARY TABLE fails with wrong error if read_only is set" +# +# check if DROP TEMPORARY on a non-existing temporary table returns the right +# error + +--error ER_BAD_TABLE_ERROR +drop temporary table ttt; + +# check if DROP TEMPORARY TABLE IF EXISTS produces a warning with read_only set +drop temporary table if exists ttt; + connection default; drop table t1,t2; drop user test@localhost; diff --git a/mysql-test/t/rpl_000015.test b/mysql-test/t/rpl_000015.test index cf93beb2bfe..ffe7ab87632 100644 --- a/mysql-test/t/rpl_000015.test +++ b/mysql-test/t/rpl_000015.test @@ -18,7 +18,7 @@ show slave status; change master to master_host='127.0.0.1'; # The following needs to be cleaned up when change master is fixed ---replace_result $MYSQL_TCP_PORT MASTER_PORT +--replace_result $DEFAULT_MASTER_PORT DEFAULT_MASTER_PORT --replace_column 1 # 8 # 9 # 23 # 33 # show slave status; --replace_result $MASTER_MYPORT MASTER_PORT diff --git a/mysql-test/t/rpl_drop_db.test b/mysql-test/t/rpl_drop_db.test index ffdc605b402..7f4a7843c4a 100644 --- a/mysql-test/t/rpl_drop_db.test +++ b/mysql-test/t/rpl_drop_db.test @@ -46,17 +46,16 @@ show tables; use test; select * from t1; -system rm $MYSQLTEST_VARDIR/master-data/mysqltest1/f1.txt; -connection master; -DROP DATABASE mysqltest1; -sync_slave_with_master; - #cleanup connection slave; stop slave; -#system rm -rf $MYSQLTEST_VARDIR/master-data/mysqltest1; +drop database mysqltest1; connection master; +# Remove the "extra" file created above +--remove_file $MYSQLTEST_VARDIR/master-data/mysqltest1/f1.txt +drop database mysqltest1; + use test; drop table t1; diff --git a/mysql-test/t/rpl_ignore_revoke.test b/mysql-test/t/rpl_ignore_revoke.test index cdeb40df069..00171605a92 100644 --- a/mysql-test/t/rpl_ignore_revoke.test +++ b/mysql-test/t/rpl_ignore_revoke.test @@ -45,3 +45,7 @@ revoke select on *.* FROM 'user_foo'; connection master; delete from mysql.user where user="user_foo"; sync_slave_with_master; + +# Since changes to mysql.* are ignored, the revoke need to +# be done on slave as well +delete from mysql.user where user="user_foo"; diff --git a/mysql-test/t/rpl_init_slave.test b/mysql-test/t/rpl_init_slave.test index cefb04a7b75..139b4902e12 100644 --- a/mysql-test/t/rpl_init_slave.test +++ b/mysql-test/t/rpl_init_slave.test @@ -17,6 +17,8 @@ show variables like 'max_connections'; save_master_pos; connection slave; sync_with_master; +# Save variable value +set @my_global_init_connect= @@global.init_connect; set global init_connect="set @c=1"; show variables like 'init_connect'; connection master; @@ -25,4 +27,8 @@ connection slave; sync_with_master; stop slave; +# Restore changed global variable +set global init_connect= @my_global_init_connect; +set global max_connections= default; + # End of 4.1 tests diff --git a/mysql-test/t/rpl_ndb_idempotent.test b/mysql-test/t/rpl_ndb_idempotent.test index 477e7ff02e5..f2bfe745523 100644 --- a/mysql-test/t/rpl_ndb_idempotent.test +++ b/mysql-test/t/rpl_ndb_idempotent.test @@ -4,7 +4,7 @@ # # Currently test only works with ndb since it retrieves "old" -# binlog positions with mysql.binlog_index and apply_status; +# binlog positions with mysql.ndb_binlog_index and ndb_apply_status; # # create a table with one row @@ -15,7 +15,7 @@ SELECT * FROM t1 ORDER BY c3; # sync slave and retrieve epoch sync_slave_with_master; --replace_column 1 <the_epoch> -SELECT @the_epoch:=MAX(epoch) FROM mysql.apply_status; +SELECT @the_epoch:=MAX(epoch) FROM mysql.ndb_apply_status; let $the_epoch= `select @the_epoch` ; SELECT * FROM t1 ORDER BY c3; @@ -24,7 +24,7 @@ connection master; --replace_result $the_epoch <the_epoch> --replace_column 1 <the_pos> eval SELECT @the_pos:=Position,@the_file:=SUBSTRING_INDEX(FILE, '/', -1) - FROM mysql.binlog_index WHERE epoch = $the_epoch ; + FROM mysql.ndb_binlog_index WHERE epoch = $the_epoch ; let $the_pos= `SELECT @the_pos` ; let $the_file= `SELECT @the_file` ; diff --git a/mysql-test/t/rpl_ndb_multi.test b/mysql-test/t/rpl_ndb_multi.test index 630668ad369..196d0a5ed6f 100644 --- a/mysql-test/t/rpl_ndb_multi.test +++ b/mysql-test/t/rpl_ndb_multi.test @@ -7,7 +7,7 @@ # # Currently test only works with ndb since it retrieves "old" -# binlog positions with mysql.binlog_index and apply_status; +# binlog positions with mysql.ndb_binlog_index and ndb_apply_status; # # create a table with one row, and make sure the other "master" gets it @@ -25,7 +25,7 @@ SELECT * FROM t1 ORDER BY c3; connection master; sync_slave_with_master; --replace_column 1 <the_epoch> -SELECT @the_epoch:=MAX(epoch) FROM mysql.apply_status; +SELECT @the_epoch:=MAX(epoch) FROM mysql.ndb_apply_status; let $the_epoch= `select @the_epoch` ; SELECT * FROM t1 ORDER BY c3; stop slave; @@ -34,7 +34,7 @@ stop slave; connection server2; --replace_result $the_epoch <the_epoch> eval SELECT @the_pos:=Position,@the_file:=SUBSTRING_INDEX(FILE, '/', -1) - FROM mysql.binlog_index WHERE epoch = $the_epoch ; + FROM mysql.ndb_binlog_index WHERE epoch = $the_epoch ; let $the_pos= `SELECT @the_pos` ; let $the_file= `SELECT @the_file` ; diff --git a/mysql-test/t/rpl_ndb_sync.test b/mysql-test/t/rpl_ndb_sync.test index 10f7dd534a3..14e2b36b588 100644 --- a/mysql-test/t/rpl_ndb_sync.test +++ b/mysql-test/t/rpl_ndb_sync.test @@ -6,7 +6,7 @@ # # Currently test only works with ndb since it retrieves "old" -# binlog positions with mysql.binlog_index and apply_status; +# binlog positions with mysql.ndb_binlog_index and ndb_apply_status; # # stop the save @@ -94,11 +94,11 @@ STOP SLAVE; --connection master reset master; # should now contain nothing -select * from mysql.binlog_index; +select * from mysql.ndb_binlog_index; --connection slave reset slave; # should now contain nothing -select * from mysql.apply_status; +select * from mysql.ndb_apply_status; # End 5.1 Test diff --git a/mysql-test/t/rpl_sf.test b/mysql-test/t/rpl_sf.test new file mode 100644 index 00000000000..2b1e0350f1b --- /dev/null +++ b/mysql-test/t/rpl_sf.test @@ -0,0 +1,68 @@ +# Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR + +# save status + +let $oblf=`select @@SESSION.BINLOG_FORMAT`; +let $otfc=`select @@log_bin_trust_function_creators`; + +set global log_bin_trust_function_creators=0; + + + +# fail *on definition* + +set binlog_format=STATEMENT; + +delimiter |; +--error ER_BINLOG_UNSAFE_ROUTINE +create function fn16456() + returns int +begin + return unix_timestamp(); +end| +delimiter ;| + + + +# force in definition, so we can see whether we fail on call + +set global log_bin_trust_function_creators=1; + +delimiter |; +create function fn16456() + returns int +begin + return unix_timestamp(); +end| +delimiter ;| + +set global log_bin_trust_function_creators=0; + + + +# allow funcall in RBR + +set binlog_format=ROW; + +--replace_column 1 timestamp +select fn16456(); + + + +# fail funcall in SBR + +set binlog_format=STATEMENT; + +--error ER_BINLOG_ROW_RBR_TO_SBR +select fn16456(); + + + +# restore status + +drop function fn16456; + +--disable_query_log +eval set binlog_format=$oblf; +eval set global log_bin_trust_function_creators=$otfc; +--enable_query_log diff --git a/mysql-test/t/rpl_sp.test b/mysql-test/t/rpl_sp.test index 22ab72df104..3a93a6608cd 100644 --- a/mysql-test/t/rpl_sp.test +++ b/mysql-test/t/rpl_sp.test @@ -8,6 +8,7 @@ # still accepted (this test also checks that the new name is # accepted). The old name could be removed in 5.1 or 6.0. +source include/have_binlog_format_mixed.inc; source include/master-slave.inc; # we need a db != test, where we don't have automatic grants @@ -319,7 +320,9 @@ select * from t2; # ********************** PART 3 : TRIGGERS *************** connection con1; ---error 1227 +# now fails due to missing trigger grant (err 1142 i/o 1227) due to new +# check in sql_trigger.cc (v1.44) by anozdrin on 2006/02/01 --azundris +--error ER_TABLEACCESS_DENIED_ERROR create trigger trg before insert on t1 for each row set new.a= 10; connection master; @@ -519,6 +522,33 @@ connection master; drop table t1; sync_slave_with_master; +# Restore log_bin_trust_function_creators to original value +set global log_bin_trust_function_creators=0; +connection master; +set global log_bin_trust_function_creators=0; --echo End of 5.0 tests + +# +# Bug22043: MySQL don't add "USE <DATABASE>" before "DROP PROCEDURE IF EXISTS" +# +connection master; +reset master; +--disable_warnings +drop database if exists mysqltest; +drop database if exists mysqltest2; +--enable_warnings +create database mysqltest; +create database mysqltest2; +use mysqltest2; +create table t ( t integer ); +create procedure mysqltest.test() begin end; +insert into t values ( 1 ); +show binlog events in 'master-bin.000001' from 102; +--error ER_BAD_DB_ERROR +create procedure `\\`.test() begin end; +# Clean up +drop database mysqltest; +drop database mysqltest2; + --echo End of 5.1 tests diff --git a/mysql-test/t/rpl_sp_effects.test b/mysql-test/t/rpl_sp_effects.test index e1746682b76..027bfd69f36 100644 --- a/mysql-test/t/rpl_sp_effects.test +++ b/mysql-test/t/rpl_sp_effects.test @@ -20,6 +20,8 @@ drop view if exists v1; --enable_warnings create table t1 (a int); +SET GLOBAL log_bin_trust_function_creators = 1; + # 1. Test simple variables use. delimiter //; create procedure p1() @@ -205,3 +207,5 @@ drop function f1; drop function f2; drop procedure p1; sync_slave_with_master; + +SET GLOBAL log_bin_trust_function_creators = 0; diff --git a/mysql-test/t/rpl_timezone.test b/mysql-test/t/rpl_timezone.test index 5a6c1cd06f8..4b8c8152c82 100644 --- a/mysql-test/t/rpl_timezone.test +++ b/mysql-test/t/rpl_timezone.test @@ -17,6 +17,9 @@ source include/master-slave.inc; +# Save original timezone +set @my_time_zone= @@global.time_zone; + # Some preparations let $VERSION=`select version()`; set timestamp=100000000; # for fixed output of mysqlbinlog @@ -133,3 +136,7 @@ connection master; drop table t1, t2; sync_slave_with_master; + +# Restore original timezone +connection master; +set global time_zone= @my_time_zone; diff --git a/mysql-test/t/rpl_variables.test b/mysql-test/t/rpl_variables.test index b1744c57c9b..84dc3acfe6e 100644 --- a/mysql-test/t/rpl_variables.test +++ b/mysql-test/t/rpl_variables.test @@ -1,5 +1,8 @@ source include/master-slave.inc; +# Init for rstore of variable values +set @my_slave_net_timeout =@@global.slave_net_timeout; + set global slave_net_timeout=100; set global sql_slave_skip_counter=100; diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test index 8f4763c636a..ba1180ffaff 100644 --- a/mysql-test/t/sp.test +++ b/mysql-test/t/sp.test @@ -359,7 +359,7 @@ end| --disable_warnings drop procedure if exists sub3| --enable_warnings -create function sub3(i int) returns int +create function sub3(i int) returns int deterministic return i+1| call sub1("sub1a", (select 7))| @@ -6707,6 +6707,83 @@ delimiter |; --echo End of 5.1 tests # +# BUG#23760: ROW_COUNT() and store procedure not owrking together +# +--disable_warnings +DROP TABLE IF EXISTS bug23760| +DROP TABLE IF EXISTS bug23760_log| +DROP PROCEDURE IF EXISTS bug23760_update_log| +DROP PROCEDURE IF EXISTS bug23760_test_row_count| +DROP FUNCTION IF EXISTS bug23760_rc_test| +--enable_warnings +CREATE TABLE bug23760 ( + id INT NOT NULL AUTO_INCREMENT , + num INT NOT NULL , + PRIMARY KEY ( id ) +)| + +CREATE TABLE bug23760_log ( + id INT NOT NULL AUTO_INCREMENT , + reason VARCHAR(50)NULL , + ammount INT NOT NULL , + PRIMARY KEY ( id ) +)| + +CREATE PROCEDURE bug23760_update_log(r Varchar(50), a INT) +BEGIN + INSERT INTO bug23760_log (reason, ammount) VALUES(r, a); +END| + +CREATE PROCEDURE bug23760_test_row_count() +BEGIN + UPDATE bug23760 SET num = num + 1; + CALL bug23760_update_log('Test is working', ROW_COUNT()); + UPDATE bug23760 SET num = num - 1; +END| + + +CREATE PROCEDURE bug23760_test_row_count2(level INT) +BEGIN + IF level THEN + UPDATE bug23760 SET num = num + 1; + CALL bug23760_update_log('Test2 is working', ROW_COUNT()); + CALL bug23760_test_row_count2(level - 1); + END IF; +END| + +CREATE FUNCTION bug23760_rc_test(in_var INT) RETURNS INT RETURN in_var| + +INSERT INTO bug23760 (num) VALUES (0), (1), (1), (2), (3), (5), (8)| +SELECT ROW_COUNT()| + +CALL bug23760_test_row_count()| +SELECT * FROM bug23760_log ORDER BY id| + +SET @save_max_sp_recursion= @@max_sp_recursion_depth| +SELECT @save_max_sp_recursion| +SET max_sp_recursion_depth= 5| +SELECT @@max_sp_recursion_depth| +CALL bug23760_test_row_count2(2)| +SELECT ROW_COUNT()| +SELECT * FROM bug23760_log ORDER BY id| +SELECT * FROM bug23760 ORDER by ID| +SET max_sp_recursion_depth= @save_max_sp_recursion| + +SELECT bug23760_rc_test(123)| +INSERT INTO bug23760 (num) VALUES (13), (21), (34), (55)| +SELECT bug23760_rc_test(ROW_COUNT())| + +DROP TABLE bug23760, bug23760_log| +DROP PROCEDURE bug23760_update_log| +DROP PROCEDURE bug23760_test_row_count| +DROP FUNCTION bug23760_rc_test| + +# +# NOTE: The delimiter is `|`, and not `;`. It is changed to `;` +# at the end of the file! +# + +# # BUG#NNNN: New bug synopsis # #--disable_warnings diff --git a/mysql-test/t/system_mysql_db_fix-master.opt b/mysql-test/t/system_mysql_db_fix30020-master.opt index 7e4fa9a3ee8..7e4fa9a3ee8 100644 --- a/mysql-test/t/system_mysql_db_fix-master.opt +++ b/mysql-test/t/system_mysql_db_fix30020-master.opt diff --git a/mysql-test/t/system_mysql_db_fix.test b/mysql-test/t/system_mysql_db_fix30020.test index 53bb366c642..6188aebb9f5 100644 --- a/mysql-test/t/system_mysql_db_fix.test +++ b/mysql-test/t/system_mysql_db_fix30020.test @@ -10,9 +10,11 @@ # # This is the test for mysql_fix_privilege_tables +# It checks that a system tables from mysql 3.20 +# can be upgraded to current system table format # # Note: If this test fails, don't be confused about the errors reported -# by mysql-test-run; This shows warnings from generated by +# by mysql-test-run This shows warnings generated by # mysql_fix_system_tables which should be ignored. # Instead, concentrate on the errors in r/system_mysql_db.reject @@ -85,7 +87,7 @@ INSERT INTO user VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y',' INSERT INTO user VALUES ('localhost','', '','N','N','N','N','N','N','N','N','N'); # Call the "shell script" $MYSQL_FIX_SYSTEM_TABLES using system --- system $MYSQL_FIX_SYSTEM_TABLES --database=test > /dev/null +-- system $MYSQL_FIX_SYSTEM_TABLES --database=test > $MYSQLTEST_VARDIR/log/system_mysql_db_fix30020.log 2>&1 -- enable_query_log -- enable_result_log @@ -96,7 +98,7 @@ INSERT INTO user VALUES ('localhost','', '','N','N','N','N','N','N','N','N',' DROP TABLE db, host, user, func, plugin, tables_priv, columns_priv, procs_priv, help_category, help_keyword, help_relation, help_topic, proc, time_zone, time_zone_leap_second, time_zone_name, time_zone_transition, -time_zone_transition_type, general_log, slow_log, event, binlog_index; +time_zone_transition_type, general_log, slow_log, event, ndb_binlog_index; -- enable_query_log diff --git a/mysql-test/t/system_mysql_db_fix40123-master.opt b/mysql-test/t/system_mysql_db_fix40123-master.opt new file mode 100644 index 00000000000..7e4fa9a3ee8 --- /dev/null +++ b/mysql-test/t/system_mysql_db_fix40123-master.opt @@ -0,0 +1 @@ +--result-file=system_mysql_db diff --git a/mysql-test/t/system_mysql_db_fix40123.test b/mysql-test/t/system_mysql_db_fix40123.test new file mode 100644 index 00000000000..00bd37979c4 --- /dev/null +++ b/mysql-test/t/system_mysql_db_fix40123.test @@ -0,0 +1,79 @@ +# Embedded server doesn't support external clients +--source include/not_embedded.inc + +# +# This is the test for mysql_fix_privilege_tables +# It checks that a system tables from mysql 4.1.23 +# can be upgraded to current system table format +# +# Note: If this test fails, don't be confused about the errors reported +# by mysql-test-run This shows warnings generated by +# mysql_fix_system_tables which should be ignored. +# Instead, concentrate on the errors in r/system_mysql_db.reject + +--disable_warnings +drop table if exists t1,t1aa,t2aa; +--enable_warnings + +-- disable_result_log +-- disable_query_log + +use test; + +# create system tables as in mysql-4.1.23 +# created by executing "./mysql_create_system_tables real ." + +set table_type=myisam; +CREATE TABLE db ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, PRIMARY KEY Host (Host,Db,User), KEY User (User) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Database privileges'; +INSERT INTO db VALUES ('%','test','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y'); +INSERT INTO db VALUES ('%','test\_%','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y'); + +CREATE TABLE host ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, PRIMARY KEY Host (Host,Db) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Host privileges; Merged with database privileges'; + + +CREATE TABLE user ( Host char(60) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Password char(41) binary DEFAULT '' NOT NULL, Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Reload_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Shutdown_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Process_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, File_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_db_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Super_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Repl_slave_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Repl_client_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, ssl_type enum('','ANY','X509', 'SPECIFIED') COLLATE utf8_general_ci DEFAULT '' NOT NULL, ssl_cipher BLOB NOT NULL, x509_issuer BLOB NOT NULL, x509_subject BLOB NOT NULL, max_questions int(11) unsigned DEFAULT 0 NOT NULL, max_updates int(11) unsigned DEFAULT 0 NOT NULL, max_connections int(11) unsigned DEFAULT 0 NOT NULL, PRIMARY KEY Host (Host,User) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Users and global privileges'; +INSERT INTO user VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0); + INSERT INTO user VALUES ('localhost','','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0); + +CREATE TABLE func ( name char(64) binary DEFAULT '' NOT NULL, ret tinyint(1) DEFAULT '0' NOT NULL, dl char(128) DEFAULT '' NOT NULL, type enum ('function','aggregate') COLLATE utf8_general_ci NOT NULL, PRIMARY KEY (name) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='User defined functions'; + + +CREATE TABLE tables_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Table_name char(64) binary DEFAULT '' NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, Timestamp timestamp(14), Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter') COLLATE utf8_general_ci DEFAULT '' NOT NULL, Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL, PRIMARY KEY (Host,Db,User,Table_name), KEY Grantor (Grantor) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Table privileges'; +CREATE TABLE columns_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Table_name char(64) binary DEFAULT '' NOT NULL, Column_name char(64) binary DEFAULT '' NOT NULL, Timestamp timestamp(14), Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL, PRIMARY KEY (Host,Db,User,Table_name,Column_name) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Column privileges'; + +CREATE TABLE help_topic ( help_topic_id int unsigned not null, name varchar(64) not null, help_category_id smallint unsigned not null, description text not null, example text not null, url varchar(128) not null, primary key (help_topic_id), unique index (name) ) engine=MyISAM CHARACTER SET utf8 comment='help topics'; +CREATE TABLE help_category ( help_category_id smallint unsigned not null, name varchar(64) not null, parent_category_id smallint unsigned null, url varchar(128) not null, primary key (help_category_id), unique index (name) ) engine=MyISAM CHARACTER SET utf8 comment='help categories'; +CREATE TABLE help_relation ( help_topic_id int unsigned not null references help_topic, help_keyword_id int unsigned not null references help_keyword, primary key (help_keyword_id, help_topic_id) ) engine=MyISAM CHARACTER SET utf8 comment='keyword-topic relation'; +CREATE TABLE help_keyword ( help_keyword_id int unsigned not null, name varchar(64) not null, primary key (help_keyword_id), unique index (name) ) engine=MyISAM CHARACTER SET utf8 comment='help keywords'; + +CREATE TABLE time_zone_name ( Name char(64) NOT NULL, Time_zone_id int unsigned NOT NULL, PRIMARY KEY Name (Name) ) engine=MyISAM CHARACTER SET utf8 comment='Time zone names'; + +CREATE TABLE time_zone ( Time_zone_id int unsigned NOT NULL auto_increment, Use_leap_seconds enum('Y','N') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, PRIMARY KEY TzId (Time_zone_id) ) engine=MyISAM CHARACTER SET utf8 comment='Time zones'; + +CREATE TABLE time_zone_transition ( Time_zone_id int unsigned NOT NULL, Transition_time bigint signed NOT NULL, Transition_type_id int unsigned NOT NULL, PRIMARY KEY TzIdTranTime (Time_zone_id, Transition_time) ) engine=MyISAM CHARACTER SET utf8 comment='Time zone transitions'; + +CREATE TABLE time_zone_transition_type ( Time_zone_id int unsigned NOT NULL, Transition_type_id int unsigned NOT NULL, Offset int signed DEFAULT 0 NOT NULL, Is_DST tinyint unsigned DEFAULT 0 NOT NULL, Abbreviation char(8) DEFAULT '' NOT NULL, PRIMARY KEY TzIdTrTId (Time_zone_id, Transition_type_id) ) engine=MyISAM CHARACTER SET utf8 comment='Time zone transition types'; + +CREATE TABLE time_zone_leap_second ( Transition_time bigint signed NOT NULL, Correction int signed NOT NULL, PRIMARY KEY TranTime (Transition_time) ) engine=MyISAM CHARACTER SET utf8 comment='Leap seconds information for time zones'; + + +# Run the mysql_fix_privilege_tables.sql using "mysql --force" +--exec $MYSQL --force test < $MYSQL_FIX_PRIVILEGE_TABLES > $MYSQLTEST_VARDIR/log/system_mysql_db_fix40123.log 2>&1 + +-- enable_query_log +-- enable_result_log + +# Dump the tables that should be compared +-- source include/system_db_struct.inc + +-- disable_query_log + +# Drop all tables created by this test +DROP TABLE db, host, user, func, plugin, tables_priv, columns_priv, procs_priv, help_category, help_keyword, help_relation, help_topic, proc, time_zone, time_zone_leap_second, time_zone_name, time_zone_transition, time_zone_transition_type, general_log, slow_log, event, ndb_binlog_index; + +-- enable_query_log + +# check that we dropped all system tables +show tables; + +# End of 4.1 tests diff --git a/mysql-test/t/system_mysql_db_fix50030-master.opt b/mysql-test/t/system_mysql_db_fix50030-master.opt new file mode 100644 index 00000000000..7e4fa9a3ee8 --- /dev/null +++ b/mysql-test/t/system_mysql_db_fix50030-master.opt @@ -0,0 +1 @@ +--result-file=system_mysql_db diff --git a/mysql-test/t/system_mysql_db_fix50030.test b/mysql-test/t/system_mysql_db_fix50030.test new file mode 100644 index 00000000000..41ae3bec4de --- /dev/null +++ b/mysql-test/t/system_mysql_db_fix50030.test @@ -0,0 +1,82 @@ +# Embedded server doesn't support external clients +--source include/not_embedded.inc + +# +# This is the test for mysql_fix_privilege_tables +# It checks that a system tables from mysql 5.0.30 +# can be upgraded to current system table format +# +# Note: If this test fails, don't be confused about the errors reported +# by mysql-test-run This shows warnings generated by +# mysql_fix_system_tables which should be ignored. +# Instead, concentrate on the errors in r/system_mysql_db.reject + +--disable_warnings +drop table if exists t1,t1aa,t2aa; +--enable_warnings + +-- disable_result_log +-- disable_query_log + +use test; + +# create system tables as in mysql-5.0.30 +# created by executing "./mysql_create_system_tables real ." + +set table_type=myisam; +CREATE TABLE db ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, PRIMARY KEY Host (Host,Db,User), KEY User (User) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Database privileges'; +INSERT INTO db VALUES ('%','test','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y','Y','Y','Y','N','N'); +INSERT INTO db VALUES ('%','test\_%','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y','Y','Y','Y','N','N'); + +CREATE TABLE host ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, PRIMARY KEY Host (Host,Db) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Host privileges; Merged with database privileges'; + +CREATE TABLE user ( Host char(60) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Password char(41) character set latin1 collate latin1_bin DEFAULT '' NOT NULL, Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Reload_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Shutdown_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Process_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, File_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_db_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Super_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Repl_slave_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Repl_client_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_user_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, ssl_type enum('','ANY','X509', 'SPECIFIED') COLLATE utf8_general_ci DEFAULT '' NOT NULL, ssl_cipher BLOB NOT NULL, x509_issuer BLOB NOT NULL, x509_subject BLOB NOT NULL, max_questions int(11) unsigned DEFAULT 0 NOT NULL, max_updates int(11) unsigned DEFAULT 0 NOT NULL, max_connections int(11) unsigned DEFAULT 0 NOT NULL, max_user_connections int(11) unsigned DEFAULT 0 NOT NULL, PRIMARY KEY Host (Host,User) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Users and global privileges'; +INSERT INTO user VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0); +INSERT INTO user VALUES ('localhost','','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0, 0); + +CREATE TABLE func ( name char(64) binary DEFAULT '' NOT NULL, ret tinyint(1) DEFAULT '0' NOT NULL, dl char(128) DEFAULT '' NOT NULL, type enum ('function','aggregate') COLLATE utf8_general_ci NOT NULL, PRIMARY KEY (name) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='User defined functions'; + +CREATE TABLE tables_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Table_name char(64) binary DEFAULT '' NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, Timestamp timestamp(14), Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view') COLLATE utf8_general_ci DEFAULT '' NOT NULL, Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL, PRIMARY KEY (Host,Db,User,Table_name), KEY Grantor (Grantor) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Table privileges'; + +CREATE TABLE columns_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Table_name char(64) binary DEFAULT '' NOT NULL, Column_name char(64) binary DEFAULT '' NOT NULL, Timestamp timestamp(14), Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL, PRIMARY KEY (Host,Db,User,Table_name,Column_name) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Column privileges'; + +CREATE TABLE help_topic ( help_topic_id int unsigned not null, name char(64) not null, help_category_id smallint unsigned not null, description text not null, example text not null, url char(128) not null, primary key (help_topic_id), unique index (name) ) engine=MyISAM CHARACTER SET utf8 comment='help topics'; +CREATE TABLE help_category ( help_category_id smallint unsigned not null, name char(64) not null, parent_category_id smallint unsigned null, url char(128) not null, primary key (help_category_id), unique index (name) ) engine=MyISAM CHARACTER SET utf8 comment='help categories'; +CREATE TABLE help_relation ( help_topic_id int unsigned not null references help_topic, help_keyword_id int unsigned not null references help_keyword, primary key (help_keyword_id, help_topic_id) ) engine=MyISAM CHARACTER SET utf8 comment='keyword-topic relation'; +CREATE TABLE help_keyword ( help_keyword_id int unsigned not null, name char(64) not null, primary key (help_keyword_id), unique index (name) ) engine=MyISAM CHARACTER SET utf8 comment='help keywords'; + +CREATE TABLE time_zone_name ( Name char(64) NOT NULL, Time_zone_id int unsigned NOT NULL, PRIMARY KEY Name (Name) ) engine=MyISAM CHARACTER SET utf8 comment='Time zone names'; + +CREATE TABLE time_zone ( Time_zone_id int unsigned NOT NULL auto_increment, Use_leap_seconds enum('Y','N') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, PRIMARY KEY TzId (Time_zone_id) ) engine=MyISAM CHARACTER SET utf8 comment='Time zones'; + +CREATE TABLE time_zone_transition ( Time_zone_id int unsigned NOT NULL, Transition_time bigint signed NOT NULL, Transition_type_id int unsigned NOT NULL, PRIMARY KEY TzIdTranTime (Time_zone_id, Transition_time) ) engine=MyISAM CHARACTER SET utf8 comment='Time zone transitions'; + +CREATE TABLE time_zone_transition_type ( Time_zone_id int unsigned NOT NULL, Transition_type_id int unsigned NOT NULL, Offset int signed DEFAULT 0 NOT NULL, Is_DST tinyint unsigned DEFAULT 0 NOT NULL, Abbreviation char(8) DEFAULT '' NOT NULL, PRIMARY KEY TzIdTrTId (Time_zone_id, Transition_type_id) ) engine=MyISAM CHARACTER SET utf8 comment='Time zone transition types'; + +CREATE TABLE time_zone_leap_second ( Transition_time bigint signed NOT NULL, Correction int signed NOT NULL, PRIMARY KEY TranTime (Transition_time) ) engine=MyISAM CHARACTER SET utf8 comment='Leap seconds information for time zones'; + +CREATE TABLE proc ( db char(64) collate utf8_bin DEFAULT '' NOT NULL, name char(64) DEFAULT '' NOT NULL, type enum('FUNCTION','PROCEDURE') NOT NULL, specific_name char(64) DEFAULT '' NOT NULL, language enum('SQL') DEFAULT 'SQL' NOT NULL, sql_data_access enum('CONTAINS_SQL', 'NO_SQL', 'READS_SQL_DATA', 'MODIFIES_SQL_DATA' ) DEFAULT 'CONTAINS_SQL' NOT NULL, is_deterministic enum('YES','NO') DEFAULT 'NO' NOT NULL, security_type enum('INVOKER','DEFINER') DEFAULT 'DEFINER' NOT NULL, param_list blob DEFAULT '' NOT NULL, returns char(64) DEFAULT '' NOT NULL, body longblob DEFAULT '' NOT NULL, definer char(77) collate utf8_bin DEFAULT '' NOT NULL, created timestamp, modified timestamp, sql_mode set( 'REAL_AS_FLOAT', 'PIPES_AS_CONCAT', 'ANSI_QUOTES', 'IGNORE_SPACE', 'NOT_USED', 'ONLY_FULL_GROUP_BY', 'NO_UNSIGNED_SUBTRACTION', 'NO_DIR_IN_CREATE', 'POSTGRESQL', 'ORACLE', 'MSSQL', 'DB2', 'MAXDB', 'NO_KEY_OPTIONS', 'NO_TABLE_OPTIONS', 'NO_FIELD_OPTIONS', 'MYSQL323', 'MYSQL40', 'ANSI', 'NO_AUTO_VALUE_ON_ZERO', 'NO_BACKSLASH_ESCAPES', 'STRICT_TRANS_TABLES', 'STRICT_ALL_TABLES', 'NO_ZERO_IN_DATE', 'NO_ZERO_DATE', 'INVALID_DATES', 'ERROR_FOR_DIVISION_BY_ZERO', 'TRADITIONAL', 'NO_AUTO_CREATE_USER', 'HIGH_NOT_PRECEDENCE' ) DEFAULT '' NOT NULL, comment char(64) collate utf8_bin DEFAULT '' NOT NULL, PRIMARY KEY (db,name,type) ) engine=MyISAM character set utf8 comment='Stored Procedures'; + +CREATE TABLE procs_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Routine_name char(64) binary DEFAULT '' NOT NULL, Routine_type enum('FUNCTION','PROCEDURE') NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, Proc_priv set('Execute','Alter Routine','Grant') COLLATE utf8_general_ci DEFAULT '' NOT NULL, Timestamp timestamp(14), PRIMARY KEY (Host,Db,User,Routine_name,Routine_type), KEY Grantor (Grantor) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Procedure privileges'; + + +# Run the mysql_fix_privilege_tables.sql using "mysql --force" +--exec $MYSQL --force test < $MYSQL_FIX_PRIVILEGE_TABLES > $MYSQLTEST_VARDIR/log/system_mysql_db_fix50030.log 2>&1 + +-- enable_query_log +-- enable_result_log + +# Dump the tables that should be compared +-- source include/system_db_struct.inc + +-- disable_query_log + +# Drop all tables created by this test +DROP TABLE db, host, user, func, plugin, tables_priv, columns_priv, procs_priv, help_category, help_keyword, help_relation, help_topic, proc, time_zone, time_zone_leap_second, time_zone_name, time_zone_transition, time_zone_transition_type, general_log, slow_log, event, ndb_binlog_index; + +-- enable_query_log + +# check that we dropped all system tables +show tables; + +# End of 4.1 tests diff --git a/mysql-test/t/timezone2.test b/mysql-test/t/timezone2.test index 862b9cc58d1..5e1f74d388f 100644 --- a/mysql-test/t/timezone2.test +++ b/mysql-test/t/timezone2.test @@ -228,6 +228,8 @@ drop table t1; # Test for bug #11081 "Using a CONVERT_TZ function in a stored function # or trigger fails". # +SET GLOBAL log_bin_trust_function_creators = 1; + create table t1 (ldt datetime, udt datetime); create function f1(i datetime) returns datetime return convert_tz(i, 'UTC', 'Europe/Moscow'); @@ -241,4 +243,6 @@ select ldt, f1(udt) as ldt2 from t1; drop table t1; drop function f1; +SET GLOBAL log_bin_trust_function_creators = 0; + # End of 5.0 tests diff --git a/mysql-test/t/type_bit.test b/mysql-test/t/type_bit.test index d46ba667665..48ad24ff6b7 100644 --- a/mysql-test/t/type_bit.test +++ b/mysql-test/t/type_bit.test @@ -261,4 +261,15 @@ insert into t1 (b, a) values ('2', '1'); select hex(a), b from t1; drop table t1; +# +# type was not properly initalized, which caused key_copy to fail +# + +create table t1(bit_field bit(2), int_field int, key a(bit_field)); +insert into t1 values (1,2); +handler t1 open as t1; +handler t1 read a=(1); +handler t1 close; +drop table t1; + --echo End of 5.0 tests diff --git a/mysql-test/t/type_varchar.test b/mysql-test/t/type_varchar.test index 439e98471b2..7b87a388c56 100644 --- a/mysql-test/t/type_varchar.test +++ b/mysql-test/t/type_varchar.test @@ -187,3 +187,13 @@ left join t3 on t1.id=t3.id order by t3.id; --disable_metadata --enable_ps_protocol drop table t1, t2, t3; + +# +# Bug #11927: Warnings shown for CAST( chr as signed) but not (chr + 0) +# +CREATE TABLE t1 (a CHAR(2)); +INSERT INTO t1 VALUES (10), (50), (30), ('1a'), (60), ('t'); +SELECT a,(a + 0) FROM t1 ORDER BY a; +SELECT a,(a DIV 2) FROM t1 ORDER BY a; +SELECT a,CAST(a AS SIGNED) FROM t1 ORDER BY a; +DROP TABLE t1; diff --git a/mysql-test/t/udf.test b/mysql-test/t/udf.test index 01aac24ded4..b0580faea3d 100644 --- a/mysql-test/t/udf.test +++ b/mysql-test/t/udf.test @@ -149,9 +149,9 @@ EXPLAIN EXTENDED SELECT myfunc_int(a AS attr_name) FROM t1; EXPLAIN EXTENDED SELECT myfunc_int(a) FROM t1; SELECT a,c FROM v1; ---error ER_PARSE_ERROR +--error ER_WRONG_PARAMETERS_TO_STORED_FCT SELECT a, fn(MIN(b) xx) as c FROM t1 GROUP BY a; ---error ER_PARSE_ERROR +--error ER_WRONG_PARAMETERS_TO_STORED_FCT SELECT myfunc_int(fn(MIN(b) xx)) as c FROM t1 GROUP BY a; --error ER_PARSE_ERROR SELECT myfunc_int(test.fn(MIN(b) xx)) as c FROM t1 GROUP BY a; @@ -174,6 +174,22 @@ DROP FUNCTION fn; --echo End of 5.0 tests. # +# Bug#24736: UDF functions parsed as Stored Functions +# + +select myfunc_double(3); +select myfunc_double(3 AS three); +select myfunc_double(abs(3)); +select myfunc_double(abs(3) AS named_param); +select abs(myfunc_double(3)); +select abs(myfunc_double(3 AS three)); + +-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT +select myfunc_double(abs(3 AS wrong)); +-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT +select abs(myfunc_double(3) AS wrong); + +# # BUG#18239: Possible to overload internal functions with stored functions # @@ -223,4 +239,41 @@ DROP FUNCTION lookup; DROP FUNCTION reverse_lookup; DROP FUNCTION avgcost; - +# +# Bug#18761: constant expression as UDF parameters not passed in as constant +# +--replace_result $UDF_EXAMPLE_LIB UDF_EXAMPLE_LIB +eval CREATE FUNCTION is_const RETURNS STRING SONAME "$UDF_EXAMPLE_LIB"; + +select + is_const(3) as const, + is_const(3.14) as const, + is_const('fnord') as const, + is_const(2+3) as const, + is_const(rand()) as 'nc rand()', + is_const(sin(3.14)) as const, + is_const(upper('test')) as const; + +create table bug18761 (n int); +insert into bug18761 values (null),(2); +select + is_const(3) as const, + is_const(3.14) as const, + is_const('fnord') as const, + is_const(2+3) as const, + is_const(2+n) as 'nc 2+n ', + is_const(sin(n)) as 'nc sin(n)', + is_const(sin(3.14)) as const, + is_const(upper('test')) as const, + is_const(rand()) as 'nc rand()', + is_const(n) as 'nc n ', + is_const(is_const(n)) as 'nc ic?(n)', + is_const(is_const('c')) as const +from + bug18761; +drop table bug18761; + +--error 1241 +select is_const((1,2,3)); + +drop function if exists is_const; diff --git a/mysql-test/t/varbinary.test b/mysql-test/t/varbinary.test index 5fbd116d7b8..0e45bfb5e1b 100644 --- a/mysql-test/t/varbinary.test +++ b/mysql-test/t/varbinary.test @@ -37,3 +37,46 @@ select x,xx from t1; drop table t1; # End of 4.1 tests + +# +# Bug #19371 VARBINARY() have trailing zeros after upgrade from 4.1 +# + +# Test with a saved table from 4.1 +copy_file std_data/bug19371.frm $MYSQLTEST_VARDIR/master-data/test/t1.frm; +chmod 0777 $MYSQLTEST_VARDIR/master-data/test/t1.frm; +copy_file std_data/bug19371.MYD $MYSQLTEST_VARDIR/master-data/test/t1.MYD; +chmod 0777 $MYSQLTEST_VARDIR/master-data/test/t1.MYD; +copy_file std_data/bug19371.MYI $MYSQLTEST_VARDIR/master-data/test/t1.MYI; +chmod 0777 $MYSQLTEST_VARDIR/master-data/test/t1.MYI; + +# Everything _looks_ fine +show create table t1; + +# But the length of the varbinary columns are too long +select length(a), length(b) from t1; + +# Run CHECK TABLE, it should indicate table need a REPAIR TABLE +CHECK TABLE t1 FOR UPGRADE; + +# Run REPAIR TABLE to alter the table and repair +# the varbinary fields +REPAIR TABLE t1; + +# Now check it's back to normal +show create table t1; +select length(a), length(b) from t1; +insert into t1 values("ccc", "ddd"); +select length(a), length(b) from t1; +select hex(a), hex(b) from t1; +select concat("'", a, "'"), concat("'", b, "'") from t1; + +drop table t1; + +# Check that the fix does not affect table created with current version +create table t1(a varbinary(255)); +insert into t1 values("aaa "); +select length(a) from t1; +alter table t1 modify a varchar(255); +select length(a) from t1; + diff --git a/mysql-test/t/view_grant.test b/mysql-test/t/view_grant.test index 39444a97984..9c06e79e2ca 100644 --- a/mysql-test/t/view_grant.test +++ b/mysql-test/t/view_grant.test @@ -733,13 +733,13 @@ CREATE SQL SECURITY DEFINER VIEW mysqltest1.v_tu AS SELECT * FROM mysqltest1.t1; CREATE SQL SECURITY DEFINER VIEW mysqltest1.v_tus AS SELECT * FROM mysqltest1.t1; CREATE SQL SECURITY DEFINER VIEW mysqltest1.v_td AS SELECT * FROM mysqltest1.t1; CREATE SQL SECURITY DEFINER VIEW mysqltest1.v_tds AS SELECT * FROM mysqltest1.t1; -GRANT SELECT, INSERT, UPDATE, DELETE ON mysqltest1.v_t1 TO readonly; -GRANT SELECT ON mysqltest1.v_ts TO readonly; -GRANT INSERT ON mysqltest1.v_ti TO readonly; -GRANT UPDATE ON mysqltest1.v_tu TO readonly; -GRANT UPDATE,SELECT ON mysqltest1.v_tus TO readonly; -GRANT DELETE ON mysqltest1.v_td TO readonly; -GRANT DELETE,SELECT ON mysqltest1.v_tds TO readonly; +GRANT SELECT, INSERT, UPDATE, DELETE ON mysqltest1.v_t1 TO readonly@localhost; +GRANT SELECT ON mysqltest1.v_ts TO readonly@localhost; +GRANT INSERT ON mysqltest1.v_ti TO readonly@localhost; +GRANT UPDATE ON mysqltest1.v_tu TO readonly@localhost; +GRANT UPDATE,SELECT ON mysqltest1.v_tus TO readonly@localhost; +GRANT DELETE ON mysqltest1.v_td TO readonly@localhost; +GRANT DELETE,SELECT ON mysqltest1.v_tds TO readonly@localhost; CONNECT (n1,localhost,readonly,,); CONNECTION n1; @@ -797,7 +797,7 @@ DROP VIEW mysqltest1.v_ti; DROP VIEW mysqltest1.v_ts; DROP VIEW mysqltest1.v_t1; DROP TABLE mysqltest1.t1; -DROP USER readonly@localhost; +DROP USER readonly@localhost; DROP DATABASE mysqltest1; # @@ -933,4 +933,41 @@ DROP VIEW v2; DROP VIEW v1; DROP USER mysqltest_u1@localhost; +# +# Bug#17254: Error for DEFINER security on VIEW provides too much info +# +connect (root,localhost,root,,); +connection root; +CREATE DATABASE db17254; +USE db17254; +CREATE TABLE t1 (f1 INT); +INSERT INTO t1 VALUES (10),(20); +CREATE USER def_17254@localhost; +GRANT SELECT ON db17254.* TO def_17254@localhost; +CREATE USER inv_17254@localhost; +GRANT SELECT ON db17254.t1 TO inv_17254@localhost; +GRANT CREATE VIEW ON db17254.* TO def_17254@localhost; + +connect (def,localhost,def_17254,,db17254); +connection def; +CREATE VIEW v1 AS SELECT * FROM t1; + +connection root; +DROP USER def_17254@localhost; + +connect (inv,localhost,inv_17254,,db17254); +connection inv; +--echo for a user +--error 1142 +SELECT * FROM v1; + +connection root; +--echo for a superuser +--error 1449 +SELECT * FROM v1; +DROP USER inv_17254@localhost; +DROP DATABASE db17254; +disconnect def; +disconnect inv; + # End of 5.0 tests. diff --git a/mysql-test/valgrind.supp b/mysql-test/valgrind.supp index e88df49a707..17532d2345f 100644 --- a/mysql-test/valgrind.supp +++ b/mysql-test/valgrind.supp @@ -470,15 +470,6 @@ # { - dbug initialization - Memcheck:Leak - fun:malloc - fun:DbugMalloc - fun:ListAdd - fun:_db_set_ -} - -{ dbug initialization by kill_server Memcheck:Leak fun:malloc diff --git a/mysql-test/valgrind.supp.orig b/mysql-test/valgrind.supp.orig deleted file mode 100644 index 1a08abcf953..00000000000 --- a/mysql-test/valgrind.supp.orig +++ /dev/null @@ -1,189 +0,0 @@ -# -# Suppress some common (not fatal) errors in system libraries found by valgrind -# - -# -# Pthread doesn't free all thread specific memory before program exists -# -{ - pthread allocate_tls memory loss - Memcheck:Leak - fun:calloc - fun:_dl_allocate_tls - fun:allocate_stack - fun:pthread_create@@GLIBC_2.1 -} - -{ - pthread allocate_dtv memory loss - Memcheck:Leak - fun:calloc - fun:allocate_dtv - fun:_dl_allocate_tls_storage - fun:__GI__dl_allocate_tls - fun:pthread_create -} - -{ - pthread allocate_dtv memory loss second - Memcheck:Leak - fun:calloc - fun:allocate_dtv - fun:_dl_allocate_tls - fun:pthread_create* -} - -{ - pthread allocate_dtv memory loss second - Memcheck:Leak - fun:calloc - fun:allocate_dtv - fun:_dl_allocate_tls - fun:pthread_create* -} - -{ - pthread memalign memory loss - Memcheck:Leak - fun:memalign - fun:_dl_allocate_tls_storage - fun:__GI__dl_allocate_tls - fun:pthread_create -} - -{ - pthread pthread_key_create - Memcheck:Leak - fun:malloc - fun:* - fun:* - fun:pthread_key_create - fun:my_thread_global_init -} - -{ - pthread strstr uninit - Memcheck:Cond - fun:strstr - obj:/lib/tls/libpthread.so.* - obj:/lib/tls/libpthread.so.* - fun:call_init - fun:_dl_init - obj:/lib/ld-*.so -} - -{ - pthread strstr uninit - Memcheck:Cond - fun:strstr - obj:/lib/tls/libpthread.so.* - obj:/lib/tls/libpthread.so.* - fun:call_init - fun:_dl_init - obj:/lib/ld-*.so -} - -{ - pthread errno - Memcheck:Leak - fun:calloc - fun:_dlerror_run - fun:dlsym - fun:__errno_location -} - - -# -# Warnings in libz becasue it works with aligned memory(?) -# - -{ - libz tr_flush_block - Memcheck:Cond - fun:_tr_flush_block - fun:deflate_slow - fun:deflate - fun:do_flush - fun:gzclose -} - -{ - libz tr_flush_block2 - Memcheck:Cond - fun:_tr_flush_block - fun:deflate_slow - fun:deflate - fun:compress2 -} - -{ - libz longest_match - Memcheck:Cond - fun:longest_match - fun:deflate_slow - fun:deflate - fun:do_flush -} - -{ - libz longest_match2 - Memcheck:Cond - fun:longest_match - fun:deflate_slow - fun:deflate - fun:compress2 -} - -{ - libz deflate - Memcheck:Cond - obj:*/libz.so.* - obj:*/libz.so.* - fun:deflate - fun:compress2 -} - -{ - libz deflate2 - Memcheck:Cond - obj:*/libz.so.* - obj:*/libz.so.* - fun:deflate - obj:*/libz.so.* - fun:gzflush -} - -{ - libz deflate3 - Memcheck:Cond - obj:*/libz.so.* - obj:*/libz.so.* - fun:deflate - fun:do_flush -} - -# -# Warning from my_thread_init becasue mysqld dies before kill thread exists -# - -{ - my_thread_init kill thread memory loss second - Memcheck:Leak - fun:calloc - fun:my_thread_init - fun:kill_server_thread -} - -# -# Warning when printing stack trace (to suppress some not needed warnings) -# - -{ - vprintf on stacktrace - Memcheck:Cond - fun:vfprintf - fun:uffered_vfprintf - fun:vfprintf - fun:fprintf - fun:print_stacktrace -} |