summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorunknown <msvensson@neptunus.(none)>2006-12-04 19:11:55 +0100
committerunknown <msvensson@neptunus.(none)>2006-12-04 19:11:55 +0100
commitdea988a04809c326a147935230f1ae5dfbc72fa2 (patch)
treeac382a3e694ccbe7ed5a481331e35e4f055fdcae /mysql-test
parent23b2d1d2c62b3a3fd94ea17e4728da82b0b2dc0a (diff)
parenta12fff7315effaecf741770665137e05f0a2e623 (diff)
downloadmariadb-git-dea988a04809c326a147935230f1ae5dfbc72fa2.tar.gz
Merge neptunus.(none):/home/msvensson/mysql/mysql-5.1
into neptunus.(none):/home/msvensson/mysql/mysql-5.1-maint BitKeeper/etc/collapsed: auto-union BitKeeper/etc/ignore: auto-union Makefile.am: Auto merged client/mysql.cc: Auto merged client/mysqltest.c: Auto merged configure.in: Auto merged extra/yassl/taocrypt/include/algebra.hpp: Auto merged include/Makefile.am: Auto merged include/my_sys.h: Auto merged mysql-test/lib/mtr_io.pl: Auto merged mysql-test/lib/mtr_process.pl: Auto merged mysql-test/mysql-test-run.pl: Auto merged mysql-test/r/information_schema.result: Auto merged mysql-test/r/parser.result: Auto merged mysql-test/r/ps.result: Auto merged mysql-test/r/view_grant.result: Auto merged mysql-test/t/information_schema.test: Auto merged mysql-test/t/parser.test: Auto merged mysql-test/t/ps.test: Auto merged mysql-test/t/sp.test: Auto merged mysql-test/t/system_mysql_db_fix30020.test: Auto merged mysql-test/t/udf.test: Auto merged mysql-test/t/view_grant.test: Auto merged scripts/mysql_fix_privilege_tables.sql: Auto merged sql/ha_ndbcluster.cc: Auto merged sql/handler.cc: Auto merged sql/item.cc: Auto merged sql/item_create.cc: Auto merged sql/item_func.cc: Auto merged sql/item_func.h: Auto merged sql/item_timefunc.cc: Auto merged sql/mysql_priv.h: Auto merged sql/mysqld.cc: Auto merged sql/sp.cc: Auto merged sql/sql_base.cc: Auto merged sql/sql_handler.cc: Auto merged sql/sql_lex.cc: Auto merged sql/sql_lex.h: Auto merged sql/sql_parse.cc: Auto merged sql/sql_table.cc: Auto merged sql-common/my_time.c: Auto merged sql/sql_yacc.yy: Auto merged storage/myisam/myisampack.c: Auto merged mysql-test/r/sp.result: Manual merge mysql-test/r/udf.result: Manual merge mysql-test/t/events_bugs.test: Manual merge sql/share/errmsg.txt: Manual merge support-files/mysql.spec.sh: Manual merge
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/Makefile.am2
-rw-r--r--mysql-test/extra/rpl_tests/rpl_deadlock.test3
-rw-r--r--mysql-test/extra/rpl_tests/rpl_max_relay_size.test5
-rw-r--r--mysql-test/lib/mtr_cases.pl4
-rw-r--r--mysql-test/lib/mtr_io.pl14
-rw-r--r--mysql-test/lib/mtr_process.pl5
-rw-r--r--mysql-test/lib/mtr_report.pl7
-rwxr-xr-xmysql-test/mysql-test-run.pl489
-rw-r--r--mysql-test/r/alter_table.result132
-rw-r--r--mysql-test/r/bigint.result11
-rw-r--r--mysql-test/r/date_formats.result66
-rw-r--r--mysql-test/r/default.result92
-rw-r--r--mysql-test/r/fix_priv_tables.result36
-rw-r--r--mysql-test/r/fix_priv_tabs.result0
-rw-r--r--mysql-test/r/flush2.result24
-rw-r--r--mysql-test/r/func_misc.result7
-rw-r--r--mysql-test/r/func_time.result8
-rw-r--r--mysql-test/r/gis.result3
-rw-r--r--mysql-test/r/grant2.result6
-rw-r--r--mysql-test/r/have_mysql_upgrade.result2
-rw-r--r--mysql-test/r/information_schema.result2
-rw-r--r--mysql-test/r/init_connect.result2
-rw-r--r--mysql-test/r/innodb_notembedded.result2
-rw-r--r--mysql-test/r/key_cache.result4
-rw-r--r--mysql-test/r/limit.result1
-rw-r--r--mysql-test/r/lowercase_fs_off.result1
-rw-r--r--mysql-test/r/mysql.result6
-rw-r--r--mysql-test/r/mysql_upgrade.result173
-rw-r--r--mysql-test/r/mysqladmin.result4
-rw-r--r--mysql-test/r/mysqldump.result6
-rw-r--r--mysql-test/r/mysqltest.result6
-rw-r--r--mysql-test/r/parser.result101
-rw-r--r--mysql-test/r/ps.result4
-rw-r--r--mysql-test/r/query_cache.result2
-rw-r--r--mysql-test/r/query_cache_notembedded.result2
-rw-r--r--mysql-test/r/read_only.result5
-rw-r--r--mysql-test/r/rpl_000015.result2
-rw-r--r--mysql-test/r/rpl_deadlock_innodb.result2
-rw-r--r--mysql-test/r/rpl_drop_db.result3
-rw-r--r--mysql-test/r/rpl_ignore_revoke.result1
-rw-r--r--mysql-test/r/rpl_init_slave.result5
-rw-r--r--mysql-test/r/rpl_row_max_relay_size.result2
-rw-r--r--mysql-test/r/rpl_sf.result23
-rw-r--r--mysql-test/r/rpl_sp.result38
-rw-r--r--mysql-test/r/rpl_sp_effects.result2
-rw-r--r--mysql-test/r/rpl_stm_max_relay_size.result2
-rw-r--r--mysql-test/r/rpl_timezone.result2
-rw-r--r--mysql-test/r/rpl_variables.result1
-rw-r--r--mysql-test/r/sp.result87
-rw-r--r--mysql-test/r/timezone2.result2
-rw-r--r--mysql-test/r/type_float.result2
-rw-r--r--mysql-test/r/udf.result61
-rw-r--r--mysql-test/r/varbinary.result52
-rw-r--r--mysql-test/r/view_grant.result14
-rw-r--r--mysql-test/std_data/bug19371.MYDbin0 -> 40 bytes
-rw-r--r--mysql-test/std_data/bug19371.MYIbin0 -> 1024 bytes
-rw-r--r--mysql-test/std_data/bug19371.frmbin0 -> 8578 bytes
-rw-r--r--mysql-test/t/alter_table.test115
-rw-r--r--mysql-test/t/bigint.test9
-rw-r--r--mysql-test/t/date_formats.test8
-rw-r--r--mysql-test/t/default.test58
-rw-r--r--mysql-test/t/disabled.def1
-rw-r--r--mysql-test/t/events_bugs.test2
-rw-r--r--mysql-test/t/fix_priv_tables.test66
-rw-r--r--mysql-test/t/flush2-master.opt1
-rw-r--r--mysql-test/t/flush2.test9
-rw-r--r--mysql-test/t/func_misc.test7
-rw-r--r--mysql-test/t/func_time.test16
-rw-r--r--mysql-test/t/gis.test2
-rw-r--r--mysql-test/t/grant2.test9
-rw-r--r--mysql-test/t/information_schema.test2
-rw-r--r--mysql-test/t/init_connect.test4
-rw-r--r--mysql-test/t/innodb_notembedded.test2
-rw-r--r--mysql-test/t/key_cache.test7
-rw-r--r--mysql-test/t/limit.test2
-rw-r--r--mysql-test/t/lowercase_fs_off.test1
-rw-r--r--mysql-test/t/mysql.test19
-rw-r--r--mysql-test/t/mysql_client_test-master.opt2
-rw-r--r--mysql-test/t/mysql_delimiter.sql10
-rwxr-xr-xmysql-test/t/mysql_delimiter_19799.sql1
-rw-r--r--mysql-test/t/mysql_upgrade.test20
-rw-r--r--mysql-test/t/mysqladmin.test32
-rw-r--r--mysql-test/t/mysqldump.test6
-rw-r--r--mysql-test/t/mysqltest.test40
-rw-r--r--mysql-test/t/parser.test110
-rw-r--r--mysql-test/t/ps.test4
-rw-r--r--mysql-test/t/query_cache.test2
-rw-r--r--mysql-test/t/query_cache_notembedded.test3
-rw-r--r--mysql-test/t/read_only.test12
-rw-r--r--mysql-test/t/rpl_000015.test2
-rw-r--r--mysql-test/t/rpl_drop_db.test11
-rw-r--r--mysql-test/t/rpl_ignore_revoke.test4
-rw-r--r--mysql-test/t/rpl_init_slave.test6
-rw-r--r--mysql-test/t/rpl_sf.test68
-rw-r--r--mysql-test/t/rpl_sp.test32
-rw-r--r--mysql-test/t/rpl_sp_effects.test4
-rw-r--r--mysql-test/t/rpl_timezone.test7
-rw-r--r--mysql-test/t/rpl_variables.test3
-rw-r--r--mysql-test/t/sp.test79
-rw-r--r--mysql-test/t/system_mysql_db_fix30020-master.opt (renamed from mysql-test/t/system_mysql_db_fix-master.opt)0
-rw-r--r--mysql-test/t/system_mysql_db_fix30020.test (renamed from mysql-test/t/system_mysql_db_fix.test)6
-rw-r--r--mysql-test/t/system_mysql_db_fix40123-master.opt1
-rw-r--r--mysql-test/t/system_mysql_db_fix40123.test79
-rw-r--r--mysql-test/t/system_mysql_db_fix50030-master.opt1
-rw-r--r--mysql-test/t/system_mysql_db_fix50030.test82
-rw-r--r--mysql-test/t/timezone2.test4
-rw-r--r--mysql-test/t/udf.test59
-rw-r--r--mysql-test/t/varbinary.test43
-rw-r--r--mysql-test/t/view_grant.test16
109 files changed, 2350 insertions, 277 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/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_process.pl b/mysql-test/lib/mtr_process.pl
index 8a8b8d0858a..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;
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 2ad24786358..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";
@@ -1260,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 = (
@@ -1290,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 )
@@ -1362,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;
@@ -1465,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 )
@@ -1476,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())
{
@@ -1506,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
@@ -1591,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 () {
@@ -1603,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/",
@@ -1635,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);
}
@@ -1661,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;
@@ -1674,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};
@@ -1852,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 )
@@ -1864,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
@@ -1890,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";
@@ -1964,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 )
{
#
@@ -1995,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/");
}
}
@@ -2029,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");
@@ -2051,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");
}
@@ -2568,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();
@@ -2597,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 () {
@@ -2985,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";
}
@@ -3018,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)= @_;
@@ -3127,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);
@@ -3135,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";
@@ -3145,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)
{
@@ -3301,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 )
{
@@ -3318,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();
@@ -3490,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' )
@@ -3507,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'});
@@ -3569,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 )
@@ -3645,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;
@@ -3894,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;
}
@@ -4018,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
@@ -4142,8 +4279,6 @@ sub run_testcase_start_servers($) {
return 1;
}
}
- mtr_tofile($master->[1]->{'path_myerr'},"CURRENT_TEST: $tname\n");
-
mysqld_start($master->[1],$tinfo->{'master_opt'},[]);
}
@@ -4171,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);
@@ -4388,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");
@@ -4513,6 +4641,7 @@ sub run_mysqltest ($) {
}
return $res;
+
}
@@ -4762,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]
@@ -4782,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
@@ -4806,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
@@ -4858,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/alter_table.result b/mysql-test/r/alter_table.result
index d3657d84678..89b7f31d00b 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;
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/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_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/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/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 e8f7eed54f4..ac51bfe2a36 100644
--- a/mysql-test/r/information_schema.result
+++ b/mysql-test/r/information_schema.result
@@ -1077,7 +1077,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/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/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 14267afc27e..3bba1944c52 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..434b7b2d23f
--- /dev/null
+++ b/mysql-test/r/mysql_upgrade.result
@@ -0,0 +1,173 @@
+Run mysql_upgrade once
+mysql.binlog_index OK
+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.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.binlog_index OK
+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.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/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/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 a44125d4bed..4988b1139e9 100644
--- a/mysql-test/r/ps.result
+++ b/mysql-test/r/ps.result
@@ -1527,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_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_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/sp.result b/mysql-test/r/sp.result
index 60363b06ea0..7ec930cc087 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/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_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/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 80851d8dd3c..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);
diff --git a/mysql-test/std_data/bug19371.MYD b/mysql-test/std_data/bug19371.MYD
new file mode 100644
index 00000000000..1b58a70832f
--- /dev/null
+++ b/mysql-test/std_data/bug19371.MYD
Binary files differ
diff --git a/mysql-test/std_data/bug19371.MYI b/mysql-test/std_data/bug19371.MYI
new file mode 100644
index 00000000000..06ee5b2d766
--- /dev/null
+++ b/mysql-test/std_data/bug19371.MYI
Binary files differ
diff --git a/mysql-test/std_data/bug19371.frm b/mysql-test/std_data/bug19371.frm
new file mode 100644
index 00000000000..7be45d6f8da
--- /dev/null
+++ b/mysql-test/std_data/bug19371.frm
Binary files differ
diff --git a/mysql-test/t/alter_table.test b/mysql-test/t/alter_table.test
index 78bbd23adf1..406854ebaed 100644
--- a/mysql-test/t/alter_table.test
+++ b/mysql-test/t/alter_table.test
@@ -372,6 +372,103 @@ 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
#
@@ -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
#
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..b541b6d8d33 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.
diff --git a/mysql-test/t/events_bugs.test b/mysql-test/t/events_bugs.test
index 81988818809..605eaa431d0 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 2.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/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/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/information_schema.test b/mysql-test/t/information_schema.test
index 6cf26acd40d..6d98e4c4aa9 100644
--- a/mysql-test/t/information_schema.test
+++ b/mysql-test/t/information_schema.test
@@ -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..7c016fd7416
--- /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/mysqladmin/
+--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/Warning: mysqladmin/
+--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/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 0e96a7aad10..15b0a476279 100644
--- a/mysql-test/t/ps.test
+++ b/mysql-test/t/ps.test
@@ -1587,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_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 cccf1d5767b..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
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..2d4fd1e920f
--- /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, 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..78ecf1e573c
--- /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, 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/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 5c920a2fc4c..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;
#