List:Commits« Previous MessageNext Message »
From:Magnus Svensson Date:February 27 2009 1:44pm
Subject:bzr commit into mysql-6.0 branch (msvensson:3066)
View as plain text  
#At file:///home/msvensson/mysql/6.0/ based on revid:alik@strippedb

 3066 Magnus Svensson	2009-02-27 [merge]
      Merge
      removed:
        mysql-test/suite/sys_vars/t/completion_type_func-master.opt
      added:
        mysql-test/include/wait_show_condition.inc
        mysql-test/r/innodb_bug42419.result
        mysql-test/suite/rpl/r/rpl_slave_load_in.result
        mysql-test/suite/rpl/r/rpl_temp_table_mix_row.result
        mysql-test/suite/rpl/t/rpl_slave_load_in.test
        mysql-test/suite/rpl/t/rpl_temp_table_mix_row.test
        mysql-test/t/innodb_bug42419.test
      modified:
        CMakeLists.txt
        client/mysql.cc
        client/mysqldump.c
        configure.in
        include/my_getopt.h
        include/my_global.h
        libmysqld/lib_sql.cc
        mysql-test/include/handler.inc
        mysql-test/include/ndb_backup.inc
        mysql-test/r/ddl_i18n_koi8r.result
        mysql-test/r/ddl_i18n_utf8.result
        mysql-test/r/debug_sync.result
        mysql-test/r/grant.result
        mysql-test/r/group_by.result
        mysql-test/r/handler_innodb.result
        mysql-test/r/handler_myisam.result
        mysql-test/r/information_schema_db.result
        mysql-test/r/locktrans_innodb.result
        mysql-test/r/locktrans_myisam.result
        mysql-test/r/mysql.result
        mysql-test/r/mysqlbinlog.result
        mysql-test/r/mysqldump-max.result
        mysql-test/r/mysqldump.result
        mysql-test/r/mysqltest.result
        mysql-test/r/openssl_1.result
        mysql-test/r/ps.result
        mysql-test/r/query_cache_debug.result
        mysql-test/r/row.result
        mysql-test/r/trigger-compat.result
        mysql-test/r/variables.result
        mysql-test/r/view_grant.result
        mysql-test/suite/backup/r/backup_backupdir.result
        mysql-test/suite/backup/r/backup_db_grants.result
        mysql-test/suite/falcon/r/falcon_bug_33148.result
        mysql-test/suite/ndb_team/t/ndb_autodiscover.test
        mysql-test/suite/parts/r/partition_auto_increment_ndb.result
        mysql-test/suite/rpl/r/rpl_heartbeat.result
        mysql-test/suite/rpl/r/rpl_locktrans_falcon.result
        mysql-test/suite/rpl/r/rpl_locktrans_innodb.result
        mysql-test/suite/rpl/r/rpl_locktrans_myisam.result
        mysql-test/suite/rpl/r/rpl_row_until.result
        mysql-test/suite/rpl/t/disabled.def
        mysql-test/suite/rpl/t/rpl_heartbeat.test
        mysql-test/suite/rpl/t/rpl_row_until.test
        mysql-test/suite/sys_vars/r/completion_type_func.result
        mysql-test/suite/sys_vars/t/completion_type_func.test
        mysql-test/t/disabled.def
        mysql-test/t/func_group.test
        mysql-test/t/group_by.test
        mysql-test/t/innodb_mysql.test
        mysql-test/t/mysql.test
        mysql-test/t/mysqlbinlog.test
        mysql-test/t/mysqldump.test
        mysql-test/t/mysqltest.test
        mysql-test/t/partition.test
        mysql-test/t/ps.test
        mysql-test/t/query_cache_28249.test
        mysql-test/t/query_cache_debug.test
        mysql-test/t/row.test
        mysql-test/t/trigger-compat.test
        mysql-test/t/variables.test
        mysql-test/t/view_grant.test
        mysys/default.c
        mysys/my_getopt.c
        scripts/mysqldumpslow.sh
        sql/item.cc
        sql/item.h
        sql/item_cmpfunc.cc
        sql/log_event.cc
        sql/log_event.h
        sql/mysql_priv.h
        sql/mysqld.cc
        sql/protocol.cc
        sql/rpl_rli.cc
        sql/rpl_rli.h
        sql/share/errmsg.txt
        sql/sql_base.cc
        sql/sql_cache.cc
        sql/sql_handler.cc
        sql/sql_insert.cc
        sql/sql_load.cc
        sql/sql_select.cc
        sql/sql_show.cc
        storage/innobase/handler/ha_innodb.cc
        storage/myisam/ha_myisam.cc
        storage/myisam/mi_locking.c
        storage/myisam/myisamchk.c
        storage/myisam/myisamdef.h
        tests/mysql_client_test.c

=== modified file 'CMakeLists.txt'
--- a/CMakeLists.txt	2009-02-13 16:30:54 +0000
+++ b/CMakeLists.txt	2009-02-25 16:13:48 +0000
@@ -186,7 +186,13 @@ IF(MSVC)
     STRING(REPLACE "/EHsc" "" CMAKE_CXX_FLAGS            ${CMAKE_CXX_FLAGS})
     STRING(REPLACE "/EHsc" "" CMAKE_CXX_FLAGS_INIT       ${CMAKE_CXX_FLAGS_INIT})
     STRING(REPLACE "/EHsc" "" CMAKE_CXX_FLAGS_DEBUG_INIT ${CMAKE_CXX_FLAGS_DEBUG_INIT})
-
+    
+    # Mark 32 bit executables large address aware so they can 
+    # use > 2GB address space
+    IF(CMAKE_SIZEOF_VOID_P MATCHES 4)
+      SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /LARGEADDRESSAWARE")
+    ENDIF(CMAKE_SIZEOF_VOID_P MATCHES 4)
+    
     # Disable automatic manifest generation.
     STRING(REPLACE "/MANIFEST" "/MANIFEST:NO" CMAKE_EXE_LINKER_FLAGS 
     	   ${CMAKE_EXE_LINKER_FLAGS})

=== modified file 'client/mysql.cc'
--- a/client/mysql.cc	2009-02-18 12:46:27 +0000
+++ b/client/mysql.cc	2009-02-25 10:06:18 +0000
@@ -2282,8 +2282,22 @@ static bool add_line(String &buffer,char
   }
   if (out != line || !buffer.is_empty())
   {
-    *out++='\n';
     uint length=(uint) (out-line);
+
+    if (length < 9 || 
+        my_strnncoll (charset_info, 
+                      (uchar *)line, 9, (const uchar *) "delimiter", 9))
+    {
+      /* 
+        Don't add a new line in case there's a DELIMITER command to be 
+        added to the glob buffer (e.g. on processing a line like 
+        "<command>;DELIMITER <non-eof>") : similar to how a new line is 
+        not added in the case when the DELIMITER is the first command 
+        entered with an empty glob buffer. 
+      */
+      *out++='\n';
+      length++;
+    }
     if (buffer.length() + length >= buffer.alloced_length())
       buffer.realloc(buffer.length()+length+IO_SIZE);
     if ((!*ml_comment || preserve_comments) && buffer.append(line, length))
@@ -2892,7 +2906,7 @@ com_charset(String *buffer __attribute__
   param= get_arg(buff, 0);
   if (!param || !*param)
   {
-    return put_info("Usage: \\C char_setname | charset charset_name", 
+    return put_info("Usage: \\C charset_name | charset charset_name", 
 		    INFO_ERROR, 0);
   }
   new_cs= get_charset_by_csname(param, MY_CS_PRIMARY, MYF(MY_WME));

=== modified file 'client/mysqldump.c'
--- a/client/mysqldump.c	2009-02-16 21:18:45 +0000
+++ b/client/mysqldump.c	2009-02-19 17:36:09 +0000
@@ -1522,7 +1522,8 @@ static int connect_to_db(char *host, cha
     DB_error(&mysql_connection, "when trying to connect");
     DBUG_RETURN(1);
   }
-  if (mysql_get_server_version(&mysql_connection) < 40100)
+  if ((mysql_get_server_version(&mysql_connection) < 40100) ||
+      (opt_compatible_mode & 3))
   {
     /* Don't dump SET NAMES with a pre-4.1 server (bug#7997).  */
     opt_set_charset= 0;
@@ -2471,11 +2472,11 @@ static uint get_table_structure(char *ta
 
       row= mysql_fetch_row(result);
 
-      fprintf(sql_file,
-              "SET @saved_cs_client     = @@character_set_client;\n"
-              "SET character_set_client = utf8;\n"
+      fprintf(sql_file, (opt_compatible_mode & 3) ? "%s;\n" :
+              "/*!40101 SET @saved_cs_client     = @@character_set_client */;\n"
+              "/*!40101 SET character_set_client = utf8 */;\n"
               "%s;\n"
-              "SET character_set_client = @saved_cs_client;\n",
+              "/*!40101 SET character_set_client = @saved_cs_client */;\n",
               row[1]);
 
       check_io(sql_file);

=== modified file 'configure.in'
--- a/configure.in	2009-02-19 16:55:17 +0000
+++ b/configure.in	2009-02-27 13:44:16 +0000
@@ -859,12 +859,9 @@ AC_CHECK_LIB(nsl_r, gethostbyname_r, [],
 AC_CHECK_FUNC(gethostbyname_r)
 AC_CHECK_LIB(mtmalloc, malloc)
 
-AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
-AC_CHECK_FUNC(yp_get_default_domain, ,
-  AC_CHECK_LIB(nsl, yp_get_default_domain))
-AC_CHECK_FUNC(p2open, , AC_CHECK_LIB(gen, p2open))
+AC_SEARCH_LIBS(setsockopt, socket)
 # This may get things to compile even if bind-8 is installed
-AC_CHECK_FUNC(bind, , AC_CHECK_LIB(bind, bind))
+AC_SEARCH_LIBS(bind, bind)
 # Check if crypt() exists in libc or libcrypt, sets LIBS if needed
 AC_SEARCH_LIBS(crypt, crypt, AC_DEFINE(HAVE_CRYPT, 1, [crypt]))
 # See if we need a library for address lookup.
@@ -874,8 +871,8 @@ AC_SEARCH_LIBS(inet_aton, [socket nsl re
 AC_CHECK_LIB(rt, aio_read)
 
 # For the sched_yield() function on Solaris
-AC_CHECK_FUNC(sched_yield, , AC_CHECK_LIB(posix4, sched_yield,
-[AC_DEFINE(HAVE_SCHED_YIELD) LIBS="$LIBS -lposix4"]))
+AC_SEARCH_LIBS(sched_yield, posix4, 
+  AC_DEFINE(HAVE_SCHED_YIELD, 1, [sched_yield]))
 
 MYSQL_CHECK_ZLIB_WITH_COMPRESS
 
@@ -988,7 +985,7 @@ AC_MSG_RESULT([$USE_PSTACK])
 # Check for gtty if termio.h doesn't exists
 if test "$ac_cv_header_termio_h" = "no" -a "$ac_cv_header_termios_h" = "no"
 then
-  AC_CHECK_FUNC(gtty, , AC_CHECK_LIB(compat, gtty))
+  AC_SEARCH_LIBS(gtty, compat)
 fi
 
 # We make a special variable for non-threaded version of LIBS to avoid

=== modified file 'include/my_getopt.h'
--- a/include/my_getopt.h	2008-02-18 22:29:39 +0000
+++ b/include/my_getopt.h	2008-10-27 09:57:59 +0000
@@ -72,7 +72,7 @@ extern void my_cleanup_options(const str
 extern void my_print_help(const struct my_option *options);
 extern void my_print_variables(const struct my_option *options);
 extern void my_getopt_register_get_addr(uchar ** (*func_addr)(const char *, uint,
-							   const struct my_option *));
+                                        const struct my_option *, int *));
 
 ulonglong getopt_ull_limit_value(ulonglong num, const struct my_option *optp,
                                  my_bool *fix);

=== modified file 'include/my_global.h'
--- a/include/my_global.h	2009-02-16 21:18:45 +0000
+++ b/include/my_global.h	2009-02-25 08:55:54 +0000
@@ -432,6 +432,9 @@ C_MODE_END
 #ifdef HAVE_FLOAT_H
 #include <float.h>
 #endif
+#ifdef HAVE_FENV_H
+#include <fenv.h> /* For fesetround() */
+#endif
 
 #ifdef HAVE_SYS_TYPES_H
 #include <sys/types.h>

=== modified file 'libmysqld/lib_sql.cc'
--- a/libmysqld/lib_sql.cc	2009-01-13 15:26:20 +0000
+++ b/libmysqld/lib_sql.cc	2009-02-24 11:56:59 +0000
@@ -43,6 +43,15 @@ extern char mysql_server_last_error[MYSQ
 static my_bool emb_read_query_result(MYSQL *mysql);
 
 
+extern "C" void unireg_clear(int exit_code)
+{
+  DBUG_ENTER("unireg_clear");
+  clean_up(!opt_help && (exit_code || !opt_bootstrap)); /* purecov: inspected */
+  my_end(opt_endinfo ? MY_CHECK_ERROR | MY_GIVE_INFO : 0);
+  DBUG_VOID_RETURN;
+}
+
+
 /*
   Reads error information from the MYSQL_DATA and puts
   it into proper MYSQL members

=== modified file 'mysql-test/include/handler.inc'
--- a/mysql-test/include/handler.inc	2008-05-23 13:54:03 +0000
+++ b/mysql-test/include/handler.inc	2009-02-26 17:02:36 +0000
@@ -479,6 +479,7 @@ handler t1 open;
 --echo --> client 1
 connection default;
 drop table t1;
+disconnect con2;
 
 #
 # Bug#30632 HANDLER read failure causes hang
@@ -697,3 +698,36 @@ unlock tables;
 drop table t1;
 --error ER_UNKNOWN_TABLE
 handler t1 read a next;
+
+#
+# Bug#41110: crash with handler command when used concurrently with alter table
+# Bug#41112: crash in mysql_ha_close_table/get_lock_data with alter table
+#
+
+connect(con1,localhost,root,,);
+connect(con2,localhost,root,,);
+
+connection default;
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+create table t1 (a int);
+insert into t1 values (1);
+handler t1 open;
+connection con1;
+send alter table t1 engine=memory;
+connection con2;
+let $wait_condition=
+  select count(*) = 1 from information_schema.processlist
+  where state = "Waiting for table" and info = "alter table t1 engine=memory";
+--source include/wait_condition.inc
+connection default;
+--error ER_ILLEGAL_HA
+handler t1 read a next;
+handler t1 close;
+connection con1;
+--reap
+drop table t1;
+disconnect con1;
+disconnect con2;
+connection default;

=== modified file 'mysql-test/include/ndb_backup.inc'
--- a/mysql-test/include/ndb_backup.inc	2007-12-12 17:19:24 +0000
+++ b/mysql-test/include/ndb_backup.inc	2009-02-19 23:24:25 +0000
@@ -2,6 +2,13 @@
 # By JBM 2006-02-16 So that the code is not repeated #
 # in test cases and can be reused.                   #
 ######################################################
+
+# Bug#41307: Tests using include/ndb_backup.inc won't work on Windows due to
+#            'grep' call
+# This test is disabled on Windows via the next line until the above bug is
+# resolved
+--source include/not_windows.inc
+
 --exec $NDB_MGM --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING" -e "start backup" >> $NDB_TOOLS_OUTPUT
 
 # there is no neat way to find the backupid, this is a hack to find it...

=== added file 'mysql-test/include/wait_show_condition.inc'
--- a/mysql-test/include/wait_show_condition.inc	1970-01-01 00:00:00 +0000
+++ b/mysql-test/include/wait_show_condition.inc	2009-02-20 09:12:06 +0000
@@ -0,0 +1,78 @@
+# include/wait_show_condition.inc
+#
+# SUMMARY
+#
+#    Waits until the show statement ($show_statement) has at least within one of
+#    the rows of the result set for the field ($field) a value which fulfils
+#    a condition ($condition), or the operation times out.
+#    
+#
+# USAGE
+#
+#    let $show_statement= SHOW PROCESSLIST;
+#    let $field= State;
+#    let $condition= = 'Updating';
+#    --source include/wait_show_condition.inc
+#
+#   OR
+#
+#    let $wait_timeout= 60; # Override default of 30 seconds with 60.
+#    let $show_statement= SHOW PROCESSLIST;
+#    let $field= State;
+#    let $condition= = 'Updating';
+#    --source include/wait_show_condition.inc
+#
+# Please do not use this use routine if you can replace the SHOW statement
+# with a select. In such a case include/wait_condition.inc is recommended.
+#
+# Created: 2009-02-18 mleich
+#
+
+let $max_run_time= 30;
+if ($wait_timeout)
+{
+  let $max_run_time= $wait_timeout;
+}
+# Reset $wait_timeout so that its value won't be used on subsequent
+# calls, and default will be used instead.
+let $wait_timeout= 0;
+
+# The smallest timespan till UNIX_TIMESTAMP() gets incremented is ~0 seconds.
+# We add one second to avoid the case that somebody measures timespans on a
+# real clock with fractions of seconds, detects that n seconds are sufficient,
+# assigns n to this routine and suffers because he sometimes gets n - 1
+# seconds in reality.
+inc $max_run_time;
+
+let $found= 0;
+let $max_end_time= `SELECT UNIX_TIMESTAMP() + $max_run_time`;
+while (`SELECT UNIX_TIMESTAMP() <= $max_end_time AND $found = 0`)
+{
+   # Sleep a bit to avoid too heavy load.
+   real_sleep 0.2;
+   let $rowno= 1;
+   let $process_result= 1;
+   while (`SELECT $process_result = 1 AND $found = 0`)
+   {
+      let $field_value= query_get_value($show_statement, $field, $rowno);
+      if (`SELECT '$field_value' $condition`)
+      {
+         let $found= 1;
+      }
+      if (`SELECT '$field_value' = 'No such row'`)
+      {
+         # We are behind the last row of the result set.
+         let $process_result= 0;
+      }
+      inc $rowno;
+   }
+}
+if (!$found)
+{
+  echo # Timeout in include/wait_show_condition.inc for $wait_condition;
+  echo #         show_statement : $show_statement;
+  echo #         field          : $field;
+  echo #         condition      : $condition;
+  echo #         max_run_time   : $max_run_time;
+}
+

=== modified file 'mysql-test/r/ddl_i18n_koi8r.result'
--- a/mysql-test/r/ddl_i18n_koi8r.result	2009-02-16 14:47:53 +0000
+++ b/mysql-test/r/ddl_i18n_koi8r.result	2009-02-19 17:36:09 +0000
@@ -1729,18 +1729,18 @@ DELETE FROM mysqltest2.log|
 CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest1` /*!40100 DEFAULT CHARACTER SET cp866 */;
 
 USE `mysqltest1`;
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE `log` (
   `msg` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-SET character_set_client = @saved_cs_client;
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE `t1` (
   `c` int(11) DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 INSERT INTO `t1` VALUES (1),(0),(1);
 ALTER DATABASE mysqltest1 CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
 /*!50003 SET @saved_cs_client      = @@character_set_client */ ;
@@ -1808,18 +1808,18 @@ ALTER DATABASE mysqltest1 CHARACTER SET 
 CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest2` /*!40100 DEFAULT CHARACTER SET cp866 */;
 
 USE `mysqltest2`;
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE `log` (
   `msg` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-SET character_set_client = @saved_cs_client;
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE `t1` (
   `c` int(11) DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 INSERT INTO `t1` VALUES (1),(0),(1);
 ALTER DATABASE mysqltest2 CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
 /*!50003 SET @saved_cs_client      = @@character_set_client */ ;

=== modified file 'mysql-test/r/ddl_i18n_utf8.result'
--- a/mysql-test/r/ddl_i18n_utf8.result	2009-02-16 14:47:53 +0000
+++ b/mysql-test/r/ddl_i18n_utf8.result	2009-02-19 17:36:09 +0000
@@ -1729,18 +1729,18 @@ DELETE FROM mysqltest2.log|
 CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest1` /*!40100 DEFAULT CHARACTER SET cp866 */;
 
 USE `mysqltest1`;
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE `log` (
   `msg` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-SET character_set_client = @saved_cs_client;
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE `t1` (
   `c` int(11) DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 INSERT INTO `t1` VALUES (1),(0),(1);
 ALTER DATABASE mysqltest1 CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
 /*!50003 SET @saved_cs_client      = @@character_set_client */ ;
@@ -1808,18 +1808,18 @@ ALTER DATABASE mysqltest1 CHARACTER SET 
 CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest2` /*!40100 DEFAULT CHARACTER SET cp866 */;
 
 USE `mysqltest2`;
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE `log` (
   `msg` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-SET character_set_client = @saved_cs_client;
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE `t1` (
   `c` int(11) DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 INSERT INTO `t1` VALUES (1),(0),(1);
 ALTER DATABASE mysqltest2 CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
 /*!50003 SET @saved_cs_client      = @@character_set_client */ ;

=== modified file 'mysql-test/r/debug_sync.result'
--- a/mysql-test/r/debug_sync.result	2008-12-24 10:48:24 +0000
+++ b/mysql-test/r/debug_sync.result	2009-02-27 09:09:00 +0000
@@ -137,7 +137,7 @@ Variable_name	Value
 debug_sync	ON - current signal: 'something'
 SET DEBUG_SYNC= 'now WAIT_FOR nothing TIMEOUT 0';
 Warnings:
-Warning	1728	debug sync point wait timed out
+Warning	1732	debug sync point wait timed out
 SET DEBUG_SYNC= 'now SIGNAL nothing';
 SHOW VARIABLES LIKE 'DEBUG_SYNC';
 Variable_name	Value

=== modified file 'mysql-test/r/grant.result'
--- a/mysql-test/r/grant.result	2009-02-16 14:47:53 +0000
+++ b/mysql-test/r/grant.result	2009-02-25 12:42:06 +0000
@@ -459,7 +459,7 @@ Privilege	Context	Comment
 Alter	Tables	To alter the table
 Alter routine	Functions,Procedures	To alter or drop stored functions/procedures
 Create	Databases,Tables,Indexes	To create new databases and tables
-Create routine	Functions,Procedures	To use CREATE FUNCTION/PROCEDURE
+Create routine	Databases	To use CREATE FUNCTION/PROCEDURE
 Create temporary tables	Databases	To use CREATE TEMPORARY TABLE
 Create view	Tables	To create new views
 Create user	Server Admin	To create new users

=== modified file 'mysql-test/r/group_by.result'
--- a/mysql-test/r/group_by.result	2009-01-08 19:06:44 +0000
+++ b/mysql-test/r/group_by.result	2009-02-26 17:31:59 +0000
@@ -1721,3 +1721,15 @@ id	select_type	table	type	possible_keys	
 SELECT COUNT(varchar_key) AS X FROM t1 WHERE pk = 8 having 'foo'='bar';
 X
 drop table t1;
+SET @old_sql_mode = @@sql_mode;
+SET @@sql_mode='ONLY_FULL_GROUP_BY';
+CREATE TABLE t1(i INT);
+INSERT INTO t1 VALUES (1), (10);
+SELECT COUNT(i) FROM t1;
+COUNT(i)
+2
+SELECT COUNT(i) FROM t1 WHERE i > 1;
+COUNT(i)
+1
+DROP TABLE t1;
+SET @@sql_mode = @old_sql_mode;

=== modified file 'mysql-test/r/handler_innodb.result'
--- a/mysql-test/r/handler_innodb.result	2008-08-11 19:37:53 +0000
+++ b/mysql-test/r/handler_innodb.result	2009-02-24 10:22:54 +0000
@@ -732,3 +732,12 @@ unlock tables;
 drop table t1;
 handler t1 read a next;
 ERROR 42S02: Unknown table 't1' in HANDLER
+drop table if exists t1;
+create table t1 (a int);
+insert into t1 values (1);
+handler t1 open;
+alter table t1 engine=memory;
+handler t1 read a next;
+ERROR HY000: Table storage engine for 't1' doesn't have this option
+handler t1 close;
+drop table t1;

=== modified file 'mysql-test/r/handler_myisam.result'
--- a/mysql-test/r/handler_myisam.result	2008-05-23 13:54:03 +0000
+++ b/mysql-test/r/handler_myisam.result	2009-02-24 10:22:54 +0000
@@ -730,3 +730,12 @@ unlock tables;
 drop table t1;
 handler t1 read a next;
 ERROR 42S02: Unknown table 't1' in HANDLER
+drop table if exists t1;
+create table t1 (a int);
+insert into t1 values (1);
+handler t1 open;
+alter table t1 engine=memory;
+handler t1 read a next;
+ERROR HY000: Table storage engine for 't1' doesn't have this option
+handler t1 close;
+drop table t1;

=== modified file 'mysql-test/r/information_schema_db.result'
--- a/mysql-test/r/information_schema_db.result	2008-12-13 11:02:16 +0000
+++ b/mysql-test/r/information_schema_db.result	2009-02-25 12:42:06 +0000
@@ -205,7 +205,7 @@ Field	Type	Null	Key	Default	Extra
 f1	char(4)	YES		NULL	
 show create view v2;
 View	Create View	character_set_client	collation_connection
-v2	CREATE ALGORITHM=UNDEFINED DEFINER=`testdb_2`@`localhost` SQL SECURITY DEFINER VIEW `test`.`v2` AS select `v1`.`f1` AS `f1` from `testdb_1`.`v1`	latin1	latin1_swedish_ci
+v2	CREATE ALGORITHM=UNDEFINED DEFINER=`testdb_2`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select `v1`.`f1` AS `f1` from `testdb_1`.`v1`	latin1	latin1_swedish_ci
 show create view testdb_1.v1;
 ERROR 42000: SELECT command denied to user 'testdb_2'@'localhost' for table 'v1'
 select table_name from information_schema.columns a 

=== added file 'mysql-test/r/innodb_bug42419.result'
--- a/mysql-test/r/innodb_bug42419.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/innodb_bug42419.result	2009-02-20 09:12:06 +0000
@@ -0,0 +1,17 @@
+CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY, b INT) ENGINE = InnoDB;
+INSERT INTO t1 VALUES (1,1),(2,2),(3,3);
+COMMIT;
+SET AUTOCOMMIT = 0;
+CREATE TEMPORARY TABLE t1_tmp ( b INT );
+INSERT INTO t1_tmp (b) SELECT b FROM t1 WHERE a = 3;
+INSERT INTO t1_tmp (b) SELECT b FROM t1 WHERE a = 2;
+SET AUTOCOMMIT = 0;
+CREATE TEMPORARY TABLE t2_tmp ( a int, new_a int );
+INSERT INTO t2_tmp VALUES (1,51),(2,52),(3,53);
+UPDATE t1 SET a = (SELECT new_a FROM t2_tmp WHERE t2_tmp.a = t1.a) WHERE a = 1;
+UPDATE t1 SET a = (SELECT new_a FROM t2_tmp WHERE t2_tmp.a = t1.a) WHERE a = 2;
+INSERT INTO t1_tmp (b) SELECT b FROM t1 WHERE a = 1;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+Reap the server message for connection user2 UPDATE t1 ...
+UPDATE t1 SET a = (SELECT new_a FROM t2_tmp WHERE t2_tmp.a = t1.a) WHERE a = 3;
+DROP TABLE t1;

=== modified file 'mysql-test/r/locktrans_innodb.result'
--- a/mysql-test/r/locktrans_innodb.result	2008-12-24 10:48:24 +0000
+++ b/mysql-test/r/locktrans_innodb.result	2009-02-27 09:09:00 +0000
@@ -95,12 +95,12 @@ ERROR 42000: You have an error in your S
 # Implicit lock method conversion due to mix in statement.
 LOCK TABLE t1 READ, t2 IN EXCLUSIVE MODE;
 Warnings:
-Warning	1622	Converted to non-transactional lock on 't2'
+Warning	1628	Converted to non-transactional lock on 't2'
 UNLOCK TABLES;
 # Lock t1 share (converted to read), t2 write.
 LOCK TABLE t1 IN SHARE MODE, t2 WRITE;
 Warnings:
-Warning	1622	Converted to non-transactional lock on 't1'
+Warning	1628	Converted to non-transactional lock on 't1'
 # Show t1 is read locked, t2 write locked.
 INSERT INTO t1 SELECT * FROM t2;
 ERROR HY000: Table 't1' was locked with a READ lock and can't be updated
@@ -111,8 +111,8 @@ INSERT INTO t2 SELECT * FROM t1;
 # Lock t1 exclusive (converted to write), t2 share (converted to read).
 LOCK TABLE t1 IN EXCLUSIVE MODE, t2 IN SHARE MODE;
 Warnings:
-Warning	1622	Converted to non-transactional lock on 't1'
-Warning	1622	Converted to non-transactional lock on 't2'
+Warning	1628	Converted to non-transactional lock on 't1'
+Warning	1628	Converted to non-transactional lock on 't2'
 # Show t1 is write locked, t2 read locked.
 INSERT INTO t1 SELECT * FROM t2;
 INSERT INTO t2 SELECT * FROM t1;
@@ -136,8 +136,8 @@ ERROR HY000: Cannot convert to non-trans
 ## Error is reported on first table only. Show both errors:
 SHOW WARNINGS;
 Level	Code	Message
-Error	1623	Cannot convert to non-transactional lock in strict mode on 't1'
-Error	1623	Cannot convert to non-transactional lock in strict mode on 't2'
+Error	1629	Cannot convert to non-transactional lock in strict mode on 't1'
+Error	1629	Cannot convert to non-transactional lock in strict mode on 't2'
 UNLOCK TABLES;
 SET @@SQL_MODE= @wl3561_save_sql_mode;
 #
@@ -157,7 +157,7 @@ CREATE TABLE t4 (c4 INT) ENGINE= MyISAM;
 # Request a transactional lock, which is converted to non-transactional.
 LOCK TABLE t4 IN SHARE MODE;
 Warnings:
-Warning	1622	Converted to non-transactional lock on 't4'
+Warning	1628	Converted to non-transactional lock on 't4'
 # Try a conflict with the existing non-transactional lock.
 INSERT INTO t4 VALUES(444);
 ERROR HY000: Table 't4' was locked with a READ lock and can't be updated
@@ -174,8 +174,8 @@ CREATE VIEW v1 AS SELECT * FROM t3, t4 W
 # Request a share lock on the view, which is converted to read locks.
 LOCK TABLE v1 IN SHARE MODE;
 Warnings:
-Warning	1622	Converted to non-transactional lock on 't3'
-Warning	1622	Converted to non-transactional lock on 't4'
+Warning	1628	Converted to non-transactional lock on 't3'
+Warning	1628	Converted to non-transactional lock on 't4'
 # Show that read locks on the base tables prohibit writing ...
 INSERT INTO t3 SELECT * FROM t4;
 ERROR HY000: Table 't3' was locked with a READ lock and can't be updated
@@ -191,7 +191,7 @@ COUNT(*)
 ## Report conversion on view due to existing non-transactional locks.
 LOCK TABLE v1 IN EXCLUSIVE MODE;
 Warnings:
-Warning	1622	Converted to non-transactional lock on 'v1'
+Warning	1628	Converted to non-transactional lock on 'v1'
 INSERT INTO t3 VALUES(333);
 INSERT INTO t4 VALUES(444);
 INSERT INTO t1 VALUES(111);
@@ -200,8 +200,8 @@ UNLOCK TABLES;
 ## Now report conversion on base table again.
 LOCK TABLE v1 IN EXCLUSIVE MODE;
 Warnings:
-Warning	1622	Converted to non-transactional lock on 't3'
-Warning	1622	Converted to non-transactional lock on 't4'
+Warning	1628	Converted to non-transactional lock on 't3'
+Warning	1628	Converted to non-transactional lock on 't4'
 INSERT INTO t3 VALUES(333);
 INSERT INTO t4 VALUES(444);
 INSERT INTO t1 VALUES(111);

=== modified file 'mysql-test/r/locktrans_myisam.result'
--- a/mysql-test/r/locktrans_myisam.result	2008-12-24 10:48:24 +0000
+++ b/mysql-test/r/locktrans_myisam.result	2009-02-27 09:09:00 +0000
@@ -21,8 +21,8 @@ UNLOCK TABLES;
 # Valid syntax for transactional locks.
 LOCK TABLE t1 IN SHARE MODE, t2 IN EXCLUSIVE MODE;
 Warnings:
-Warning	1622	Converted to non-transactional lock on 't1'
-Warning	1622	Converted to non-transactional lock on 't2'
+Warning	1628	Converted to non-transactional lock on 't1'
+Warning	1628	Converted to non-transactional lock on 't2'
 UNLOCK TABLES;
 #
 # Valid syntax for aliases with and without 'AS'.
@@ -30,19 +30,19 @@ LOCK TABLE t1 AS a1 READ, t2 a2 WRITE;
 UNLOCK TABLES;
 LOCK TABLE t1 AS a1 IN SHARE MODE, t2 a2 IN EXCLUSIVE MODE;
 Warnings:
-Warning	1622	Converted to non-transactional lock on 'a1'
-Warning	1622	Converted to non-transactional lock on 'a2'
+Warning	1628	Converted to non-transactional lock on 'a1'
+Warning	1628	Converted to non-transactional lock on 'a2'
 UNLOCK TABLES;
 #
 # Transactional locks taken on a view.
 CREATE VIEW v1 AS SELECT * FROM t1, t2 WHERE t1.c1 = t2.c2;
 LOCK TABLE v1 IN SHARE MODE;
 Warnings:
-Warning	1622	Converted to non-transactional lock on 't1'
-Warning	1622	Converted to non-transactional lock on 't2'
+Warning	1628	Converted to non-transactional lock on 't1'
+Warning	1628	Converted to non-transactional lock on 't2'
 LOCK TABLE v1 IN EXCLUSIVE MODE;
 Warnings:
-Warning	1622	Converted to non-transactional lock on 'v1'
+Warning	1628	Converted to non-transactional lock on 'v1'
 UNLOCK TABLES;
 DROP VIEW v1;
 #
@@ -95,12 +95,12 @@ ERROR 42000: You have an error in your S
 # Implicit lock method conversion due to mix in statement.
 LOCK TABLE t1 READ, t2 IN EXCLUSIVE MODE;
 Warnings:
-Warning	1622	Converted to non-transactional lock on 't2'
+Warning	1628	Converted to non-transactional lock on 't2'
 UNLOCK TABLES;
 # Lock t1 share (converted to read), t2 write.
 LOCK TABLE t1 IN SHARE MODE, t2 WRITE;
 Warnings:
-Warning	1622	Converted to non-transactional lock on 't1'
+Warning	1628	Converted to non-transactional lock on 't1'
 # Show t1 is read locked, t2 write locked.
 INSERT INTO t1 SELECT * FROM t2;
 ERROR HY000: Table 't1' was locked with a READ lock and can't be updated
@@ -111,8 +111,8 @@ INSERT INTO t2 SELECT * FROM t1;
 # Lock t1 exclusive (converted to write), t2 share (converted to read).
 LOCK TABLE t1 IN EXCLUSIVE MODE, t2 IN SHARE MODE;
 Warnings:
-Warning	1622	Converted to non-transactional lock on 't1'
-Warning	1622	Converted to non-transactional lock on 't2'
+Warning	1628	Converted to non-transactional lock on 't1'
+Warning	1628	Converted to non-transactional lock on 't2'
 # Show t1 is write locked, t2 read locked.
 INSERT INTO t1 SELECT * FROM t2;
 INSERT INTO t2 SELECT * FROM t1;
@@ -136,8 +136,8 @@ ERROR HY000: Cannot convert to non-trans
 ## Error is reported on first table only. Show both errors:
 SHOW WARNINGS;
 Level	Code	Message
-Error	1623	Cannot convert to non-transactional lock in strict mode on 't1'
-Error	1623	Cannot convert to non-transactional lock in strict mode on 't2'
+Error	1629	Cannot convert to non-transactional lock in strict mode on 't1'
+Error	1629	Cannot convert to non-transactional lock in strict mode on 't2'
 UNLOCK TABLES;
 SET @@SQL_MODE= @wl3561_save_sql_mode;
 #
@@ -157,7 +157,7 @@ CREATE TABLE t4 (c4 INT) ENGINE= MyISAM;
 # Request a transactional lock, which is converted to non-transactional.
 LOCK TABLE t4 IN SHARE MODE;
 Warnings:
-Warning	1622	Converted to non-transactional lock on 't4'
+Warning	1628	Converted to non-transactional lock on 't4'
 # Try a conflict with the existing non-transactional lock.
 INSERT INTO t4 VALUES(444);
 ERROR HY000: Table 't4' was locked with a READ lock and can't be updated
@@ -174,8 +174,8 @@ CREATE VIEW v1 AS SELECT * FROM t3, t4 W
 # Request a share lock on the view, which is converted to read locks.
 LOCK TABLE v1 IN SHARE MODE;
 Warnings:
-Warning	1622	Converted to non-transactional lock on 't3'
-Warning	1622	Converted to non-transactional lock on 't4'
+Warning	1628	Converted to non-transactional lock on 't3'
+Warning	1628	Converted to non-transactional lock on 't4'
 # Show that read locks on the base tables prohibit writing ...
 INSERT INTO t3 SELECT * FROM t4;
 ERROR HY000: Table 't3' was locked with a READ lock and can't be updated
@@ -191,7 +191,7 @@ COUNT(*)
 ## Report conversion on view due to existing non-transactional locks.
 LOCK TABLE v1 IN EXCLUSIVE MODE;
 Warnings:
-Warning	1622	Converted to non-transactional lock on 'v1'
+Warning	1628	Converted to non-transactional lock on 'v1'
 INSERT INTO t3 VALUES(333);
 INSERT INTO t4 VALUES(444);
 INSERT INTO t1 VALUES(111);
@@ -200,8 +200,8 @@ UNLOCK TABLES;
 ## Now report conversion on base table again.
 LOCK TABLE v1 IN EXCLUSIVE MODE;
 Warnings:
-Warning	1622	Converted to non-transactional lock on 't3'
-Warning	1622	Converted to non-transactional lock on 't4'
+Warning	1628	Converted to non-transactional lock on 't3'
+Warning	1628	Converted to non-transactional lock on 't4'
 INSERT INTO t3 VALUES(333);
 INSERT INTO t4 VALUES(444);
 INSERT INTO t1 VALUES(111);

=== modified file 'mysql-test/r/mysql.result'
--- a/mysql-test/r/mysql.result	2009-01-09 18:43:23 +0000
+++ b/mysql-test/r/mysql.result	2009-02-25 10:06:18 +0000
@@ -188,6 +188,10 @@ delimiter
 2
 @z:='1'	@z=database()
 1	NULL
+1
+1
+1
+1
 End of 5.0 tests
 WARNING: --server-arg option not supported in this configuration.
 *************************** 1. row ***************************

=== modified file 'mysql-test/r/mysqlbinlog.result'
--- a/mysql-test/r/mysqlbinlog.result	2008-08-04 14:30:50 +0000
+++ b/mysql-test/r/mysqlbinlog.result	2009-02-24 17:25:30 +0000
@@ -395,7 +395,14 @@ flush logs;
 INSERT INTO t1 VALUES ('0123456789');
 flush logs;
 DROP TABLE t1;
-# 	Query	thread_id=REMOVED	exec_time=REMOVED	error_code=REMOVED
+We expect this value to be 1
+The bug being tested was that 'Query' lines were not preceded by '#'
+If the line is in the table, it had to have been preceded by a '#'
+
+SELECT COUNT(*) AS `BUG#28293_expect_1` FROM patch WHERE a LIKE '%Query%';
+BUG#28293_expect_1
+1
+DROP TABLE patch;
 flush logs;
 create table t1(a int);
 insert into t1 values(connection_id());
@@ -404,7 +411,6 @@ drop table t1;
 1
 drop table t1;
 shell> mysqlbinlog std_data/corrupt-relay-bin.000624 > var/tmp/bug31793.sql
-End of 5.0 tests
 flush logs;
 BUG#31611: Security risk with BINLOG statement
 SET BINLOG_FORMAT=ROW;
@@ -454,4 +460,15 @@ an_int	1000
 a_decimal	907.79
 a_string	Just a test
 DROP TABLE t1;
+set @@global.server_id= 4294967295;
+reset master;
+flush logs;
+select
+(@a:=load_file("MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug37313.binlog"))
+is not null;
+(@a:=load_file("MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug37313.binlog"))
+is not null
+1
+*** Unsigned server_id 4294967295 is found: 1 ***
+set @@global.server_id= 1;
 End of 5.1 tests

=== modified file 'mysql-test/r/mysqldump-max.result'
--- a/mysql-test/r/mysqldump-max.result	2008-09-11 06:14:19 +0000
+++ b/mysql-test/r/mysqldump-max.result	2009-02-19 17:22:28 +0000
@@ -93,73 +93,73 @@ CREATE DATABASE /*!32312 IF NOT EXISTS*/
 
 USE `test`;
 DROP TABLE IF EXISTS `t1`;
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE `t1` (
   `id` int(8) DEFAULT NULL,
   `name` varchar(32) DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 
 /*!40000 ALTER TABLE `t1` DISABLE KEYS */;
 INSERT  DELAYED IGNORE INTO `t1` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
 /*!40000 ALTER TABLE `t1` ENABLE KEYS */;
 DROP TABLE IF EXISTS `t2`;
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE `t2` (
   `id` int(8) DEFAULT NULL,
   `name` varchar(32) DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 
 /*!40000 ALTER TABLE `t2` DISABLE KEYS */;
 INSERT  DELAYED IGNORE INTO `t2` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
 /*!40000 ALTER TABLE `t2` ENABLE KEYS */;
 DROP TABLE IF EXISTS `t3`;
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE `t3` (
   `id` int(8) DEFAULT NULL,
   `name` varchar(32) DEFAULT NULL
 ) ENGINE=MEMORY DEFAULT CHARSET=latin1;
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 
 /*!40000 ALTER TABLE `t3` DISABLE KEYS */;
 INSERT  DELAYED IGNORE INTO `t3` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
 /*!40000 ALTER TABLE `t3` ENABLE KEYS */;
 DROP TABLE IF EXISTS `t4`;
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE `t4` (
   `id` int(8) DEFAULT NULL,
   `name` varchar(32) DEFAULT NULL
 ) ENGINE=MEMORY DEFAULT CHARSET=latin1;
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 
 /*!40000 ALTER TABLE `t4` DISABLE KEYS */;
 INSERT  DELAYED IGNORE INTO `t4` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
 /*!40000 ALTER TABLE `t4` ENABLE KEYS */;
 DROP TABLE IF EXISTS `t5`;
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE `t5` (
   `id` int(8) DEFAULT NULL,
   `name` varchar(32) DEFAULT NULL
 ) ENGINE=ARCHIVE DEFAULT CHARSET=latin1;
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 
 /*!40000 ALTER TABLE `t5` DISABLE KEYS */;
 INSERT  DELAYED IGNORE INTO `t5` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
 /*!40000 ALTER TABLE `t5` ENABLE KEYS */;
 DROP TABLE IF EXISTS `t6`;
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE `t6` (
   `id` int(8) DEFAULT NULL,
   `name` varchar(32) DEFAULT NULL
 ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 
 /*!40000 ALTER TABLE `t6` DISABLE KEYS */;
 INSERT  IGNORE INTO `t6` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
@@ -190,73 +190,73 @@ CREATE DATABASE /*!32312 IF NOT EXISTS*/
 
 USE `test`;
 DROP TABLE IF EXISTS `t1`;
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE `t1` (
   `id` int(8) DEFAULT NULL,
   `name` varchar(32) DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 
 /*!40000 ALTER TABLE `t1` DISABLE KEYS */;
 INSERT  DELAYED INTO `t1` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
 /*!40000 ALTER TABLE `t1` ENABLE KEYS */;
 DROP TABLE IF EXISTS `t2`;
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE `t2` (
   `id` int(8) DEFAULT NULL,
   `name` varchar(32) DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 
 /*!40000 ALTER TABLE `t2` DISABLE KEYS */;
 INSERT  DELAYED INTO `t2` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
 /*!40000 ALTER TABLE `t2` ENABLE KEYS */;
 DROP TABLE IF EXISTS `t3`;
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE `t3` (
   `id` int(8) DEFAULT NULL,
   `name` varchar(32) DEFAULT NULL
 ) ENGINE=MEMORY DEFAULT CHARSET=latin1;
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 
 /*!40000 ALTER TABLE `t3` DISABLE KEYS */;
 INSERT  DELAYED INTO `t3` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
 /*!40000 ALTER TABLE `t3` ENABLE KEYS */;
 DROP TABLE IF EXISTS `t4`;
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE `t4` (
   `id` int(8) DEFAULT NULL,
   `name` varchar(32) DEFAULT NULL
 ) ENGINE=MEMORY DEFAULT CHARSET=latin1;
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 
 /*!40000 ALTER TABLE `t4` DISABLE KEYS */;
 INSERT  DELAYED INTO `t4` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
 /*!40000 ALTER TABLE `t4` ENABLE KEYS */;
 DROP TABLE IF EXISTS `t5`;
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE `t5` (
   `id` int(8) DEFAULT NULL,
   `name` varchar(32) DEFAULT NULL
 ) ENGINE=ARCHIVE DEFAULT CHARSET=latin1;
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 
 /*!40000 ALTER TABLE `t5` DISABLE KEYS */;
 INSERT  DELAYED INTO `t5` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
 /*!40000 ALTER TABLE `t5` ENABLE KEYS */;
 DROP TABLE IF EXISTS `t6`;
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE `t6` (
   `id` int(8) DEFAULT NULL,
   `name` varchar(32) DEFAULT NULL
 ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 
 /*!40000 ALTER TABLE `t6` DISABLE KEYS */;
 INSERT INTO `t6` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');

=== modified file 'mysql-test/r/mysqldump.result'
--- a/mysql-test/r/mysqldump.result	2009-02-03 16:32:37 +0000
+++ b/mysql-test/r/mysqldump.result	2009-02-25 12:42:06 +0000
@@ -34,12 +34,12 @@ DROP TABLE t1;
 CREATE TABLE t1 (a decimal(64, 20));
 INSERT INTO t1 VALUES ("1234567890123456789012345678901234567890"),
 ("0987654321098765432109876543210987654321");
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE `t1` (
   `a` decimal(64,20) DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 INSERT INTO `t1` VALUES ('1234567890123456789012345678901234567890.00000000000000000000'),('987654321098765432109876543210987654321.00000000000000000000');
 DROP TABLE t1;
 #
@@ -49,12 +49,12 @@ CREATE TABLE t1 (a double);
 INSERT INTO t1 VALUES ('-9e999999');
 Warnings:
 Warning	1264	Out of range value for column 'a' at row 1
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE `t1` (
   `a` double DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 INSERT INTO `t1` VALUES (-1.7976931348623157e308);
 DROP TABLE t1;
 #
@@ -70,21 +70,21 @@ INSERT INTO t1 VALUES ('1.2345', 2.3456)
 INSERT INTO t1 VALUES ("1.2345", 2.3456);
 ERROR 42S22: Unknown column '1.2345' in 'field list'
 SET SQL_MODE=@OLD_SQL_MODE;
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE `t1` (
   `a` decimal(10,5) DEFAULT NULL,
   `b` float DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 INSERT INTO `t1` VALUES ('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456);
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE `t1` (
   `a` decimal(10,5) DEFAULT NULL,
   `b` float DEFAULT NULL
 );
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 INSERT INTO `t1` VALUES ('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456);
 
 /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
@@ -98,13 +98,13 @@ INSERT INTO `t1` VALUES ('1.23450',2.345
 /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
 /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
 DROP TABLE IF EXISTS `t1`;
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE `t1` (
   `a` decimal(10,5) DEFAULT NULL,
   `b` float DEFAULT NULL
 );
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 
 LOCK TABLES `t1` WRITE;
 /*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -127,13 +127,13 @@ UNLOCK TABLES;
 /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
 /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
 /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE `t1` (
   `a` decimal(10,5) DEFAULT NULL,
   `b` float DEFAULT NULL
 );
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 
 INSERT INTO `t1` VALUES ('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456);
 /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
@@ -209,12 +209,12 @@ INSERT INTO t1  VALUES (_koi8r x'C1C2C3C
 /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
 /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
 DROP TABLE IF EXISTS `t1`;
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE `t1` (
   `a` varchar(255) DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=koi8r;
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 
 LOCK TABLES `t1` WRITE;
 /*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -245,12 +245,9 @@ INSERT INTO t1 VALUES (1), (2);
 /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO,MYSQL40' */;
 /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
 DROP TABLE IF EXISTS `t1`;
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
 CREATE TABLE `t1` (
   `a` int(11) DEFAULT NULL
 ) TYPE=MyISAM;
-SET character_set_client = @saved_cs_client;
 
 LOCK TABLES `t1` WRITE;
 /*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -271,12 +268,9 @@ UNLOCK TABLES;
 /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO,MYSQL323' */;
 /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
 DROP TABLE IF EXISTS `t1`;
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
 CREATE TABLE `t1` (
   `a` int(11) DEFAULT NULL
 ) TYPE=MyISAM;
-SET character_set_client = @saved_cs_client;
 
 LOCK TABLES `t1` WRITE;
 /*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -295,12 +289,12 @@ DROP TABLE t1;
 # Bug#2592 mysqldump doesn't quote "tricky" names correctly
 #
 create table ```a` (i int);
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE ```a` (
   `i` int(11) DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 drop table ```a`;
 #
 # Bug#2591 mysqldump quotes names inconsistently
@@ -318,12 +312,12 @@ create table t1(a int);
 /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
 /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
 DROP TABLE IF EXISTS `t1`;
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE `t1` (
   `a` int(11) DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 
 LOCK TABLES `t1` WRITE;
 /*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -346,12 +340,12 @@ UNLOCK TABLES;
 /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO,ANSI' */;
 /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
 DROP TABLE IF EXISTS "t1";
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE "t1" (
   "a" int(11) DEFAULT NULL
 );
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 
 LOCK TABLES "t1" WRITE;
 /*!40000 ALTER TABLE "t1" DISABLE KEYS */;
@@ -377,12 +371,12 @@ set global sql_mode='ANSI_QUOTES';
 /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
 /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
 DROP TABLE IF EXISTS `t1`;
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE `t1` (
   `a` int(11) DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 
 LOCK TABLES `t1` WRITE;
 /*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -405,12 +399,12 @@ UNLOCK TABLES;
 /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO,ANSI' */;
 /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
 DROP TABLE IF EXISTS "t1";
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE "t1" (
   "a" int(11) DEFAULT NULL
 );
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 
 LOCK TABLES "t1" WRITE;
 /*!40000 ALTER TABLE "t1" DISABLE KEYS */;
@@ -440,12 +434,12 @@ insert into t1 values (1),(2),(3);
 /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='' */;
 /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
 DROP TABLE IF EXISTS `t1`;
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE `t1` (
   `a` int(11) DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 
 /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
 
@@ -534,12 +528,12 @@ INSERT INTO t1  VALUES (_latin1 '��');
 /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
 /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
 DROP TABLE IF EXISTS `t1`;
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE `t1` (
   `a` char(10) DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 
 LOCK TABLES `t1` WRITE;
 /*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -570,12 +564,9 @@ UNLOCK TABLES;
 /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO,MYSQL323' */;
 /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
 DROP TABLE IF EXISTS `t1`;
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
 CREATE TABLE `t1` (
   `a` char(10) DEFAULT NULL
 ) TYPE=MyISAM;
-SET character_set_client = @saved_cs_client;
 
 LOCK TABLES `t1` WRITE;
 /*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -596,12 +587,9 @@ UNLOCK TABLES;
 /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO,MYSQL323' */;
 /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
 DROP TABLE IF EXISTS `t1`;
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
 CREATE TABLE `t1` (
   `a` char(10) DEFAULT NULL
 ) TYPE=MyISAM;
-SET character_set_client = @saved_cs_client;
 
 LOCK TABLES `t1` WRITE;
 /*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -622,12 +610,9 @@ UNLOCK TABLES;
 /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO,MYSQL323' */;
 /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
 DROP TABLE IF EXISTS `t1`;
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
 CREATE TABLE `t1` (
   `a` char(10) DEFAULT NULL
 ) TYPE=MyISAM;
-SET character_set_client = @saved_cs_client;
 
 LOCK TABLES `t1` WRITE;
 /*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -661,12 +646,12 @@ INSERT INTO t2 VALUES (4),(5),(6);
 /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
 /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
 DROP TABLE IF EXISTS `t2`;
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE `t2` (
   `a` int(11) DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 
 LOCK TABLES `t2` WRITE;
 /*!40000 ALTER TABLE `t2` DISABLE KEYS */;
@@ -702,12 +687,12 @@ INSERT INTO `t1` VALUES (0x6020100002801
 /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
 /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
 DROP TABLE IF EXISTS `t1`;
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE `t1` (
   `b` blob
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 
 LOCK TABLES `t1` WRITE;
 /*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -743,12 +728,12 @@ INSERT INTO t1 VALUES (4),(5),(6);
 /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
 /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
 DROP TABLE IF EXISTS `t1`;
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE `t1` (
   `a` int(11) DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 
 LOCK TABLES `t1` WRITE;
 /*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -777,12 +762,12 @@ UNLOCK TABLES;
 /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
 /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
 DROP TABLE IF EXISTS `t1`;
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE `t1` (
   `a` int(11) DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 
 /*!40000 ALTER TABLE `t1` DISABLE KEYS */;
 INSERT  DELAYED IGNORE INTO `t1` VALUES (1),(2),(3),(4),(5),(6);
@@ -1146,8 +1131,8 @@ insert into t1 (F_8d3bba7425e7c98c50f52c
 /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
 /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
 DROP TABLE IF EXISTS `t1`;
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE `t1` (
   `F_c4ca4238a0b923820dcc509a6f75849b` int(11) DEFAULT NULL,
   `F_c81e728d9d4c2f636f067f89cc14862c` int(11) DEFAULT NULL,
@@ -1480,7 +1465,7 @@ CREATE TABLE `t1` (
   `F_6faa8040da20ef399b63a72d0e4ab575` int(11) DEFAULT NULL,
   `F_fe73f687e5bc5280214e0486b273a5f9` int(11) DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 
 LOCK TABLES `t1` WRITE;
 /*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -1521,12 +1506,12 @@ CREATE DATABASE /*!32312 IF NOT EXISTS*/
 
 USE `test`;
 DROP TABLE IF EXISTS `t1`;
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE `t1` (
   `a` int(11) DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 
 LOCK TABLES `t1` WRITE;
 /*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -1565,19 +1550,19 @@ INSERT INTO t2 VALUES (1), (2);
 /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
 /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
 DROP TABLE IF EXISTS `t1`;
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE `t1` (
   `a` int(11) DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 DROP TABLE IF EXISTS `t2`;
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE `t2` (
   `a` int(11) DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
 
 /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
@@ -1600,19 +1585,19 @@ SET character_set_client = @saved_cs_cli
 /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
 /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
 DROP TABLE IF EXISTS `t1`;
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE `t1` (
   `a` int(11) DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 DROP TABLE IF EXISTS `t2`;
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE `t2` (
   `a` int(11) DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
 
 /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
@@ -1813,26 +1798,26 @@ create table t3(a int);
 /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
 /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
 DROP TABLE IF EXISTS `t3`;
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE `t3` (
   `a` int(11) DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 DROP TABLE IF EXISTS `t1`;
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE `t1` (
   `a` int(11) DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 DROP TABLE IF EXISTS `t2`;
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE `t2` (
   `a` int(11) DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
 
 /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
@@ -1862,12 +1847,12 @@ mysqldump: Got error: 1064: You have an 
 /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
 /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
 DROP TABLE IF EXISTS `t1`;
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE `t1` (
   `a` int(11) DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 
 /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
 
@@ -1898,15 +1883,15 @@ insert into t1 values (0815, 4711, 2006)
 /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO,ANSI' */;
 /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
 DROP TABLE IF EXISTS "t1";
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE "t1" (
   "a b" int(11) NOT NULL DEFAULT '0',
   "c""d" int(11) NOT NULL DEFAULT '0',
   "e`f" int(11) NOT NULL DEFAULT '0',
   PRIMARY KEY ("a b","c""d","e`f")
 );
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 
 LOCK TABLES "t1" WRITE;
 /*!40000 ALTER TABLE "t1" DISABLE KEYS */;
@@ -1932,15 +1917,15 @@ UNLOCK TABLES;
 /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
 /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
 DROP TABLE IF EXISTS `t1`;
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE `t1` (
   `a b` int(11) NOT NULL DEFAULT '0',
   `c"d` int(11) NOT NULL DEFAULT '0',
   `e``f` int(11) NOT NULL DEFAULT '0',
   PRIMARY KEY (`a b`,`c"d`,`e``f`)
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 
 LOCK TABLES `t1` WRITE;
 /*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -1986,13 +1971,13 @@ create view v2 as select * from t2 where
 /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
 /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
 DROP TABLE IF EXISTS `t2`;
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE `t2` (
   `a` varchar(30) DEFAULT NULL,
   KEY `a` (`a`(5))
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 
 LOCK TABLES `t2` WRITE;
 /*!40000 ALTER TABLE `t2` DISABLE KEYS */;
@@ -2082,12 +2067,12 @@ create view v1 as select * from t1;
 /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
 /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
 DROP TABLE IF EXISTS `t1`;
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE `t1` (
   `a` int(11) DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 
 LOCK TABLES `t1` WRITE;
 /*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -2154,13 +2139,13 @@ create view v2 as select * from t2 where
 /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
 /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
 DROP TABLE IF EXISTS `t2`;
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE `t2` (
   `a` varchar(30) DEFAULT NULL,
   KEY `a` (`a`(5))
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 
 LOCK TABLES `t2` WRITE;
 /*!40000 ALTER TABLE `t2` DISABLE KEYS */;
@@ -2221,12 +2206,12 @@ INSERT INTO t1 VALUES ('\'');
 /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
 /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
 DROP TABLE IF EXISTS `t1`;
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE `t1` (
   `a` char(10) DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 
 LOCK TABLES `t1` WRITE;
 /*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -2267,14 +2252,14 @@ select v3.a from v3, v1 where v1.a=v3.a 
 /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
 /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
 DROP TABLE IF EXISTS `t1`;
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE `t1` (
   `a` int(11) DEFAULT NULL,
   `b` int(11) DEFAULT NULL,
   `c` varchar(30) DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 
 LOCK TABLES `t1` WRITE;
 /*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -2426,13 +2411,13 @@ CREATE DATABASE /*!32312 IF NOT EXISTS*/
 
 USE `test`;
 DROP TABLE IF EXISTS `t1`;
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE `t1` (
   `a` int(11) DEFAULT NULL,
   `b` bigint(20) DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 
 LOCK TABLES `t1` WRITE;
 /*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -2498,12 +2483,12 @@ DELIMITER ;
 /*!50003 SET character_set_results = @saved_cs_results */ ;
 /*!50003 SET collation_connection  = @saved_col_connection */ ;
 DROP TABLE IF EXISTS `t2`;
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE `t2` (
   `a` int(11) DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 
 LOCK TABLES `t2` WRITE;
 /*!40000 ALTER TABLE `t2` DISABLE KEYS */;
@@ -2555,13 +2540,13 @@ CREATE DATABASE /*!32312 IF NOT EXISTS*/
 
 USE `test`;
 DROP TABLE IF EXISTS `t1`;
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE `t1` (
   `a` int(11) DEFAULT NULL,
   `b` bigint(20) DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 
 LOCK TABLES `t1` WRITE;
 /*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -2569,12 +2554,12 @@ INSERT INTO `t1` VALUES (1,NULL),(2,NULL
 /*!40000 ALTER TABLE `t1` ENABLE KEYS */;
 UNLOCK TABLES;
 DROP TABLE IF EXISTS `t2`;
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE `t2` (
   `a` int(11) DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 
 LOCK TABLES `t2` WRITE;
 /*!40000 ALTER TABLE `t2` DISABLE KEYS */;
@@ -2700,12 +2685,12 @@ CREATE DATABASE /*!32312 IF NOT EXISTS*/
 
 USE `test`;
 DROP TABLE IF EXISTS `t1`;
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE `t1` (
   `id` int(11) DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 
 LOCK TABLES `t1` WRITE;
 /*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -2851,13 +2836,13 @@ CREATE DATABASE /*!32312 IF NOT EXISTS*/
 
 USE `test`;
 DROP TABLE IF EXISTS `t1`;
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE `t1` (
   `d` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
   UNIQUE KEY `d` (`d`)
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 
 LOCK TABLES `t1` WRITE;
 /*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -2888,13 +2873,13 @@ CREATE DATABASE /*!32312 IF NOT EXISTS*/
 
 USE `test`;
 DROP TABLE IF EXISTS `t1`;
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE `t1` (
   `d` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
   UNIQUE KEY `d` (`d`)
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 
 LOCK TABLES `t1` WRITE;
 /*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -2941,12 +2926,12 @@ a2
 /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO,ANSI' */;
 /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
 DROP TABLE IF EXISTS "t1 test";
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE "t1 test" (
   "a1" int(11) DEFAULT NULL
 );
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 
 LOCK TABLES "t1 test" WRITE;
 /*!40000 ALTER TABLE "t1 test" DISABLE KEYS */;
@@ -2970,12 +2955,12 @@ DELIMITER ;
 /*!50003 SET character_set_results = @saved_cs_results */ ;
 /*!50003 SET collation_connection  = @saved_col_connection */ ;
 DROP TABLE IF EXISTS "t2 test";
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE "t2 test" (
   "a2" int(11) DEFAULT NULL
 );
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 
 LOCK TABLES "t2 test" WRITE;
 /*!40000 ALTER TABLE "t2 test" DISABLE KEYS */;
@@ -3024,14 +3009,14 @@ CREATE DATABASE /*!32312 IF NOT EXISTS*/
 
 USE `test`;
 DROP TABLE IF EXISTS `t1`;
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE `t1` (
   `a` int(11) DEFAULT NULL,
   `b` varchar(32) DEFAULT NULL,
   `c` varchar(32) DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 
 LOCK TABLES `t1` WRITE;
 /*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -3155,12 +3140,12 @@ CREATE DATABASE /*!32312 IF NOT EXISTS*/
 
 USE `test`;
 DROP TABLE IF EXISTS `t1`;
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE `t1` (
   `a` int(11) DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 
 LOCK TABLES `t1` WRITE;
 /*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -3214,13 +3199,13 @@ insert into t1 values ('','');
 /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
 /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
 DROP TABLE IF EXISTS `t1`;
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE `t1` (
   `a` binary(1) DEFAULT NULL,
   `b` blob
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 
 LOCK TABLES `t1` WRITE;
 /*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -3249,13 +3234,13 @@ UNLOCK TABLES;
 /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
 /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
 DROP TABLE IF EXISTS `t1`;
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE `t1` (
   `a` binary(1) DEFAULT NULL,
   `b` blob
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 
 LOCK TABLES `t1` WRITE;
 /*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -3428,12 +3413,12 @@ CREATE DATABASE /*!32312 IF NOT EXISTS*/
 
 USE `mysqldump_test_db`;
 DROP TABLE IF EXISTS `t1`;
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE `t1` (
   `id` int(11) DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 
 LOCK TABLES `t1` WRITE;
 /*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -3490,14 +3475,14 @@ create view nasishnasifu as select mysql
 CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqldump_tables` /*!40100 DEFAULT CHARACTER SET latin1 */;
 
 USE `mysqldump_tables`;
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE `basetable` (
   `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
   `tag` varchar(64) DEFAULT NULL,
   UNIQUE KEY `id` (`id`)
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 
 CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqldump_views` /*!40100 DEFAULT CHARACTER SET latin1 */;
 
@@ -3521,7 +3506,7 @@ USE `mysqldump_views`;
 /*!50001 SET collation_connection      = latin1_swedish_ci */;
 /*!50001 CREATE ALGORITHM=UNDEFINED */
 /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
-/*!50001 VIEW `mysqldump_views`.`nasishnasifu` AS select `mysqldump_tables`.`basetable`.`id` AS `id` from `mysqldump_tables`.`basetable` */;
+/*!50001 VIEW `nasishnasifu` AS select `mysqldump_tables`.`basetable`.`id` AS `id` from `mysqldump_tables`.`basetable` */;
 /*!50001 SET character_set_client      = @saved_cs_client */;
 /*!50001 SET character_set_results     = @saved_cs_results */;
 /*!50001 SET collation_connection      = @saved_col_connection */;
@@ -3664,31 +3649,31 @@ CREATE TABLE t1 (a INT) ENGINE=merge UNI
 /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
 /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
 DROP TABLE IF EXISTS `t1`;
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE `t1` (
   `a` int(11) DEFAULT NULL
 ) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t2`,`t3`);
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 DROP TABLE IF EXISTS `t2`;
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE `t2` (
   `a` int(11) DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 
 LOCK TABLES `t2` WRITE;
 /*!40000 ALTER TABLE `t2` DISABLE KEYS */;
 /*!40000 ALTER TABLE `t2` ENABLE KEYS */;
 UNLOCK TABLES;
 DROP TABLE IF EXISTS `t3`;
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE `t3` (
   `a` int(11) DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 
 LOCK TABLES `t3` WRITE;
 /*!40000 ALTER TABLE `t3` DISABLE KEYS */;
@@ -3768,13 +3753,13 @@ drop database mysqldump_test_db;
 #
 CREATE TABLE t1 (c1 INT, c2 LONGBLOB);
 INSERT INTO t1 SET c1=11, c2=REPEAT('q',509);
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE `t1` (
   `c1` int(11) DEFAULT NULL,
   `c2` longblob
 );
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 INSERT INTO `t1` VALUES (11,0x7171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171);
 DROP TABLE t1;
 #
@@ -3832,6 +3817,87 @@ DROP TABLE t1,t2;
 
 -- Dump completed on DATE
 #
+# Bug#33550 mysqldump 4.0 compatibility broken
+#
+SET NAMES utf8;
+CREATE TABLE `straße` ( f1 INT );
+/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
+/*!40103 SET TIME_ZONE='+00:00' */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO,MYSQL323' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+DROP TABLE IF EXISTS `straße`;
+CREATE TABLE `straße` (
+  `f1` int(11) DEFAULT NULL
+) TYPE=MyISAM;
+
+LOCK TABLES `straße` WRITE;
+/*!40000 ALTER TABLE `straße` DISABLE KEYS */;
+/*!40000 ALTER TABLE `straße` ENABLE KEYS */;
+UNLOCK TABLES;
+/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
+
+/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
+/*!40103 SET TIME_ZONE='+00:00' */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO,MYSQL323' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+DROP TABLE IF EXISTS `stra�`;
+CREATE TABLE `stra�` (
+  `f1` int(11) DEFAULT NULL
+) TYPE=MyISAM;
+
+LOCK TABLES `stra�` WRITE;
+/*!40000 ALTER TABLE `stra�` DISABLE KEYS */;
+/*!40000 ALTER TABLE `stra�` ENABLE KEYS */;
+UNLOCK TABLES;
+/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
+
+DROP TABLE `straße`;
+CREATE TABLE `כדשגכחךלדגכחשךדגחכךלדגכ` ( f1 INT );
+/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
+/*!40103 SET TIME_ZONE='+00:00' */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO,MYSQL323' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+DROP TABLE IF EXISTS `כדשגכחךלדגכחשךדגחכךחשךדגחכךלדגכ` (
+  `f1` int(11) DEFAULT NULL
+) TYPE=MyISAM;
+
+LOCK TABLES `כTE;
+/*!40000 ALTER TABLE `כדשגכחךלדגכחשךדגחכךלדגכ` DISABLE KEYS */;
+/*!40000 ALTER TABLE `כדשגכחךלדגכחשBLES;
+/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
+
+/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
+/*!40103 SET TIME_ZONE='+00:00' */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO,MYSQL323' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+DROP TABLE `כדשגכחךtin1;
+#
 # End of 5.0 tests
 #
 drop table if exists t1;
@@ -3851,13 +3917,13 @@ INSERT INTO t1 VALUES (3,4), (4,5);
 /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
 /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
 DROP TABLE IF EXISTS `t1`;
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE `t1` (
   `a` int(11) DEFAULT NULL,
   `b` int(11) DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 
 LOCK TABLES `t1` WRITE;
 /*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -3946,12 +4012,12 @@ CREATE DATABASE /*!32312 IF NOT EXISTS*/
 
 USE `mysqldump_test_db`;
 DROP TABLE IF EXISTS `t1`;
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE `t1` (
   `id` int(11) DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 
 LOCK TABLES `t1` WRITE;
 /*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -4048,12 +4114,12 @@ create database `test-database`;
 use `test-database`;
 create table test (a int);
 DROP TABLE IF EXISTS `test`;
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE `test` (
   `a` int(11) DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 LOCK TABLES `test` WRITE;
 /*!40000 ALTER TABLE `test` DISABLE KEYS */;
 /*!40000 ALTER TABLE `test` ENABLE KEYS */;

=== modified file 'mysql-test/r/mysqltest.result'
--- a/mysql-test/r/mysqltest.result	2009-01-15 10:26:48 +0000
+++ b/mysql-test/r/mysqltest.result	2009-02-20 13:35:24 +0000
@@ -215,7 +215,6 @@ source database
 "MySQL: The world's most popular ;open source database"
 echo message echo message
 
-mysqltest: At line 1: command "false" failed
 mysqltest: At line 1: Missing argument in exec
 MySQL
 "MySQL"
@@ -383,7 +382,6 @@ mysqltest: At line 1: The argument to de
 mysqltest: At line 1: End of line junk detected: "1000"
 mysqltest: At line 1: Missing arguments to system, nothing to do!
 mysqltest: At line 1: Missing arguments to system, nothing to do!
-mysqltest: At line 1: system command 'false' failed
 system command 'NonExistsinfComamdn 2> /dev/null' failed
 test
 test2

=== modified file 'mysql-test/r/openssl_1.result'
--- a/mysql-test/r/openssl_1.result	2009-02-03 09:16:53 +0000
+++ b/mysql-test/r/openssl_1.result	2009-02-19 17:36:09 +0000
@@ -98,12 +98,12 @@ INSERT INTO t1 VALUES (1), (2);
 /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
 /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
 DROP TABLE IF EXISTS `t1`;
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE `t1` (
   `a` int(11) DEFAULT NULL
 );
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 
 LOCK TABLES `t1` WRITE;
 /*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -132,12 +132,12 @@ UNLOCK TABLES;
 /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
 /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
 DROP TABLE IF EXISTS `t1`;
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE `t1` (
   `a` int(11) DEFAULT NULL
 );
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 
 LOCK TABLES `t1` WRITE;
 /*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -166,12 +166,12 @@ UNLOCK TABLES;
 /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
 /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
 DROP TABLE IF EXISTS `t1`;
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE `t1` (
   `a` int(11) DEFAULT NULL
 );
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 
 LOCK TABLES `t1` WRITE;
 /*!40000 ALTER TABLE `t1` DISABLE KEYS */;

=== modified file 'mysql-test/r/ps.result'
--- a/mysql-test/r/ps.result	2008-12-11 01:21:12 +0000
+++ b/mysql-test/r/ps.result	2009-02-25 12:27:38 +0000
@@ -235,7 +235,7 @@ execute stmt1;
 prepare stmt1 from "insert into t1 select i from t1";
 execute stmt1;
 execute stmt1;
-prepare stmt1 from "select * from t1 into outfile 'f1.txt'";
+prepare stmt1 from "select * from t1 into outfile '<MYSQLTEST_VARDIR>/tmp/f1.txt'";
 execute stmt1;
 deallocate prepare stmt1;
 drop table t1;

=== modified file 'mysql-test/r/query_cache_debug.result'
--- a/mysql-test/r/query_cache_debug.result	2008-04-01 22:43:17 +0000
+++ b/mysql-test/r/query_cache_debug.result	2009-02-19 21:09:35 +0000
@@ -22,3 +22,52 @@ Qcache_queries_in_cache	0
 set global query_cache_size= 0;
 use test;
 drop table t1;
+SET @old_concurrent_insert= @@GLOBAL.concurrent_insert;
+SET @old_query_cache_size= @@GLOBAL.query_cache_size;
+DROP TABLE IF EXISTS t1, t2;
+CREATE TABLE t1 (a INT);
+CREATE TABLE t2 (a INT);
+INSERT INTO t1 VALUES (1),(2),(3);
+SET GLOBAL concurrent_insert= 1;
+SET GLOBAL query_cache_size= 1024*512;
+SET GLOBAL query_cache_type= ON;
+# Switch to connection con1
+SET SESSION debug='+d,wait_after_query_cache_invalidate';
+# Send concurrent insert, will wait in the query cache table invalidate
+INSERT INTO t1 VALUES (4);
+# Switch to connection default
+# Wait for concurrent insert to reach the debug point
+# Switch to connection con2
+# Send SELECT that shouldn't be cached
+SELECT * FROM t1;
+a
+1
+2
+3
+# Switch to connection default
+# Notify the concurrent insert to proceed
+SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST
+WHERE STATE = 'wait_after_query_cache_invalidate' INTO @thread_id;
+KILL QUERY @thread_id;
+# Switch to connection con1
+# Gather insert result
+SHOW STATUS LIKE "Qcache_queries_in_cache";
+Variable_name	Value
+Qcache_queries_in_cache	0
+# Test that it's cacheable
+SELECT * FROM t1;
+a
+1
+2
+3
+4
+SHOW STATUS LIKE "Qcache_queries_in_cache";
+Variable_name	Value
+Qcache_queries_in_cache	1
+# Disconnect
+# Restore defaults
+RESET QUERY CACHE;
+DROP TABLE t1,t2;
+SET GLOBAL concurrent_insert= DEFAULT;
+SET GLOBAL query_cache_size= DEFAULT;
+SET GLOBAL query_cache_type= DEFAULT;

=== modified file 'mysql-test/r/row.result'
--- a/mysql-test/r/row.result	2008-02-29 11:07:47 +0000
+++ b/mysql-test/r/row.result	2009-02-19 14:48:28 +0000
@@ -443,3 +443,17 @@ SELECT ROW(a, 1) IN (SELECT SUM(b), 3) F
 ROW(a, 1) IN (SELECT SUM(b), 3)
 0
 DROP TABLE t1;
+create table t1 (a varchar(200),
+b int unsigned not null primary key auto_increment)
+default character set 'utf8';
+create table t2 (c varchar(200),
+d int unsigned not null primary key auto_increment)
+default character set 'latin1';
+insert into t1 (a) values('abc');
+insert into t2 (c) values('abc');
+select * from t1,t2 where (a,b) = (c,d);
+a	b	c	d
+abc	1	abc	1
+select host,user from mysql.user where (host,user) = ('localhost','test');
+host	user
+drop table t1,t2;

=== modified file 'mysql-test/r/trigger-compat.result'
--- a/mysql-test/r/trigger-compat.result	2009-02-16 14:47:53 +0000
+++ b/mysql-test/r/trigger-compat.result	2009-02-20 13:35:24 +0000
@@ -12,9 +12,7 @@ GRANT CREATE, TRIGGER ON mysqltest_db1.*
 ---> connection: wl2818_definer_con
 CREATE TABLE t1(num_value INT);
 CREATE TABLE t2(user_str TEXT);
-CREATE TRIGGER wl2818_trg1 BEFORE INSERT ON t1
-FOR EACH ROW
-INSERT INTO t2 VALUES(CURRENT_USER());
+CREATE TRIGGER wl2818_trg1 BEFORE INSERT ON t1 FOR EACH ROW INSERT INTO t2 VALUES(CURRENT_USER());
 
 ---> patching t1.TRG...
 

=== modified file 'mysql-test/r/variables.result'
--- a/mysql-test/r/variables.result	2009-01-31 15:53:35 +0000
+++ b/mysql-test/r/variables.result	2009-02-27 08:34:31 +0000
@@ -299,59 +299,107 @@ set @@rand_seed1=10000000,@@rand_seed2=1
 select ROUND(RAND(),5);
 ROUND(RAND(),5)
 0.02887
-show variables like '%alloc%';
+
+==+ Testing %alloc% system variables +==
+==+ NOTE:  These values *must* be a multiple of 1024 +==
+==+ Other values will be rounded down to nearest multiple +==
+
+==+ Show initial values +==
+SHOW VARIABLES WHERE variable_name IN ('range_alloc_block_size',
+'query_alloc_block_size', 'query_prealloc_size',
+'transaction_alloc_block_size', 'transaction_prealloc_size');
 Variable_name	Value
 query_alloc_block_size	8192
 query_prealloc_size	8192
 range_alloc_block_size	4096
 transaction_alloc_block_size	8192
 transaction_prealloc_size	4096
-select * from information_schema.session_variables where variable_name like '%alloc%' order by 1;
+==+ information_schema data +==
+SELECT * FROM information_schema.session_variables 
+WHERE variable_name IN ('range_alloc_block_size',
+'query_alloc_block_size', 'query_prealloc_size',
+'transaction_alloc_block_size', 'transaction_prealloc_size') ORDER BY 1;
 VARIABLE_NAME	VARIABLE_VALUE
 QUERY_ALLOC_BLOCK_SIZE	8192
 QUERY_PREALLOC_SIZE	8192
 RANGE_ALLOC_BLOCK_SIZE	4096
 TRANSACTION_ALLOC_BLOCK_SIZE	8192
 TRANSACTION_PREALLOC_SIZE	4096
-set @@range_alloc_block_size=1024*16;
+Testing values that are multiples of 1024
+set @@range_alloc_block_size=1024*15+1024;
+set @@query_alloc_block_size=1024*15+1024*2;
+set @@query_prealloc_size=1024*18-1024;
+set @@transaction_alloc_block_size=1024*21-1024*1;
+set @@transaction_prealloc_size=1024*21-2048;
+==+ Check manipulated values ==+
+select @@query_alloc_block_size;
+@@query_alloc_block_size
+17408
+SHOW VARIABLES WHERE variable_name IN ('range_alloc_block_size',
+'query_alloc_block_size', 'query_prealloc_size',
+'transaction_alloc_block_size', 'transaction_prealloc_size');
+Variable_name	Value
+query_alloc_block_size	17408
+query_prealloc_size	17408
+range_alloc_block_size	16384
+transaction_alloc_block_size	20480
+transaction_prealloc_size	19456
+==+ information_schema data +==
+SELECT * FROM information_schema.session_variables
+WHERE variable_name IN ('range_alloc_block_size',
+'query_alloc_block_size', 'query_prealloc_size',
+'transaction_alloc_block_size', 'transaction_prealloc_size') ORDER BY 1;
+VARIABLE_NAME	VARIABLE_VALUE
+QUERY_ALLOC_BLOCK_SIZE	17408
+QUERY_PREALLOC_SIZE	17408
+RANGE_ALLOC_BLOCK_SIZE	16384
+TRANSACTION_ALLOC_BLOCK_SIZE	20480
+TRANSACTION_PREALLOC_SIZE	19456
+==+ Manipulate variable values +==
+Testing values that are not 1024 multiples
+set @@range_alloc_block_size=1024*16+1023;
 set @@query_alloc_block_size=1024*17+2;
-set @@query_prealloc_size=1024*18;
+set @@query_prealloc_size=1024*18-1023;
 set @@transaction_alloc_block_size=1024*20-1;
 set @@transaction_prealloc_size=1024*21-1;
 select @@query_alloc_block_size;
 @@query_alloc_block_size
 17408
-show variables like '%alloc%';
+==+ Check manipulated values ==+
+SHOW VARIABLES WHERE variable_name IN ('range_alloc_block_size',
+'query_alloc_block_size', 'query_prealloc_size',
+'transaction_alloc_block_size', 'transaction_prealloc_size');
 Variable_name	Value
 query_alloc_block_size	17408
-query_prealloc_size	18432
+query_prealloc_size	17408
 range_alloc_block_size	16384
 transaction_alloc_block_size	19456
 transaction_prealloc_size	20480
-select * from information_schema.session_variables where variable_name like '%alloc%' order by 1;
+==+ information_schema data +==
+SELECT * FROM information_schema.session_variables 
+WHERE variable_name IN ('range_alloc_block_size',
+'query_alloc_block_size', 'query_prealloc_size',
+'transaction_alloc_block_size', 'transaction_prealloc_size') ORDER BY 1;
 VARIABLE_NAME	VARIABLE_VALUE
 QUERY_ALLOC_BLOCK_SIZE	17408
-QUERY_PREALLOC_SIZE	18432
+QUERY_PREALLOC_SIZE	17408
 RANGE_ALLOC_BLOCK_SIZE	16384
 TRANSACTION_ALLOC_BLOCK_SIZE	19456
 TRANSACTION_PREALLOC_SIZE	20480
+==+ Set values back to the default values +==
 set @@range_alloc_block_size=default;
 set @@query_alloc_block_size=default, @@query_prealloc_size=default;
 set transaction_alloc_block_size=default, @@transaction_prealloc_size=default;
-show variables like '%alloc%';
+==+ Check the values now that they are reset +==
+SHOW VARIABLES WHERE variable_name IN ('range_alloc_block_size',
+'query_alloc_block_size', 'query_prealloc_size',
+'transaction_alloc_block_size', 'transaction_prealloc_size');
 Variable_name	Value
 query_alloc_block_size	8192
 query_prealloc_size	8192
 range_alloc_block_size	4096
 transaction_alloc_block_size	8192
 transaction_prealloc_size	4096
-select * from information_schema.session_variables where variable_name like '%alloc%' order by 1;
-VARIABLE_NAME	VARIABLE_VALUE
-QUERY_ALLOC_BLOCK_SIZE	8192
-QUERY_PREALLOC_SIZE	8192
-RANGE_ALLOC_BLOCK_SIZE	4096
-TRANSACTION_ALLOC_BLOCK_SIZE	8192
-TRANSACTION_PREALLOC_SIZE	4096
 SELECT @@version LIKE 'non-existent';
 @@version LIKE 'non-existent'
 0

=== modified file 'mysql-test/r/view_grant.result'
--- a/mysql-test/r/view_grant.result	2008-11-12 15:23:22 +0000
+++ b/mysql-test/r/view_grant.result	2009-02-26 17:45:13 +0000
@@ -28,7 +28,7 @@ create view v2 as select * from mysqltes
 ERROR 42000: ANY command denied to user 'mysqltest_1'@'localhost' for table 't2'
 show create view v1;
 View	Create View	character_set_client	collation_connection
-v1	CREATE ALGORITHM=UNDEFINED DEFINER=`mysqltest_1`@`localhost` SQL SECURITY DEFINER VIEW `test`.`v1` AS select `mysqltest`.`t1`.`a` AS `a`,`mysqltest`.`t1`.`b` AS `b` from `mysqltest`.`t1`	latin1	latin1_swedish_ci
+v1	CREATE ALGORITHM=UNDEFINED DEFINER=`mysqltest_1`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `mysqltest`.`t1`.`a` AS `a`,`mysqltest`.`t1`.`b` AS `b` from `mysqltest`.`t1`	latin1	latin1_swedish_ci
 grant create view,drop,select on test.* to mysqltest_1@localhost;
 use test;
 alter view v1 as select * from mysqltest.t1;
@@ -309,7 +309,7 @@ grant create view,select on test.* to my
 create view v1 as select * from mysqltest.t1;
 show create view v1;
 View	Create View	character_set_client	collation_connection
-v1	CREATE ALGORITHM=UNDEFINED DEFINER=`mysqltest_1`@`localhost` SQL SECURITY DEFINER VIEW `test`.`v1` AS select `mysqltest`.`t1`.`a` AS `a`,`mysqltest`.`t1`.`b` AS `b` from `mysqltest`.`t1`	latin1	latin1_swedish_ci
+v1	CREATE ALGORITHM=UNDEFINED DEFINER=`mysqltest_1`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `mysqltest`.`t1`.`a` AS `a`,`mysqltest`.`t1`.`b` AS `b` from `mysqltest`.`t1`	latin1	latin1_swedish_ci
 revoke select on mysqltest.t1 from mysqltest_1@localhost;
 select * from v1;
 ERROR HY000: View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
@@ -912,6 +912,32 @@ c4
 DROP DATABASE mysqltest1;
 DROP DATABASE mysqltest2;
 DROP USER mysqltest_u1@localhost;
+CREATE DATABASE db1;
+USE db1;
+CREATE TABLE t1(f1 INT, f2 INT);
+CREATE VIEW v1 AS SELECT f1, f2 FROM t1;
+GRANT SELECT (f1) ON t1 TO foo;
+GRANT SELECT (f1) ON v1 TO foo;
+USE db1;
+SELECT f1 FROM t1;
+f1
+SELECT f2 FROM t1;
+ERROR 42000: SELECT command denied to user 'foo'@'localhost' for column 'f2' in table 't1'
+SELECT * FROM t1;
+ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 't1'
+SELECT f1 FROM v1;
+f1
+SELECT f2 FROM v1;
+ERROR 42000: SELECT command denied to user 'foo'@'localhost' for column 'f2' in table 'v1'
+SELECT * FROM v1;
+ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 'v1'
+USE test;
+REVOKE SELECT (f1) ON db1.t1 FROM foo;
+REVOKE SELECT (f1) ON db1.v1 FROM foo;
+DROP USER foo;
+DROP VIEW db1.v1;
+DROP TABLE db1.t1;
+DROP DATABASE db1;
 End of 5.0 tests.
 DROP VIEW IF EXISTS v1;
 DROP TABLE IF EXISTS t1;

=== modified file 'mysql-test/suite/backup/r/backup_backupdir.result'
--- a/mysql-test/suite/backup/r/backup_backupdir.result	2008-12-24 10:48:24 +0000
+++ b/mysql-test/suite/backup/r/backup_backupdir.result	2009-02-27 09:09:00 +0000
@@ -53,8 +53,8 @@ ERROR HY000: Can't create/write to file 
 Attempt to set the backupdir to something invalid.
 SET @@global.backupdir = 'This_is_really_stupid/not/there/at/all';
 Warnings:
-Warning	1733	The path specified for the system variable backupdir cannot be accessed or is invalid. ref: This_is_really_stupid/not/there/at/all
-Warning	1733	The path specified for the system variable backupdir cannot be accessed or is invalid. ref: This_is_really_stupid/not/there/at/all
+Warning	1737	The path specified for the system variable backupdir cannot be accessed or is invalid. ref: This_is_really_stupid/not/there/at/all
+Warning	1737	The path specified for the system variable backupdir cannot be accessed or is invalid. ref: This_is_really_stupid/not/there/at/all
 Cleanup
 Reset backupdir 
 SET @@global.backupdir = @@global.datadir;

=== modified file 'mysql-test/suite/backup/r/backup_db_grants.result'
--- a/mysql-test/suite/backup/r/backup_db_grants.result	2008-12-13 19:55:44 +0000
+++ b/mysql-test/suite/backup/r/backup_db_grants.result	2009-02-27 09:09:00 +0000
@@ -70,24 +70,24 @@ RESTORE FROM 'bup_db_grants.bak' OVERWRI
 backup_id
 #
 Warnings:
-#	1739	The grant 'ALTER ON bup_db_grants.*' for the user 'no_user'@'%' was skipped because the user does not exist.
-#	1739	The grant 'ALTER ROUTINE ON bup_db_grants.*' for the user 'no_user'@'%' was skipped because the user does not exist.
-#	1739	The grant 'CREATE ON bup_db_grants.*' for the user 'no_user'@'%' was skipped because the user does not exist.
-#	1739	The grant 'CREATE ROUTINE ON bup_db_grants.*' for the user 'no_user'@'%' was skipped because the user does not exist.
-#	1739	The grant 'CREATE TEMPORARY TABLES ON bup_db_grants.*' for the user 'no_user'@'%' was skipped because the user does not exist.
-#	1739	The grant 'CREATE VIEW ON bup_db_grants.*' for the user 'no_user'@'%' was skipped because the user does not exist.
-#	1739	The grant 'DELETE ON bup_db_grants.*' for the user 'no_user'@'%' was skipped because the user does not exist.
-#	1739	The grant 'DROP ON bup_db_grants.*' for the user 'no_user'@'%' was skipped because the user does not exist.
-#	1739	The grant 'EVENT ON bup_db_grants.*' for the user 'no_user'@'%' was skipped because the user does not exist.
-#	1739	The grant 'EXECUTE ON bup_db_grants.*' for the user 'no_user'@'%' was skipped because the user does not exist.
-#	1739	The grant 'INDEX ON bup_db_grants.*' for the user 'no_user'@'%' was skipped because the user does not exist.
-#	1739	The grant 'INSERT ON bup_db_grants.*' for the user 'no_user'@'%' was skipped because the user does not exist.
-#	1739	The grant 'LOCK TABLES ON bup_db_grants.*' for the user 'no_user'@'%' was skipped because the user does not exist.
-#	1739	The grant 'REFERENCES ON bup_db_grants.*' for the user 'no_user'@'%' was skipped because the user does not exist.
-#	1739	The grant 'SELECT ON bup_db_grants.*' for the user 'no_user'@'%' was skipped because the user does not exist.
-#	1739	The grant 'SHOW VIEW ON bup_db_grants.*' for the user 'no_user'@'%' was skipped because the user does not exist.
-#	1739	The grant 'TRIGGER ON bup_db_grants.*' for the user 'no_user'@'%' was skipped because the user does not exist.
-#	1739	The grant 'UPDATE ON bup_db_grants.*' for the user 'no_user'@'%' was skipped because the user does not exist.
+#	1743	The grant 'ALTER ON bup_db_grants.*' for the user 'no_user'@'%' was skipped because the user does not exist.
+#	1743	The grant 'ALTER ROUTINE ON bup_db_grants.*' for the user 'no_user'@'%' was skipped because the user does not exist.
+#	1743	The grant 'CREATE ON bup_db_grants.*' for the user 'no_user'@'%' was skipped because the user does not exist.
+#	1743	The grant 'CREATE ROUTINE ON bup_db_grants.*' for the user 'no_user'@'%' was skipped because the user does not exist.
+#	1743	The grant 'CREATE TEMPORARY TABLES ON bup_db_grants.*' for the user 'no_user'@'%' was skipped because the user does not exist.
+#	1743	The grant 'CREATE VIEW ON bup_db_grants.*' for the user 'no_user'@'%' was skipped because the user does not exist.
+#	1743	The grant 'DELETE ON bup_db_grants.*' for the user 'no_user'@'%' was skipped because the user does not exist.
+#	1743	The grant 'DROP ON bup_db_grants.*' for the user 'no_user'@'%' was skipped because the user does not exist.
+#	1743	The grant 'EVENT ON bup_db_grants.*' for the user 'no_user'@'%' was skipped because the user does not exist.
+#	1743	The grant 'EXECUTE ON bup_db_grants.*' for the user 'no_user'@'%' was skipped because the user does not exist.
+#	1743	The grant 'INDEX ON bup_db_grants.*' for the user 'no_user'@'%' was skipped because the user does not exist.
+#	1743	The grant 'INSERT ON bup_db_grants.*' for the user 'no_user'@'%' was skipped because the user does not exist.
+#	1743	The grant 'LOCK TABLES ON bup_db_grants.*' for the user 'no_user'@'%' was skipped because the user does not exist.
+#	1743	The grant 'REFERENCES ON bup_db_grants.*' for the user 'no_user'@'%' was skipped because the user does not exist.
+#	1743	The grant 'SELECT ON bup_db_grants.*' for the user 'no_user'@'%' was skipped because the user does not exist.
+#	1743	The grant 'SHOW VIEW ON bup_db_grants.*' for the user 'no_user'@'%' was skipped because the user does not exist.
+#	1743	The grant 'TRIGGER ON bup_db_grants.*' for the user 'no_user'@'%' was skipped because the user does not exist.
+#	1743	The grant 'UPDATE ON bup_db_grants.*' for the user 'no_user'@'%' was skipped because the user does not exist.
 SHOW TABLES FROM bup_db_grants;
 Tables_in_bup_db_grants
 s1
@@ -121,27 +121,27 @@ RESTORE FROM 'bup_db_grants.bak' OVERWRI
 backup_id
 #
 Warnings:
-#	1739	The grant 'INSERT ON bup_db_grants.*' for the user 'bup_user2'@'%' was skipped because the user does not exist.
-#	1739	The grant 'INSERT(b) ON bup_db_grants.s1' for the user 'bup_user2'@'%' was skipped because the user does not exist.
-#	1739	The grant 'SELECT(b) ON bup_db_grants.s1' for the user 'bup_user2'@'%' was skipped because the user does not exist.
-#	1739	The grant 'ALTER ON bup_db_grants.*' for the user 'no_user'@'%' was skipped because the user does not exist.
-#	1739	The grant 'ALTER ROUTINE ON bup_db_grants.*' for the user 'no_user'@'%' was skipped because the user does not exist.
-#	1739	The grant 'CREATE ON bup_db_grants.*' for the user 'no_user'@'%' was skipped because the user does not exist.
-#	1739	The grant 'CREATE ROUTINE ON bup_db_grants.*' for the user 'no_user'@'%' was skipped because the user does not exist.
-#	1739	The grant 'CREATE TEMPORARY TABLES ON bup_db_grants.*' for the user 'no_user'@'%' was skipped because the user does not exist.
-#	1739	The grant 'CREATE VIEW ON bup_db_grants.*' for the user 'no_user'@'%' was skipped because the user does not exist.
-#	1739	The grant 'DELETE ON bup_db_grants.*' for the user 'no_user'@'%' was skipped because the user does not exist.
-#	1739	The grant 'DROP ON bup_db_grants.*' for the user 'no_user'@'%' was skipped because the user does not exist.
-#	1739	The grant 'EVENT ON bup_db_grants.*' for the user 'no_user'@'%' was skipped because the user does not exist.
-#	1739	The grant 'EXECUTE ON bup_db_grants.*' for the user 'no_user'@'%' was skipped because the user does not exist.
-#	1739	The grant 'INDEX ON bup_db_grants.*' for the user 'no_user'@'%' was skipped because the user does not exist.
-#	1739	The grant 'INSERT ON bup_db_grants.*' for the user 'no_user'@'%' was skipped because the user does not exist.
-#	1739	The grant 'LOCK TABLES ON bup_db_grants.*' for the user 'no_user'@'%' was skipped because the user does not exist.
-#	1739	The grant 'REFERENCES ON bup_db_grants.*' for the user 'no_user'@'%' was skipped because the user does not exist.
-#	1739	The grant 'SELECT ON bup_db_grants.*' for the user 'no_user'@'%' was skipped because the user does not exist.
-#	1739	The grant 'SHOW VIEW ON bup_db_grants.*' for the user 'no_user'@'%' was skipped because the user does not exist.
-#	1739	The grant 'TRIGGER ON bup_db_grants.*' for the user 'no_user'@'%' was skipped because the user does not exist.
-#	1739	The grant 'UPDATE ON bup_db_grants.*' for the user 'no_user'@'%' was skipped because the user does not exist.
+#	1743	The grant 'INSERT ON bup_db_grants.*' for the user 'bup_user2'@'%' was skipped because the user does not exist.
+#	1743	The grant 'INSERT(b) ON bup_db_grants.s1' for the user 'bup_user2'@'%' was skipped because the user does not exist.
+#	1743	The grant 'SELECT(b) ON bup_db_grants.s1' for the user 'bup_user2'@'%' was skipped because the user does not exist.
+#	1743	The grant 'ALTER ON bup_db_grants.*' for the user 'no_user'@'%' was skipped because the user does not exist.
+#	1743	The grant 'ALTER ROUTINE ON bup_db_grants.*' for the user 'no_user'@'%' was skipped because the user does not exist.
+#	1743	The grant 'CREATE ON bup_db_grants.*' for the user 'no_user'@'%' was skipped because the user does not exist.
+#	1743	The grant 'CREATE ROUTINE ON bup_db_grants.*' for the user 'no_user'@'%' was skipped because the user does not exist.
+#	1743	The grant 'CREATE TEMPORARY TABLES ON bup_db_grants.*' for the user 'no_user'@'%' was skipped because the user does not exist.
+#	1743	The grant 'CREATE VIEW ON bup_db_grants.*' for the user 'no_user'@'%' was skipped because the user does not exist.
+#	1743	The grant 'DELETE ON bup_db_grants.*' for the user 'no_user'@'%' was skipped because the user does not exist.
+#	1743	The grant 'DROP ON bup_db_grants.*' for the user 'no_user'@'%' was skipped because the user does not exist.
+#	1743	The grant 'EVENT ON bup_db_grants.*' for the user 'no_user'@'%' was skipped because the user does not exist.
+#	1743	The grant 'EXECUTE ON bup_db_grants.*' for the user 'no_user'@'%' was skipped because the user does not exist.
+#	1743	The grant 'INDEX ON bup_db_grants.*' for the user 'no_user'@'%' was skipped because the user does not exist.
+#	1743	The grant 'INSERT ON bup_db_grants.*' for the user 'no_user'@'%' was skipped because the user does not exist.
+#	1743	The grant 'LOCK TABLES ON bup_db_grants.*' for the user 'no_user'@'%' was skipped because the user does not exist.
+#	1743	The grant 'REFERENCES ON bup_db_grants.*' for the user 'no_user'@'%' was skipped because the user does not exist.
+#	1743	The grant 'SELECT ON bup_db_grants.*' for the user 'no_user'@'%' was skipped because the user does not exist.
+#	1743	The grant 'SHOW VIEW ON bup_db_grants.*' for the user 'no_user'@'%' was skipped because the user does not exist.
+#	1743	The grant 'TRIGGER ON bup_db_grants.*' for the user 'no_user'@'%' was skipped because the user does not exist.
+#	1743	The grant 'UPDATE ON bup_db_grants.*' for the user 'no_user'@'%' was skipped because the user does not exist.
 SHOW TABLES FROM bup_db_grants;
 Tables_in_bup_db_grants
 s1

=== modified file 'mysql-test/suite/falcon/r/falcon_bug_33148.result'
--- a/mysql-test/suite/falcon/r/falcon_bug_33148.result	2008-12-18 15:19:41 +0000
+++ b/mysql-test/suite/falcon/r/falcon_bug_33148.result	2009-02-19 17:36:09 +0000
@@ -8,11 +8,11 @@ CREATE TABLESPACE TS1
   ADD DATAFILE 'ts1.fts'
   EXTENT_SIZE 0
   ENGINE=Falcon;
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE `t1` (
   `a` int(11) DEFAULT NULL
 ) /*!50100 TABLESPACE `ts1` */ ENGINE=Falcon DEFAULT CHARSET=latin1;
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 DROP TABLE t1;
 DROP TABLESPACE ts1 ENGINE=Falcon;

=== modified file 'mysql-test/suite/ndb_team/t/ndb_autodiscover.test'
--- a/mysql-test/suite/ndb_team/t/ndb_autodiscover.test	2008-10-29 08:45:14 +0000
+++ b/mysql-test/suite/ndb_team/t/ndb_autodiscover.test	2009-02-20 13:35:24 +0000
@@ -1,6 +1,12 @@
 -- source include/have_ndb.inc
 -- source include/not_embedded.inc
 
+# Bug#41308: Test main.ndb_autodiscover.test doesn't work on Windows due
+#            to 'grep' calls
+# Test is currently disabled on Windows via the next line until this bug
+# can be resolved.
+--source include/not_windows.inc
+
 --disable_warnings
 drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9,t10;
 --enable_warnings

=== modified file 'mysql-test/suite/parts/r/partition_auto_increment_ndb.result'
--- a/mysql-test/suite/parts/r/partition_auto_increment_ndb.result	2009-02-11 12:11:20 +0000
+++ b/mysql-test/suite/parts/r/partition_auto_increment_ndb.result	2009-02-20 12:37:37 +0000
@@ -649,6 +649,7 @@ INSERT INTO t1 VALUES (3, NULL);
 INSERT INTO t1 VALUES (3, NULL), (2, 0), (2, NULL);
 INSERT INTO t1 VALUES (2, 2);
 # ERROR (only OK if Blackhole/NDB) should give ER_DUP_KEY or ER_DUP_ENTRY
+# mysql_errno: 0
 INSERT INTO t1 VALUES (2, 22), (2, NULL);
 SELECT * FROM t1 ORDER BY c1,c2;
 c1	c2

=== modified file 'mysql-test/suite/rpl/r/rpl_heartbeat.result'
--- a/mysql-test/suite/rpl/r/rpl_heartbeat.result	2009-01-26 16:03:39 +0000
+++ b/mysql-test/suite/rpl/r/rpl_heartbeat.result	2009-02-27 09:09:00 +0000
@@ -11,13 +11,13 @@ Variable_name	Slave_heartbeat_period
 Value	5.000
 change master to master_host='127.0.0.1',master_port=MASTER_PORT, master_user='root', master_heartbeat_period= 0.0009999;
 Warnings:
-Warning	1678	The requested value for the heartbeat period  is less than 1 msec.  The period is reset to zero which means no heartbeats will be sending
+Warning	1624	The requested value for the heartbeat period  is less than 1 msec.  The period is reset to zero which means no heartbeats will be sending
 show status like 'Slave_heartbeat_period';;
 Variable_name	Slave_heartbeat_period
 Value	0.000
 change master to master_host='127.0.0.1',master_port=MASTER_PORT, master_user='root', master_heartbeat_period= 4294967;
 Warnings:
-Warning	1678	The requested value for the heartbeat period  exceeds the value of `slave_net_timeout' sec.  A sensible value for the period should be less than the timeout.
+Warning	1624	The requested value for the heartbeat period  exceeds the value of `slave_net_timeout' sec.  A sensible value for the period should be less than the timeout.
 show status like 'Slave_heartbeat_period';;
 Variable_name	Slave_heartbeat_period
 Value	4294967.000
@@ -29,7 +29,7 @@ reset slave;
 set @@global.slave_net_timeout= 5;
 change master to master_host='127.0.0.1',master_port=MASTER_PORT, master_user='root', master_heartbeat_period= 5.001;
 Warnings:
-Warning	1678	The requested value for the heartbeat period  exceeds the value of `slave_net_timeout' sec.  A sensible value for the period should be less than the timeout.
+Warning	1624	The requested value for the heartbeat period  exceeds the value of `slave_net_timeout' sec.  A sensible value for the period should be less than the timeout.
 show status like 'Slave_heartbeat_period';;
 Variable_name	Slave_heartbeat_period
 Value	5.001
@@ -41,10 +41,10 @@ Variable_name	Slave_heartbeat_period
 Value	4.000
 set @@global.slave_net_timeout= 3 /* must be a warning */;
 Warnings:
-Warning	1678	The currect value for master_heartbeat_period exceeds the new value of `slave_net_timeout' sec. A sensible value for the period should be less than the timeout.
+Warning	1624	The currect value for master_heartbeat_period exceeds the new value of `slave_net_timeout' sec. A sensible value for the period should be less than the timeout.
 reset slave;
 drop table if exists t1;
-set @@global.slave_net_timeout= 10;
+set @@global.slave_net_timeout= 20;
 change master to master_host='127.0.0.1',master_port=MASTER_PORT, master_user='root', master_heartbeat_period= 0.5;
 show status like 'Slave_heartbeat_period';;
 Variable_name	Slave_heartbeat_period

=== modified file 'mysql-test/suite/rpl/r/rpl_locktrans_falcon.result'
--- a/mysql-test/suite/rpl/r/rpl_locktrans_falcon.result	2008-12-15 12:41:31 +0000
+++ b/mysql-test/suite/rpl/r/rpl_locktrans_falcon.result	2009-02-27 09:09:00 +0000
@@ -27,8 +27,8 @@ UNLOCK TABLES;
 # Valid syntax for transactional locks.
 LOCK TABLE t1 IN SHARE MODE, t2 IN EXCLUSIVE MODE;
 Warnings:
-Warning	1622	Converted to non-transactional lock on 't1'
-Warning	1622	Converted to non-transactional lock on 't2'
+Warning	1628	Converted to non-transactional lock on 't1'
+Warning	1628	Converted to non-transactional lock on 't2'
 UNLOCK TABLES;
 #
 # Valid syntax for aliases with and without 'AS'.
@@ -36,19 +36,19 @@ LOCK TABLE t1 AS a1 READ, t2 a2 WRITE;
 UNLOCK TABLES;
 LOCK TABLE t1 AS a1 IN SHARE MODE, t2 a2 IN EXCLUSIVE MODE;
 Warnings:
-Warning	1622	Converted to non-transactional lock on 'a1'
-Warning	1622	Converted to non-transactional lock on 'a2'
+Warning	1628	Converted to non-transactional lock on 'a1'
+Warning	1628	Converted to non-transactional lock on 'a2'
 UNLOCK TABLES;
 #
 # Transactional locks taken on a view.
 CREATE VIEW v1 AS SELECT * FROM t1, t2 WHERE t1.c1 = t2.c2;
 LOCK TABLE v1 IN SHARE MODE;
 Warnings:
-Warning	1622	Converted to non-transactional lock on 't1'
-Warning	1622	Converted to non-transactional lock on 't2'
+Warning	1628	Converted to non-transactional lock on 't1'
+Warning	1628	Converted to non-transactional lock on 't2'
 LOCK TABLE v1 IN EXCLUSIVE MODE;
 Warnings:
-Warning	1622	Converted to non-transactional lock on 'v1'
+Warning	1628	Converted to non-transactional lock on 'v1'
 UNLOCK TABLES;
 DROP VIEW v1;
 #
@@ -101,12 +101,12 @@ ERROR 42000: You have an error in your S
 # Implicit lock method conversion due to mix in statement.
 LOCK TABLE t1 READ, t2 IN EXCLUSIVE MODE;
 Warnings:
-Warning	1622	Converted to non-transactional lock on 't2'
+Warning	1628	Converted to non-transactional lock on 't2'
 UNLOCK TABLES;
 # Lock t1 share (converted to read), t2 write.
 LOCK TABLE t1 IN SHARE MODE, t2 WRITE;
 Warnings:
-Warning	1622	Converted to non-transactional lock on 't1'
+Warning	1628	Converted to non-transactional lock on 't1'
 # Show t1 is read locked, t2 write locked.
 INSERT INTO t1 SELECT * FROM t2;
 ERROR HY000: Table 't1' was locked with a READ lock and can't be updated
@@ -117,8 +117,8 @@ INSERT INTO t2 SELECT * FROM t1;
 # Lock t1 exclusive (converted to write), t2 share (converted to read).
 LOCK TABLE t1 IN EXCLUSIVE MODE, t2 IN SHARE MODE;
 Warnings:
-Warning	1622	Converted to non-transactional lock on 't1'
-Warning	1622	Converted to non-transactional lock on 't2'
+Warning	1628	Converted to non-transactional lock on 't1'
+Warning	1628	Converted to non-transactional lock on 't2'
 # Show t1 is write locked, t2 read locked.
 INSERT INTO t1 SELECT * FROM t2;
 INSERT INTO t2 SELECT * FROM t1;
@@ -142,8 +142,8 @@ ERROR HY000: Cannot convert to non-trans
 ## Error is reported on first table only. Show both errors:
 SHOW WARNINGS;
 Level	Code	Message
-Error	1623	Cannot convert to non-transactional lock in strict mode on 't1'
-Error	1623	Cannot convert to non-transactional lock in strict mode on 't2'
+Error	1629	Cannot convert to non-transactional lock in strict mode on 't1'
+Error	1629	Cannot convert to non-transactional lock in strict mode on 't2'
 UNLOCK TABLES;
 SET @@SQL_MODE= @wl3561_save_sql_mode;
 #
@@ -163,7 +163,7 @@ CREATE TABLE t4 (c4 INT) ENGINE= MyISAM;
 # Request a transactional lock, which is converted to non-transactional.
 LOCK TABLE t4 IN SHARE MODE;
 Warnings:
-Warning	1622	Converted to non-transactional lock on 't4'
+Warning	1628	Converted to non-transactional lock on 't4'
 # Try a conflict with the existing non-transactional lock.
 INSERT INTO t4 VALUES(444);
 ERROR HY000: Table 't4' was locked with a READ lock and can't be updated
@@ -180,8 +180,8 @@ CREATE VIEW v1 AS SELECT * FROM t3, t4 W
 # Request a share lock on the view, which is converted to read locks.
 LOCK TABLE v1 IN SHARE MODE;
 Warnings:
-Warning	1622	Converted to non-transactional lock on 't3'
-Warning	1622	Converted to non-transactional lock on 't4'
+Warning	1628	Converted to non-transactional lock on 't3'
+Warning	1628	Converted to non-transactional lock on 't4'
 # Show that read locks on the base tables prohibit writing ...
 INSERT INTO t3 SELECT * FROM t4;
 ERROR HY000: Table 't3' was locked with a READ lock and can't be updated
@@ -197,7 +197,7 @@ COUNT(*)
 ## Report conversion on view due to existing non-transactional locks.
 LOCK TABLE v1 IN EXCLUSIVE MODE;
 Warnings:
-Warning	1622	Converted to non-transactional lock on 'v1'
+Warning	1628	Converted to non-transactional lock on 'v1'
 INSERT INTO t3 VALUES(333);
 INSERT INTO t4 VALUES(444);
 INSERT INTO t1 VALUES(111);
@@ -206,8 +206,8 @@ UNLOCK TABLES;
 ## Now report conversion on base table again.
 LOCK TABLE v1 IN EXCLUSIVE MODE;
 Warnings:
-Warning	1622	Converted to non-transactional lock on 't3'
-Warning	1622	Converted to non-transactional lock on 't4'
+Warning	1628	Converted to non-transactional lock on 't3'
+Warning	1628	Converted to non-transactional lock on 't4'
 INSERT INTO t3 VALUES(333);
 INSERT INTO t4 VALUES(444);
 INSERT INTO t1 VALUES(111);

=== modified file 'mysql-test/suite/rpl/r/rpl_locktrans_innodb.result'
--- a/mysql-test/suite/rpl/r/rpl_locktrans_innodb.result	2009-01-26 16:03:39 +0000
+++ b/mysql-test/suite/rpl/r/rpl_locktrans_innodb.result	2009-02-27 09:09:00 +0000
@@ -101,12 +101,12 @@ ERROR 42000: You have an error in your S
 # Implicit lock method conversion due to mix in statement.
 LOCK TABLE t1 READ, t2 IN EXCLUSIVE MODE;
 Warnings:
-Warning	1622	Converted to non-transactional lock on 't2'
+Warning	1628	Converted to non-transactional lock on 't2'
 UNLOCK TABLES;
 # Lock t1 share (converted to read), t2 write.
 LOCK TABLE t1 IN SHARE MODE, t2 WRITE;
 Warnings:
-Warning	1622	Converted to non-transactional lock on 't1'
+Warning	1628	Converted to non-transactional lock on 't1'
 # Show t1 is read locked, t2 write locked.
 INSERT INTO t1 SELECT * FROM t2;
 ERROR HY000: Table 't1' was locked with a READ lock and can't be updated
@@ -117,8 +117,8 @@ INSERT INTO t2 SELECT * FROM t1;
 # Lock t1 exclusive (converted to write), t2 share (converted to read).
 LOCK TABLE t1 IN EXCLUSIVE MODE, t2 IN SHARE MODE;
 Warnings:
-Warning	1622	Converted to non-transactional lock on 't1'
-Warning	1622	Converted to non-transactional lock on 't2'
+Warning	1628	Converted to non-transactional lock on 't1'
+Warning	1628	Converted to non-transactional lock on 't2'
 # Show t1 is write locked, t2 read locked.
 INSERT INTO t1 SELECT * FROM t2;
 INSERT INTO t2 SELECT * FROM t1;
@@ -142,8 +142,8 @@ ERROR HY000: Cannot convert to non-trans
 ## Error is reported on first table only. Show both errors:
 SHOW WARNINGS;
 Level	Code	Message
-Error	1623	Cannot convert to non-transactional lock in strict mode on 't1'
-Error	1623	Cannot convert to non-transactional lock in strict mode on 't2'
+Error	1629	Cannot convert to non-transactional lock in strict mode on 't1'
+Error	1629	Cannot convert to non-transactional lock in strict mode on 't2'
 UNLOCK TABLES;
 SET @@SQL_MODE= @wl3561_save_sql_mode;
 #
@@ -163,7 +163,7 @@ CREATE TABLE t4 (c4 INT) ENGINE= MyISAM;
 # Request a transactional lock, which is converted to non-transactional.
 LOCK TABLE t4 IN SHARE MODE;
 Warnings:
-Warning	1622	Converted to non-transactional lock on 't4'
+Warning	1628	Converted to non-transactional lock on 't4'
 # Try a conflict with the existing non-transactional lock.
 INSERT INTO t4 VALUES(444);
 ERROR HY000: Table 't4' was locked with a READ lock and can't be updated
@@ -180,8 +180,8 @@ CREATE VIEW v1 AS SELECT * FROM t3, t4 W
 # Request a share lock on the view, which is converted to read locks.
 LOCK TABLE v1 IN SHARE MODE;
 Warnings:
-Warning	1622	Converted to non-transactional lock on 't3'
-Warning	1622	Converted to non-transactional lock on 't4'
+Warning	1628	Converted to non-transactional lock on 't3'
+Warning	1628	Converted to non-transactional lock on 't4'
 # Show that read locks on the base tables prohibit writing ...
 INSERT INTO t3 SELECT * FROM t4;
 ERROR HY000: Table 't3' was locked with a READ lock and can't be updated
@@ -197,7 +197,7 @@ COUNT(*)
 ## Report conversion on view due to existing non-transactional locks.
 LOCK TABLE v1 IN EXCLUSIVE MODE;
 Warnings:
-Warning	1622	Converted to non-transactional lock on 'v1'
+Warning	1628	Converted to non-transactional lock on 'v1'
 INSERT INTO t3 VALUES(333);
 INSERT INTO t4 VALUES(444);
 INSERT INTO t1 VALUES(111);
@@ -206,8 +206,8 @@ UNLOCK TABLES;
 ## Now report conversion on base table again.
 LOCK TABLE v1 IN EXCLUSIVE MODE;
 Warnings:
-Warning	1622	Converted to non-transactional lock on 't3'
-Warning	1622	Converted to non-transactional lock on 't4'
+Warning	1628	Converted to non-transactional lock on 't3'
+Warning	1628	Converted to non-transactional lock on 't4'
 INSERT INTO t3 VALUES(333);
 INSERT INTO t4 VALUES(444);
 INSERT INTO t1 VALUES(111);

=== modified file 'mysql-test/suite/rpl/r/rpl_locktrans_myisam.result'
--- a/mysql-test/suite/rpl/r/rpl_locktrans_myisam.result	2008-12-24 10:48:24 +0000
+++ b/mysql-test/suite/rpl/r/rpl_locktrans_myisam.result	2009-02-27 09:09:00 +0000
@@ -68,8 +68,8 @@ UNLOCK TABLES;
 # Valid syntax for transactional locks.
 LOCK TABLE t1 IN SHARE MODE, t2 IN EXCLUSIVE MODE;
 Warnings:
-Warning	1622	Converted to non-transactional lock on 't1'
-Warning	1622	Converted to non-transactional lock on 't2'
+Warning	1628	Converted to non-transactional lock on 't1'
+Warning	1628	Converted to non-transactional lock on 't2'
 UNLOCK TABLES;
 #
 # Valid syntax for aliases with and without 'AS'.
@@ -77,19 +77,19 @@ LOCK TABLE t1 AS a1 READ, t2 a2 WRITE;
 UNLOCK TABLES;
 LOCK TABLE t1 AS a1 IN SHARE MODE, t2 a2 IN EXCLUSIVE MODE;
 Warnings:
-Warning	1622	Converted to non-transactional lock on 'a1'
-Warning	1622	Converted to non-transactional lock on 'a2'
+Warning	1628	Converted to non-transactional lock on 'a1'
+Warning	1628	Converted to non-transactional lock on 'a2'
 UNLOCK TABLES;
 #
 # Transactional locks taken on a view.
 CREATE VIEW v1 AS SELECT * FROM t1, t2 WHERE t1.c1 = t2.c2;
 LOCK TABLE v1 IN SHARE MODE;
 Warnings:
-Warning	1622	Converted to non-transactional lock on 't1'
-Warning	1622	Converted to non-transactional lock on 't2'
+Warning	1628	Converted to non-transactional lock on 't1'
+Warning	1628	Converted to non-transactional lock on 't2'
 LOCK TABLE v1 IN EXCLUSIVE MODE;
 Warnings:
-Warning	1622	Converted to non-transactional lock on 'v1'
+Warning	1628	Converted to non-transactional lock on 'v1'
 UNLOCK TABLES;
 DROP VIEW v1;
 #
@@ -142,12 +142,12 @@ ERROR 42000: You have an error in your S
 # Implicit lock method conversion due to mix in statement.
 LOCK TABLE t1 READ, t2 IN EXCLUSIVE MODE;
 Warnings:
-Warning	1622	Converted to non-transactional lock on 't2'
+Warning	1628	Converted to non-transactional lock on 't2'
 UNLOCK TABLES;
 # Lock t1 share (converted to read), t2 write.
 LOCK TABLE t1 IN SHARE MODE, t2 WRITE;
 Warnings:
-Warning	1622	Converted to non-transactional lock on 't1'
+Warning	1628	Converted to non-transactional lock on 't1'
 # Show t1 is read locked, t2 write locked.
 INSERT INTO t1 SELECT * FROM t2;
 ERROR HY000: Table 't1' was locked with a READ lock and can't be updated
@@ -158,8 +158,8 @@ INSERT INTO t2 SELECT * FROM t1;
 # Lock t1 exclusive (converted to write), t2 share (converted to read).
 LOCK TABLE t1 IN EXCLUSIVE MODE, t2 IN SHARE MODE;
 Warnings:
-Warning	1622	Converted to non-transactional lock on 't1'
-Warning	1622	Converted to non-transactional lock on 't2'
+Warning	1628	Converted to non-transactional lock on 't1'
+Warning	1628	Converted to non-transactional lock on 't2'
 # Show t1 is write locked, t2 read locked.
 INSERT INTO t1 SELECT * FROM t2;
 INSERT INTO t2 SELECT * FROM t1;
@@ -183,8 +183,8 @@ ERROR HY000: Cannot convert to non-trans
 ## Error is reported on first table only. Show both errors:
 SHOW WARNINGS;
 Level	Code	Message
-Error	1623	Cannot convert to non-transactional lock in strict mode on 't1'
-Error	1623	Cannot convert to non-transactional lock in strict mode on 't2'
+Error	1629	Cannot convert to non-transactional lock in strict mode on 't1'
+Error	1629	Cannot convert to non-transactional lock in strict mode on 't2'
 UNLOCK TABLES;
 SET @@SQL_MODE= @wl3561_save_sql_mode;
 #
@@ -204,7 +204,7 @@ CREATE TABLE t4 (c4 INT) ENGINE= MyISAM;
 # Request a transactional lock, which is converted to non-transactional.
 LOCK TABLE t4 IN SHARE MODE;
 Warnings:
-Warning	1622	Converted to non-transactional lock on 't4'
+Warning	1628	Converted to non-transactional lock on 't4'
 # Try a conflict with the existing non-transactional lock.
 INSERT INTO t4 VALUES(444);
 ERROR HY000: Table 't4' was locked with a READ lock and can't be updated
@@ -221,8 +221,8 @@ CREATE VIEW v1 AS SELECT * FROM t3, t4 W
 # Request a share lock on the view, which is converted to read locks.
 LOCK TABLE v1 IN SHARE MODE;
 Warnings:
-Warning	1622	Converted to non-transactional lock on 't3'
-Warning	1622	Converted to non-transactional lock on 't4'
+Warning	1628	Converted to non-transactional lock on 't3'
+Warning	1628	Converted to non-transactional lock on 't4'
 # Show that read locks on the base tables prohibit writing ...
 INSERT INTO t3 SELECT * FROM t4;
 ERROR HY000: Table 't3' was locked with a READ lock and can't be updated
@@ -238,7 +238,7 @@ COUNT(*)
 ## Report conversion on view due to existing non-transactional locks.
 LOCK TABLE v1 IN EXCLUSIVE MODE;
 Warnings:
-Warning	1622	Converted to non-transactional lock on 'v1'
+Warning	1628	Converted to non-transactional lock on 'v1'
 INSERT INTO t3 VALUES(333);
 INSERT INTO t4 VALUES(444);
 INSERT INTO t1 VALUES(111);
@@ -247,8 +247,8 @@ UNLOCK TABLES;
 ## Now report conversion on base table again.
 LOCK TABLE v1 IN EXCLUSIVE MODE;
 Warnings:
-Warning	1622	Converted to non-transactional lock on 't3'
-Warning	1622	Converted to non-transactional lock on 't4'
+Warning	1628	Converted to non-transactional lock on 't3'
+Warning	1628	Converted to non-transactional lock on 't4'
 INSERT INTO t3 VALUES(333);
 INSERT INTO t4 VALUES(444);
 INSERT INTO t1 VALUES(111);

=== modified file 'mysql-test/suite/rpl/r/rpl_row_until.result'
--- a/mysql-test/suite/rpl/r/rpl_row_until.result	2009-02-02 15:58:48 +0000
+++ b/mysql-test/suite/rpl/r/rpl_row_until.result	2009-02-19 20:37:38 +0000
@@ -4,16 +4,17 @@ reset master;
 reset slave;
 drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
 start slave;
+CREATE TABLE t1(n INT NOT NULL AUTO_INCREMENT PRIMARY KEY);
+INSERT INTO t1 VALUES (1),(2),(3),(4);
+DROP TABLE t1;
+CREATE TABLE t2(n INT NOT NULL AUTO_INCREMENT PRIMARY KEY);
+INSERT INTO t2 VALUES (1),(2);
+INSERT INTO t2 VALUES (3),(4);
+DROP TABLE t2;
 include/stop_slave.inc
-create table t1(n int not null auto_increment primary key);
-insert into t1 values (1),(2),(3),(4);
-drop table t1;
-create table t2(n int not null auto_increment primary key);
-insert into t2 values (1),(2);
-insert into t2 values (3),(4);
-drop table t2;
-start slave until master_log_file='master-bin.000001', master_log_pos=455;
-select * from t1;
+RESET SLAVE;
+START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=master_pos_drop_t1
+SELECT * FROM t1;
 n
 1
 2
@@ -23,10 +24,10 @@ SHOW SLAVE STATUS;
 Slave_IO_State	#
 Master_Host	127.0.0.1
 Master_User	root
-Master_Port	MASTER_PORT
+Master_Port	#
 Connect_Retry	1
 Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	1162
+Read_Master_Log_Pos	#
 Relay_Log_File	#
 Relay_Log_Pos	#
 Relay_Master_Log_File	master-bin.000001
@@ -41,11 +42,11 @@ Replicate_Wild_Ignore_Table	
 Last_Errno	0
 Last_Error	
 Skip_Counter	0
-Exec_Master_Log_Pos	455
+Exec_Master_Log_Pos	MASTER_POS_DROP_T1
 Relay_Log_Space	#
 Until_Condition	Master
 Until_Log_File	master-bin.000001
-Until_Log_Pos	455
+Until_Log_Pos	MASTER_POS_DROP_T1
 Master_SSL_Allowed	No
 Master_SSL_CA_File	
 Master_SSL_CA_Path	
@@ -60,8 +61,8 @@ Last_SQL_Errno	0
 Last_SQL_Error	
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
-start slave until master_log_file='master-no-such-bin.000001', master_log_pos=291;
-select * from t1;
+START SLAVE UNTIL MASTER_LOG_FILE='master-no-such-bin.000001', MASTER_LOG_POS=291;
+SELECT * FROM t1;
 n
 1
 2
@@ -71,10 +72,10 @@ SHOW SLAVE STATUS;
 Slave_IO_State	#
 Master_Host	127.0.0.1
 Master_User	root
-Master_Port	MASTER_PORT
+Master_Port	#
 Connect_Retry	1
 Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	1162
+Read_Master_Log_Pos	#
 Relay_Log_File	#
 Relay_Log_Pos	#
 Relay_Master_Log_File	master-bin.000001
@@ -89,7 +90,7 @@ Replicate_Wild_Ignore_Table	
 Last_Errno	0
 Last_Error	
 Skip_Counter	0
-Exec_Master_Log_Pos	455
+Exec_Master_Log_Pos	MASTER_POS_DROP_T1
 Relay_Log_Space	#
 Until_Condition	Master
 Until_Log_File	master-no-such-bin.000001
@@ -108,8 +109,8 @@ Last_SQL_Errno	0
 Last_SQL_Error	
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
-start slave until relay_log_file='slave-relay-bin.000004', relay_log_pos=1016;
-select * from t2;
+START SLAVE UNTIL RELAY_LOG_FILE='slave-relay-bin.000002', RELAY_LOG_POS=relay_pos_insert1_t2
+SELECT * FROM t2;
 n
 1
 2
@@ -117,10 +118,10 @@ SHOW SLAVE STATUS;
 Slave_IO_State	#
 Master_Host	127.0.0.1
 Master_User	root
-Master_Port	MASTER_PORT
+Master_Port	#
 Connect_Retry	1
 Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	1162
+Read_Master_Log_Pos	#
 Relay_Log_File	#
 Relay_Log_Pos	#
 Relay_Master_Log_File	master-bin.000001
@@ -135,11 +136,11 @@ Replicate_Wild_Ignore_Table	
 Last_Errno	0
 Last_Error	
 Skip_Counter	0
-Exec_Master_Log_Pos	869
+Exec_Master_Log_Pos	MASTER_POS_INSERT1_T2
 Relay_Log_Space	#
 Until_Condition	Relay
-Until_Log_File	slave-relay-bin.000004
-Until_Log_Pos	1016
+Until_Log_File	slave-relay-bin.000002
+Until_Log_Pos	RELAY_POS_INSERT1_T2
 Master_SSL_Allowed	No
 Master_SSL_CA_File	
 Master_SSL_CA_Path	
@@ -154,17 +155,17 @@ Last_SQL_Errno	0
 Last_SQL_Error	
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
-start slave;
+START SLAVE;
 include/stop_slave.inc
-start slave sql_thread until master_log_file='master-bin.000001', master_log_pos=740;
+START SLAVE SQL_THREAD UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=master_pos_create_t2
 SHOW SLAVE STATUS;
 Slave_IO_State	#
 Master_Host	127.0.0.1
 Master_User	root
-Master_Port	MASTER_PORT
+Master_Port	#
 Connect_Retry	1
 Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	1162
+Read_Master_Log_Pos	#
 Relay_Log_File	#
 Relay_Log_Pos	#
 Relay_Master_Log_File	master-bin.000001
@@ -179,11 +180,11 @@ Replicate_Wild_Ignore_Table	
 Last_Errno	0
 Last_Error	
 Skip_Counter	0
-Exec_Master_Log_Pos	1162
+Exec_Master_Log_Pos	MASTER_POS_DROP_T2
 Relay_Log_Space	#
 Until_Condition	Master
 Until_Log_File	master-bin.000001
-Until_Log_Pos	740
+Until_Log_Pos	MASTER_POS_CREATE_T2
 Master_SSL_Allowed	No
 Master_SSL_CA_File	
 Master_SSL_CA_Path	
@@ -198,17 +199,17 @@ Last_SQL_Errno	0
 Last_SQL_Error	
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
-start slave until master_log_file='master-bin', master_log_pos=561;
+START SLAVE UNTIL MASTER_LOG_FILE='master-bin', MASTER_LOG_POS=561;
 ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
-start slave until master_log_file='master-bin.000001', master_log_pos=561, relay_log_pos=12;
+START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=561, RELAY_LOG_POS=12;
 ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
-start slave until master_log_file='master-bin.000001';
+START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001';
 ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
-start slave until relay_log_file='slave-relay-bin.000002';
+START SLAVE UNTIL RELAY_LOG_FILE='slave-relay-bin.000009';
 ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
-start slave until relay_log_file='slave-relay-bin.000002', master_log_pos=561;
+START SLAVE UNTIL RELAY_LOG_FILE='slave-relay-bin.000002', MASTER_LOG_POS=561;
 ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
-start slave;
-start slave until master_log_file='master-bin.000001', master_log_pos=740;
+START SLAVE;
+START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=740;
 Warnings:
 Note	1254	Slave is already running

=== added file 'mysql-test/suite/rpl/r/rpl_slave_load_in.result'
--- a/mysql-test/suite/rpl/r/rpl_slave_load_in.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/r/rpl_slave_load_in.result	2009-02-21 09:36:07 +0000
@@ -0,0 +1,10 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+create table t1(a int not null auto_increment, b int, primary key(a));
+load data infile '../../std_data/rpl_loaddata.dat' into table t1;
+Comparing tables master:test.t1 and slave:test.t1
+drop table t1;

=== added file 'mysql-test/suite/rpl/r/rpl_temp_table_mix_row.result'
--- a/mysql-test/suite/rpl/r/rpl_temp_table_mix_row.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/r/rpl_temp_table_mix_row.result	2009-02-23 03:26:38 +0000
@@ -0,0 +1,26 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+==== Initialize ====
+[on master]
+CREATE TABLE t1 (a CHAR(48));
+CREATE TEMPORARY TABLE t1_tmp1(a INT);
+INSERT INTO t1 VALUES (UUID());
+[on slave]
+==== Verify results on slave ====
+SHOW STATUS LIKE "Slave_open_temp_tables";
+Variable_name	Value
+Slave_open_temp_tables	1
+[on master]
+[on slave]
+==== Verify results on slave ====
+SHOW STATUS LIKE "Slave_open_temp_tables";
+Variable_name	Value
+Slave_open_temp_tables	0
+==== Clean up ====
+[on master]
+DROP TABLE t1;
+[on slave]

=== modified file 'mysql-test/suite/rpl/t/disabled.def'
--- a/mysql-test/suite/rpl/t/disabled.def	2009-02-14 11:23:14 +0000
+++ b/mysql-test/suite/rpl/t/disabled.def	2009-02-19 22:10:31 +0000
@@ -12,7 +12,6 @@
 
 rpl_extraColmaster_innodb  : BUG#41097 2008-12-12 sven result files for rpl_extraColmaster_myisam, rpl_extraColmaster_innodb are gone
 rpl_extraColmaster_myisam  : BUG#41097 2008-12-12 sven result files for rpl_extraColmaster_myisam, rpl_extraColmaster_innodb are gone
-rpl_row_until              : BUG#41423 2008-12-12 sven rpl_row_until needs maintenance
 rpl_binlog_corruption      : BUG#41793 2008-12-30 sven rpl_binlog_corruption disabled in main (needs new mtr)
 rpl_extraCol_falcon        : Bug#40930 2008-11-21 johnemb rpl.rpl_extraCol_falcon fails doing STOP SLAVE (on Windows PB2)
 rpl_cross_version	   : Bug#42311 2009-01-23 aelkin

=== modified file 'mysql-test/suite/rpl/t/rpl_heartbeat.test'
--- a/mysql-test/suite/rpl/t/rpl_heartbeat.test	2009-02-05 13:07:55 +0000
+++ b/mysql-test/suite/rpl/t/rpl_heartbeat.test	2009-02-23 13:30:29 +0000
@@ -112,7 +112,7 @@ drop table if exists t1;
 #
 
 connection slave;
-set @@global.slave_net_timeout= 10;
+set @@global.slave_net_timeout= 20;
 --replace_result $MASTER_MYPORT MASTER_PORT
 # no error this time but rather a warning
 eval change master to master_host='127.0.0.1',master_port=$MASTER_MYPORT, master_user='root', master_heartbeat_period= 0.5;
@@ -132,7 +132,7 @@ source include/show_slave_status.inc;
 # That would cause reconnecting and relaylog rotation w/o the fix i.e
 # without a heartbeat received.
 
-real_sleep 15;
+real_sleep 30;
 
 # check (compare with the previous show's results) that no rotation happened
 source include/show_slave_status.inc;
@@ -166,6 +166,7 @@ while (`select $slave_value = 0`)
   let $slave_value= query_get_value("SHOW STATUS like 'Slave_received_heartbeats'", Value, 1);
 }
 --echo A heartbeat has been received by the slave
+
 # cleanup
 
 connection master;

=== modified file 'mysql-test/suite/rpl/t/rpl_row_until.test'
--- a/mysql-test/suite/rpl/t/rpl_row_until.test	2008-12-26 07:23:16 +0000
+++ b/mysql-test/suite/rpl/t/rpl_row_until.test	2009-02-19 20:37:38 +0000
@@ -2,75 +2,115 @@
 -- source include/have_binlog_format_row.inc
 -- source include/master-slave.inc
 
-# Test is dependent on binlog positions
+# Note: The test is dependent on binlog positions
 
 # prepare version for substitutions
 let $VERSION=`select version()`;
 
-# stop slave before he will start replication also sync with master
-# for avoiding undetermenistic behaviour
+# Create some events on master
+connection master;
+CREATE TABLE t1(n INT NOT NULL AUTO_INCREMENT PRIMARY KEY);
+INSERT INTO t1 VALUES (1),(2),(3),(4);
+DROP TABLE t1;
+# Save master log postion for query DROP TABLE t1
+save_master_pos;
+let $master_pos_drop_t1= query_get_value(SHOW BINLOG EVENTS, Pos, 7);
+
+CREATE TABLE t2(n INT NOT NULL AUTO_INCREMENT PRIMARY KEY);
+# Save master log postion for query CREATE TABLE t2
+save_master_pos;
+let $master_pos_create_t2= query_get_value(SHOW BINLOG EVENTS, Pos, 8);
+
+INSERT INTO t2 VALUES (1),(2);
+save_master_pos;
+# Save master log postion for query INSERT INTO t2 VALUES (1),(2);
+let $master_pos_insert1_t2= query_get_value(SHOW BINLOG EVENTS, End_log_pos, 12);
 sync_slave_with_master;
---source include/stop_slave.inc
+
+# Save relay log postion for query INSERT INTO t2 VALUES (1),(2);
+let $relay_pos_insert1_t2= query_get_value(show slave status, Relay_Log_Pos, 1);
 
 connection master;
-# create some events on master
-create table t1(n int not null auto_increment primary key);
-insert into t1 values (1),(2),(3),(4);
-drop table t1;
-create table t2(n int not null auto_increment primary key);
-insert into t2 values (1),(2);
-insert into t2 values (3),(4);
-drop table t2;
+INSERT INTO t2 VALUES (3),(4);
+DROP TABLE t2;
+# Save master log postion for query INSERT INTO t2 VALUES (1),(2);
+let $master_pos_drop_t2= query_get_value(SHOW BINLOG EVENTS, End_log_pos, 17);
+sync_slave_with_master;
 
-# try to replicate all queries until drop of t1
+--source include/stop_slave.inc
+# Reset slave.
+RESET SLAVE;
+--disable_query_log
+eval CHANGE MASTER TO MASTER_USER='root', MASTER_CONNECT_RETRY=1, MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT;
+--enable_query_log
+
+# Try to replicate all queries until drop of t1
 connection slave;
-start slave until master_log_file='master-bin.000001', master_log_pos=455;
+echo START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=master_pos_drop_t1;
+--disable_query_log
+eval START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=$master_pos_drop_t1;
+--enable_query_log
 --source include/wait_for_slave_sql_to_stop.inc
-# here table should be still not deleted
-select * from t1;
-source include/show_slave_status.inc;
 
-# this should fail right after start
-start slave until master_log_file='master-no-such-bin.000001', master_log_pos=291;
+# Here table should be still not deleted
+SELECT * FROM t1;
+--replace_result $master_pos_drop_t1 MASTER_POS_DROP_T1
+--replace_column 1 # 4 # 7 # 8 # 9 # 16 # 23 # 33 # 35 # 36 #
+query_vertical SHOW SLAVE STATUS;
+
+# This should fail right after start
+START SLAVE UNTIL MASTER_LOG_FILE='master-no-such-bin.000001', MASTER_LOG_POS=291;
 --source include/wait_for_slave_sql_to_stop.inc
 # again this table should be still not deleted
-select * from t1;
-source include/show_slave_status.inc;
-
-# try replicate all up to and not including the second insert to t2;
-start slave until relay_log_file='slave-relay-bin.000004', relay_log_pos=1016;
+SELECT * FROM t1;
+--replace_result $master_pos_drop_t1 MASTER_POS_DROP_T1
+--replace_column 1 # 4 # 7 # 8 # 9 # 16 # 23 # 33 # 35 # 36 #
+query_vertical SHOW SLAVE STATUS;
+
+# Try replicate all up to and not including the second insert to t2;
+echo START SLAVE UNTIL RELAY_LOG_FILE='slave-relay-bin.000002', RELAY_LOG_POS=relay_pos_insert1_t2;
+--disable_query_log
+eval START SLAVE UNTIL RELAY_LOG_FILE='slave-relay-bin.000002', RELAY_LOG_POS=$relay_pos_insert1_t2;
+--enable_query_log
 --source include/wait_for_slave_sql_to_stop.inc
-select * from t2;
-source include/show_slave_status.inc;
+SELECT * FROM t2;
+--replace_result $relay_pos_insert1_t2 RELAY_POS_INSERT1_T2 $master_pos_insert1_t2 MASTER_POS_INSERT1_T2
+--replace_column 1 # 4 # 7 # 8 # 9 # 16 # 23 # 33 # 35 # 36 #
+query_vertical SHOW SLAVE STATUS;
 
 # clean up
-start slave;
+START SLAVE;
 --source include/wait_for_slave_to_start.inc
 connection master;
 sync_slave_with_master;
 --source include/stop_slave.inc
 
-# this should stop immediately as we are already there
-start slave sql_thread until master_log_file='master-bin.000001', master_log_pos=740;
---let $slave_param= Until_Log_Pos
---let $slave_param_value= 740
+# This should stop immediately as we are already there
+echo START SLAVE SQL_THREAD UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=master_pos_create_t2;
+--disable_query_log
+eval START SLAVE SQL_THREAD UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=$master_pos_create_t2;
+--enable_query_log
+let $slave_param= Until_Log_Pos;
+let $slave_param_value= $master_pos_create_t2;
 --source include/wait_for_slave_param.inc
 --source include/wait_for_slave_sql_to_stop.inc
 # here the sql slave thread should be stopped
 --replace_result bin.000005 bin.000004 bin.000006 bin.000004 bin.000007 bin.000004
-source include/show_slave_status.inc;
+--replace_result $master_pos_create_t2 MASTER_POS_CREATE_T2 $master_pos_drop_t2 MASTER_POS_DROP_T2
+--replace_column 1 # 4 # 7 # 8 # 9 # 16 # 23 # 33 # 35 # 36 #
+query_vertical SHOW SLAVE STATUS;
 
 #testing various error conditions
 --error 1277
-start slave until master_log_file='master-bin', master_log_pos=561;
+START SLAVE UNTIL MASTER_LOG_FILE='master-bin', MASTER_LOG_POS=561;
 --error 1277
-start slave until master_log_file='master-bin.000001', master_log_pos=561, relay_log_pos=12;
+START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=561, RELAY_LOG_POS=12;
 --error 1277
-start slave until master_log_file='master-bin.000001';
+START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001';
 --error 1277
-start slave until relay_log_file='slave-relay-bin.000002';
+START SLAVE UNTIL RELAY_LOG_FILE='slave-relay-bin.000009';
 --error 1277
-start slave until relay_log_file='slave-relay-bin.000002', master_log_pos=561;
+START SLAVE UNTIL RELAY_LOG_FILE='slave-relay-bin.000002', MASTER_LOG_POS=561;
 # Warning should be given for second command
-start slave;
-start slave until master_log_file='master-bin.000001', master_log_pos=740;
+START SLAVE;
+START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=740;

=== added file 'mysql-test/suite/rpl/t/rpl_slave_load_in.test'
--- a/mysql-test/suite/rpl/t/rpl_slave_load_in.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/t/rpl_slave_load_in.test	2009-02-21 09:36:07 +0000
@@ -0,0 +1,35 @@
+##########################################################################
+# This test verifies if a slave is able to process a "LOAD DATA INFILE" 
+# event while the "--secure-file-priv" option is set.
+# 
+# The test is divided in two steps:
+#    1 - Creates a table and populates it through "LOAD DATA INFILE".
+#    2 - Compares the master and slave.
+##########################################################################
+source include/master-slave.inc;
+
+##########################################################################
+#                            Loading data
+##########################################################################
+connection master;
+
+create table t1(a int not null auto_increment, b int, primary key(a));
+load data infile '../../std_data/rpl_loaddata.dat' into table t1;
+
+##########################################################################
+#                       Checking Consistency
+##########################################################################
+sync_slave_with_master;
+
+let $diff_table_1=master:test.t1;
+let $diff_table_2=slave:test.t1;
+source include/diff_tables.inc;
+
+##########################################################################
+#                             Clean up
+##########################################################################
+connection master;
+
+drop table t1;
+
+sync_slave_with_master;

=== added file 'mysql-test/suite/rpl/t/rpl_temp_table_mix_row.test'
--- a/mysql-test/suite/rpl/t/rpl_temp_table_mix_row.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/t/rpl_temp_table_mix_row.test	2009-02-23 03:26:38 +0000
@@ -0,0 +1,49 @@
+# ==== Purpose ====
+#
+# Test that temporary tables are correctly replicated after switching to ROW format in MIX mode.
+# This test case will test the condition of the bug#40013.
+# The test step is:
+#   1: create temp table on connection 'master';
+#   2: switch to ROW format using 'INSERT INTO t1 VALUES (UUID());'
+#   3: disconnect 'master' and connect to a new connection 'master1';
+#   4: sync to slave and check the number of temp tables on slave.
+#
+
+source include/master-slave.inc;
+source include/have_binlog_format_mixed.inc;
+
+--echo ==== Initialize ====
+
+--echo [on master]
+--connection master
+
+CREATE TABLE t1 (a CHAR(48));
+CREATE TEMPORARY TABLE t1_tmp1(a INT);
+INSERT INTO t1 VALUES (UUID());
+
+--echo [on slave]
+sync_slave_with_master;
+
+--echo ==== Verify results on slave ====
+SHOW STATUS LIKE "Slave_open_temp_tables";
+
+--echo [on master]
+--connection master
+
+disconnect master;
+--connection master1
+
+--echo [on slave]
+sync_slave_with_master;
+
+--echo ==== Verify results on slave ====
+SHOW STATUS LIKE "Slave_open_temp_tables";
+
+--echo ==== Clean up ====
+
+--echo [on master]
+--connection master1
+DROP TABLE t1;
+
+--echo [on slave]
+sync_slave_with_master;

=== modified file 'mysql-test/suite/sys_vars/r/completion_type_func.result'
--- a/mysql-test/suite/sys_vars/r/completion_type_func.result	2009-02-03 09:16:53 +0000
+++ b/mysql-test/suite/sys_vars/r/completion_type_func.result	2009-02-25 08:36:50 +0000
@@ -2,76 +2,187 @@ DROP TABLE IF EXISTS t1;
 ## Creating new table ##
 CREATE TABLE t1
 (
-id INT NOT NULL AUTO_INCREMENT,
+id INT NOT NULL,
 PRIMARY KEY (id),
 name VARCHAR(30)
 ) ENGINE = INNODB;
-'#--------------------FN_DYNVARS_017_01-------------------------#'
-## Creating new connection ##
-INSERT INTO t1(name) VALUES('Record_1');
-SET @@autocommit = 0;
+## Creating new connections test_con1, test_con2 ##
+#########################################################
+#    Setting initial value of completion_type to zero   #
+#########################################################
+INSERT INTO t1 VALUES(1,'Record_1');
 SELECT * FROM t1;
 id	name
 1	Record_1
 ## Setting value of variable to 0 ##
 SET @@session.completion_type = 0;
 ## Here commit & rollback should work normally ##
+## test commit ##
 START TRANSACTION;
+INSERT INTO t1 VALUES(2,'Record_2');
+INSERT INTO t1 VALUES(3,'Record_3');
 SELECT * FROM t1;
 id	name
 1	Record_1
-INSERT INTO t1(name) VALUES('Record_2');
-INSERT INTO t1(name) VALUES('Record_3');
+2	Record_2
+3	Record_3
+Switching to connection test_con1
+## Don't expect to see id's 2 and 3 in the table w/o COMMIT ##
+SELECT * FROM t1;
+id	name
+1	Record_1
+Switching to default connection
+COMMIT;
+## test rollback ##
+START TRANSACTION;
+INSERT INTO t1 VALUES(4,'Record_4');
+INSERT INTO t1 VALUES(5,'Record_5');
+SELECT * FROM t1;
+id	name
+1	Record_1
+2	Record_2
+3	Record_3
+4	Record_4
+5	Record_5
+Switching to connection test_con1
+## Don't expect to see id's 4 and 5 here ##
+## Expect to see 3, Record_3 ##
 SELECT * FROM t1;
 id	name
 1	Record_1
 2	Record_2
 3	Record_3
-DELETE FROM t1 WHERE id = 2;
+Switching to connection default;
+ROLLBACK;
+## Don't expect to see id's 4 and 5 now ##
 SELECT * FROM t1;
 id	name
 1	Record_1
+2	Record_2
 3	Record_3
+
+#########################################################
+#    Setting initial value of completion_type to one    #
+#########################################################
+Switching to connection test_con1;
+SET @@session.completion_type = 1;
 START TRANSACTION;
 SELECT * FROM t1;
 id	name
 1	Record_1
+2	Record_2
 3	Record_3
-INSERT INTO t1(name) VALUES('Record_4');
-INSERT INTO t1(name) VALUES('Record_5');
+INSERT INTO t1 VALUES(6,'Record_6');
+INSERT INTO t1 VALUES(7,'Record_7');
 COMMIT;
-'#--------------------FN_DYNVARS_017_02-------------------------#'
+## Expect to immediately have a new transaction ##
+INSERT INTO t1 VALUES(8,'Record_8');
+SELECT * FROM t1;
+id	name
+1	Record_1
+2	Record_2
+3	Record_3
+6	Record_6
+7	Record_7
+8	Record_8
+switching to test_con2
+## Do not expect to see 8, Record_8 as no COMMIT has occurred ##
+SELECT * FROM t1;
+id	name
+1	Record_1
+2	Record_2
+3	Record_3
+6	Record_6
+7	Record_7
+switch to connection test_con1
+## Testing ROLLBACK behavior
+START TRANSACTION;
+INSERT INTO t1 VALUES(9, 'Record_9');
+INSERT INTO t1 VALUES(10, 'Record_10');
+## Expect to see id's 8, 9, 10 here ##
+## 8, Record_8 COMMITted with the start of this transaction ##
+SELECT * FROM t1;
+id	name
+1	Record_1
+2	Record_2
+3	Record_3
+6	Record_6
+7	Record_7
+8	Record_8
+9	Record_9
+10	Record_10
+ROLLBACK;
+## id's 9 and 10 are gone now due to ROLLBACK ##
+SELECT * FROM t1;
+id	name
+1	Record_1
+2	Record_2
+3	Record_3
+6	Record_6
+7	Record_7
+8	Record_8
+## Expect a new transaction ##
+INSERT INTO t1 VALUES(9, 'Record_9');
+Switching to connection test_con2
+## Don't expect to see 9, Record_9 due to no COMMIT yet ##
+SELECT * FROM t1;
+id	name
+1	Record_1
+2	Record_2
+3	Record_3
+6	Record_6
+7	Record_7
+8	Record_8
+Switching to connection test_con1
+ROLLBACK;
+## Don't expect to see 9, Record_9
+SELECT * FROM t1;
+id	name
+1	Record_1
+2	Record_2
+3	Record_3
+6	Record_6
+7	Record_7
+8	Record_8
+#########################################################
+#    Setting initial value of completion_type to 2      #
+#########################################################
 SET @@session.completion_type = 2;
 ## Here commit should work as COMMIT RELEASE ##
 START TRANSACTION;
 SELECT * FROM t1;
 id	name
 1	Record_1
+2	Record_2
 3	Record_3
-4	Record_4
-5	Record_5
-INSERT INTO t1(name) VALUES('Record_6');
-INSERT INTO t1(name) VALUES('Record_7');
+6	Record_6
+7	Record_7
+8	Record_8
+INSERT INTO t1 VALUES(9,'Record_9');
+INSERT INTO t1 VALUES(10,'Record_10');
 COMMIT;
 ## Inserting rows should give error here because connection should ##
 ## disconnect after using COMMIT ##
-INSERT INTO t1(name) VALUES('Record_4');
+INSERT INTO t1 VALUES(4,'Record_4');
 Got one of the listed errors
-## Creating new connection test_con2 ##
+switch to connection test_con2
 SET @@session.completion_type = 2;
 ## Inserting rows and using Rollback which should Rollback & release ##
 START TRANSACTION;
 SELECT * FROM t1;
 id	name
 1	Record_1
+2	Record_2
 3	Record_3
-4	Record_4
-5	Record_5
 6	Record_6
 7	Record_7
-INSERT INTO t1(name) VALUES('Record_8');
-INSERT INTO t1(name) VALUES('Record_9');
+8	Record_8
+9	Record_9
+10	Record_10
+INSERT INTO t1 VALUES(11,'Record_11');
+INSERT INTO t1 VALUES(12,'Record_12');
 ROLLBACK;
-INSERT INTO t1(name) VALUES('Record_4');
+## Expect a failure due to COMMIT/ROLLBACK AND RELEASE behavior ##
+INSERT INTO t1 VALUES(4,'Record_4');
 Got one of the listed errors
 DROP TABLE t1;

=== removed file 'mysql-test/suite/sys_vars/t/completion_type_func-master.opt'
--- a/mysql-test/suite/sys_vars/t/completion_type_func-master.opt	2008-12-19 15:12:15 +0000
+++ b/mysql-test/suite/sys_vars/t/completion_type_func-master.opt	1970-01-01 00:00:00 +0000
@@ -1 +0,0 @@
---innodb

=== modified file 'mysql-test/suite/sys_vars/t/completion_type_func.test'
--- a/mysql-test/suite/sys_vars/t/completion_type_func.test	2009-02-03 09:16:53 +0000
+++ b/mysql-test/suite/sys_vars/t/completion_type_func.test	2009-02-25 08:36:50 +0000
@@ -1,4 +1,4 @@
-############## mysql-test\t\completion_type_func.test ##########################
+############## mysql-test/suite/sys_vars/t/completion_type_func.test ###########
 #                                                                              #
 # Variable Name: completion_type                                               #
 # Scope: GLOBAL & SESSION                                                      #
@@ -25,84 +25,154 @@
 DROP TABLE IF EXISTS t1;
 --enable_warnings
 
-#########################
-#   Creating new table  #
-#########################
+##############################
+# Setup: Table + connections #
+##############################
 
 --echo ## Creating new table ##
 CREATE TABLE t1
 (
-id INT NOT NULL AUTO_INCREMENT,
+id INT NOT NULL,
 PRIMARY KEY (id),
 name VARCHAR(30)
 ) ENGINE = INNODB;
 
---echo '#--------------------FN_DYNVARS_017_01-------------------------#'

-#########################################################
-#    Setting initial value of completion_type to zero   #
-#########################################################
-
---echo ## Creating new connection ##
+--echo ## Creating new connections test_con1, test_con2 ##
 connect (test_con1,localhost,root,,);
-connection test_con1;
+connect (test_con2,localhost,root,,);
+
+connection default;
+
+--echo #########################################################
+--echo #    Setting initial value of completion_type to zero   #
+--echo #########################################################
 
-INSERT INTO t1(name) VALUES('Record_1');
-SET @@autocommit = 0;
+INSERT INTO t1 VALUES(1,'Record_1');
 SELECT * FROM t1;
 
 --echo ## Setting value of variable to 0 ##
 SET @@session.completion_type = 0;
 
 --echo ## Here commit & rollback should work normally ##
+--echo ## test commit ##
+START TRANSACTION;
+INSERT INTO t1 VALUES(2,'Record_2');
+INSERT INTO t1 VALUES(3,'Record_3');
+SELECT * FROM t1;
+
+--echo Switching to connection test_con1
+connection test_con1;
+--echo ## Don't expect to see id's 2 and 3 in the table w/o COMMIT ##
+SELECT * FROM t1;
+
+--echo Switching to default connection
+connection default;
+COMMIT;
+
+--echo ## test rollback ##
 START TRANSACTION;
+INSERT INTO t1 VALUES(4,'Record_4');
+INSERT INTO t1 VALUES(5,'Record_5');
 SELECT * FROM t1;
-INSERT INTO t1(name) VALUES('Record_2');
-INSERT INTO t1(name) VALUES('Record_3');
+
+--echo Switching to connection test_con1
+connection test_con1;
+--echo ## Don't expect to see id's 4 and 5 here ##
+--echo ## Expect to see 3, Record_3 ##
 SELECT * FROM t1;
-DELETE FROM t1 WHERE id = 2;
+
+--echo Switching to connection default;
+connection default;
+
+
+ROLLBACK;
+--echo ## Don't expect to see id's 4 and 5 now ##
 SELECT * FROM t1;
 
+--echo 
+--echo #########################################################
+--echo #    Setting initial value of completion_type to one    #
+--echo #########################################################
+
+--echo Switching to connection test_con1;
+connection test_con1;
+SET @@session.completion_type = 1;
 
 START TRANSACTION;
 SELECT * FROM t1;
-INSERT INTO t1(name) VALUES('Record_4');
-INSERT INTO t1(name) VALUES('Record_5');
+INSERT INTO t1 VALUES(6,'Record_6');
+INSERT INTO t1 VALUES(7,'Record_7');
 COMMIT;
 
+--echo ## Expect to immediately have a new transaction ##
+INSERT INTO t1 VALUES(8,'Record_8');
+SELECT * FROM t1;
+
+connection test_con2;
+--echo switching to test_con2
+--echo ## Do not expect to see 8, Record_8 as no COMMIT has occurred ##
+SELECT * FROM t1;
+
+--echo switch to connection test_con1
+connection test_con1;
+
+--echo ## Testing ROLLBACK behavior
+START TRANSACTION;
+INSERT INTO t1 VALUES(9, 'Record_9');
+INSERT INTO t1 VALUES(10, 'Record_10');
+--echo ## Expect to see id's 8, 9, 10 here ##
+--echo ## 8, Record_8 COMMITted with the start of this transaction ##
+SELECT * FROM t1;
+ROLLBACK;
+--echo ## id's 9 and 10 are gone now due to ROLLBACK ##
+SELECT * FROM t1;
+
+--echo ## Expect a new transaction ##
+INSERT INTO t1 VALUES(9, 'Record_9');
 
---echo '#--------------------FN_DYNVARS_017_02-------------------------#'
-#########################################################
-#    Setting initial value of completion_type to 2      #
-#########################################################
+--echo Switching to connection test_con2
+connection test_con2;
+--echo ## Don't expect to see 9, Record_9 due to no COMMIT yet ##
+SELECT * FROM t1;
+
+--echo Switching to connection test_con1
+connection test_con1;
+ROLLBACK;
+--echo ## Don't expect to see 9, Record_9
+SELECT * FROM t1;
+
+--echo #########################################################
+--echo #    Setting initial value of completion_type to 2      #
+--echo #########################################################
 
 SET @@session.completion_type = 2;
 
 --echo ## Here commit should work as COMMIT RELEASE ##
 START TRANSACTION;
 SELECT * FROM t1;
-INSERT INTO t1(name) VALUES('Record_6');
-INSERT INTO t1(name) VALUES('Record_7');
+INSERT INTO t1 VALUES(9,'Record_9');
+INSERT INTO t1 VALUES(10,'Record_10');
 COMMIT;
 
 --echo ## Inserting rows should give error here because connection should ##
 --echo ## disconnect after using COMMIT ##
---Error 2006,2013,1053
-INSERT INTO t1(name) VALUES('Record_4');
+--Error 2006,2013,ER_SERVER_SHUTDOWN
+INSERT INTO t1 VALUES(4,'Record_4');
 
---echo ## Creating new connection test_con2 ##
-connect (test_con2,localhost,root,,);
+--echo switch to connection test_con2
 connection test_con2;
 SET @@session.completion_type = 2;
 
 --echo ## Inserting rows and using Rollback which should Rollback & release ##
 START TRANSACTION;
 SELECT * FROM t1;
-INSERT INTO t1(name) VALUES('Record_8');
-INSERT INTO t1(name) VALUES('Record_9');
+INSERT INTO t1 VALUES(11,'Record_11');
+INSERT INTO t1 VALUES(12,'Record_12');
 ROLLBACK;
 
---Error 2006,2013,1053
-INSERT INTO t1(name) VALUES('Record_4');
+--echo ## Expect a failure due to COMMIT/ROLLBACK AND RELEASE behavior ##
+--Error 2006,2013,ER_SERVER_SHUTDOWN,
+INSERT INTO t1 VALUES(4,'Record_4');
 
 connection default;
 disconnect test_con1;

=== modified file 'mysql-test/t/disabled.def'
--- a/mysql-test/t/disabled.def	2009-02-18 10:23:38 +0000
+++ b/mysql-test/t/disabled.def	2009-02-27 09:29:49 +0000
@@ -9,11 +9,8 @@
 #  Do not use any TAB characters for whitespace.
 #
 ##############################################################################
-ctype_create         : Bug#32965 main.ctype_create fails
-csv_alter_table      : Bug#42831 main.csv_alter_table is disabled 
 cast                 : Bug#35594 2008-03-27 main.cast fails on Windows2003-64
 events_bugs          : Bug#37774 Bug#39569 Bug#39863 Bug#39848 2008-10-08 alik
 innodb               : Bug#41299 2008-12-08 alik
 user_limits          : Bug#42384 thread_handling = pool-of-threads, wrong handling of max_questions user limit
-query_cache_28249    : Bug#41098 Query Cache returns wrong result with concurrent insert
 innodb_bug39438      : BUG#42383 2009-01-28 lsoares "This fails in embedded and on windows.  Note that this test is not run on windows and on embedded in PB for main trees currently"

=== modified file 'mysql-test/t/func_group.test'
--- a/mysql-test/t/func_group.test	2008-11-24 16:00:09 +0000
+++ b/mysql-test/t/func_group.test	2009-02-26 17:17:06 +0000
@@ -18,6 +18,8 @@ insert into t1 values (3,5,"C");
 insert into t1 values (3,6,"D");
 
 # Test of MySQL field extension with and without matching records.
+#### Note: The two following statements may fail if the execution plan
+#### or optimizer is changed. The result for column c is undefined.
 select a,c,sum(a) from t1 group by a;
 select a,c,sum(a) from t1 where a > 10 group by a;
 select sum(a) from t1 where a > 10;

=== modified file 'mysql-test/t/group_by.test'
--- a/mysql-test/t/group_by.test	2008-11-12 20:04:19 +0000
+++ b/mysql-test/t/group_by.test	2009-02-26 17:31:59 +0000
@@ -1167,3 +1167,22 @@ explain SELECT COUNT(varchar_key) AS X F
 SELECT COUNT(varchar_key) AS X FROM t1 WHERE pk = 8 having 'foo'='bar';
 drop table t1;
 
+#
+# Bug#42567 Invalid GROUP BY error
+#
+
+# Setup of the subtest
+SET @old_sql_mode = @@sql_mode;
+SET @@sql_mode='ONLY_FULL_GROUP_BY';
+
+CREATE TABLE t1(i INT);
+INSERT INTO t1 VALUES (1), (10);
+
+# The actual test
+SELECT COUNT(i) FROM t1;
+SELECT COUNT(i) FROM t1 WHERE i > 1;
+
+# Cleanup of subtest
+DROP TABLE t1;
+SET @@sql_mode = @old_sql_mode;
+

=== added file 'mysql-test/t/innodb_bug42419.test'
--- a/mysql-test/t/innodb_bug42419.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/innodb_bug42419.test	2009-02-20 15:56:32 +0000
@@ -0,0 +1,78 @@
+#
+# Testcase for InnoDB
+# Bug#42419 Server crash with "Pure virtual method called" on two concurrent connections
+#
+
+--source include/not_embedded.inc
+--source include/have_innodb.inc
+
+let $innodb_lock_wait_timeout= query_get_value(SHOW VARIABLES LIKE 'innodb_lock_wait_timeout%', Value, 1);
+if (`SELECT $innodb_lock_wait_timeout < 10`)
+{
+   --echo # innodb_lock_wait_timeout must be >= 10 seconds
+   --echo # so that this test can work all time fine on an overloaded testing box
+   SHOW VARIABLES LIKE 'innodb_lock_wait_timeout';
+   exit;
+}
+
+# Save the initial number of concurrent sessions
+--source include/count_sessions.inc
+
+# First session
+connection default;
+
+
+--enable_warnings
+CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY, b INT) ENGINE = InnoDB;
+
+INSERT INTO t1 VALUES (1,1),(2,2),(3,3);
+COMMIT;
+SET AUTOCOMMIT = 0;
+
+CREATE TEMPORARY TABLE t1_tmp ( b INT );
+
+INSERT INTO t1_tmp (b) SELECT b FROM t1 WHERE a = 3;
+INSERT INTO t1_tmp (b) SELECT b FROM t1 WHERE a = 2;
+
+# Second session
+connect (user2,localhost,root,,,$MASTER_MYPORT,$MASTER_MYSOCK);
+
+SET AUTOCOMMIT = 0;
+
+CREATE TEMPORARY TABLE t2_tmp ( a int, new_a int );
+INSERT INTO t2_tmp VALUES (1,51),(2,52),(3,53);
+
+UPDATE t1 SET a = (SELECT new_a FROM t2_tmp WHERE t2_tmp.a = t1.a) WHERE a = 1;
+send
+UPDATE t1 SET a = (SELECT new_a FROM t2_tmp WHERE t2_tmp.a = t1.a) WHERE a = 2;
+
+# The last update will wait for a lock held by the first session
+
+# First session
+connection default;
+
+# Poll till the UPDATE of the second session waits for lock
+let $show_statement= SHOW PROCESSLIST;
+let $field= State;
+let $condition= = 'Updating';
+--source include/wait_show_condition.inc
+
+# If the testing box is overloadeded and innodb_lock_wait_timeout is too small
+# we might get here ER_LOCK_WAIT_TIMEOUT.
+--error ER_LOCK_DEADLOCK
+INSERT INTO t1_tmp (b) SELECT b FROM t1 WHERE a = 1;
+
+# Second session
+connection user2;
+--echo Reap the server message for connection user2 UPDATE t1 ...
+reap;
+
+# The server crashed when executing this UPDATE or the succeeding SQL command.
+UPDATE t1 SET a = (SELECT new_a FROM t2_tmp WHERE t2_tmp.a = t1.a) WHERE a = 3;
+
+connection default;
+disconnect user2;
+DROP TABLE t1;
+
+# Wait till all disconnects are completed
+--source include/wait_until_count_sessions.inc

=== modified file 'mysql-test/t/innodb_mysql.test'
--- a/mysql-test/t/innodb_mysql.test	2009-02-12 18:27:05 +0000
+++ b/mysql-test/t/innodb_mysql.test	2009-02-20 12:37:37 +0000
@@ -91,6 +91,7 @@ INSERT INTO foo2 SELECT * FROM foo;
 
 DROP TABLE foo, bar, foo2;
 
+
 #
 # Bug#41348: INSERT INTO tbl SELECT * FROM temp_tbl overwrites locking type of temp table
 #

=== modified file 'mysql-test/t/mysql.test'
--- a/mysql-test/t/mysql.test	2009-01-09 18:43:23 +0000
+++ b/mysql-test/t/mysql.test	2009-02-25 10:06:18 +0000
@@ -315,6 +315,23 @@ remove_file $MYSQLTEST_VARDIR/tmp/bug381
 #
 --exec $MYSQL -e "select @z:='1',@z=database()"
 
+
+#
+# Bug #31060: MySQL CLI parser bug 2
+#
+
+--write_file $MYSQLTEST_VARDIR/tmp/bug31060.sql
+;DELIMITER DELIMITER
+;
+SELECT 1DELIMITER
+DELIMITER ;
+SELECT 1;
+EOF
+
+--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug31060.sql 2>&1
+
+remove_file $MYSQLTEST_VARDIR/tmp/bug31060.sql;
+
 --echo End of 5.0 tests
 
 #

=== modified file 'mysql-test/t/mysqlbinlog.test'
--- a/mysql-test/t/mysqlbinlog.test	2008-04-08 06:34:40 +0000
+++ b/mysql-test/t/mysqlbinlog.test	2009-02-24 17:25:30 +0000
@@ -180,7 +180,7 @@ delimiter ;//
 flush logs;
 call p1();
 drop procedure p1;
---error 1305
+--error ER_SP_DOES_NOT_EXIST 
 call p1();
 --replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
 --exec $MYSQL_BINLOG --short-form $MYSQLD_DATADIR/master-bin.000008
@@ -232,7 +232,26 @@ flush logs;
 INSERT INTO t1 VALUES ('0123456789');
 flush logs;
 DROP TABLE t1;
---exec $MYSQL_BINLOG --hexdump --local-load=$MYSQLTEST_VARDIR/tmp/ $MYSQLD_DATADIR/master-bin.000012 | grep 'Query' | sed 's/[0-9]\{1,\}/REMOVED/g'
+
+# We create a table, patch, and load the output into it
+# By using LINES STARTING BY '#' + SELECT WHERE a LIKE 'Query'
+# We can easily see if a 'Query' line is missing the '#' character
+# as described in the original bug
+
+--disable_query_log 
+CREATE TABLE patch (a blob);
+--exec $MYSQL_BINLOG --hexdump --local-load=$MYSQLTEST_VARDIR/tmp/ $MYSQLD_DATADIR/master-bin.000012 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_tmp.dat
+eval LOAD DATA LOCAL INFILE '$MYSQLTEST_VARDIR/tmp/mysqlbinlog_tmp.dat'
+     INTO TABLE patch FIELDS TERMINATED by '' LINES STARTING BY '#';
+--remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog_tmp.dat
+--enable_query_log
+
+--echo We expect this value to be 1
+--echo The bug being tested was that 'Query' lines were not preceded by '#'
+--echo If the line is in the table, it had to have been preceded by a '#'
+--echo
+SELECT COUNT(*) AS `BUG#28293_expect_1` FROM patch WHERE a LIKE '%Query%';
+DROP TABLE patch;
 
 #
 # Bug #29928: incorrect connection_id() restoring from mysqlbinlog out
@@ -259,7 +278,6 @@ echo shell> mysqlbinlog std_data/corrupt
 error 1;
 exec $MYSQL_BINLOG $MYSQL_TEST_DIR/std_data/corrupt-relay-bin.000624 > $MYSQLTEST_VARDIR/tmp/bug31793.sql;
 
---echo End of 5.0 tests
 
 #
 # Test --disable-force-if-open and --force-if-open
@@ -324,4 +342,25 @@ remove_file $MYSQLTEST_VARDIR/tmp/bug325
 query_vertical SELECT * FROM t1;
 DROP TABLE t1;
 
+#
+# Bug #37313  	BINLOG Contains Incorrect server id
+#
+
+let $save_server_id= `select @@global.server_id`;
+let $s_id_max=`select (1 << 32) - 1`;
+eval set @@global.server_id= $s_id_max;
+
+reset master;
+flush logs;
+--exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug37313.binlog
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+eval select
+(@a:=load_file("$MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug37313.binlog"))
+is not null;
+let $s_id_unsigned= `select @a like "%server id $s_id_max%" /* must return 1 */`;
+echo *** Unsigned server_id $s_id_max is found: $s_id_unsigned ***;
+
+eval set @@global.server_id= $save_server_id;
+--remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug37313.binlog
+
 --echo End of 5.1 tests

=== modified file 'mysql-test/t/mysqldump.test'
--- a/mysql-test/t/mysqldump.test	2009-02-16 21:18:45 +0000
+++ b/mysql-test/t/mysqldump.test	2009-02-19 17:36:09 +0000
@@ -1649,6 +1649,24 @@ DROP TABLE t1,t2;
 
 
 --echo #
+--echo # Bug#33550 mysqldump 4.0 compatibility broken
+--echo #
+
+SET NAMES utf8;
+CREATE TABLE `straße` ( f1 INT );
+--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --skip-comments --default-character-set=utf8 --compatible=mysql323 test
+--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --skip-comments --default-character-set=latin1 --compatible=mysql323 test
+DROP TABLE `straße`;
+
+CREATE TABLE `כדשגכחךלדc $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --skip-comments --default-character-set=utf8 --compatible=mysql323 test
+--error 2
+--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --skip-comments --default-character-set=latin1 --compatible=mysql323 test
+DROP TABLE `כדשגכחlatin1;
+
+
+--echo #
 --echo # End of 5.0 tests
 --echo #
 

=== modified file 'mysql-test/t/mysqltest.test'
--- a/mysql-test/t/mysqltest.test	2009-01-15 10:26:48 +0000
+++ b/mysql-test/t/mysqltest.test	2009-02-20 13:35:24 +0000
@@ -62,7 +62,8 @@ select otto from (select 1 as otto) as t
 --exec echo "select friedrich from (select 1 as otto) as t1;" | $MYSQL_TEST  2>&1
 
 # expectation = response
---error 1054
+--error ER_BAD_FIELD_ERROR
+
 select friedrich from (select 1 as otto) as t1;
 
 # The following unmasked unsuccessful statement must give
@@ -135,14 +136,16 @@ eval select $mysql_errno as "after_succe
 #----------------------------------------------------------------------------
 # check mysql_errno = 1064 after statement with wrong syntax
 # ----------------------------------------------------------------------------
---error 1064
+--error ER_PARSE_ERROR
+
 garbage ;
 eval select $mysql_errno as "after_wrong_syntax_errno" ;
 
 # ----------------------------------------------------------------------------
 # check if let $my_var= 'abc' ; affects $mysql_errno
 # ----------------------------------------------------------------------------
---error 1064
+--error ER_PARSE_ERROR
+
 garbage ;
 let $my_var= 'abc' ;
 eval select $mysql_errno as "after_let_var_equal_value" ;
@@ -150,7 +153,8 @@ eval select $mysql_errno as "after_let_v
 # ----------------------------------------------------------------------------
 # check if set @my_var= 'abc' ; affects $mysql_errno
 # ----------------------------------------------------------------------------
---error 1064
+--error ER_PARSE_ERROR
+
 garbage ;
 set @my_var= 'abc' ;
 eval select $mysql_errno as "after_set_var_equal_value" ;
@@ -159,7 +163,8 @@ eval select $mysql_errno as "after_set_v
 #  check if the setting of --disable-warnings itself affects $mysql_errno
 #  (May be --<whatever> modifies $mysql_errno.)
 # ----------------------------------------------------------------------------
---error 1064
+--error ER_PARSE_ERROR
+
 garbage ;
 --disable_warnings
 eval select $mysql_errno as "after_disable_warnings_command" ;
@@ -170,7 +175,8 @@ eval select $mysql_errno as "after_disab
 # (May be disabled warnings affect $mysql_errno.)
 # ----------------------------------------------------------------------------
 drop table if exists t1 ;
---error 1064
+--error ER_PARSE_ERROR
+
 garbage ;
 drop table if exists t1 ;
 eval select $mysql_errno as "after_disable_warnings" ;
@@ -179,21 +185,26 @@ eval select $mysql_errno as "after_disab
 # ----------------------------------------------------------------------------
 # check if masked errors affect $mysql_errno
 # ----------------------------------------------------------------------------
---error 1064
+--error ER_PARSE_ERROR
+
 garbage ;
---error 1146
+--error ER_NO_SUCH_TABLE
+
 select 3 from t1 ;
 eval select $mysql_errno as "after_minus_masked" ;
---error 1064
+--error ER_PARSE_ERROR
+
 garbage ;
---error 1146
+--error ER_NO_SUCH_TABLE
+
 select 3 from t1 ;
 eval select $mysql_errno as "after_!_masked" ;
 
 # ----------------------------------------------------------------------------
 # Will manipulations of $mysql_errno be possible and visible ?
 # ----------------------------------------------------------------------------
---error 1064
+--error ER_PARSE_ERROR
+
 garbage ;
 let $mysql_errno= -1;
 eval select $mysql_errno as "after_let_errno_equal_value" ;
@@ -202,50 +213,61 @@ eval select $mysql_errno as "after_let_e
 # How affect actions on prepared statements $mysql_errno ?
 # ----------------------------------------------------------------------------
 # failing prepare
---error 1064
+--error ER_PARSE_ERROR
+
 garbage ;
---error 1146
+--error ER_NO_SUCH_TABLE
+
 prepare stmt from "select 3 from t1" ;
 eval select $mysql_errno as "after_failing_prepare" ;
 create table t1 ( f1 char(10));
 
 # successful prepare
---error 1064
+--error ER_PARSE_ERROR
+
 garbage ;
 prepare stmt from "select 3 from t1" ;
 eval select $mysql_errno as "after_successful_prepare" ;
 
 # successful execute
---error 1064
+--error ER_PARSE_ERROR
+
 garbage ;
 execute stmt;
 eval select $mysql_errno as "after_successful_execute" ;
 
 # failing execute (table has been dropped)
 drop table t1;
---error 1064
+--error ER_PARSE_ERROR
+
 garbage ;
---error 1146
+--error ER_NO_SUCH_TABLE
+
 execute stmt;
 eval select $mysql_errno as "after_failing_execute" ;
 
 # failing execute (unknown statement)
---error 1064
+--error ER_PARSE_ERROR
+
 garbage ;
---error 1243
+--error ER_UNKNOWN_STMT_HANDLER
+
 execute __stmt_;
 eval select $mysql_errno as "after_failing_execute" ;
 
 # successful deallocate
---error 1064
+--error ER_PARSE_ERROR
+
 garbage ;
 deallocate prepare stmt;
 eval select $mysql_errno as "after_successful_deallocate" ;
 
 # failing deallocate ( statement handle does not exist )
---error 1064
+--error ER_PARSE_ERROR
+
 garbage ;
---error 1243
+--error ER_UNKNOWN_STMT_HANDLER
+
 deallocate prepare __stmt_;
 eval select $mysql_errno as "after_failing_deallocate" ;
 
@@ -270,7 +292,8 @@ eval select $mysql_errno as "after_faili
 # ----------------------------------------------------------------------------
 # Switch off the abort on error and check the effect on $mysql_errno
 # ----------------------------------------------------------------------------
---error 1064
+--error ER_PARSE_ERROR
+
 garbage ;
 --disable_abort_on_error
 eval select $mysql_errno as "after_--disable_abort_on_error" ;
@@ -284,9 +307,11 @@ select 3 from t1 ;
 # masked failing statements
 # ----------------------------------------------------------------------------
 # expected error = response
---error 1146
+--error ER_NO_SUCH_TABLE
+
 select 3 from t1 ;
---error 1146
+--error ER_NO_SUCH_TABLE
+
 select 3 from t1 ;
 eval select $mysql_errno as "after_!errno_masked_error" ;
 # expected error <> response
@@ -300,7 +325,8 @@ eval select $mysql_errno as "after_!errn
 # ----------------------------------------------------------------------------

 # Switch the abort on error on and check the effect on $mysql_errno
 # ----------------------------------------------------------------------------
---error 1064
+--error ER_PARSE_ERROR
+
 garbage ;
 --enable_abort_on_error
 eval select $mysql_errno as "after_--enable_abort_on_error" ;
@@ -309,7 +335,8 @@ eval select $mysql_errno as "after_--ena
 # masked failing statements
 # ----------------------------------------------------------------------------
 # expected error = response
---error 1146
+--error ER_NO_SUCH_TABLE
+
 select 3 from t1 ;
 
 # ----------------------------------------------------------------------------
@@ -573,9 +600,6 @@ echo ;
 
 # Illegal use of exec
 --error 1
---exec echo "--exec false" | $MYSQL_TEST 2>&1
-
---error 1
 --exec echo "--exec " | $MYSQL_TEST 2>&1
 
 # ----------------------------------------------------------------------------
@@ -955,8 +979,6 @@ system echo "hej" > /dev/null;
 --exec echo "system;" | $MYSQL_TEST 2>&1
 --error 1
 --exec echo "system $NONEXISTSINFVAREABLI;" | $MYSQL_TEST 2>&1
---error 1
---exec echo "system false;" | $MYSQL_TEST 2>&1
 
 --disable_abort_on_error
 system NonExistsinfComamdn 2> /dev/null;
@@ -1374,7 +1396,8 @@ connection default;
 let $num= 2;
 while ($num)
 {
-   --error 1064
+   --error ER_PARSE_ERROR
+
    failing_statement;
 
    dec $num;
@@ -1433,7 +1456,7 @@ select "this will be executed";
 #
 # Test zero length result file. Should not pass
 #
---exec touch $MYSQLTEST_VARDIR/tmp/zero_length_file.result
+--exec echo '' > $MYSQLTEST_VARDIR/tmp/zero_length_file.result
 --exec echo "echo ok;" > $MYSQLTEST_VARDIR/tmp/query.sql
 --error 1
 --exec $MYSQL_TEST -x $MYSQLTEST_VARDIR/tmp/query.sql -R $MYSQLTEST_VARDIR/tmp/zero_length_file.result  > /dev/null 2>&1
@@ -1486,7 +1509,8 @@ drop table t1;
 --error 1
 --exec $MYSQL_TEST --record -x $MYSQLTEST_VARDIR/tmp/bug11731.sql -R $MYSQLTEST_VARDIR/tmp/bug11731.out 2>&1
 # The .out file should be non existent
---exec test ! -s $MYSQLTEST_VARDIR/tmp/bug11731.out
+--error 1
+--file_exists $MYSQLTEST_VARDIR/tmp/bug11731.out
 drop table t1;
 
 
@@ -1508,7 +1532,7 @@ drop table t1;
 
 --exec $MYSQL_TEST --record -x $MYSQLTEST_VARDIR/tmp/bug11731.sql -R $MYSQLTEST_VARDIR/tmp/bug11731.out 2>&1
 # The .out file should exist
---exec test -s $MYSQLTEST_VARDIR/tmp/bug11731.out
+--file_exists $MYSQLTEST_VARDIR/tmp/bug11731.out
 drop table t1;
 remove_file $MYSQLTEST_VARDIR/tmp/bug11731.out;
 remove_file $MYSQLTEST_VARDIR/log/bug11731.log;
@@ -1520,14 +1544,17 @@ remove_file $MYSQLTEST_VARDIR/tmp/bug117
 
 # It should be possible to use the command "query" to force mysqltest to
 # send the command to the server although it's a builtin mysqltest command.
---error 1064
+--error ER_PARSE_ERROR
+
 query sleep;
 
---error 1064
+--error ER_PARSE_ERROR
+
 --query sleep
 
 # Just an empty query command
---error 1065
+--error ER_EMPTY_QUERY
+
 query ;
 
 # test for replace_regex
@@ -1921,7 +1948,8 @@ eval $my_stmt;
 # 8. Ensure that "sorted_result " does not change the semantics of
 #    "--error ...." or the protocol output after such an expected failure
 --sorted_result
---error 1146
+--error ER_NO_SUCH_TABLE
+
 SELECT '2' as "my_col1",2 as "my_col2"
 UNION
 SELECT '1',1 from t2;

=== modified file 'mysql-test/t/partition.test'
--- a/mysql-test/t/partition.test	2009-02-13 16:30:54 +0000
+++ b/mysql-test/t/partition.test	2009-02-20 12:37:37 +0000
@@ -19,7 +19,6 @@ drop table if exists t1, t2;
 #
 # Bug#36001: Partitions: spelling and using some error messages
 #
-
 --error ER_FOREIGN_KEY_ON_PARTITIONED
 CREATE TABLE t1 (a INT, FOREIGN KEY (a) REFERENCES t0 (a))
 ENGINE=MyISAM

=== modified file 'mysql-test/t/ps.test'
--- a/mysql-test/t/ps.test	2008-10-29 08:45:14 +0000
+++ b/mysql-test/t/ps.test	2009-02-26 07:23:54 +0000
@@ -230,6 +230,10 @@ drop table t1;
 # statements or are correctly created and deleted on each execute
 #
 
+--let $outfile=$MYSQLTEST_VARDIR/tmp/f1.txt
+--error 0,1
+--remove_file $outfile
+
 prepare stmt1 from "select 1 into @var";
 execute stmt1;
 execute stmt1;
@@ -240,11 +244,14 @@ execute stmt1;
 prepare stmt1 from "insert into t1 select i from t1";
 execute stmt1;
 execute stmt1;
-prepare stmt1 from "select * from t1 into outfile 'f1.txt'";
+--replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR>
+eval prepare stmt1 from "select * from t1 into outfile '$outfile'";
 execute stmt1;
 deallocate prepare stmt1;
 drop table t1;
 
+--remove_file $outfile
+
 # 
 # BUG#5242 "Prepared statement names are case sensitive"
 #
@@ -939,8 +946,13 @@ set global max_prepared_stmt_count=3;
 select @@max_prepared_stmt_count;
 show status like 'prepared_stmt_count';
 prepare stmt from "select 1";
+
 connect (con1,localhost,root,,);
+
+# Switch to connection con1
 connection con1;
+let $con1_id=`SELECT CONNECTION_ID()`;
+
 prepare stmt from "select 2";
 prepare stmt1 from "select 3";
 --error ER_MAX_PREPARED_STMT_COUNT_REACHED
@@ -950,18 +962,17 @@ connection default;
 prepare stmt2 from "select 4";
 select @@max_prepared_stmt_count;
 show status like 'prepared_stmt_count';
+
+# Disconnect connection con1 and switch to default connection
 disconnect con1;
 connection default;
-# Wait for the connection to die: deal with a possible race
+
+# Wait for the connection con1 to die
+let $wait_condition=SELECT COUNT(*)=0 FROM information_schema.processlist WHERE id=$con1_id;
+--source include/wait_condition.inc
+
 deallocate prepare stmt;
-let $query= select variable_value from information_schema.global_status
-            where variable_name = 'prepared_stmt_count';
-let $count= `$query`;
-if ($count)
-{
---sleep 1
-  let $count= `$query`;
-}
+
 select @@max_prepared_stmt_count;
 show status like 'prepared_stmt_count';
 #
@@ -3195,15 +3206,6 @@ SELECT @a;
 DROP PROCEDURE p1;
 DROP PROCEDURE p2;
 
-#
-# Additional cleanup.
-#
-# Delete files which were created by "select ... into outfile ...".
-#
-
-let $datadir= `select @@datadir`;
---remove_file $datadir/test/f1.txt
-
 --echo
 --echo # End of WL#4435.
 

=== modified file 'mysql-test/t/query_cache_28249.test'
--- a/mysql-test/t/query_cache_28249.test	2008-12-19 08:12:18 +0000
+++ b/mysql-test/t/query_cache_28249.test	2009-02-23 08:47:39 +0000
@@ -11,6 +11,7 @@
 #
 

 --source include/have_query_cache.inc
+--source include/not_embedded.inc
 
 SET @query_cache_type=         @@global.query_cache_type;
 SET @query_cache_limit=        @@global.query_cache_limit;

=== modified file 'mysql-test/t/query_cache_debug.test'
--- a/mysql-test/t/query_cache_debug.test	2008-10-20 09:16:47 +0000
+++ b/mysql-test/t/query_cache_debug.test	2009-02-20 12:37:37 +0000
@@ -45,3 +45,71 @@ set global query_cache_size= 0;
 use test;
 drop table t1;
 
+#
+# Bug#41098: Query Cache returns wrong result with concurrent insert
+#
+
+SET @old_concurrent_insert= @@GLOBAL.concurrent_insert;
+SET @old_query_cache_size= @@GLOBAL.query_cache_size;
+
+--disable_warnings
+DROP TABLE IF EXISTS t1, t2;
+--enable_warnings
+CREATE TABLE t1 (a INT);
+CREATE TABLE t2 (a INT);
+INSERT INTO t1 VALUES (1),(2),(3);
+
+SET GLOBAL concurrent_insert= 1;
+SET GLOBAL query_cache_size= 1024*512;
+SET GLOBAL query_cache_type= ON;
+
+connect(con1,localhost,root,,test,,);
+connect(con2,localhost,root,,test,,);
+
+connection con1;
+--echo # Switch to connection con1
+SET SESSION debug='+d,wait_after_query_cache_invalidate';
+--echo # Send concurrent insert, will wait in the query cache table invalidate
+--send INSERT INTO t1 VALUES (4)
+
+connection default;
+--echo # Switch to connection default
+--echo # Wait for concurrent insert to reach the debug point
+let $wait_condition=
+  SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST
+  WHERE STATE = "wait_after_query_cache_invalidate" AND
+        INFO = "INSERT INTO t1 VALUES (4)";
+--source include/wait_condition.inc
+
+connection con2;
+--echo # Switch to connection con2
+--echo # Send SELECT that shouldn't be cached
+SELECT * FROM t1;
+
+connection default;
+--echo # Switch to connection default
+--echo # Notify the concurrent insert to proceed
+SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST
+  WHERE STATE = 'wait_after_query_cache_invalidate' INTO @thread_id;
+KILL QUERY @thread_id;
+
+connection con1;
+--echo # Switch to connection con1
+--echo # Gather insert result
+--reap
+SHOW STATUS LIKE "Qcache_queries_in_cache";
+--echo # Test that it's cacheable
+SELECT * FROM t1;
+SHOW STATUS LIKE "Qcache_queries_in_cache";
+
+--echo # Disconnect
+disconnect con1;
+disconnect con2;
+
+connection default;
+--echo # Restore defaults
+RESET QUERY CACHE;

+DROP TABLE t1,t2;
+SET GLOBAL concurrent_insert= DEFAULT;
+SET GLOBAL query_cache_size= DEFAULT;
+SET GLOBAL query_cache_type= DEFAULT;

=== modified file 'mysql-test/t/row.test'
--- a/mysql-test/t/row.test	2008-02-28 18:53:31 +0000
+++ b/mysql-test/t/row.test	2009-02-19 13:20:44 +0000
@@ -237,3 +237,21 @@ SELECT ROW(a, 1) IN (SELECT SUM(b), 1) F
 SELECT ROW(a, 1) IN (SELECT SUM(b), 3) FROM t1 GROUP BY a;
 
 DROP TABLE t1;
+
+#
+# Bug#37601 Cast Is Not Done On Row Comparison
+#
+create table t1 (a varchar(200),
+                 b int unsigned not null primary key auto_increment)
+default character set 'utf8';
+
+create table t2 (c varchar(200),
+                 d int unsigned not null primary key auto_increment)
+default character set 'latin1';
+
+insert into t1 (a) values('abc');
+insert into t2 (c) values('abc');
+select * from t1,t2 where (a,b) = (c,d);
+
+select host,user from mysql.user where (host,user) = ('localhost','test');
+drop table t1,t2;

=== modified file 'mysql-test/t/trigger-compat.test'
--- a/mysql-test/t/trigger-compat.test	2007-12-12 17:19:24 +0000
+++ b/mysql-test/t/trigger-compat.test	2009-02-19 23:24:25 +0000
@@ -49,9 +49,7 @@ GRANT CREATE, TRIGGER ON mysqltest_db1.*
 CREATE TABLE t1(num_value INT);
 CREATE TABLE t2(user_str TEXT);
 
-CREATE TRIGGER wl2818_trg1 BEFORE INSERT ON t1
-  FOR EACH ROW
-    INSERT INTO t2 VALUES(CURRENT_USER());
+CREATE TRIGGER wl2818_trg1 BEFORE INSERT ON t1 FOR EACH ROW INSERT INTO t2 VALUES(CURRENT_USER());
 
 #
 # Remove definers from TRG file.
@@ -60,9 +58,24 @@ CREATE TRIGGER wl2818_trg1 BEFORE INSERT
 --echo
 --echo ---> patching t1.TRG...
 
-let $MYSQLD_DATADIR= `select @@datadir`;
---exec grep -v 'definers=' $MYSQLD_DATADIR/mysqltest_db1/t1.TRG > $MYSQLTEST_VARDIR/tmp/t1.TRG
---exec mv $MYSQLTEST_VARDIR/tmp/t1.TRG $MYSQLD_DATADIR/mysqltest_db1/t1.TRG
+# Here we remove definers.  This is somewhat complex than the original test
+# Previously, the test only used grep -v 'definers=' t1.TRG, but grep is not
+# portable and we have to load the file into a table, exclude the definers line,
+# then load the data to an outfile to accomplish the same effect
+
+--disable_query_log
+--connection default
+CREATE TABLE patch (a blob);
+let $MYSQLD_DATADIR = `select @@datadir`;
+eval LOAD DATA LOCAL INFILE '$MYSQLD_DATADIR/mysqltest_db1/t1.TRG' INTO TABLE patch;
+# remove original t1.TRG file so SELECT INTO OUTFILE won't fail
+--remove_file $MYSQLD_DATADIR/mysqltest_db1/t1.TRG
+eval SELECT SUBSTRING_INDEX(a,'definers=',1) INTO OUTFILE
+ '$MYSQLD_DATADIR/mysqltest_db1/t1.TRG' 
+FROM patch;
+DROP TABLE patch;
+--connection wl2818_definer_con
+--enable_query_log
 
 #
 # Create a new trigger.

=== modified file 'mysql-test/t/variables.test'
--- a/mysql-test/t/variables.test	2009-02-13 16:30:54 +0000
+++ b/mysql-test/t/variables.test	2009-02-27 08:34:31 +0000
@@ -173,21 +173,63 @@ select @@timestamp>0;
 set @@rand_seed1=10000000,@@rand_seed2=1000000;
 select ROUND(RAND(),5);
 
-show variables like '%alloc%';
-select * from information_schema.session_variables where variable_name like '%alloc%' order by 1;
-set @@range_alloc_block_size=1024*16;
+
+--echo
+--echo ==+ Testing %alloc% system variables +==
+--echo ==+ NOTE:  These values *must* be a multiple of 1024 +==
+--echo ==+ Other values will be rounded down to nearest multiple +==
+--echo
+--echo ==+ Show initial values +==
+SHOW VARIABLES WHERE variable_name IN ('range_alloc_block_size',
+'query_alloc_block_size', 'query_prealloc_size',
+'transaction_alloc_block_size', 'transaction_prealloc_size');
+
+--echo ==+ information_schema data +==
+SELECT * FROM information_schema.session_variables 
+WHERE variable_name IN ('range_alloc_block_size',
+'query_alloc_block_size', 'query_prealloc_size',
+'transaction_alloc_block_size', 'transaction_prealloc_size') ORDER BY 1;
+--echo Testing values that are multiples of 1024
+set @@range_alloc_block_size=1024*15+1024;
+set @@query_alloc_block_size=1024*15+1024*2;
+set @@query_prealloc_size=1024*18-1024;
+set @@transaction_alloc_block_size=1024*21-1024*1;
+set @@transaction_prealloc_size=1024*21-2048;
+--echo ==+ Check manipulated values ==+
+select @@query_alloc_block_size;
+SHOW VARIABLES WHERE variable_name IN ('range_alloc_block_size',
+'query_alloc_block_size', 'query_prealloc_size',
+'transaction_alloc_block_size', 'transaction_prealloc_size');
+--echo ==+ information_schema data +==
+SELECT * FROM information_schema.session_variables
+WHERE variable_name IN ('range_alloc_block_size',
+'query_alloc_block_size', 'query_prealloc_size',
+'transaction_alloc_block_size', 'transaction_prealloc_size') ORDER BY 1;
+--echo ==+ Manipulate variable values +==
+--echo Testing values that are not 1024 multiples
+set @@range_alloc_block_size=1024*16+1023;
 set @@query_alloc_block_size=1024*17+2;
-set @@query_prealloc_size=1024*18;
+set @@query_prealloc_size=1024*18-1023;
 set @@transaction_alloc_block_size=1024*20-1;
 set @@transaction_prealloc_size=1024*21-1;
 select @@query_alloc_block_size;
-show variables like '%alloc%';
-select * from information_schema.session_variables where variable_name like '%alloc%' order by 1;
+--echo ==+ Check manipulated values ==+
+SHOW VARIABLES WHERE variable_name IN ('range_alloc_block_size',
+'query_alloc_block_size', 'query_prealloc_size',
+'transaction_alloc_block_size', 'transaction_prealloc_size');
+--echo ==+ information_schema data +==
+SELECT * FROM information_schema.session_variables 
+WHERE variable_name IN ('range_alloc_block_size',
+'query_alloc_block_size', 'query_prealloc_size',
+'transaction_alloc_block_size', 'transaction_prealloc_size') ORDER BY 1;
+--echo ==+ Set values back to the default values +==
 set @@range_alloc_block_size=default;
 set @@query_alloc_block_size=default, @@query_prealloc_size=default;
 set transaction_alloc_block_size=default, @@transaction_prealloc_size=default;
-show variables like '%alloc%';
-select * from information_schema.session_variables where variable_name like '%alloc%' order by 1;
+--echo ==+ Check the values now that they are reset +==
+SHOW VARIABLES WHERE variable_name IN ('range_alloc_block_size',
+'query_alloc_block_size', 'query_prealloc_size',
+'transaction_alloc_block_size', 'transaction_prealloc_size');
 
 #
 # Bug #10904 Illegal mix of collations between

=== modified file 'mysql-test/t/view_grant.test'
--- a/mysql-test/t/view_grant.test	2008-11-12 15:23:22 +0000
+++ b/mysql-test/t/view_grant.test	2009-02-26 17:45:13 +0000
@@ -1188,6 +1188,46 @@ DROP DATABASE mysqltest1;
 DROP DATABASE mysqltest2;
 DROP USER mysqltest_u1@localhost;
 
+
+#
+# Bug #41354: Access control is bypassed when all columns of a view are 
+# selected by * wildcard
+
+CREATE DATABASE db1;
+USE db1;
+CREATE TABLE t1(f1 INT, f2 INT);
+CREATE VIEW v1 AS SELECT f1, f2 FROM t1;
+
+GRANT SELECT (f1) ON t1 TO foo;
+GRANT SELECT (f1) ON v1 TO foo;
+
+connect (addconfoo, localhost, foo,,);
+connection addconfoo;
+USE db1;
+
+
+SELECT f1 FROM t1;
+--error ER_COLUMNACCESS_DENIED_ERROR
+SELECT f2 FROM t1;
+--error ER_TABLEACCESS_DENIED_ERROR
+SELECT * FROM t1;
+
+SELECT f1 FROM v1;
+--error ER_COLUMNACCESS_DENIED_ERROR
+SELECT f2 FROM v1;
+--error ER_TABLEACCESS_DENIED_ERROR
+SELECT * FROM v1;
+
+connection default;
+USE test;
+disconnect addconfoo;
+REVOKE SELECT (f1) ON db1.t1 FROM foo;
+REVOKE SELECT (f1) ON db1.v1 FROM foo;
+DROP USER foo;
+DROP VIEW db1.v1;
+DROP TABLE db1.t1;
+DROP DATABASE db1;
+
 --echo End of 5.0 tests.
 
 

=== modified file 'mysys/default.c'
--- a/mysys/default.c	2008-07-22 11:38:24 +0000
+++ b/mysys/default.c	2009-02-24 11:56:59 +0000
@@ -144,6 +144,7 @@ static char *remove_end_comment(char *pt
   RETURN
     0  ok
     1  given cinf_file doesn't exist
+    2  out of memory
 
     The global variable 'my_defaults_group_suffix' is updated with value for
     --defaults_group_suffix
@@ -190,7 +191,7 @@ int my_search_option_files(const char *c
     if (!(extra_groups= 
 	  (const char**)alloc_root(ctx->alloc,
                                    (2*group->count+1)*sizeof(char*))))
-      goto err;
+      DBUG_RETURN(2);
     

     for (i= 0; i < group->count; i++)
     {
@@ -199,7 +200,7 @@ int my_search_option_files(const char *c
       
       len= strlen(extra_groups[i]);
       if (!(ptr= alloc_root(ctx->alloc, len+instance_len+1)))
-	goto err;
+        DBUG_RETURN(2);
       
       extra_groups[i+group->count]= ptr;
       
@@ -254,12 +255,11 @@ int my_search_option_files(const char *c
     }
   }
 
-  DBUG_RETURN(error);
+  DBUG_RETURN(0);
 
 err:
   fprintf(stderr,"Fatal error in defaults handling. Program aborted\n");
-  exit(1);
-  return 0;					/* Keep compiler happy */
+  DBUG_RETURN(1);
 }
 
 

=== modified file 'mysys/my_getopt.c'
--- a/mysys/my_getopt.c	2009-02-13 16:30:54 +0000
+++ b/mysys/my_getopt.c	2009-02-24 11:56:59 +0000
@@ -99,10 +99,10 @@ static void default_reporter(enum loglev
   one. Call function 'get_one_option()' once for each option.
 */
 
-static uchar** (*getopt_get_addr)(const char *, uint, const struct my_option *);
+static uchar** (*getopt_get_addr)(const char *, uint, const struct my_option *, int *);
 
 void my_getopt_register_get_addr(uchar** (*func_addr)(const char *, uint,
-						    const struct my_option *))
+						    const struct my_option *, int *))
 {
   getopt_get_addr= func_addr;
 }
@@ -361,8 +361,12 @@ int handle_options(int *argc, char ***ar
                                      my_progname, optp->name);
 	  return EXIT_NO_ARGUMENT_ALLOWED;
 	}
+        error= 0;
 	value= optp->var_type & GET_ASK_ADDR ?
-	  (*getopt_get_addr)(key_name, (uint) strlen(key_name), optp) : optp->value;
+	  (*getopt_get_addr)(key_name, (uint) strlen(key_name), optp, &error) :
+          optp->value;
+        if (error)
+          return error;
   
 	if (optp->arg_type == NO_ARG)
 	{
@@ -1090,7 +1094,7 @@ static void init_variables(const struct 
     if (options->value)
       init_one_value(options, options->value, options->def_value);
     if (options->var_type & GET_ASK_ADDR &&
-	(variable= (*getopt_get_addr)("", 0, options)))
+	(variable= (*getopt_get_addr)("", 0, options, 0)))
       init_one_value(options, variable, options->def_value);
   }
   DBUG_VOID_RETURN;
@@ -1202,7 +1206,7 @@ void my_print_variables(const struct my_
   for (optp= options; optp->id; optp++)
   {
     uchar* *value= (optp->var_type & GET_ASK_ADDR ?
-		  (*getopt_get_addr)("", 0, optp) : optp->value);
+		  (*getopt_get_addr)("", 0, optp, 0) : optp->value);
     if (value)
     {
       printf("%s ", optp->name);

=== modified file 'scripts/mysqldumpslow.sh'
--- a/scripts/mysqldumpslow.sh	2008-10-14 19:52:52 +0000
+++ b/scripts/mysqldumpslow.sh	2009-02-24 08:07:40 +0000
@@ -17,9 +17,9 @@ my %opt = (
 );
 
 GetOptions(\%opt,
-    'verbose|v+',# verbose
+    'v|verbose+',# verbose
     'help+',	# write usage info
-    'debug|d+',	# debug
+    'd|debug+',	# debug
     's=s',	# what to sort by (t, at, l, al, r, ar etc)
     'r!',	# reverse the sort order (largest last instead of first)
     't=i',	# just show the top n queries

=== modified file 'sql/item.cc'
--- a/sql/item.cc	2009-02-16 21:18:45 +0000
+++ b/sql/item.cc	2009-02-20 12:37:37 +0000
@@ -1648,48 +1648,11 @@ bool agg_item_collations_for_comparison(
 }
 
 
-/**
-  Collect arguments' character sets together.
-
-  We allow to apply automatic character set conversion in some cases.
-  The conditions when conversion is possible are:
-  - arguments A and B have different charsets
-  - A wins according to coercibility rules
-    (i.e. a column is stronger than a string constant,
-     an explicit COLLATE clause is stronger than a column)
-  - character set of A is either superset for character set of B,
-    or B is a string constant which can be converted into the
-    character set of A without data loss.
-    
-  If all of the above is true, then it's possible to convert
-  B into the character set of A, and then compare according
-  to the collation of A.
-  
-  For functions with more than two arguments:
-  @code
-    collect(A,B,C) ::= collect(collect(A,B),C)
-  @endcode
-  Since this function calls THD::change_item_tree() on the passed Item **
-  pointers, it is necessary to pass the original Item **'s, not copies.
-  Otherwise their values will not be properly restored (see BUG#20769).
-  If the items are not consecutive (eg. args[2] and args[5]), use the
-  item_sep argument, ie.
-  @code
-    agg_item_charsets(coll, fname, &args[2], 2, flags, 3)
-  @endcode
-*/
-
-bool agg_item_charsets(DTCollation &coll, const char *fname,
-                       Item **args, uint nargs, uint flags, int item_sep)
+bool agg_item_set_converter(DTCollation &coll, const char *fname,
+                            Item **args, uint nargs, uint flags, int item_sep)
 {
   Item **arg, *safe_args[2];
 
-  LINT_INIT(safe_args[0]);
-  LINT_INIT(safe_args[1]);
-
-  if (agg_item_collations(coll, fname, args, nargs, flags, item_sep))
-    return TRUE;
-
   /*
     For better error reporting: save the first and the second argument.
     We need this only if the the number of args is 3 or 2:
@@ -1769,6 +1732,46 @@ bool agg_item_charsets(DTCollation &coll
 }
 
 
+/* 
+  Collect arguments' character sets together.
+  We allow to apply automatic character set conversion in some cases.
+  The conditions when conversion is possible are:
+  - arguments A and B have different charsets
+  - A wins according to coercibility rules
+    (i.e. a column is stronger than a string constant,
+     an explicit COLLATE clause is stronger than a column)
+  - character set of A is either superset for character set of B,
+    or B is a string constant which can be converted into the
+    character set of A without data loss.
+    
+  If all of the above is true, then it's possible to convert
+  B into the character set of A, and then compare according
+  to the collation of A.
+  
+  For functions with more than two arguments:
+
+    collect(A,B,C) ::= collect(collect(A,B),C)
+
+  Since this function calls THD::change_item_tree() on the passed Item **
+  pointers, it is necessary to pass the original Item **'s, not copies.
+  Otherwise their values will not be properly restored (see BUG#20769).
+  If the items are not consecutive (eg. args[2] and args[5]), use the
+  item_sep argument, ie.
+
+    agg_item_charsets(coll, fname, &args[2], 2, flags, 3)
+
+*/
+
+bool agg_item_charsets(DTCollation &coll, const char *fname,
+                       Item **args, uint nargs, uint flags, int item_sep)
+{
+  if (agg_item_collations(coll, fname, args, nargs, flags, item_sep))
+    return TRUE;
+
+  return agg_item_set_converter(coll, fname, args, nargs, flags, item_sep);
+}
+
+
 void Item_ident_for_show::make_field(Send_field *tmp_field)
 {
   tmp_field->table_name= tmp_field->org_table_name= table_name;
@@ -3133,7 +3136,7 @@ bool Item_param::convert_str_value(THD *
       str_value.set_charset(value.cs_info.final_character_set_of_str_value);
     /* Here str_value is guaranteed to be in final_character_set_of_str_value */
 
-    max_length= str_value.length();
+    max_length= str_value.numchars() * str_value.charset()->mbmaxlen;
     decimals= 0;
     /*
       str_value_ptr is returned from val_str(). It must be not alloced

=== modified file 'sql/item.h'
--- a/sql/item.h	2009-02-13 16:30:54 +0000
+++ b/sql/item.h	2009-02-19 14:48:28 +0000
@@ -1346,6 +1346,8 @@ bool agg_item_collations(DTCollation &c,
                          Item **items, uint nitems, uint flags, int item_sep);
 bool agg_item_collations_for_comparison(DTCollation &c, const char *name,
                                         Item **items, uint nitems, uint flags);
+bool agg_item_set_converter(DTCollation &coll, const char *fname,
+                            Item **args, uint nargs, uint flags, int item_sep);
 bool agg_item_charsets(DTCollation &c, const char *name,
                        Item **items, uint nitems, uint flags, int item_sep);
 

=== modified file 'sql/item_cmpfunc.cc'
--- a/sql/item_cmpfunc.cc	2009-02-13 16:30:54 +0000
+++ b/sql/item_cmpfunc.cc	2009-02-19 14:48:28 +0000
@@ -549,7 +549,8 @@ int Arg_comparator::set_compare_func(Ite
 	my_error(ER_OPERAND_COLUMNS, MYF(0), (*a)->element_index(i)->cols());
 	return 1;
       }
-      comparators[i].set_cmp_func(owner, (*a)->addr(i), (*b)->addr(i));
+      if (comparators[i].set_cmp_func(owner, (*a)->addr(i), (*b)->addr(i)))
+        return 1;
     }
     break;
   }
@@ -893,6 +894,16 @@ int Arg_comparator::set_cmp_func(Item_bo
     get_value_func= &get_time_value;
     return 0;
   }
+  else if (type == STRING_RESULT &&
+           (*a)->result_type() == STRING_RESULT &&
+           (*b)->result_type() == STRING_RESULT)
+  {
+    DTCollation coll;
+    coll.set((*a)->collation.collation);
+    if (agg_item_set_converter(coll, owner_arg->func_name(),
+                               b, 1, MY_COLL_CMP_CONV, 1))
+      return 1;
+  }
 
   return set_compare_func(owner_arg, type);
 }

=== modified file 'sql/log_event.cc'
--- a/sql/log_event.cc	2009-02-16 21:18:45 +0000
+++ b/sql/log_event.cc	2009-02-24 17:25:30 +0000
@@ -355,7 +355,7 @@ static char *slave_load_file_stem(char *
                                   int event_server_id, const char *ext)
 {
   char *res;
-  fn_format(buf,"SQL_LOAD-",slave_load_tmpdir, "", MY_UNPACK_FILENAME);
+  fn_format(buf,PREFIX_SQL_LOAD,slave_load_tmpdir, "", MY_UNPACK_FILENAME);
   to_unix_path(buf);
 
   buf = strend(buf);
@@ -394,7 +394,7 @@ static void cleanup_load_tmpdir()
      we cannot meet Start_log event in the middle of events from one 
      LOAD DATA.
   */
-  p= strmake(prefbuf, STRING_WITH_LEN("SQL_LOAD-"));
+  p= strmake(prefbuf, STRING_WITH_LEN(PREFIX_SQL_LOAD));
   p= int10_to_str(::server_id, p, 10);
   *(p++)= '-';
   *p= 0;
@@ -1259,7 +1259,7 @@ void Log_event::print_header(IO_CACHE* f
 
   my_b_printf(file, "#");
   print_timestamp(file);
-  my_b_printf(file, " server id %d  end_log_pos %s ", server_id,
+  my_b_printf(file, " server id %lu  end_log_pos %s ", (ulong) server_id,
               llstr(log_pos,llbuff));
 
   /* mysqlbinlog --hexdump */

=== modified file 'sql/log_event.h'
--- a/sql/log_event.h	2009-02-02 15:58:48 +0000
+++ b/sql/log_event.h	2009-02-21 10:29:05 +0000
@@ -47,6 +47,8 @@
 #include "rpl_reporting.h"
 #endif
 
+#define PREFIX_SQL_LOAD "SQL_LOAD-"
+
 /**
    Either assert or return an error.
 

=== modified file 'sql/mysql_priv.h'
--- a/sql/mysql_priv.h	2009-02-18 10:23:38 +0000
+++ b/sql/mysql_priv.h	2009-02-24 11:56:59 +0000
@@ -2489,7 +2489,8 @@ extern "C" void unireg_abort(int exit_co
 void kill_delayed_threads(void);
 bool check_stack_overrun(THD *thd, long margin, uchar *dummy);
 #else
-#define unireg_abort(exit_code) DBUG_RETURN(exit_code)
+extern "C" void unireg_clear(int exit_code);
+#define unireg_abort(exit_code) do { unireg_clear(exit_code); DBUG_RETURN(exit_code); } while(0)
 inline void kill_delayed_threads(void) {}
 #define check_stack_overrun(A, B, C) 0
 #endif

=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc	2009-02-16 21:18:45 +0000
+++ b/sql/mysqld.cc	2009-02-25 08:58:28 +0000
@@ -180,10 +180,6 @@ typedef fp_except fp_except_t;
 #endif
 #endif /* __FreeBSD__ && HAVE_IEEEFP_H */
 
-#ifdef HAVE_FENV_H
-#include <fenv.h>
-#endif
-
 #ifdef HAVE_FPU_CONTROL_H
 #include <fpu_control.h>
 #endif
@@ -848,12 +844,12 @@ uint connection_count= 0;
 
 pthread_handler_t signal_hand(void *arg);
 static int mysql_init_variables(void);
-static void get_options(int *argc,char **argv);
+static int get_options(int *argc,char **argv);
 extern "C" my_bool mysqld_get_one_option(int, const struct my_option *, char *);
 static void set_server_version(void);
 static int init_thread_environment();
 static char *get_relative_path(const char *path);
-static void fix_paths(void);
+static int fix_paths(void);
 void handle_connections_sockets();
 #ifdef _WIN32
 pthread_handler_t handle_connections_sockets_thread(void *arg);
@@ -870,7 +866,7 @@ pthread_handler_t handle_connections_sha
 pthread_handler_t handle_slave(void *arg);
 static ulong find_bit_type(const char *x, TYPELIB *bit_lib);
 static ulong find_bit_type_or_exit(const char *x, TYPELIB *bit_lib,
-                                   const char *option);
+                                   const char *option, int *error);
 static void clean_up(bool print_message);
 static int test_if_case_insensitive(const char *dir_name);
 static void register_mutex_order();
@@ -3447,7 +3443,8 @@ static int init_common_variables(const c
   load_defaults(conf_file_name, groups, &argc, &argv);
   defaults_argv=argv;
   defaults_argc=argc;
-  get_options(&defaults_argc, defaults_argv);
+  if (get_options(&defaults_argc, defaults_argv))
+    return 1;
   set_server_version();
 
   DBUG_PRINT("info",("%s  Ver %s for %s on %s\n",my_progname,
@@ -7937,6 +7934,7 @@ To see what values a running MySQL serve
 
 static int mysql_init_variables(void)
 {
+  int error;
   /* Things reset to zero */
   opt_skip_slave_start= opt_reckless_slave = 0;
   mysql_home[0]= pidfile_name[0]= log_error_file[0]= 0;
@@ -8001,7 +7999,10 @@ static int mysql_init_variables(void)
   delay_key_write_options= (uint) DELAY_KEY_WRITE_ON;
   slave_exec_mode_options= 0;
   slave_exec_mode_options= (uint)
-    find_bit_type_or_exit(slave_exec_mode_str, &slave_exec_mode_typelib, NULL);
+    find_bit_type_or_exit(slave_exec_mode_str, &slave_exec_mode_typelib, NULL,
+                          &error);
+  if (error)
+    return 1;
   opt_specialflag= SPECIAL_ENGLISH;
   unix_sock= ip_sock= INVALID_SOCKET;
   mysql_home_ptr= mysql_home;
@@ -8176,6 +8177,8 @@ mysqld_get_one_option(int optid,
                       const struct my_option *opt __attribute__((unused)),
                       char *argument)
 {
+  int error;
+
   switch(optid) {
 #ifndef DBUG_OFF
   case '#':
@@ -8244,7 +8247,9 @@ mysqld_get_one_option(int optid,
     break;
   case OPT_SLAVE_EXEC_MODE:
     slave_exec_mode_options= (uint)
-      find_bit_type_or_exit(argument, &slave_exec_mode_typelib, "");
+      find_bit_type_or_exit(argument, &slave_exec_mode_typelib, "", &error);
+    if (error)
+      return 1;
     break;
 #endif
   case OPT_SAFEMALLOC_MEM_LIMIT:
@@ -8312,18 +8317,16 @@ mysqld_get_one_option(int optid,
 
     if (!(p= strstr(argument, "->")))
     {
-      fprintf(stderr,
-	      "Bad syntax in replicate-rewrite-db - missing '->'!\n");
-      exit(1);
+      sql_print_error("Bad syntax in replicate-rewrite-db - missing '->'!\n");
+      return 1;
     }
     val= p--;
     while (my_isspace(mysqld_charset, *p) && p > argument)
       *p-- = 0;
     if (p == argument)
     {
-      fprintf(stderr,
-	      "Bad syntax in replicate-rewrite-db - empty FROM db!\n");
-      exit(1);
+      sql_print_error("Bad syntax in replicate-rewrite-db - empty FROM db!\n");
+      return 1;
     }
     *val= 0;
     val+= 2;
@@ -8331,9 +8334,8 @@ mysqld_get_one_option(int optid,
       *val++;
     if (!*val)
     {
-      fprintf(stderr,
-	      "Bad syntax in replicate-rewrite-db - empty TO db!\n");
-      exit(1);
+      sql_print_error("Bad syntax in replicate-rewrite-db - empty TO db!\n");
+      return 1;
     }
 
     rpl_filter->add_db_rewrite(key, val);
@@ -8361,8 +8363,8 @@ mysqld_get_one_option(int optid,
   {
     if (rpl_filter->add_do_table(argument))
     {
-      fprintf(stderr, "Could not add do table rule '%s'!\n", argument);
-      exit(1);
+      sql_print_error("Could not add do table rule '%s'!\n", argument);
+      return 1;
     }
     break;
   }
@@ -8370,8 +8372,8 @@ mysqld_get_one_option(int optid,
   {
     if (rpl_filter->add_wild_do_table(argument))
     {
-      fprintf(stderr, "Could not add do table rule '%s'!\n", argument);
-      exit(1);
+      sql_print_error("Could not add do table rule '%s'!\n", argument);
+      return 1;
     }
     break;
   }
@@ -8379,8 +8381,8 @@ mysqld_get_one_option(int optid,
   {
     if (rpl_filter->add_wild_ignore_table(argument))
     {
-      fprintf(stderr, "Could not add ignore table rule '%s'!\n", argument);
-      exit(1);
+      sql_print_error("Could not add ignore table rule '%s'!\n", argument);
+      return 1;
     }
     break;
   }
@@ -8388,8 +8390,8 @@ mysqld_get_one_option(int optid,
   {
     if (rpl_filter->add_ignore_table(argument))
     {
-      fprintf(stderr, "Could not add ignore table rule '%s'!\n", argument);
-      exit(1);
+      sql_print_error("Could not add ignore table rule '%s'!\n", argument);
+      return 1;
     }
     break;
   }
@@ -8411,7 +8413,9 @@ mysqld_get_one_option(int optid,
     {
       log_output_str= argument;
       log_output_options=
-        find_bit_type_or_exit(argument, &log_output_typelib, opt->name);
+        find_bit_type_or_exit(argument, &log_output_typelib, opt->name, &error);
+      if (error)
+        return 1;
   }
     break;
   }
@@ -8426,7 +8430,10 @@ mysqld_get_one_option(int optid,
     {
       log_backup_output_str= argument;
       log_backup_output_options=
-        find_bit_type_or_exit(argument, &log_output_typelib, opt->name);
+        find_bit_type_or_exit(argument, &log_output_typelib, opt->name,
+                              &error);
+      if (error)
+        return 1;
   }
     break;
   }
@@ -8436,7 +8443,7 @@ mysqld_get_one_option(int optid,
     sql_perror("Event scheduler is not supported in embedded build.");
 #else
     if (Events::set_opt_event_scheduler(argument))
-	exit(1);
+      return 1;
 #endif
     break;
   case (int) OPT_SKIP_NEW:
@@ -8475,7 +8482,7 @@ mysqld_get_one_option(int optid,
   case (int) OPT_SKIP_NETWORKING:
 #if defined(__NETWARE__)
     sql_perror("Can't start server: skip-networking option is currently not supported on NetWare");
-    exit(1);
+    return 1;
 #endif
     opt_disable_networking=1;
     mysqld_port=0;
@@ -8621,7 +8628,10 @@ mysqld_get_one_option(int optid,
     {
       myisam_recover_options_str=argument;
       myisam_recover_options=
-        find_bit_type_or_exit(argument, &myisam_recover_typelib, opt->name);
+        find_bit_type_or_exit(argument, &myisam_recover_typelib, opt->name,
+                              &error);
+      if (error)
+        return 1;
     }
     ha_open_options|=HA_OPEN_ABORT_IF_CRASHED;
     break;
@@ -8666,7 +8676,9 @@ mysqld_get_one_option(int optid,
   {
     sql_mode_str= argument;
     global_system_variables.sql_mode=
-      find_bit_type_or_exit(argument, &sql_mode_typelib, opt->name);
+      find_bit_type_or_exit(argument, &sql_mode_typelib, opt->name, &error);
+    if (error)
+      return 1;
     global_system_variables.sql_mode= fix_sql_mode(global_system_variables.
 						   sql_mode);
     break;
@@ -8727,13 +8739,17 @@ mysqld_get_one_option(int optid,
 
 /** Handle arguments for multiple key caches. */
 
-extern "C" uchar **mysql_getopt_value(const char *keyname, uint key_length,
-                                      const struct my_option *option);
+extern "C" int mysql_getopt_value(uchar **value,
+                                  const char *keyname, uint key_length,
+                                  const struct my_option *option,
+                                  int *error);
 
-uchar* *
+static uchar* *
 mysql_getopt_value(const char *keyname, uint key_length,
-		   const struct my_option *option)
+		   const struct my_option *option, int *error)
 {
+  if (error)
+    *error= 0;
   switch (option->id) {
   case OPT_KEY_BUFFER_SIZE:
   case OPT_KEY_CACHE_BLOCK_SIZE:
@@ -8742,7 +8758,11 @@ mysql_getopt_value(const char *keyname, 
   {
     KEY_CACHE *key_cache;
     if (!(key_cache= get_or_create_key_cache(keyname, key_length)))
-      exit(1);
+    {
+      if (error)
+        *error= EXIT_OUT_OF_MEMORY;
+      return 0;
+    }
     switch (option->id) {
     case OPT_KEY_BUFFER_SIZE:
       return (uchar**) &key_cache->param_buff_size;
@@ -8780,7 +8800,7 @@ void option_error_reporter(enum loglevel
   @todo
   - FIXME add EXIT_TOO_MANY_ARGUMENTS to "mysys_err.h" and return that code?
 */
-static void get_options(int *argc,char **argv)
+static int get_options(int *argc,char **argv)
 {
   int ho_error;
 
@@ -8794,7 +8814,7 @@ static void get_options(int *argc,char *
 
   if ((ho_error= handle_options(argc, &argv, my_long_options,
                                 mysqld_get_one_option)))
-    exit(ho_error);
+    return ho_error;
   (*argc)++; /* add back one for the progname handle_options removes */
              /* no need to do this for argv as we are discarding it. */
 
@@ -8833,7 +8853,8 @@ static void get_options(int *argc,char *
   max_allowed_packet= global_system_variables.max_allowed_packet;
   net_buffer_length= global_system_variables.net_buffer_length;
 #endif
-  fix_paths();
+  if (fix_paths())
+    return 1;
 
   /*
     Set some global variables from the global_system_variables
@@ -8861,7 +8882,7 @@ static void get_options(int *argc,char *
 				  &global_system_variables.time_format) ||
       init_global_datetime_format(MYSQL_TIMESTAMP_DATETIME,
 				  &global_system_variables.datetime_format))
-    exit(1);
+    return 1;
 
 #ifdef EMBEDDED_LIBRARY
   one_thread_scheduler(&thread_scheduler);
@@ -8874,6 +8895,7 @@ static void get_options(int *argc,char *
   else
     pool_of_threads_scheduler(&thread_scheduler);  /* purecov: tested */
 #endif
+  return 0;
 }
 
 
@@ -8937,7 +8959,7 @@ fn_format_relative_to_data_home(char * t
 }
 
 
-static void fix_paths(void)
+static int fix_paths(void)
 {
   char buff[FN_REFLEN],*pos;
   convert_dirname(mysql_home,mysql_home,NullS);
@@ -8994,12 +9016,12 @@ static void fix_paths(void)
   charsets_dir=mysql_charsets_dir;
 
   if (init_tmpdir(&mysql_tmpdir_list, opt_mysql_tmpdir))
-    exit(1);
+    return 1;
 #ifdef HAVE_REPLICATION
   if (!slave_load_tmpdir)
   {
     if (!(slave_load_tmpdir = (char*) my_strdup(mysql_tmpdir, MYF(MY_FAE))))
-      exit(1);
+      return 1;
   }
 #endif /* HAVE_REPLICATION */
   /*
@@ -9012,30 +9034,37 @@ static void fix_paths(void)
     my_free(opt_secure_file_priv, MYF(0));
     opt_secure_file_priv= my_strdup(buff, MYF(MY_FAE));
   }
+  return 0;
 }
 
 
 static ulong find_bit_type_or_exit(const char *x, TYPELIB *bit_lib,
-                                   const char *option)
+                                   const char *option, int *error)
 {
-  ulong res;
-
+  ulong result;
   const char **ptr;
-
-  if ((res= find_bit_type(x, bit_lib)) == ~(ulong) 0)
+  
+  *error= 0;
+  if ((result= find_bit_type(x, bit_lib)) == ~(ulong) 0)
   {
+    char *buff= (char *) my_alloca(2048);
+    char *cbuf;
     ptr= bit_lib->type_names;
-    if (!*x)
-      fprintf(stderr, "No option given to %s\n", option);
-    else
-      fprintf(stderr, "Wrong option to %s. Option(s) given: %s\n", option, x);
-    fprintf(stderr, "Alternatives are: '%s'", *ptr);
+    cbuf= buff + ((!*x) ?
+      my_snprintf(buff, 2048, "No option given to %s\n", option) :
+      my_snprintf(buff, 2048, "Wrong option to %s. Option(s) given: %s\n",
+                  option, x));
+    cbuf+= my_snprintf(cbuf, 2048 - (cbuf-buff), "Alternatives are: '%s'", *ptr);
     while (*++ptr)
-      fprintf(stderr, ",'%s'", *ptr);
-    fprintf(stderr, "\n");
-    exit(1);
+      cbuf+= my_snprintf(cbuf, 2048 - (cbuf-buff), ",'%s'", *ptr);
+    my_snprintf(cbuf, 2048 - (cbuf-buff), "\n");
+    sql_perror(buff);
+    *error= 1;
+    my_afree(buff);
+    return 0;
   }
-  return res;
+
+  return result;
 }
 
 

=== modified file 'sql/protocol.cc'
--- a/sql/protocol.cc	2009-02-13 17:12:39 +0000
+++ b/sql/protocol.cc	2009-02-27 08:20:47 +0000
@@ -683,7 +683,8 @@ bool Protocol::send_result_set_metadata(
       else
       {
         /* With conversion */
-        uint max_char_len;
+        ulonglong max_length;
+        uint32 field_length;
         int2store(pos, thd_charset->number);
         /*
           For TEXT/BLOB columns, field_length describes the maximum data
@@ -694,12 +695,22 @@ bool Protocol::send_result_set_metadata(
           char_count * mbmaxlen, where character count is taken from the
           definition of the column. In other words, the maximum number
           of characters here is limited by the column definition.
+
+          When one has a LONG TEXT column with a single-byte
+          character set, and the connection character set is multi-byte, the
+          client may get fields longer than UINT_MAX32, due to
+          <character set column> -> <character set connection> conversion.
+          In that case column max length does not fit into the 4 bytes
+          reserved for it in the protocol.
         */
-        max_char_len= (field.type >= (int) MYSQL_TYPE_TINY_BLOB &&
-                      field.type <= (int) MYSQL_TYPE_BLOB) ?
-                      field.length / item->collation.collation->mbminlen :
-                      field.length / item->collation.collation->mbmaxlen;
-        int4store(pos+2, max_char_len * thd_charset->mbmaxlen);
+        max_length= (field.type >= MYSQL_TYPE_TINY_BLOB &&
+                     field.type <= MYSQL_TYPE_BLOB) ?
+                     field.length / item->collation.collation->mbminlen :
+                     field.length / item->collation.collation->mbmaxlen;
+        max_length*= thd_charset->mbmaxlen;
+        field_length= (max_length > UINT_MAX32) ? 
+          UINT_MAX32 : (uint32) max_length;
+        int4store(pos + 2, field_length);
       }
       pos[6]= field.type;
       int2store(pos+7,field.flags);

=== modified file 'sql/rpl_rli.cc'
--- a/sql/rpl_rli.cc	2009-02-13 16:30:54 +0000
+++ b/sql/rpl_rli.cc	2009-02-22 13:43:05 +0000
@@ -106,6 +106,11 @@ int init_relay_log_info(Relay_log_info* 
   rli->tables_to_lock= 0;
   rli->tables_to_lock_count= 0;
 
+  fn_format(rli->slave_patternload_file, PREFIX_SQL_LOAD, slave_load_tmpdir, "",
+            MY_PACK_FILENAME | MY_UNPACK_FILENAME |
+            MY_RETURN_REAL_PATH);
+  rli->slave_patternload_file_size= strlen(rli->slave_patternload_file);
+
   /*
     The relay log will now be opened, as a SEQ_READ_APPEND IO_CACHE.
     Note that the I/O thread flushes it to disk after writing every

=== modified file 'sql/rpl_rli.h'
--- a/sql/rpl_rli.h	2008-08-18 05:43:50 +0000
+++ b/sql/rpl_rli.h	2009-02-21 10:29:05 +0000
@@ -260,6 +260,13 @@ public:
   char ign_master_log_name_end[FN_REFLEN];
   ulonglong ign_master_log_pos_end;
 
+  /* 
+    Indentifies where the SQL Thread should create temporary files for the
+    LOAD DATA INFILE. This is used for security reasons.
+   */ 
+  char slave_patternload_file[FN_REFLEN]; 
+  size_t slave_patternload_file_size;  
+
   Relay_log_info();
   ~Relay_log_info();
 

=== modified file 'sql/share/errmsg.txt'
--- a/sql/share/errmsg.txt	2009-02-12 17:56:03 +0000
+++ b/sql/share/errmsg.txt	2009-02-27 09:09:00 +0000
@@ -6149,6 +6149,21 @@ WARN_PLUGIN_BUSY
 ER_VARIABLE_IS_READONLY
   eng "%s variable '%s' is read-only. Use SET %s to assign the value"
 
+ER_WARN_ENGINE_TRANSACTION_ROLLBACK
+  eng "Storage engine %s does not support rollback for this statement. Transaction rolled back and must be restarted"
+
+ER_SLAVE_HEARTBEAT_FAILURE
+  eng "Unexpected master's heartbeat data: %s"
+ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE
+  eng "The requested value for the heartbeat period %s %s"
+
+ER_NDB_REPLICATION_SCHEMA_ERROR
+        eng "Bad schema for mysql.ndb_replication table. Message: %-.64s"
+ER_CONFLICT_FN_PARSE_ERROR
+        eng "Error in parsing conflict function. Message: %-.64s"
+ER_EXCEPTIONS_WRITE_ERROR
+        eng "Write to exceptions table failed. Message: %-.128s""
+
 ER_WARN_AUTO_CONVERT_LOCK
         eng "Converted to non-transactional lock on '%-.64s'"
         ger "Umgewandelt zu nicht-transaktionalen Sperren auf '%-.64s'"
@@ -6272,10 +6287,6 @@ ER_TABLESPACE_EXIST
   eng "Tablespace '%-.192s' already exists"
 ER_NO_SUCH_TABLESPACE
   eng "Tablespace '%-.192s' doesn't exist"
-ER_SLAVE_HEARTBEAT_FAILURE
-  eng "Unexpected master's heartbeat data: %s"
-ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE
-  eng "The requested value for the heartbeat period %s %s"
 ER_SLAVE_IGNORE_SERVER_IDS
   eng "The requested server id %d clashes with the slave startup option --replicate-same-server-id"
 
@@ -6450,8 +6461,6 @@ ER_BACKUP_BACKUP_DBS
 ER_BACKUP_RESTORE_DBS
   eng "Restoring %u database(s) %.220s"
 
-ER_WARN_ENGINE_TRANSACTION_ROLLBACK
-  eng "Storage engine %s does not support rollback for this statement. Transaction rolled back and must be restarted"
 ER_COM_UNSUPPORTED
   eng "%s doesn't support %s"
 

=== modified file 'sql/sql_base.cc'
--- a/sql/sql_base.cc	2009-02-16 21:18:45 +0000
+++ b/sql/sql_base.cc	2009-02-26 17:45:13 +0000
@@ -1538,7 +1538,8 @@ void close_temporary_tables(THD *thd)
   if (!thd->temporary_tables)
     return;
 
-  if (!mysql_bin_log.is_open() || thd->current_stmt_binlog_row_based)
+  if (!mysql_bin_log.is_open() || 
+      (thd->current_stmt_binlog_row_based && thd->variables.binlog_format == BINLOG_FORMAT_ROW))
   {
     TABLE *tmp_next;
     for (table= thd->temporary_tables; table; table= tmp_next)

=== modified file 'sql/sql_cache.cc'
--- a/sql/sql_cache.cc	2009-02-13 16:30:54 +0000
+++ b/sql/sql_cache.cc	2009-02-20 12:37:37 +0000
@@ -1540,6 +1540,9 @@ void Query_cache::invalidate(THD *thd, T
       invalidate_table(thd, tables_used);
   }
 
+  DBUG_EXECUTE_IF("wait_after_query_cache_invalidate",
+                  debug_wait_for_kill("wait_after_query_cache_invalidate"););
+
   DBUG_VOID_RETURN;
 }
 

=== modified file 'sql/sql_handler.cc'
--- a/sql/sql_handler.cc	2009-01-27 02:08:48 +0000
+++ b/sql/sql_handler.cc	2009-02-24 10:22:54 +0000
@@ -160,6 +160,9 @@ static void mysql_ha_close_table(THD *th
     table->query_id= thd->query_id;
     table->open_by_handler= 0;
   }
+
+  /* Mark table as closed, ready for re-open if necessary. */
+  tables->table= NULL;
 }
 
 /*
@@ -177,8 +180,7 @@ static void mysql_ha_close_table(THD *th
     'reopen' is set when a handler table is to be re-opened. In this case,
     'tables' is the pointer to the hashed TABLE_LIST object which has been
     saved on the original open.
-    'reopen' is also used to suppress the sending of an 'ok' message or
-    error messages.
+    'reopen' is also used to suppress the sending of an 'ok' message.
 
   RETURN
     FALSE OK
@@ -308,8 +310,7 @@ bool mysql_ha_open(THD *thd, TABLE_LIST 
   /* There can be only one table in '*tables'. */
   if (! (hash_tables->table->file->ha_table_flags() & HA_CAN_SQL_HANDLER))
   {
-    if (! reopen)
-      my_error(ER_ILLEGAL_HA, MYF(0), tables->alias);
+    my_error(ER_ILLEGAL_HA, MYF(0), tables->alias);
     goto err;
   }
 
@@ -500,8 +501,7 @@ retry:
 
   if (need_reopen)
   {
-    mysql_ha_close_table(thd, tables);
-    hash_tables->table= NULL;
+    mysql_ha_close_table(thd, hash_tables);
     /*
       The lock might have been aborted, we need to manually reset
       thd->some_tables_deleted because handler's tables are closed
@@ -780,11 +780,7 @@ void mysql_ha_flush(THD *thd)
         (hash_tables->table->mdl_lock_data &&
          mdl_has_pending_conflicting_lock(hash_tables->table->mdl_lock_data) ||
          hash_tables->table->needs_reopen()))
-    {
       mysql_ha_close_table(thd, hash_tables);
-      /* Mark table as closed, ready for re-open. */
-      hash_tables->table= NULL;
-    }
   }
 
   DBUG_VOID_RETURN;

=== modified file 'sql/sql_insert.cc'
--- a/sql/sql_insert.cc	2009-02-16 21:18:45 +0000
+++ b/sql/sql_insert.cc	2009-02-20 12:37:37 +0000
@@ -928,20 +928,6 @@ bool mysql_insert(THD *thd,TABLE_LIST *t
     }
     DBUG_ASSERT(transactional_table || !changed || 
                 thd->transaction.stmt.modified_non_trans_table);
-
-    if (thd->lock)
-    {
-      /*
-        Invalidate the table in the query cache if something changed
-        after unlocking when changes become fisible.
-        TODO: this is workaround. right way will be move invalidating in
-        the unlock procedure.
-      */
-      if (lock_type ==  TL_WRITE_CONCURRENT_INSERT && changed)
-      {
-        query_cache_invalidate3(thd, table_list, 1);
-      }
-    }
   }
   thd_proc_info(thd, "end");
   /*

=== modified file 'sql/sql_load.cc'
--- a/sql/sql_load.cc	2008-12-24 10:48:24 +0000

+++ b/sql/sql_load.cc	2009-02-21 10:29:05 +0000
@@ -20,6 +20,7 @@
 #include "mysql_priv.h"
 #include <my_dir.h>
 #include <m_ctype.h>
+#include "rpl_mi.h"
 #include "sql_repl.h"
 #include "sp_head.h"
 #include "sql_trigger.h"
@@ -324,8 +325,31 @@ int mysql_load(THD *thd,sql_exchange *ex
       (void) fn_format(name, ex->file_name, mysql_real_data_home, "",
 		       MY_RELATIVE_PATH | MY_UNPACK_FILENAME);
 
-      if (opt_secure_file_priv &&
-          strncmp(opt_secure_file_priv, name, strlen(opt_secure_file_priv)))
+      if (thd->slave_thread)
+      {
+#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
+        if (strncmp(active_mi->rli.slave_patternload_file, name,
+            active_mi->rli.slave_patternload_file_size))
+        {
+          /*
+            LOAD DATA INFILE in the slave SQL Thread can only read from
+            --slave-load-tmpdir". This should never happen. Please, report a bug.
+           */
+
+          sql_print_error("LOAD DATA INFILE in the slave SQL Thread can only read from --slave-load-tmpdir. " \
+                          "Please, report a bug.");
+          my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "--slave-load-tmpdir");
+          DBUG_RETURN(TRUE);
+        }
+#else
+        /*
+          This is impossible and should never happen.
+        */
+        DBUG_ASSERT(FALSE);
+#endif
+      }
+      else if (opt_secure_file_priv &&
+               strncmp(opt_secure_file_priv, name, strlen(opt_secure_file_priv)))
       {
         /* Read only allowed from within dir specified by secure_file_priv */
         my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "--secure-file-priv");

=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc	2009-02-16 21:18:45 +0000
+++ b/sql/sql_select.cc	2009-02-20 12:37:37 +0000
@@ -3995,11 +3995,12 @@ static uint get_tmp_table_rec_length(Lis
 */
 
 static bool
-make_join_statistics(JOIN *join, TABLE_LIST *tables, COND *conds,
+make_join_statistics(JOIN *join, TABLE_LIST *tables_arg, COND *conds,
 		     DYNAMIC_ARRAY *keyuse_array)
 {
   int error;
   TABLE *table;
+  TABLE_LIST *tables= tables_arg;
   uint i,table_count,const_count,key;
   table_map found_const_table_map, all_table_map, found_ref, refs;
   key_map const_ref, eq_part;
@@ -4039,7 +4040,7 @@ make_join_statistics(JOIN *join, TABLE_L
     if ((error= table->file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK)))
     {
       table->file->print_error(error, MYF(0));
-      DBUG_RETURN(1);
+      goto error;
     }
     table->quick_keys.clear_all();
     table->reginfo.join_tab=s;
@@ -4135,7 +4136,7 @@ make_join_statistics(JOIN *join, TABLE_L
       {
         join->tables=0;			// Don't use join->table
         my_message(ER_WRONG_OUTER_JOIN, ER(ER_WRONG_OUTER_JOIN), MYF(0));
-        DBUG_RETURN(1);
+        goto error;
       }
       s->key_dependent= s->dependent;
     }
@@ -4145,7 +4146,7 @@ make_join_statistics(JOIN *join, TABLE_L
     if (update_ref_and_keys(join->thd, keyuse_array, stat, join->tables,
                             conds, join->cond_equal,
                             ~outer_join, join->select_lex, &sargables))
-      DBUG_RETURN(1);
+      goto error;
 
   /* Read tables with 0 or 1 rows (system tables) */
   join->const_table_map= 0;
@@ -4161,7 +4162,7 @@ make_join_statistics(JOIN *join, TABLE_L
     if ((tmp=join_read_const_table(s, p_pos)))
     {
       if (tmp > 0)
-	DBUG_RETURN(1);			// Fatal error
+	goto error;		// Fatal error
     }
     else
       found_const_table_map|= s->table->map;
@@ -4233,7 +4234,7 @@ make_join_statistics(JOIN *join, TABLE_L
 	  if ((tmp= join_read_const_table(s, join->positions+const_count-1)))
 	  {
 	    if (tmp > 0)
-	      DBUG_RETURN(1);			// Fatal error
+	      goto error;			// Fatal error
 	  }
 	  else
 	    found_const_table_map|= table->map;
@@ -4289,12 +4290,12 @@ make_join_statistics(JOIN *join, TABLE_L
 	        set_position(join,const_count++,s,start_keyuse);
 	        if (create_ref_for_key(join, s, start_keyuse,
 				       found_const_table_map))
-		  DBUG_RETURN(1);
+                  goto error;
 	        if ((tmp=join_read_const_table(s,
                                                join->positions+const_count-1)))
 	        {
 		  if (tmp > 0)
-		    DBUG_RETURN(1);			// Fatal error
+		    goto error;			// Fatal error
 	        }
 	        else
 		  found_const_table_map|= table->map;
@@ -4381,7 +4382,7 @@ make_join_statistics(JOIN *join, TABLE_L
 			  *s->on_expr_ref ? *s->on_expr_ref : conds,
 			  1, &error);
       if (!select)
-        DBUG_RETURN(1);
+        goto error;
       records= get_quick_record_count(join->thd, select, s->table,
 				      &s->const_keys, join->row_limit);
       s->quick=select->quick;
@@ -4432,7 +4433,7 @@ make_join_statistics(JOIN *join, TABLE_L
   if (join->const_tables != join->tables)
   {
     if (choose_plan(join, all_table_map & ~join->const_table_map))
-      DBUG_RETURN(TRUE);
+      goto error;
   }
   else
   {
@@ -4442,6 +4443,17 @@ make_join_statistics(JOIN *join, TABLE_L
   }
   /* Generate an execution plan from the found optimal join order. */
   DBUG_RETURN(join->thd->killed || get_best_combination(join));
+
+error:
+  /*
+    Need to clean up join_tab from TABLEs in case of error.
+    They won't get cleaned up by JOIN::cleanup() because JOIN::join_tab
+    may not be assigned yet by this function (which is building join_tab).
+    Dangling TABLE::reginfo.join_tab may cause part_of_refkey to choke. 
+  */
+  for (tables= tables_arg; tables; tables= tables->next_leaf)
+    tables->table->reginfo.join_tab= NULL;
+  DBUG_RETURN (1);
 }
 
 

=== modified file 'sql/sql_show.cc'
--- a/sql/sql_show.cc	2009-02-18 12:57:37 +0000
+++ b/sql/sql_show.cc	2009-02-25 12:42:06 +0000
@@ -288,7 +288,7 @@ static struct show_privileges_st sys_pri
   {"Alter", "Tables",  "To alter the table"},
   {"Alter routine", "Functions,Procedures",  "To alter or drop stored functions/procedures"},
   {"Create", "Databases,Tables,Indexes",  "To create new databases and tables"},
-  {"Create routine","Functions,Procedures","To use CREATE FUNCTION/PROCEDURE"},
+  {"Create routine","Databases","To use CREATE FUNCTION/PROCEDURE"},
   {"Create temporary tables","Databases","To use CREATE TEMPORARY TABLE"},
   {"Create view", "Tables",  "To create new views"},
   {"Create user", "Server Admin",  "To create new users"},
@@ -1623,21 +1623,25 @@ void append_definer(THD *thd, String *bu
 int
 view_store_create_info(THD *thd, TABLE_LIST *table, String *buff)
 {
+  my_bool compact_view_name= TRUE;
   my_bool foreign_db_mode= (thd->variables.sql_mode & (MODE_POSTGRESQL |
                                                        MODE_ORACLE |
                                                        MODE_MSSQL |
                                                        MODE_DB2 |
                                                        MODE_MAXDB |
                                                        MODE_ANSI)) != 0;
-  /*
-     Compact output format for view can be used
-     - if user has db of this view as current db
-     - if this view only references table inside it's own db
-  */
+
   if (!thd->db || strcmp(thd->db, table->view_db.str))
-    table->compact_view_format= FALSE;
+    /*
+      print compact view name if the view belongs to the current database
+    */
+    compact_view_name= table->compact_view_format= FALSE;
   else
   {
+    /*
+      Compact output format for view body can be used
+      if this view only references table inside it's own db
+    */
     TABLE_LIST *tbl;
     table->compact_view_format= TRUE;
     for (tbl= thd->lex->query_tables;
@@ -1658,7 +1662,7 @@ view_store_create_info(THD *thd, TABLE_L
     view_store_options(thd, table, buff);
   }
   buff->append(STRING_WITH_LEN("VIEW "));
-  if (!table->compact_view_format)
+  if (!compact_view_name)
   {
     append_identifier(thd, buff, table->view_db.str, table->view_db.length);
     buff->append('.');

=== modified file 'storage/innobase/handler/ha_innodb.cc'
--- a/storage/innobase/handler/ha_innodb.cc	2009-02-18 10:23:38 +0000
+++ b/storage/innobase/handler/ha_innodb.cc	2009-02-24 11:56:59 +0000
@@ -4333,7 +4333,6 @@ convert_search_mode_to_innobase(
 	case HA_READ_MBR_WITHIN:
 	case HA_READ_MBR_DISJOINT:
 	case HA_READ_MBR_EQUAL:
-		my_error(ER_TABLE_CANT_HANDLE_SPKEYS, MYF(0));
 		return(PAGE_CUR_UNSUPP);
 	/* do not use "default:" in order to produce a gcc warning:
 	enumeration value '...' not handled in switch
@@ -5869,7 +5868,7 @@ ha_innobase::records_in_range(
 						      mode2);
 	} else {
 
-		n_rows = 0;
+		n_rows = HA_POS_ERROR;
 	}
 
 	dtuple_free_for_mysql(heap1);

=== modified file 'storage/myisam/ha_myisam.cc'
--- a/storage/myisam/ha_myisam.cc	2009-02-11 12:11:20 +0000
+++ b/storage/myisam/ha_myisam.cc	2009-02-24 11:56:59 +0000
@@ -1676,7 +1676,7 @@ int ha_myisam::info(uint flag)
     if (share->key_parts)
       memcpy((char*) table->key_info[0].rec_per_key,
 	     (char*) misam_info.rec_per_key,
-	     sizeof(table->key_info[0].rec_per_key)*share->key_parts);
+	     sizeof(table->key_info[0].rec_per_key[0])*share->key_parts);
     if (share->tmp_table == NO_TMP_TABLE)
       pthread_mutex_unlock(&share->LOCK_ha_data);
 
@@ -1712,6 +1712,8 @@ int ha_myisam::extra(enum ha_extra_funct
 {
   if ((specialflag & SPECIAL_SAFE_MODE) && operation == HA_EXTRA_KEYREAD)
     return 0;
+  if (operation == HA_EXTRA_MMAP && !opt_myisam_use_mmap)
+    return 0;
   return mi_extra(file, operation, 0);
 }
 
@@ -2162,6 +2164,15 @@ my_bool ha_myisam::register_query_cache_
     }
   }
 
+  /*
+    This query execution might have started after the query cache was flushed
+    by a concurrent INSERT. In this case, don't cache this statement as the
+    data file length difference might not be visible yet if the tables haven't
+    been unlocked by the concurrent insert thread.
+  */
+  if (file->state->uncacheable)
+    DBUG_RETURN(FALSE);
+
   /* It is ok to try to cache current statement. */
   DBUG_RETURN(TRUE);
 }

=== modified file 'storage/myisam/mi_locking.c'
--- a/storage/myisam/mi_locking.c	2008-10-31 18:02:34 +0000
+++ b/storage/myisam/mi_locking.c	2009-02-20 12:37:37 +0000
@@ -287,6 +287,8 @@ void mi_get_status(void* param, my_bool 
   info->save_state=info->s->state.state;
   info->state= &info->save_state;
   info->append_insert_at_end= concurrent_insert;
+  if (concurrent_insert)
+    info->s->state.state.uncacheable= TRUE;
   DBUG_VOID_RETURN;
 }
 

=== modified file 'storage/myisam/myisamchk.c'
--- a/storage/myisam/myisamchk.c	2009-02-13 16:30:54 +0000
+++ b/storage/myisam/myisamchk.c	2009-02-25 10:06:18 +0000
@@ -360,6 +360,7 @@ static void usage(void)
   -#, --debug=...     Output debug log. Often this is 'd:t:o,filename'.\n");
 #endif
   printf("\
+  -H, --HELP          Display this help and exit.\n\
   -?, --help          Display this help and exit.\n\
   -O, --set-variable var=option.\n\
                       Change the value of a variable. Please note that\n\

=== modified file 'storage/myisam/myisamdef.h'
--- a/storage/myisam/myisamdef.h	2009-02-13 16:30:54 +0000
+++ b/storage/myisam/myisamdef.h	2009-02-20 12:37:37 +0000
@@ -43,6 +43,7 @@ typedef struct st_mi_status_info
   my_off_t key_file_length;
   my_off_t data_file_length;
   ha_checksum checksum;
+  my_bool uncacheable;                  /* Active concurrent insert */
 } MI_STATUS_INFO;
 
 typedef struct st_mi_state_info

=== modified file 'tests/mysql_client_test.c'
--- a/tests/mysql_client_test.c	2009-02-16 21:18:45 +0000
+++ b/tests/mysql_client_test.c	2009-02-26 12:18:28 +0000
@@ -749,6 +749,7 @@ static void do_verify_prepare_field(MYSQ
 {
   MYSQL_FIELD *field;
   CHARSET_INFO *cs;
+  ulonglong expected_field_length;
 
   if (!(field= mysql_fetch_field_direct(result, no)))
   {
@@ -757,6 +758,8 @@ static void do_verify_prepare_field(MYSQ
   }
   cs= get_charset(field->charsetnr, 0);
   DIE_UNLESS(cs);
+  if ((expected_field_length= length * cs->mbmaxlen) > UINT_MAX32)
+    expected_field_length= UINT_MAX32;
   if (!opt_silent)
   {
     fprintf(stdout, "\n field[%d]:", no);
@@ -771,8 +774,8 @@ static void do_verify_prepare_field(MYSQ
       fprintf(stdout, "\n    org_table:`%s`\t(expected: `%s`)",
               field->org_table, org_table);
     fprintf(stdout, "\n    database :`%s`\t(expected: `%s`)", field->db, db);
-    fprintf(stdout, "\n    length   :`%lu`\t(expected: `%lu`)",
-            field->length, length * cs->mbmaxlen);
+    fprintf(stdout, "\n    length   :`%lu`\t(expected: `%llu`)",
+            field->length, expected_field_length);
     fprintf(stdout, "\n    maxlength:`%ld`", field->max_length);
     fprintf(stdout, "\n    charsetnr:`%d`", field->charsetnr);
     fprintf(stdout, "\n    default  :`%s`\t(expected: `%s`)",
@@ -808,11 +811,11 @@ static void do_verify_prepare_field(MYSQ
     as utf8. Field length is calculated as number of characters * maximum
     number of bytes a character can occupy.
   */
-  if (length && field->length != length * cs->mbmaxlen)
+  if (length && (field->length != expected_field_length))
   {
-    fprintf(stderr, "Expected field length: %d,  got length: %d\n",
-            (int) (length * cs->mbmaxlen), (int) field->length);
-    DIE_UNLESS(field->length == length * cs->mbmaxlen);
+    fprintf(stderr, "Expected field length: %llu,  got length: %lu\n",
+            expected_field_length, field->length);
+    DIE_UNLESS(field->length == expected_field_length);
   }
   if (def)
     DIE_UNLESS(strcmp(field->def, def) == 0);
@@ -18643,6 +18646,69 @@ static void test_bug36326()
 
 #endif
 
+/**
+  Bug#41078: With CURSOR_TYPE_READ_ONLY mysql_stmt_fetch() returns short
+             string value.
+*/
+
+static void test_bug41078(void)
+{
+  uint         rc;
+  MYSQL_STMT   *stmt= 0;
+  MYSQL_BIND   param, result;
+  ulong        cursor_type= CURSOR_TYPE_READ_ONLY;
+  ulong        len;
+  char         str[64];
+  const char   param_str[]= "abcdefghijklmn";
+  my_bool      is_null, error;
+
+  DBUG_ENTER("test_bug41078");
+
+  rc= mysql_query(mysql, "SET NAMES UTF8");
+  myquery(rc);
+
+  stmt= mysql_simple_prepare(mysql, "SELECT ?");
+  check_stmt(stmt);
+  verify_param_count(stmt, 1);
+
+  rc= mysql_stmt_attr_set(stmt, STMT_ATTR_CURSOR_TYPE, &cursor_type);
+  check_execute(stmt, rc);
+  
+  bzero(&param, sizeof(param));
+  param.buffer_type= MYSQL_TYPE_STRING;
+  param.buffer= (void *) param_str;
+  len= sizeof(param_str) - 1;
+  param.length= &len;
+
+  rc= mysql_stmt_bind_param(stmt, &param);
+  check_execute(stmt, rc);
+
+  rc= mysql_stmt_execute(stmt);
+  check_execute(stmt, rc);
+
+  bzero(&result, sizeof(result));
+  result.buffer_type= MYSQL_TYPE_STRING;
+  result.buffer= str;
+  result.buffer_length= sizeof(str);
+  result.is_null= &is_null;
+  result.length= &len;
+  result.error=  &error;
+  
+  rc= mysql_stmt_bind_result(stmt, &result);
+  check_execute(stmt, rc);
+
+  rc= mysql_stmt_store_result(stmt);
+  check_execute(stmt, rc);
+
+  rc= mysql_stmt_fetch(stmt);
+  check_execute(stmt, rc);
+
+  DIE_UNLESS(len == sizeof(param_str) - 1 && !strcmp(str, param_str));
+
+  mysql_stmt_close(stmt);
+
+  DBUG_VOID_RETURN;
+}
 
 /*
   Read and parse arguments and MySQL options from my.cnf
@@ -18966,6 +19032,7 @@ static struct my_tests_st my_tests[]= {
 #ifdef HAVE_QUERY_CACHE
   { "test_bug36326", test_bug36326 },
 #endif
+  { "test_bug41078", test_bug41078 },
   { 0, 0 }
 };
 

Thread
bzr commit into mysql-6.0 branch (msvensson:3066)Magnus Svensson27 Feb