List:Commits« Previous MessageNext Message »
From:He Zhenxing Date:August 14 2008 7:35am
Subject:bzr push into mysql-6.0 branch (hezx:2683 to 2684) Bug#10143 Bug#21226
Bug#22165 Bug#29211 Bug#29738 Bug#31605 Bug#33002 Bug#33053 Bug#33362
Bug#336...
View as plain text  
 2684 He Zhenxing	2008-08-14 [merge]
      Merge 6.0 -> 6.0-rpl-testfixes
removed:
  mysql-test/include/wait_timeout_basic.inc
added:
  mysql-test/include/have_nodebug.inc
  mysql-test/r/have_nodebug.require
  mysql-test/r/innodb-autoinc-optimize.result
  mysql-test/r/sp-no-code.result
  mysql-test/suite/falcon/r/falcon_bug_35939.result
  mysql-test/suite/falcon/r/falcon_bug_38039.result
  mysql-test/suite/falcon/t/falcon_bug_35939.test
  mysql-test/suite/falcon/t/falcon_bug_38039.test
  mysql-test/suite/sys_vars/inc/multi_range_count_basic.inc
  mysql-test/suite/sys_vars/r/multi_range_count_basic_32.result
  mysql-test/suite/sys_vars/r/multi_range_count_basic_64.result
  mysql-test/suite/sys_vars/t/multi_range_count_basic_32.test
  mysql-test/suite/sys_vars/t/multi_range_count_basic_64.test
  mysql-test/t/innodb-autoinc-optimize.test
  mysql-test/t/sp-no-code.test
renamed:
  mysql-test/suite/falcon_team/r/falcon_bug_23962.result => mysql-test/suite/falcon/r/falcon_bug_23962.result
  mysql-test/suite/falcon_team/r/falcon_bug_27997.result => mysql-test/suite/falcon/r/falcon_bug_27997.result
  mysql-test/suite/falcon_team/r/falcon_bug_37080.result => mysql-test/suite/falcon/r/falcon_bug_37080.result
  mysql-test/suite/falcon_team/t/falcon_bug_23962.test => mysql-test/suite/falcon/t/falcon_bug_23962.test
  mysql-test/suite/falcon_team/t/falcon_bug_27997.test => mysql-test/suite/falcon/t/falcon_bug_27997.test
  mysql-test/suite/falcon_team/t/falcon_bug_37080.test => mysql-test/suite/falcon/t/falcon_bug_37080.test
modified:
  .bzr-mysql/default.conf
  client/Makefile.am
  client/mysql_upgrade.c
  client/mysqltest.c
  config/ac-macros/character_sets.m4
  configure.in
  extra/comp_err.c
  extra/perror.c
  mysql-test/mysql-test-run.pl
  mysql-test/r/func_if.result
  mysql-test/r/perror.result
  mysql-test/r/subselect.result
  mysql-test/r/subselect_no_mat.result
  mysql-test/r/subselect_no_opts.result
  mysql-test/r/subselect_no_semijoin.result
  mysql-test/suite/falcon/r/falcon_bug_22161.result
  mysql-test/suite/falcon/r/falcon_bug_31295.result
  mysql-test/suite/falcon/r/falcon_bug_33404.result
  mysql-test/suite/falcon/r/falcon_options.result
  mysql-test/suite/falcon/r/falcon_options2.result
  mysql-test/suite/falcon/t/falcon_bug_22161.test
  mysql-test/suite/falcon/t/falcon_bug_31295.test
  mysql-test/suite/falcon/t/falcon_bug_33404.test
  mysql-test/suite/falcon/t/falcon_options2.test
  mysql-test/suite/funcs_1/r/falcon_storedproc.result
  mysql-test/suite/funcs_1/r/falcon_trig_03.result
  mysql-test/suite/funcs_1/r/falcon_trig_03e.result
  mysql-test/suite/funcs_1/r/innodb_storedproc.result
  mysql-test/suite/funcs_1/r/innodb_trig_03.result
  mysql-test/suite/funcs_1/r/innodb_trig_03e.result
  mysql-test/suite/funcs_1/r/is_columns_is_falcon.result
  mysql-test/suite/funcs_1/r/is_columns_mysql.result
  mysql-test/suite/funcs_1/r/is_tables_is_falcon.result
  mysql-test/suite/funcs_1/r/is_user_privileges.result
  mysql-test/suite/funcs_1/r/memory_storedproc.result
  mysql-test/suite/funcs_1/r/memory_trig_03.result
  mysql-test/suite/funcs_1/r/memory_trig_03e.result
  mysql-test/suite/funcs_1/r/myisam_storedproc.result
  mysql-test/suite/funcs_1/r/myisam_trig_03.result
  mysql-test/suite/funcs_1/r/myisam_trig_03e.result
  mysql-test/suite/funcs_1/r/ndb_storedproc.result
  mysql-test/suite/funcs_1/r/ndb_trig_03.result
  mysql-test/suite/funcs_1/r/ndb_trig_03e.result
  mysql-test/suite/funcs_1/triggers/triggers_03.inc
  mysql-test/suite/funcs_1/triggers/triggers_08.inc
  mysql-test/suite/funcs_1/triggers/triggers_1011ext.inc
  mysql-test/suite/ndb/r/ndb_basic.result
  mysql-test/suite/ndb/t/disabled.def
  mysql-test/suite/rpl/t/disabled.def
  mysql-test/t/func_if.test
  mysql-test/t/information_schema-master.opt
  mysql-test/t/information_schema_db-master.opt
  mysql-test/t/mysqlshow-master.opt
  mysql-test/t/perror.test
  mysql-test/t/subselect.test
  mysql-test/t/variables-master.opt
  scripts/mysql_system_tables_fix.sql
  sql/field.h
  sql/item.cc
  sql/item.h
  sql/item_cmpfunc.cc
  sql/item_func.cc
  sql/mysql_priv.h
  sql/probes.h
  sql/share/errmsg.txt
  sql/sp_head.cc
  sql/sql_acl.cc
  sql/sql_base.cc
  sql/sql_error.cc
  sql/sql_error.h
  sql/sql_lex.h
  sql/sql_list.h
  sql/sql_parse.cc
  sql/sql_select.cc
  sql/sql_string.h
  sql/sql_yacc.yy
  sql/table.cc
  sql/table.h
  sql/thr_malloc.cc
  storage/falcon/BDB.cpp
  storage/falcon/BDB.h
  storage/falcon/BackLog.cpp
  storage/falcon/Cache.cpp
  storage/falcon/CollationManager.cpp
  storage/falcon/CompiledStatement.cpp
  storage/falcon/Configuration.cpp
  storage/falcon/Configuration.h
  storage/falcon/Connection.cpp
  storage/falcon/Database.cpp
  storage/falcon/DatabaseClone.cpp
  storage/falcon/DatabaseCopy.cpp
  storage/falcon/Dbb.cpp
  storage/falcon/Dbb.h
  storage/falcon/DeferredIndex.cpp
  storage/falcon/DeferredIndex.h
  storage/falcon/Gopher.cpp
  storage/falcon/IO.cpp
  storage/falcon/IOx.h
  storage/falcon/Index.cpp
  storage/falcon/IndexWalker.cpp
  storage/falcon/IndexWalker.h
  storage/falcon/Inversion.cpp
  storage/falcon/LicenseManager.cpp
  storage/falcon/Makefile.am
  storage/falcon/MemMgr.cpp
  storage/falcon/RecordLeaf.cpp
  storage/falcon/RecordVersion.cpp
  storage/falcon/RecoveryObjects.cpp
  storage/falcon/RecoveryObjects.h
  storage/falcon/Repository.cpp
  storage/falcon/RepositoryManager.cpp
  storage/falcon/RepositoryVolume.cpp
  storage/falcon/ResultSet.cpp
  storage/falcon/Role.cpp
  storage/falcon/SQLParse.cpp
  storage/falcon/SRLCreateTableSpace.cpp
  storage/falcon/SRLCreateTableSpace.h
  storage/falcon/SRLDeleteIndex.cpp
  storage/falcon/SRLPrepare.cpp
  storage/falcon/SRLRollback.cpp
  storage/falcon/SRLUpdateIndex.cpp
  storage/falcon/Scheduler.cpp
  storage/falcon/SectorBuffer.cpp
  storage/falcon/SectorCache.cpp
  storage/falcon/SequenceManager.cpp
  storage/falcon/SerialLog.cpp
  storage/falcon/SerialLog.h
  storage/falcon/SerialLogFile.cpp
  storage/falcon/Server.cpp
  storage/falcon/SessionManager.cpp
  storage/falcon/Statement.cpp
  storage/falcon/StorageDatabase.cpp
  storage/falcon/StorageDatabase.h
  storage/falcon/StorageHandler.cpp
  storage/falcon/StorageHandler.h
  storage/falcon/StorageTableShare.cpp
  storage/falcon/SymbolManager.cpp
  storage/falcon/Sync.cpp
  storage/falcon/Sync.h
  storage/falcon/SyncObject.cpp
  storage/falcon/SyncObject.h
  storage/falcon/SyncTest.cpp
  storage/falcon/Table.cpp
  storage/falcon/TableSpace.cpp
  storage/falcon/TableSpace.h
  storage/falcon/TableSpaceManager.cpp
  storage/falcon/TableSpaceManager.h
  storage/falcon/Thread.cpp
  storage/falcon/Threads.cpp
  storage/falcon/Transaction.cpp
  storage/falcon/Transaction.h
  storage/falcon/TransactionManager.cpp
  storage/falcon/WalkDeferred.cpp
  storage/falcon/WalkDeferred.h
  storage/falcon/WalkIndex.cpp
  storage/falcon/ha_falcon.cpp
  storage/falcon/ha_falcon.h
  support-files/build-tags
  mysql-test/suite/falcon/r/falcon_bug_23962.result
  mysql-test/suite/falcon/r/falcon_bug_37080.result
  mysql-test/suite/falcon/t/falcon_bug_23962.test
  mysql-test/suite/falcon/t/falcon_bug_37080.test

 2683 Sven Sandberg	2008-08-06 [merge]
      merged 6.0 main -> 6.0-rpl-testfixes
      all files automerged without conflict
modified:
  mysql-test/extra/binlog_tests/binlog_insert_delayed.test
  mysql-test/include/show_binlog_events.inc
  mysql-test/suite/binlog/r/binlog_killed_simulate.result
  mysql-test/suite/binlog/r/binlog_row_binlog.result
  mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result
  mysql-test/suite/binlog/r/binlog_statement_insert_delayed.result
  mysql-test/suite/binlog/r/binlog_stm_binlog.result
  mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result
  mysql-test/suite/rpl/r/rpl_loaddata_map.result
  mysql-test/suite/rpl/r/rpl_stm_log.result
  mysql-test/suite/rpl/r/rpl_variables.result
  mysql-test/suite/rpl/t/rpl_incident.test
  mysql-test/suite/rpl/t/rpl_loaddata_map.test
  mysql-test/suite/rpl/t/rpl_trunc_temp.test
  mysql-test/suite/rpl/t/rpl_variables.test

=== modified file '.bzr-mysql/default.conf'
--- a/.bzr-mysql/default.conf	2008-07-28 17:44:14 +0000
+++ b/.bzr-mysql/default.conf	2008-08-12 14:18:52 +0000
@@ -1,5 +1,5 @@
-[MYSQL]
-tree_location = bzr+ssh://bk-internal.mysql.com/bzrroot/server/mysql-6.0
-post_commit_to = commits@strippedql.com
-post_push_to = commits@stripped
-tree_name = mysql-6.0
+[MYSQL]
+tree_location = bzr+ssh://bk-internal.mysql.com/bzrroot/server/mysql-6.0
+post_commit_to = commits@stripped
+post_push_to = commits@lists.mysql.com
+tree_name = mysql-6.0

=== modified file 'client/Makefile.am'
--- a/client/Makefile.am	2008-06-20 11:40:01 +0000
+++ b/client/Makefile.am	2008-08-06 14:39:03 +0000
@@ -88,11 +88,12 @@ mysqlslap_LDADD =		$(CXXLDFLAGS) $(CLIEN
 
 mysqltest_SOURCES=		mysqltest.c
 mysqltest_CFLAGS=		-DTHREAD -UUNDEF_THREADS_HACK
-mysqltest_LDADD =		$(CXXLDFLAGS) $(CLIENT_THREAD_LIBS) \
+mysqltest_LDADD =		$(CXXLDFLAGS) \
 				@CLIENT_EXTRA_LDFLAGS@ \
 				$(LIBMYSQLCLIENT_LA) \
 				$(top_builddir)/mysys/libmysys.a \
-				$(top_builddir)/regex/libregex.a
+				$(top_builddir)/regex/libregex.a \
+				$(CLIENT_THREAD_LIBS)
 
 mysql_upgrade_SOURCES=          mysql_upgrade.c \
                                 $(top_srcdir)/mysys/my_getpagesize.c

=== modified file 'client/mysql_upgrade.c'
--- a/client/mysql_upgrade.c	2008-05-02 17:42:34 +0000
+++ b/client/mysql_upgrade.c	2008-08-11 15:30:29 +0000
@@ -269,6 +269,10 @@ get_one_option(int optid, const struct m
 }
 
 
+/**
+  Run a command using the shell, storing its output in the supplied dynamic
+  string.
+*/
 static int run_command(char* cmd,
                        DYNAMIC_STRING *ds_res)
 {
@@ -341,37 +345,15 @@ static int run_tool(char *tool_path, DYN
 }
 
 
-/*
-  Try to get the full path to this exceutable
-
-  Return 0 if path found
-
+/**
+  Look for the filename of given tool, with the presumption that it is in the
+  same directory as mysql_upgrade and that the same executable-searching 
+  mechanism will be used when we run our sub-shells with popen() later.
 */
-
-static my_bool get_full_path_to_executable(char* path)
+static void find_tool(char *tool_executable_name, const char *tool_name, 
+                      const char *self_name)
 {
-  my_bool ret;
-  DBUG_ENTER("get_full_path_to_executable");
-#ifdef __WIN__
-  ret= (GetModuleFileName(NULL, path, FN_REFLEN) == 0);
-#else
-  /* my_readlink returns 0 if a symlink was read */
-  ret= (my_readlink(path, "/proc/self/exe", MYF(0)) != 0);
-  /* Might also want to try with /proc/$$/exe if the above fails */
-#endif
-  DBUG_PRINT("exit", ("path: %s", path));
-  DBUG_RETURN(ret);
-}
-
-
-/*
-  Look for the tool in the same directory as mysql_upgrade.
-*/
-
-static void find_tool(char *tool_path, const char *tool_name)
-{
-  size_t path_len;
-  char path[FN_REFLEN];
+  char *last_fn_libchar;
   DYNAMIC_STRING ds_tmp;
   DBUG_ENTER("find_tool");
   DBUG_PRINT("enter", ("progname: %s", my_progname));
@@ -379,77 +361,59 @@ static void find_tool(char *tool_path, c
   if (init_dynamic_string(&ds_tmp, "", 32, 32))
     die("Out of memory");
 
-  /* Initialize path with the full path to this program */
-  if (get_full_path_to_executable(path))
+  last_fn_libchar= strrchr(self_name, FN_LIBCHAR);
+
+  if (last_fn_libchar == NULL)
   {
     /*
-      Easy way to get full executable path failed, try
-      other methods
+      mysql_upgrade was found by the shell searching the path.  A sibling
+      next to us should be found the same way.
     */
-    if (my_progname[0] == FN_LIBCHAR)
-    {
-      /* 1. my_progname contains full path */
-      strmake(path, my_progname, FN_REFLEN);
-    }
-    else if (my_progname[0] == '.')
-    {
-      /* 2. my_progname contains relative path, prepend wd */
-      char buf[FN_REFLEN];
-      my_getwd(buf, FN_REFLEN, MYF(0));
-      my_snprintf(path, FN_REFLEN, "%s%s", buf, my_progname);
-    }
-    else
-    {
-      /* 3. Just go for it and hope tool is in path */
-      path[0]= 0;
-    }
+    strncpy(tool_executable_name, tool_name, FN_REFLEN);
   }
-
-  DBUG_PRINT("info", ("path: '%s'", path));
-
-  /* Chop off binary name (i.e mysql-upgrade) from path */
-  dirname_part(path, path, &path_len);
-
-  /*
-    When running in a not yet installed build and using libtool,
-    the program(mysql_upgrade) will be in .libs/ and executed
-    through a libtool wrapper in order to use the dynamic libraries
-    from this build. The same must be done for the tools(mysql and
-    mysqlcheck). Thus if path ends in .libs/, step up one directory
-    and execute the tools from there
-  */
-  path[max(path_len-1, 0)]= 0;   /* Chop off last / */
-  if (strncmp(path + dirname_length(path), ".libs", 5) == 0)
+  else
   {
-    DBUG_PRINT("info", ("Chopping off .libs from '%s'", path));
-
-    /* Chop off .libs */
-    dirname_part(path, path, &path_len);
-  }
+    int len;
 
+    /*
+      mysql_upgrade was run absolutely or relatively.  We can find a sibling
+      by replacing our name after the LIBCHAR with the new tool name.
+    */
 
-  DBUG_PRINT("info", ("path: '%s'", path));
+    /*
+      When running in a not yet installed build and using libtool,
+      the program(mysql_upgrade) will be in .libs/ and executed
+      through a libtool wrapper in order to use the dynamic libraries
+      from this build. The same must be done for the tools(mysql and
+      mysqlcheck). Thus if path ends in .libs/, step up one directory
+      and execute the tools from there
+    */
+    if (((last_fn_libchar - 6) >= self_name) &&
+        (strncmp(last_fn_libchar - 5, ".libs", 5) == 0) &&
+        (*(last_fn_libchar - 6) == FN_LIBCHAR))
+    {
+      DBUG_PRINT("info", ("Chopping off \".libs\" from end of path"));
+      last_fn_libchar -= 6;
+    }
 
-  /* Format name of the tool to search for */
-  fn_format(tool_path, tool_name,
-            path, "", MYF(MY_REPLACE_DIR));
+    len= last_fn_libchar - self_name;
 
-  verbose("Looking for '%s' in: %s", tool_name, tool_path);
+    my_snprintf(tool_executable_name, FN_REFLEN, "%.*s%c%s",
+                len, self_name, FN_LIBCHAR, tool_name);
+  }
 
-  /* Make sure the tool exists */
-  if (my_access(tool_path, F_OK) != 0)
-    die("Can't find '%s'", tool_path);
+  verbose("Looking for '%s' as: %s", tool_name, tool_executable_name);
 
   /*
     Make sure it can be executed
   */
-  if (run_tool(tool_path,
+  if (run_tool(tool_executable_name,
                &ds_tmp, /* Get output from command, discard*/
                "--help",
                "2>&1",
                IF_WIN("> NUL", "> /dev/null"),
                NULL))
-    die("Can't execute '%s'", tool_path);
+    die("Can't execute '%s'", tool_executable_name);
 
   dynstr_free(&ds_tmp);
 
@@ -759,11 +723,20 @@ static const char *load_default_groups[]
 
 int main(int argc, char **argv)
 {
+  char self_name[FN_REFLEN];
+
   MY_INIT(argv[0]);
 #ifdef __NETWARE__
   setscreenmode(SCR_AUTOCLOSE_ON_EXIT);
 #endif
 
+#if __WIN__
+  if (GetModuleFileName(NULL, self_name, FN_REFLEN) == 0)
+#endif
+  {
+    strncpy(self_name, argv[0], FN_REFLEN);
+  }
+
   if (init_dynamic_string(&ds_args, "", 512, 256))
     die("Out of memory");
 
@@ -789,10 +762,10 @@ int main(int argc, char **argv)
   dynstr_append(&ds_args, " ");
 
   /* Find mysql */
-  find_tool(mysql_path, IF_WIN("mysql.exe", "mysql"));
+  find_tool(mysql_path, IF_WIN("mysql.exe", "mysql"), self_name);
 
   /* Find mysqlcheck */
-  find_tool(mysqlcheck_path, IF_WIN("mysqlcheck.exe", "mysqlcheck"));
+  find_tool(mysqlcheck_path, IF_WIN("mysqlcheck.exe", "mysqlcheck"), self_name);
 
   /*
     Read the mysql_upgrade_info file to check if mysql_upgrade

=== modified file 'client/mysqltest.c'
--- a/client/mysqltest.c	2008-07-24 08:26:24 +0000
+++ b/client/mysqltest.c	2008-08-05 23:26:18 +0000
@@ -3861,12 +3861,13 @@ typedef struct
 {
   const char *name;
   uint        code;
+  const char *text;
 } st_error;
 
 static st_error global_error_names[] =
 {
 #include <mysqld_ername.h>
-  { 0, 0 }
+  { 0, 0, 0 }
 };
 
 uint get_errcode_from_name(char *error_name, char *error_end)

=== modified file 'config/ac-macros/character_sets.m4'
--- a/config/ac-macros/character_sets.m4	2008-02-26 19:54:19 +0000
+++ b/config/ac-macros/character_sets.m4	2008-07-29 03:42:07 +0000
@@ -358,8 +358,8 @@ case $default_charset in 
       default_charset_default_collation="ucs2_general_ci"
       define(UCSC1, ucs2_general_ci ucs2_bin)
       define(UCSC2, ucs2_czech_ci ucs2_danish_ci)
-      define(UCSC3, ucs2_esperanto_ci ucs2_estonian_ci ucs2_icelandic_ci)
-      define(UCSC4, ucs2_latvian_ci ucs2_lithuanian_ci)
+      define(UCSC3, ucs2_esperanto_ci ucs2_estonian_ci ucs2_hungarian_ci)
+      define(UCSC4, ucs2_icelandic_ci ucs2_latvian_ci ucs2_lithuanian_ci)
       define(UCSC5, ucs2_persian_ci ucs2_polish_ci ucs2_romanian_ci)
       define(UCSC6, ucs2_sinhala_ci ucs2_slovak_ci ucs2_slovenian_ci)
       define(UCSC7, ucs2_spanish2_ci ucs2_spanish_ci)
@@ -376,8 +376,8 @@ case $default_charset in 
       default_charset_default_collation="utf8_general_ci"
       define(UTFC1, utf8_general_ci utf8_bin)
       define(UTFC2, utf8_czech_ci utf8_danish_ci)
-      define(UTFC3, utf8_esperanto_ci utf8_estonian_ci utf8_icelandic_ci)
-      define(UTFC4, utf8_latvian_ci utf8_lithuanian_ci)
+      define(UTFC3, utf8_esperanto_ci utf8_estonian_ci utf8_hungarian_ci)
+      define(UTFC4, utf8_icelandic_ci utf8_latvian_ci utf8_lithuanian_ci)
       define(UTFC5, utf8_persian_ci utf8_polish_ci utf8_romanian_ci)
       define(UTFC6, utf8_sinhala_ci utf8_slovak_ci utf8_slovenian_ci)
       define(UTFC7, utf8_spanish2_ci utf8_spanish_ci)
@@ -396,8 +396,8 @@ case $default_charset in 
       else
         define(UTFC1, utf8mb3_general_ci utf8mb3_bin)
         define(UTFC2, utf8mb3_czech_ci utf8mb3_danish_ci)
-        define(UTFC3, utf8mb3_esperanto_ci utf8mb3_estonian_ci utf8mb3_icelandic_ci)
-        define(UTFC4, utf8mb3_latvian_ci utf8mb3_lithuanian_ci)
+        define(UTFC3, utf8mb3_esperanto_ci utf8mb3_estonian_ci utf8mb3_hungarian_ci)
+        define(UTFC4, utf8mb3_icelandic_ci utf8mb3_latvian_ci utf8mb3_lithuanian_ci)
         define(UTFC5, utf8mb3_persian_ci utf8mb3_polish_ci utf8mb3_romanian_ci)
         define(UTFC6, utf8mb3_sinhala_ci utf8mb3_slovak_ci utf8mb3_slovenian_ci)
         define(UTFC7, utf8mb3_spanish2_ci utf8mb3_spanish_ci)
@@ -411,8 +411,8 @@ case $default_charset in 
       default_charset_default_collation="utf16_general_ci"
       define(UTFC1, utf16_general_ci utf16_bin)
       define(UTFC2, utf16_czech_ci utf16_danish_ci)
-      define(UTFC3, utf16_esperanto_ci utf16_estonian_ci utf16_icelandic_ci)
-      define(UTFC4, utf16_latvian_ci utf16_lithuanian_ci)
+      define(UTFC3, utf16_esperanto_ci utf16_estonian_ci utf16_hungarian_ci)
+      define(UTFC4, utf16_icelandic_ci utf16_latvian_ci utf16_lithuanian_ci)
       define(UTFC5, utf16_persian_ci utf16_polish_ci utf16_romanian_ci)
       define(UTFC6, utf16_sinhala_ci utf16_slovak_ci utf16_slovenian_ci)
       define(UTFC7, utf16_spanish2_ci utf16_spanish_ci)
@@ -425,8 +425,8 @@ case $default_charset in 
       default_charset_default_collation="utf32_general_ci"
       define(UTFC1, utf32_general_ci utf32_bin)
       define(UTFC2, utf32_czech_ci utf32_danish_ci)
-      define(UTFC3, utf32_esperanto_ci utf32_estonian_ci utf32_icelandic_ci)
-      define(UTFC4, utf32_latvian_ci utf32_lithuanian_ci)
+      define(UTFC3, utf32_esperanto_ci utf32_estonian_ci utf32_hungarian_ci)
+      define(UTFC4, utf32_icelandic_ci utf32_latvian_ci utf32_lithuanian_ci)
       define(UTFC5, utf32_persian_ci utf32_polish_ci utf32_romanian_ci)
       define(UTFC6, utf32_sinhala_ci utf32_slovak_ci utf32_slovenian_ci)
       define(UTFC7, utf32_spanish2_ci utf32_spanish_ci)

=== modified file 'configure.in'
--- a/configure.in	2008-07-23 11:28:20 +0000
+++ b/configure.in	2008-08-12 04:38:50 +0000
@@ -643,19 +643,19 @@ fi
 AC_MSG_CHECKING(whether features provided by the user community should be included.)
 AC_ARG_ENABLE(community-features,
     AC_HELP_STRING(
-        [--enable-community-features], 
-        [Enable additional features provided by the user community.]),
+        [--disable-community-features], 
+        [Disable additional features provided by the user community.]),
     [ ENABLE_COMMUNITY_FEATURES=$enableval ],
-    [ ENABLE_COMMUNITY_FEATURES=no ]
+    [ ENABLE_COMMUNITY_FEATURES=yes ]
     )
 
 if test "$ENABLE_COMMUNITY_FEATURES" = "yes"
 then
   AC_DEFINE([COMMUNITY_SERVER], [1],
             [Whether features provided by the user community should be included])
-  AC_MSG_RESULT([yes, community server])
+  AC_MSG_RESULT([yes])
 else
-  AC_MSG_RESULT([no, enterprise server])
+  AC_MSG_RESULT([no])
 fi
 
 AC_ARG_WITH(server-suffix,

=== modified file 'extra/comp_err.c'
--- a/extra/comp_err.c	2008-04-09 00:56:49 +0000
+++ b/extra/comp_err.c	2008-08-06 19:20:57 +0000
@@ -199,11 +199,33 @@ int main(int argc, char *argv[])
 }
 
 
+static void print_escaped_string(FILE *f, const char *str)
+{
+  const char *tmp = str;
+
+  while (tmp[0] != 0)
+  {
+    switch (tmp[0])
+    {
+      case '\\': fprintf(f, "\\\\"); break;
+      case '\'': fprintf(f, "\\\'"); break;
+      case '\"': fprintf(f, "\\\""); break;
+      case '\n': fprintf(f, "\\n"); break;
+      case '\r': fprintf(f, "\\r"); break;
+      default: fprintf(f, "%c", tmp[0]);
+    }
+    tmp++;
+  }
+}
+
+
 static int create_header_files(struct errors *error_head)
 {
   uint er_last;
   FILE *er_definef, *sql_statef, *er_namef;
   struct errors *tmp_error;
+  struct message *er_msg;
+  const char *er_text;
   DBUG_ENTER("create_header_files");
   LINT_INIT(er_last);
 
@@ -245,8 +267,12 @@ static int create_header_files(struct er
 	      "{ %-40s,\"%s\", \"%s\" },\n", tmp_error->er_name,
 	      tmp_error->sql_code1, tmp_error->sql_code2);
     /*generating er_name file */
-    fprintf(er_namef, "{ \"%s\", %d },\n", tmp_error->er_name,
+    er_msg= find_message(tmp_error, default_language, FALSE);
+    er_text = (er_msg ? er_msg->text : "");
+    fprintf(er_namef, "{ \"%s\", %d, \"", tmp_error->er_name,
 	    tmp_error->d_code);
+    print_escaped_string(er_namef, er_text);
+    fprintf(er_namef, "\" },\n");
 
   }
   /* finishing off with mysqld_error.h */

=== modified file 'extra/perror.c'
--- a/extra/perror.c	2008-03-28 19:59:20 +0000
+++ b/extra/perror.c	2008-08-05 23:26:18 +0000
@@ -184,11 +184,51 @@ static const char *get_ha_error_msg(int 
   return NullS;
 }
 
+typedef struct
+{
+  const char *name;
+  uint        code;
+  const char *text;
+} st_error;
+
+static st_error global_error_names[] =
+{
+#include <mysqld_ername.h>
+  { 0, 0, 0 }
+};
+
+/**
+  Lookup an error by code in the global_error_names array.
+  @param code the code to lookup
+  @param [out] name_ptr the error name, when found
+  @param [out] msg_ptr the error text, when found
+  @return 1 when found, otherwise 0
+*/
+int get_ER_error_msg(uint code, const char **name_ptr, const char **msg_ptr)
+{
+  st_error *tmp_error;
+
+  tmp_error= & global_error_names[0];
+
+  while (tmp_error->name != NULL)
+  {
+    if (tmp_error->code == code)
+    {
+      *name_ptr= tmp_error->name;
+      *msg_ptr= tmp_error->text;
+      return 1;
+    }
+    tmp_error++;
+  }
+
+  return 0;
+}
 
 int main(int argc,char *argv[])
 {
   int error,code,found;
   const char *msg;
+  const char *name;
   char *unknown_error = 0;
   MY_INIT(argv[0]);
 
@@ -291,6 +331,14 @@ int main(int argc,char *argv[])
         else
           puts(msg);
       }
+      if (get_ER_error_msg(code, & name, & msg))
+      {
+        found= 1;
+        if (verbose)
+          printf("MySQL error code %3d (%s): %s\n", code, name, msg);
+        else
+          puts(msg);
+      }
       if (!found)
       {
         fprintf(stderr,"Illegal error code: %d\n", code);

=== added file 'mysql-test/include/have_nodebug.inc'
--- a/mysql-test/include/have_nodebug.inc	1970-01-01 00:00:00 +0000
+++ b/mysql-test/include/have_nodebug.inc	2008-07-24 16:50:18 +0000
@@ -0,0 +1,4 @@
+-- require r/have_nodebug.require
+disable_query_log;
+select (version() like '%debug%') as debug;
+enable_query_log;

=== removed file 'mysql-test/include/wait_timeout_basic.inc'
--- a/mysql-test/include/wait_timeout_basic.inc	2008-05-08 18:13:39 +0000
+++ b/mysql-test/include/wait_timeout_basic.inc	1970-01-01 00:00:00 +0000
@@ -1,218 +0,0 @@
-############## mysql-test\t\wait_timeout_basic.test ###########################
-#                                                                             #
-# Variable Name: wait_timeout                                                 #
-# Scope: GLOBAL | SESSION                                                     #
-# Access Type: Dynamic                                                        #
-# Data Type: numeric                                                          #
-# Default Value:                                                              #
-# Range:                                                                      #
-#                                                                             #
-#                                                                             #
-# Creation Date: 2008-02-07                                                   #
-# Author:  Sharique Abdullah                                                      #
-#                                                                             #
-# Description: Test Cases of Dynamic System Variable wait_timeout             #
-#              that checks the behavior of this variable in the following ways#
-#              * Default Value                                                #
-#              * Valid & Invalid values                                       #
-#              * Scope & Access method                                        #
-#              * Data Integrity                                               #
-#                                                                             #
-# Reference: http://dev.mysql.com/doc/refman/5.1/en/                          #
-#  server-system-variables.html#option_mysqld_wait_timeouts                   #
-#                                                                             #
-###############################################################################
-# Due to differnces between linux and windows in the results
-
---source include/not_windows.inc
---source include/load_sysvars.inc
-
-############################################################
-#           START OF wait_timeout TESTS                    #
-############################################################
-
-#############################################################
-#                 Save initial value                        #
-#############################################################
-
-SET @start_global_value = @@global.wait_timeout;
-SET @start_session_value = @@session.wait_timeout;
-
---echo '#--------------------FN_DYNVARS_005_01-------------------------#'
-############################################################
-#     Display the DEFAULT value of wait_timeout            #
-############################################################
-
-SET @@global.wait_timeout = 100;
-SET @@global.wait_timeout = DEFAULT;
-SELECT @@global.wait_timeout;
-
-SET @@session.wait_timeout = 200;
-SET @@session.wait_timeout = DEFAULT;
-SELECT @@session.wait_timeout;
-
-
---echo '#--------------------FN_DYNVARS_005_02-------------------------#'
-############################################################
-#     Check the DEFAULT value of wait_timeout              #
-############################################################
-
-SET @@global.wait_timeout = DEFAULT;
-SELECT @@global.wait_timeout = @default_wait_timeout;
-
-SET @@session.wait_timeout = DEFAULT;
-SELECT @@session.wait_timeout = @default_wait_timeout;
-
-
-
---echo '#--------------------FN_DYNVARS_005_03-------------------------#'
-######################################################################
-# Change the value of wait_timeout to a valid value for GLOBAL Scope #
-######################################################################
-
-#SET @@global.wait_timeout= @min_wait_timeout;
-SET @@global.wait_timeout= 1;
-SELECT @@global.wait_timeout;
-
-SET @@global.wait_timeout = 60020;
-SELECT @@global.wait_timeout;
-
-#SET @@global.wait_timeout = @max_wait_timeout;
-SET @@global.wait_timeout = 31536000;
-SELECT @@global.wait_timeout = @max_wait_timeout;
-
-
---echo '#--------------------FN_DYNVARS_005_04-------------------------#'
-#######################################################################
-# Change the value of wait_timeout to a valid value for SESSION Scope #
-#######################################################################
-#SET @@session.wait_timeout = @min_wait_timeout;
-#SELECT @@session.wait_timeout;
-
-SET @@session.wait_timeout =6000;
-SELECT @@session.wait_timeout;
-
-#SET @@session.wait_timeout = @max_wait_timeout;
-#SELECT @@session.wait_timeout = @max_wait_timeout;
-
-
---echo '#------------------FN_DYNVARS_005_05-----------------------#'
-########################################################
-# Change the value of wait_timeout to an invalid value #
-########################################################
-
-SET @@global.wait_timeout = 0;
-SET @@global.wait_timeout = -1024;
-
---echo 'Bug # 34837: Errors are not coming on assigning invalid values to variable';
-
---Error ER_WRONG_TYPE_FOR_VAR
-SET @@global.wait_timeout = ON;
-
---Error ER_WRONG_TYPE_FOR_VAR
-SET @@global.wait_timeout = OFF;
-
-SET @@global.wait_timeout = True;
-SELECT @@global.wait_timeout;
-
-SET @@global.wait_timeout = False;
-SELECT @@global.wait_timeout;
-
---Error ER_WRONG_TYPE_FOR_VAR
-SET @@global.wait_timeout = 65530.34;
-
---Error ER_WRONG_TYPE_FOR_VAR
-SET @@global.wait_timeout ="Test";
-
-
---Error ER_WRONG_TYPE_FOR_VAR
-SET @@session.wait_timeout = ON;
-
-
---Error ER_WRONG_TYPE_FOR_VAR
-SET @@session.wait_timeout = OFF;
-
-SET @@session.wait_timeout = True;
-SELECT @@session.wait_timeout;
-
-SET @@session.wait_timeout = False;
-SELECT @@session.wait_timeout;
-
-
---Error ER_WRONG_TYPE_FOR_VAR
-SET @@session.wait_timeout = "Test";
-
-
---Error ER_WRONG_TYPE_FOR_VAR
-SET @@session.wait_timeout = 'test';
-
-SET @@session.wait_timeout = 123456789031;
-SELECT @@session.wait_timeout = @max_wait_timeout;
-
-
---echo '#------------------FN_DYNVARS_005_06-----------------------#'
-####################################################################
-#   Check if the value in GLOBAL Table matches value in variable   #
-####################################################################
-
-SELECT @@global.wait_timeout = VARIABLE_VALUE 
-FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES 
-WHERE VARIABLE_NAME='wait_timeout';
-
---echo '#------------------FN_DYNVARS_005_07-----------------------#'
-####################################################################
-#  Check if the value in SESSION Table matches value in variable   #
-####################################################################
-
-SELECT @@session.wait_timeout = VARIABLE_VALUE 
-FROM INFORMATION_SCHEMA.SESSION_VARIABLES
-WHERE VARIABLE_NAME='wait_timeout';
-
---echo '#---------------------FN_DYNVARS_001_09----------------------#'
-###########################################################################
-#  Check if global and session variable are independent of each other     #
-###########################################################################
-
-SET @@global.wait_timeout = 30000;
-SET @@global.wait_timeout = 40000;
-SELECT @@wait_timeout = @@global.wait_timeout;
-
---echo '#---------------------FN_DYNVARS_001_10----------------------#'
-########################################################################
-#    Check if accessing variable with SESSION,LOCAL and without SCOPE  #
-#    points to same session variable                                   #
-########################################################################
-
-SET @@wait_timeout = 100;
-SELECT @@wait_timeout = @@local.wait_timeout;
-SELECT @@local.wait_timeout = @@session.wait_timeout;
-
---echo '#---------------------FN_DYNVARS_001_11----------------------#'
-#######################################################################
-#   Check if wait_timeout can be accessed with and without @@ sign    #
-#######################################################################
-
-SET wait_timeout = 1027;
-SELECT @@wait_timeout;
-
-
---Error ER_UNKNOWN_TABLE
-SELECT local.wait_timeout;
-
---Error ER_UNKNOWN_TABLE
-SELECT session.wait_timeout;
-
---Error ER_BAD_FIELD_ERROR
-SELECT wait_timeout = @@session.wait_timeout;
-
-
-####################################
-#     Restore initial value        #
-####################################
-
-SET @@global.wait_timeout = @start_global_value;
-SET @@session.wait_timeout = @start_session_value;
-
-#################################################
-#                 END OF wait_timeout TESTS     #
-#################################################

=== modified file 'mysql-test/mysql-test-run.pl'
--- a/mysql-test/mysql-test-run.pl	2008-07-24 14:33:10 +0000
+++ b/mysql-test/mysql-test-run.pl	2008-08-07 14:19:54 +0000
@@ -1474,13 +1474,15 @@ sub executable_setup_ndb () {
 
   $exe_ndbd=
     mtr_exe_maybe_exists("$ndb_path/src/kernel/ndbd",
-			 "$ndb_path/ndbd");
+			 "$ndb_path/ndbd",
+			 "$glob_basedir/libexec/ndbd");
   $exe_ndb_mgm=
     mtr_exe_maybe_exists("$ndb_path/src/mgmclient/ndb_mgm",
 			 "$ndb_path/ndb_mgm");
   $exe_ndb_mgmd=
     mtr_exe_maybe_exists("$ndb_path/src/mgmsrv/ndb_mgmd",
-			 "$ndb_path/ndb_mgmd");
+			 "$ndb_path/ndb_mgmd",
+			 "$glob_basedir/libexec/ndb_mgmd");
   $exe_ndb_waiter=
     mtr_exe_maybe_exists("$ndb_path/tools/ndb_waiter",
 			 "$ndb_path/ndb_waiter");
@@ -4703,11 +4705,15 @@ sub run_mysqltest ($) {
 
   # ----------------------------------------------------------------------
   # If embedded server, we create server args to give mysqltest to pass on
+  # and remove existing falcon tables
   # ----------------------------------------------------------------------
-
+  
   if ( $glob_use_embedded_server )
   {
     mysqld_arguments($args,$master->[0],$tinfo->{'master_opt'},[]);
+    #Remove  falcon tables before each test, otherwise every start might fail
+    #if there is an error in falcon recovery
+    rm_falcon_tables($master->[0]->{'path_myddir'});
   }
 
   # ----------------------------------------------------------------------

=== modified file 'mysql-test/r/func_if.result'
--- a/mysql-test/r/func_if.result	2008-02-12 19:09:16 +0000
+++ b/mysql-test/r/func_if.result	2008-07-31 09:50:24 +0000
@@ -131,3 +131,49 @@ drop table t1;
 select if(0, 18446744073709551610, 18446744073709551610);
 if(0, 18446744073709551610, 18446744073709551610)
 18446744073709551610
+CREATE TABLE t1(a DECIMAL(10,3));
+SELECT t1.a,
+IF((ROUND(t1.a,2)=1), 2,
+IF((ROUND(t1.a,2)=1), 2,
+IF((ROUND(t1.a,2)=1), 2,
+IF((ROUND(t1.a,2)=1), 2,
+IF((ROUND(t1.a,2)=1), 2,
+IF((ROUND(t1.a,2)=1), 2,
+IF((ROUND(t1.a,2)=1), 2,
+IF((ROUND(t1.a,2)=1), 2,
+IF((ROUND(t1.a,2)=1), 2,
+IF((ROUND(t1.a,2)=1), 2,
+IF((ROUND(t1.a,2)=1), 2,
+IF((ROUND(t1.a,2)=1), 2,
+IF((ROUND(t1.a,2)=1), 2,
+IF((ROUND(t1.a,2)=1), 2,
+IF((ROUND(t1.a,2)=1), 2,
+IF((ROUND(t1.a,2)=1), 2,
+IF((ROUND(t1.a,2)=1), 2,
+IF((ROUND(t1.a,2)=1), 2,
+IF((ROUND(t1.a,2)=1), 2,
+IF((ROUND(t1.a,2)=1), 2,
+IF((ROUND(t1.a,2)=1), 2,
+IF((ROUND(t1.a,2)=1), 2,
+IF((ROUND(t1.a,2)=1), 2,
+IF((ROUND(t1.a,2)=1), 2,
+IF((ROUND(t1.a,2)=1), 2,
+IF((ROUND(t1.a,2)=1), 2,
+IF((ROUND(t1.a,2)=1), 2,
+IF((ROUND(t1.a,2)=1), 2,
+IF((ROUND(t1.a,2)=1), 2,
+IF((ROUND(t1.a,2)=1), 2,0)))))))))))))))))))))))))))))) + 1
+FROM t1;
+a	IF((ROUND(t1.a,2)=1), 2,
+IF((ROUND(t1.a,2)=1), 2,
+IF((ROUND(t1.a,2)=1), 2,
+IF((ROUND(t1.a,2)=1), 2,
+IF((ROUND(t1.a,2)=1), 2,
+IF((ROUND(t1.a,2)=1), 2,
+IF((ROUND(t1.a,2)=1), 2,
+IF((ROUND(t1.a,2)=1), 2,
+IF((ROUND(t1.a,2)=1), 2,
+IF((ROUND(t1.a,2)=1), 2,
+IF((R
+DROP TABLE t1;
+End of 5.0 tests

=== added file 'mysql-test/r/have_nodebug.require'
--- a/mysql-test/r/have_nodebug.require	1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/have_nodebug.require	2008-07-24 16:50:18 +0000
@@ -0,0 +1,2 @@
+debug
+0

=== added file 'mysql-test/r/innodb-autoinc-optimize.result'
--- a/mysql-test/r/innodb-autoinc-optimize.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/innodb-autoinc-optimize.result	2008-08-13 08:16:34 +0000
@@ -0,0 +1,6 @@
+drop table if exists t1;
+create table t1(a int not null auto_increment primary key) engine=innodb;
+insert into t1 set a = -1;
+optimize table t1;
+Table	Op	Msg_type	Msg_text
+test.t1	optimize	status	OK

=== modified file 'mysql-test/r/perror.result'
--- a/mysql-test/r/perror.result	2006-08-01 09:29:10 +0000
+++ b/mysql-test/r/perror.result	2008-08-05 23:26:18 +0000
@@ -1 +1,6 @@
 Illegal error code: 10000
+MySQL error code 1062 (ER_DUP_ENTRY): Duplicate entry '%-.192s' for key %d
+MySQL error code 1076 (ER_READY): %s: ready for connections.
+Version: '%s'  socket: '%s'  port: %d
+MySQL error code 1459 (ER_TABLE_NEEDS_UPGRADE): Table upgrade required. Please do "REPAIR TABLE `%-.32s`" to fix it!
+MySQL error code 1461 (ER_MAX_PREPARED_STMT_COUNT_REACHED): Can't create more than max_prepared_stmt_count statements (current value: %lu)

=== added file 'mysql-test/r/sp-no-code.result'
--- a/mysql-test/r/sp-no-code.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/sp-no-code.result	2008-07-24 16:50:18 +0000
@@ -0,0 +1,4 @@
+show procedure code foo;
+ERROR HY000: The 'SHOW PROCEDURE|FUNCTION CODE' feature is disabled; you need MySQL built with '--with-debug' to have it working
+show function code foo;
+ERROR HY000: The 'SHOW PROCEDURE|FUNCTION CODE' feature is disabled; you need MySQL built with '--with-debug' to have it working

=== modified file 'mysql-test/r/subselect.result'
--- a/mysql-test/r/subselect.result	2008-07-10 23:29:27 +0000
+++ b/mysql-test/r/subselect.result	2008-07-31 11:37:07 +0000
@@ -4600,7 +4600,18 @@ INSERT INTO t1 VALUES (1), (3);
 SELECT * FROM t2 WHERE b NOT IN (SELECT max(t.c) FROM t1, t1 t WHERE t.c>10);
 a	b
 DROP TABLE t1,t2;
-End of 5.0 tests.
+CREATE TABLE t1(pk int PRIMARY KEY, a int, INDEX idx(a));
+INSERT INTO t1 VALUES (1, 10), (3, 30), (2, 20);
+CREATE TABLE t2(pk int PRIMARY KEY, a int, b int, INDEX idxa(a));
+INSERT INTO t2 VALUES (2, 20, 700), (1, 10, 200), (4, 10, 100);
+SELECT * FROM t1
+WHERE EXISTS (SELECT DISTINCT a FROM t2 WHERE t1.a < t2.a ORDER BY b);
+pk	a
+1	10
+3	30
+2	20
+DROP TABLE t1,t2;
+End of 5.1 tests.
 CREATE TABLE t1( a INT );
 INSERT INTO t1 VALUES (1),(2);
 CREATE TABLE t2( a INT, b INT );

=== modified file 'mysql-test/r/subselect_no_mat.result'
--- a/mysql-test/r/subselect_no_mat.result	2008-07-10 23:29:27 +0000
+++ b/mysql-test/r/subselect_no_mat.result	2008-07-31 11:37:07 +0000
@@ -4604,7 +4604,18 @@ INSERT INTO t1 VALUES (1), (3);
 SELECT * FROM t2 WHERE b NOT IN (SELECT max(t.c) FROM t1, t1 t WHERE t.c>10);
 a	b
 DROP TABLE t1,t2;
-End of 5.0 tests.
+CREATE TABLE t1(pk int PRIMARY KEY, a int, INDEX idx(a));
+INSERT INTO t1 VALUES (1, 10), (3, 30), (2, 20);
+CREATE TABLE t2(pk int PRIMARY KEY, a int, b int, INDEX idxa(a));
+INSERT INTO t2 VALUES (2, 20, 700), (1, 10, 200), (4, 10, 100);
+SELECT * FROM t1
+WHERE EXISTS (SELECT DISTINCT a FROM t2 WHERE t1.a < t2.a ORDER BY b);
+pk	a
+1	10
+3	30
+2	20
+DROP TABLE t1,t2;
+End of 5.1 tests.
 CREATE TABLE t1( a INT );
 INSERT INTO t1 VALUES (1),(2);
 CREATE TABLE t2( a INT, b INT );

=== modified file 'mysql-test/r/subselect_no_opts.result'
--- a/mysql-test/r/subselect_no_opts.result	2008-07-10 23:29:27 +0000
+++ b/mysql-test/r/subselect_no_opts.result	2008-07-31 11:37:07 +0000
@@ -4604,7 +4604,18 @@ INSERT INTO t1 VALUES (1), (3);
 SELECT * FROM t2 WHERE b NOT IN (SELECT max(t.c) FROM t1, t1 t WHERE t.c>10);
 a	b
 DROP TABLE t1,t2;
-End of 5.0 tests.
+CREATE TABLE t1(pk int PRIMARY KEY, a int, INDEX idx(a));
+INSERT INTO t1 VALUES (1, 10), (3, 30), (2, 20);
+CREATE TABLE t2(pk int PRIMARY KEY, a int, b int, INDEX idxa(a));
+INSERT INTO t2 VALUES (2, 20, 700), (1, 10, 200), (4, 10, 100);
+SELECT * FROM t1
+WHERE EXISTS (SELECT DISTINCT a FROM t2 WHERE t1.a < t2.a ORDER BY b);
+pk	a
+1	10
+3	30
+2	20
+DROP TABLE t1,t2;
+End of 5.1 tests.
 CREATE TABLE t1( a INT );
 INSERT INTO t1 VALUES (1),(2);
 CREATE TABLE t2( a INT, b INT );

=== modified file 'mysql-test/r/subselect_no_semijoin.result'
--- a/mysql-test/r/subselect_no_semijoin.result	2008-07-10 23:29:27 +0000
+++ b/mysql-test/r/subselect_no_semijoin.result	2008-07-31 11:37:07 +0000
@@ -4604,7 +4604,18 @@ INSERT INTO t1 VALUES (1), (3);
 SELECT * FROM t2 WHERE b NOT IN (SELECT max(t.c) FROM t1, t1 t WHERE t.c>10);
 a	b
 DROP TABLE t1,t2;
-End of 5.0 tests.
+CREATE TABLE t1(pk int PRIMARY KEY, a int, INDEX idx(a));
+INSERT INTO t1 VALUES (1, 10), (3, 30), (2, 20);
+CREATE TABLE t2(pk int PRIMARY KEY, a int, b int, INDEX idxa(a));
+INSERT INTO t2 VALUES (2, 20, 700), (1, 10, 200), (4, 10, 100);
+SELECT * FROM t1
+WHERE EXISTS (SELECT DISTINCT a FROM t2 WHERE t1.a < t2.a ORDER BY b);
+pk	a
+1	10
+3	30
+2	20
+DROP TABLE t1,t2;
+End of 5.1 tests.
 CREATE TABLE t1( a INT );
 INSERT INTO t1 VALUES (1),(2);
 CREATE TABLE t2( a INT, b INT );

=== modified file 'mysql-test/suite/falcon/r/falcon_bug_22161.result'
--- a/mysql-test/suite/falcon/r/falcon_bug_22161.result	2008-07-14 05:32:03 +0000
+++ b/mysql-test/suite/falcon/r/falcon_bug_22161.result	2008-07-31 10:37:43 +0000
@@ -9,10 +9,6 @@ CREATE INDEX i1 ON t1 (a);
 ERROR 42000: BLOB column 'a' can't be used in key specification with the used table type
 ALTER TABLE t1 MODIFY COLUMN a varchar(30000);
 CREATE INDEX i1 ON t1 (a);
-Warnings:
-Warning	1071	Specified key was too long; max key length is 1100 bytes
-Warning	1071	Specified key was too long; max key length is 1100 bytes
-Warning	1071	Specified key was too long; max key length is 1100 bytes
 SELECT count(*) FROM t1;
 count(*)
 1

=== renamed file 'mysql-test/suite/falcon_team/r/falcon_bug_23962.result' => 'mysql-test/suite/falcon/r/falcon_bug_23962.result'
--- a/mysql-test/suite/falcon_team/r/falcon_bug_23962.result	2008-04-20 00:05:17 +0000
+++ b/mysql-test/suite/falcon/r/falcon_bug_23962.result	2008-07-16 16:00:34 +0000
@@ -1,5 +1,5 @@
-SET STORAGE_ENGINE = Falcon;
 *** Bug #23962 ***
+SET @@storage_engine = 'Falcon';
 DROP TABLE IF EXISTS t1;
 CREATE TABLE t1 (a char(5), KEY (a));
 INSERT INTO t1 VALUES ('a'), ('aa'), ('aaa'), ('abc'), ('bbb');
@@ -14,4 +14,7 @@ a
 aaa
 abc
 bbb
+SELECT count(*) FROM t1;
+count(*)
+5
 DROP TABLE t1;

=== renamed file 'mysql-test/suite/falcon_team/r/falcon_bug_27997.result' => 'mysql-test/suite/falcon/r/falcon_bug_27997.result'
=== modified file 'mysql-test/suite/falcon/r/falcon_bug_31295.result'
--- a/mysql-test/suite/falcon/r/falcon_bug_31295.result	2008-04-15 17:29:36 +0000
+++ b/mysql-test/suite/falcon/r/falcon_bug_31295.result	2008-07-29 10:45:39 +0000
@@ -1,22 +1,28 @@
 *** Bug #31295 ***
-SET @@storage_engine = 'Falcon';
+SET @@storage_engine = Falcon;
 DROP TABLE IF EXISTS t1;
-DROP TABLESPACE ts1 ENGINE 'Falcon';
-CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.fts' ENGINE 'Falcon';
+DROP TABLESPACE ts1 ENGINE Falcon;
+CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.fts' ENGINE Falcon;
 CREATE TABLE t1(a int);
-SELECT * FROM INFORMATION_SCHEMA.FALCON_TABLES WHERE TABLE_NAME='t1';
-SCHEMA_NAME	TABLE_NAME	PARTITION	TABLESPACE	INTERNAL_NAME
-TEST	T1		FALCON_USER	T1
-ALTER TABLE t1 TABLESPACE ts1 ENGINE 'Falcon';
-SELECT * FROM INFORMATION_SCHEMA.FALCON_TABLES WHERE TABLE_NAME='t1';
-SCHEMA_NAME	TABLE_NAME	PARTITION	TABLESPACE	INTERNAL_NAME
-TEST	T1		ts1	T1
-ALTER TABLE t1 ENGINE 'Falcon';
-SELECT * FROM INFORMATION_SCHEMA.FALCON_TABLES WHERE TABLE_NAME='t1';
-SCHEMA_NAME	TABLE_NAME	PARTITION	TABLESPACE	INTERNAL_NAME
-TEST	T1		ts1	T1
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL
+) ENGINE=ENGINE DEFAULT CHARSET=latin1
+ALTER TABLE t1 TABLESPACE ts1 ENGINE Falcon;
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL
+) /*!50100 TABLESPACE `ts1` */ ENGINE=ENGINE DEFAULT CHARSET=latin1
+ALTER TABLE t1 ENGINE Falcon;
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL
+) /*!50100 TABLESPACE `ts1` */ ENGINE=ENGINE DEFAULT CHARSET=latin1
 SELECT count(*) FROM t1;
 count(*)
 0
 DROP TABLE t1;
-DROP TABLESPACE ts1 ENGINE 'Falcon';
+DROP TABLESPACE ts1 ENGINE Falcon;

=== modified file 'mysql-test/suite/falcon/r/falcon_bug_33404.result'
--- a/mysql-test/suite/falcon/r/falcon_bug_33404.result	2008-04-23 06:54:13 +0000
+++ b/mysql-test/suite/falcon/r/falcon_bug_33404.result	2008-07-29 10:45:39 +0000
@@ -12,23 +12,17 @@ SUBPARTITION p2s1,
 SUBPARTITION p2s2
 )
 );
-SELECT * FROM INFORMATION_SCHEMA.FALCON_TABLES WHERE
-TABLE_NAME = 't1' AND SCHEMA_NAME='test';
-SCHEMA_NAME	TABLE_NAME	PARTITION	TABLESPACE	INTERNAL_NAME
-TEST	T1	P1S1	ts3	T1#P#P1#SP#P1S1
-TEST	T1	P1S2	ts2	T1#P#P1#SP#P1S2
-TEST	T1	P2S1	ts1	T1#P#P2#SP#P2S1
-TEST	T1	P2S2	ts1	T1#P#P2#SP#P2S2
 SHOW CREATE TABLE t1;
 Table	Create Table
 t1	CREATE TABLE `t1` (
   `a` int(11) DEFAULT NULL
 ) /*!50100 TABLESPACE `ts1` */ ENGINE=Falcon DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (a) SUBPARTITION BY HASH (a) (PARTITION p1 VALUES LESS THAN (100) (SUBPARTITION p1s1 TABLESPACE = ts3 ENGINE = Falcon, SUBPARTITION p1s2 TABLESPACE = ts2 ENGINE = Falcon), PARTITION p2 VALUES LESS THAN MAXVALUE (SUBPARTITION p2s1 TABLESPACE = ts1 ENGINE = Falcon, SUBPARTITION p2s2 TABLESPACE = ts1 ENGINE = Falcon)) */
 ALTER TABLE t1 REMOVE PARTITIONING;
-SELECT * FROM INFORMATION_SCHEMA.FALCON_TABLES WHERE
-TABLE_NAME = 't1' AND SCHEMA_NAME='test';
-SCHEMA_NAME	TABLE_NAME	PARTITION	TABLESPACE	INTERNAL_NAME
-TEST	T1		ts1	T1
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL
+) /*!50100 TABLESPACE `ts1` */ ENGINE=Falcon DEFAULT CHARSET=latin1
 ALTER TABLE t1 TABLESPACE ts1
 PARTITION BY RANGE(a) SUBPARTITION BY HASH(a) (
 PARTITION p1 VALUES LESS THAN (100) TABLESPACE ts2 (
@@ -40,56 +34,38 @@ SUBPARTITION p2s1,
 SUBPARTITION p2s2
 )
 );
-SELECT * FROM INFORMATION_SCHEMA.FALCON_TABLES WHERE
-TABLE_NAME = 't1' AND SCHEMA_NAME='test';
-SCHEMA_NAME	TABLE_NAME	PARTITION	TABLESPACE	INTERNAL_NAME
-TEST	T1	P1S1	ts3	T1#P#P1#SP#P1S1
-TEST	T1	P1S2	ts2	T1#P#P1#SP#P1S2
-TEST	T1	P2S1	ts1	T1#P#P2#SP#P2S1
-TEST	T1	P2S2	ts1	T1#P#P2#SP#P2S2
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL
+) /*!50100 TABLESPACE `ts1` */ ENGINE=Falcon DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (a) SUBPARTITION BY HASH (a) (PARTITION p1 VALUES LESS THAN (100) (SUBPARTITION p1s1 TABLESPACE = ts3 ENGINE = Falcon, SUBPARTITION p1s2 TABLESPACE = ts2 ENGINE = Falcon), PARTITION p2 VALUES LESS THAN (200) (SUBPARTITION p2s1 TABLESPACE = ts1 ENGINE = Falcon, SUBPARTITION p2s2 TABLESPACE = ts1 ENGINE = Falcon)) */
 ALTER TABLE t1 ADD PARTITION (PARTITION p3 VALUES LESS THAN MAXVALUE);
-SELECT * FROM INFORMATION_SCHEMA.FALCON_TABLES WHERE
-TABLE_NAME = 't1' AND SCHEMA_NAME='test';
-SCHEMA_NAME	TABLE_NAME	PARTITION	TABLESPACE	INTERNAL_NAME
-TEST	T1	P1S1	ts3	T1#P#P1#SP#P1S1
-TEST	T1	P1S2	ts2	T1#P#P1#SP#P1S2
-TEST	T1	P2S1	ts1	T1#P#P2#SP#P2S1
-TEST	T1	P2S2	ts1	T1#P#P2#SP#P2S2
-TEST	T1	P3SP0	ts1	T1#P#P3#SP#P3SP0
-TEST	T1	P3SP1	ts1	T1#P#P3#SP#P3SP1
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL
+) /*!50100 TABLESPACE `ts1` */ ENGINE=Falcon DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (a) SUBPARTITION BY HASH (a) (PARTITION p1 VALUES LESS THAN (100) (SUBPARTITION p1s1 TABLESPACE = ts3 ENGINE = Falcon, SUBPARTITION p1s2 TABLESPACE = ts2 ENGINE = Falcon), PARTITION p2 VALUES LESS THAN (200) (SUBPARTITION p2s1 TABLESPACE = ts1 ENGINE = Falcon, SUBPARTITION p2s2 TABLESPACE = ts1 ENGINE = Falcon), PARTITION p3 VALUES LESS THAN MAXVALUE (SUBPARTITION p3sp0 TABLESPACE = ts1 ENGINE = Falcon, SUBPARTITION p3sp1 TABLESPACE = ts1 ENGINE = Falcon)) */
 ALTER TABLE t1 REORGANIZE PARTITION p3 INTO (PARTITION p3 VALUES LESS THAN
 MAXVALUE TABLESPACE ts1);
-SELECT * FROM INFORMATION_SCHEMA.FALCON_TABLES WHERE
-TABLE_NAME = 't1' AND SCHEMA_NAME='test';
-SCHEMA_NAME	TABLE_NAME	PARTITION	TABLESPACE	INTERNAL_NAME
-TEST	T1	P1S1	ts3	T1#P#P1#SP#P1S1
-TEST	T1	P1S2	ts2	T1#P#P1#SP#P1S2
-TEST	T1	P2S1	ts1	T1#P#P2#SP#P2S1
-TEST	T1	P2S2	ts1	T1#P#P2#SP#P2S2
-TEST	T1	P3SP0	ts1	T1#P#P3#SP#P3SP0
-TEST	T1	P3SP1	ts1	T1#P#P3#SP#P3SP1
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL
+) /*!50100 TABLESPACE `ts1` */ ENGINE=Falcon DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (a) SUBPARTITION BY HASH (a) (PARTITION p1 VALUES LESS THAN (100) (SUBPARTITION p1s1 TABLESPACE = ts3 ENGINE = Falcon, SUBPARTITION p1s2 TABLESPACE = ts2 ENGINE = Falcon), PARTITION p2 VALUES LESS THAN (200) (SUBPARTITION p2s1 TABLESPACE = ts1 ENGINE = Falcon, SUBPARTITION p2s2 TABLESPACE = ts1 ENGINE = Falcon), PARTITION p3 VALUES LESS THAN MAXVALUE (SUBPARTITION p3sp0 TABLESPACE = ts1 ENGINE = Falcon, SUBPARTITION p3sp1 TABLESPACE = ts1 ENGINE = Falcon)) */
 ALTER TABLE t1 REORGANIZE PARTITION p3 INTO (PARTITION p3 VALUES LESS THAN
 MAXVALUE TABLESPACE ts2);
-SELECT * FROM INFORMATION_SCHEMA.FALCON_TABLES WHERE
-TABLE_NAME = 't1' AND SCHEMA_NAME='test';
-SCHEMA_NAME	TABLE_NAME	PARTITION	TABLESPACE	INTERNAL_NAME
-TEST	T1	P1S1	ts3	T1#P#P1#SP#P1S1
-TEST	T1	P1S2	ts2	T1#P#P1#SP#P1S2
-TEST	T1	P2S1	ts1	T1#P#P2#SP#P2S1
-TEST	T1	P2S2	ts1	T1#P#P2#SP#P2S2
-TEST	T1	P3SP0	ts2	T1#P#P3#SP#P3SP0
-TEST	T1	P3SP1	ts2	T1#P#P3#SP#P3SP1
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL
+) /*!50100 TABLESPACE `ts1` */ ENGINE=Falcon DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (a) SUBPARTITION BY HASH (a) (PARTITION p1 VALUES LESS THAN (100) (SUBPARTITION p1s1 TABLESPACE = ts3 ENGINE = Falcon, SUBPARTITION p1s2 TABLESPACE = ts2 ENGINE = Falcon), PARTITION p2 VALUES LESS THAN (200) (SUBPARTITION p2s1 TABLESPACE = ts1 ENGINE = Falcon, SUBPARTITION p2s2 TABLESPACE = ts1 ENGINE = Falcon), PARTITION p3 VALUES LESS THAN MAXVALUE (SUBPARTITION p3sp0 TABLESPACE = ts2 ENGINE = Falcon, SUBPARTITION p3sp1 TABLESPACE = ts2 ENGINE = Falcon)) */
 ALTER TABLE t1 REORGANIZE PARTITION p1 INTO (PARTITION p1 VALUES LESS THAN
 (100) TABLESPACE ts2);
-SELECT * FROM INFORMATION_SCHEMA.FALCON_TABLES WHERE
-TABLE_NAME = 't1' AND SCHEMA_NAME='test';
-SCHEMA_NAME	TABLE_NAME	PARTITION	TABLESPACE	INTERNAL_NAME
-TEST	T1	P2S1	ts1	T1#P#P2#SP#P2S1
-TEST	T1	P2S2	ts1	T1#P#P2#SP#P2S2
-TEST	T1	P3SP0	ts2	T1#P#P3#SP#P3SP0
-TEST	T1	P3SP1	ts2	T1#P#P3#SP#P3SP1
-TEST	T1	P1SP0	ts2	T1#P#P1#SP#P1SP0
-TEST	T1	P1SP1	ts2	T1#P#P1#SP#P1SP1
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL
+) /*!50100 TABLESPACE `ts1` */ ENGINE=Falcon DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (a) SUBPARTITION BY HASH (a) (PARTITION p1 VALUES LESS THAN (100) (SUBPARTITION p1sp0 TABLESPACE = ts2 ENGINE = Falcon, SUBPARTITION p1sp1 TABLESPACE = ts2 ENGINE = Falcon), PARTITION p2 VALUES LESS THAN (200) (SUBPARTITION p2s1 TABLESPACE = ts1 ENGINE = Falcon, SUBPARTITION p2s2 TABLESPACE = ts1 ENGINE = Falcon), PARTITION p3 VALUES LESS THAN MAXVALUE (SUBPARTITION p3sp0 TABLESPACE = ts2 ENGINE = Falcon, SUBPARTITION p3sp1 TABLESPACE = ts2 ENGINE = Falcon)) */
 DROP TABLE t1;
 DROP TABLESPACE ts1 ENGINE=Falcon;
 DROP TABLESPACE ts2 ENGINE=Falcon;

=== added file 'mysql-test/suite/falcon/r/falcon_bug_35939.result'
--- a/mysql-test/suite/falcon/r/falcon_bug_35939.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/falcon/r/falcon_bug_35939.result	2008-07-31 10:04:30 +0000
@@ -0,0 +1,61 @@
+*** Bug #35939 ***
+SET @@storage_engine = 'Falcon';
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1(i int);
+INSERT INTO t1(i) VALUES (1),(2),(3),(4);
+SELECT TABLE_ROWS  FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
+TABLE_ROWS
+4
+UPDATE t1 set i=i+1;
+SELECT TABLE_ROWS  FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
+TABLE_ROWS
+4
+DELETE FROM t1 WHERE i=2;
+SELECT TABLE_ROWS  FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
+TABLE_ROWS
+3
+SET AUTOCOMMIT=OFF;
+BEGIN;
+INSERT INTO t1(i) VALUES(42);
+DELETE FROM t1 WHERE i=42;
+COMMIT;
+SELECT TABLE_ROWS  FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
+TABLE_ROWS
+3
+BEGIN;
+DELETE FROM t1 WHERE i=4;
+INSERT INTO t1(i) VALUES(4);
+COMMIT;
+SELECT TABLE_ROWS  FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
+TABLE_ROWS
+3
+BEGIN;
+INSERT INTO t1(i) VALUES(42);
+UPDATE t1 SET i=43 WHERE i=42;
+DELETE FROM t1 WHERE i=43;
+COMMIT;
+SELECT TABLE_ROWS  FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
+TABLE_ROWS
+3
+BEGIN;
+DELETE FROM t1 WHERE i=4;
+INSERT INTO t1(i) VALUES(4);
+UPDATE t1 SET i=42 WHERE i=4;
+UPDATE t1 SET i=4 WHERE i=42;
+COMMIT;
+SELECT TABLE_ROWS  FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
+TABLE_ROWS
+3
+BEGIN;
+INSERT INTO t1(i) VALUES(42);
+UPDATE t1 SET i=43 WHERE i=42;
+DELETE FROM t1 WHERE i=43;
+ROLLBACK;
+SELECT TABLE_ROWS  FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
+TABLE_ROWS
+3
+SET AUTOCOMMIT=ON;
+SELECT count(*) FROM t1;
+count(*)
+3
+DROP TABLE t1;

=== renamed file 'mysql-test/suite/falcon_team/r/falcon_bug_37080.result' => 'mysql-test/suite/falcon/r/falcon_bug_37080.result'
--- a/mysql-test/suite/falcon_team/r/falcon_bug_37080.result	2008-07-03 08:46:37 +0000
+++ b/mysql-test/suite/falcon/r/falcon_bug_37080.result	2008-07-16 17:52:19 +0000
@@ -1,5 +1,5 @@
 *** Bug #37080 ***
 SET @@storage_engine = 'Falcon';
-DROP TABLE IF EXISTS t;
-CREATE TABLE t(i int);
-DROP TABLE t;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1(a int);
+DROP TABLE t1;

=== added file 'mysql-test/suite/falcon/r/falcon_bug_38039.result'
--- a/mysql-test/suite/falcon/r/falcon_bug_38039.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/falcon/r/falcon_bug_38039.result	2008-07-16 12:40:47 +0000
@@ -0,0 +1,18 @@
+*** Bug #38039 ***
+SET @@storage_engine = 'Falcon';
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a_int INT) Engine = Falcon;
+ALTER TABLE t1 ADD KEY (a_int);
+SHOW INDEXES FROM t1;
+Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment	Index_Comment
+t1	1	a_int	1	a_int	NULL	1	NULL	NULL	YES	BTREE		
+ALTER TABLE t1 ADD KEY (a_int);
+SHOW INDEXES FROM t1;
+Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment	Index_Comment
+t1	1	a_int	1	a_int	NULL	1	NULL	NULL	YES	BTREE		
+t1	1	a_int_2	1	a_int	NULL	1	NULL	NULL	YES	BTREE		
+ALTER TABLE t1 DROP KEY a_int;
+SHOW INDEXES FROM t1;
+Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment	Index_Comment
+t1	1	a_int_2	1	a_int	NULL	1	NULL	NULL	YES	BTREE		
+DROP TABLE t1;

=== modified file 'mysql-test/suite/falcon/r/falcon_options.result'
--- a/mysql-test/suite/falcon/r/falcon_options.result	2008-07-10 19:00:14 +0000
+++ b/mysql-test/suite/falcon/r/falcon_options.result	2008-07-17 13:52:17 +0000
@@ -9,7 +9,6 @@ falcon_debug_trace	0
 falcon_direct_io	1
 falcon_gopher_threads	5
 falcon_index_chill_threshold	4194304
-falcon_initial_allocation	0
 falcon_io_threads	2
 falcon_large_blob_threshold	160000
 falcon_lock_wait_timeout	50
@@ -92,7 +91,6 @@ FALCON_DEBUG_TRACE	0
 FALCON_DIRECT_IO	1
 FALCON_GOPHER_THREADS	5
 FALCON_INDEX_CHILL_THRESHOLD	1073741824
-FALCON_INITIAL_ALLOCATION	0
 FALCON_IO_THREADS	2
 FALCON_LARGE_BLOB_THRESHOLD	160000
 FALCON_LOCK_WAIT_TIMEOUT	50

=== modified file 'mysql-test/suite/falcon/r/falcon_options2.result'
--- a/mysql-test/suite/falcon/r/falcon_options2.result	2008-07-10 19:00:14 +0000
+++ b/mysql-test/suite/falcon/r/falcon_options2.result	2008-07-17 13:52:17 +0000
@@ -10,7 +10,6 @@ FALCON_DEBUG_TRACE	0
 FALCON_DIRECT_IO	1
 FALCON_GOPHER_THREADS	5
 FALCON_INDEX_CHILL_THRESHOLD	4194304
-FALCON_INITIAL_ALLOCATION	0
 FALCON_IO_THREADS	2
 FALCON_LARGE_BLOB_THRESHOLD	160000
 FALCON_LOCK_WAIT_TIMEOUT	50
@@ -54,9 +53,6 @@ SELECT @@falcon_gopher_threads;
 SELECT @@falcon_index_chill_threshold;
 @@falcon_index_chill_threshold
 4194304
-SELECT @@falcon_initial_allocation;
-@@falcon_initial_allocation
-0
 SELECT @@falcon_io_threads;
 @@falcon_io_threads
 2

=== modified file 'mysql-test/suite/falcon/t/falcon_bug_22161.test'
--- a/mysql-test/suite/falcon/t/falcon_bug_22161.test	2008-02-06 15:21:13 +0000
+++ b/mysql-test/suite/falcon/t/falcon_bug_22161.test	2008-07-31 10:37:43 +0000
@@ -25,7 +25,9 @@ ALTER TABLE t1 MODIFY COLUMN a text;
 --error ER_BLOB_USED_AS_KEY
 CREATE INDEX i1 ON t1 (a);
 ALTER TABLE t1 MODIFY COLUMN a varchar(30000);
+--disable_warnings
 CREATE INDEX i1 ON t1 (a);
+--enable_warnings
 
 # ----------------------------------------------------- #
 # --- Check                                         --- #

=== renamed file 'mysql-test/suite/falcon_team/t/falcon_bug_23962.test' => 'mysql-test/suite/falcon/t/falcon_bug_23962.test'
--- a/mysql-test/suite/falcon_team/t/falcon_bug_23962.test	2008-04-20 00:05:17 +0000
+++ b/mysql-test/suite/falcon/t/falcon_bug_23962.test	2008-07-16 16:00:34 +0000
@@ -1,9 +1,16 @@
 --source include/have_falcon.inc
-SET STORAGE_ENGINE = Falcon;
+
 #
 # Bug #23962: Wrong results with > search
 #
 --echo *** Bug #23962 ***
+
+# ----------------------------------------------------- #
+# --- Initialisation                                --- #
+# ----------------------------------------------------- #
+let $engine = 'Falcon';
+eval SET @@storage_engine = $engine;
+
 --disable_warnings
 DROP TABLE IF EXISTS t1;
 --enable_warnings
@@ -11,8 +18,18 @@ DROP TABLE IF EXISTS t1;
 CREATE TABLE t1 (a char(5), KEY (a));
 INSERT INTO t1 VALUES ('a'), ('aa'), ('aaa'), ('abc'), ('bbb');
 
+# ----------------------------------------------------- #
+# --- Test                                          --- #
+# ----------------------------------------------------- #
 SELECT * FROM t1 WHERE a > 'a'  ORDER BY a;
 SELECT * FROM t1 WHERE a > 'aa' ORDER BY a;
 
-# Final cleanup.
+# ----------------------------------------------------- #
+# --- Check                                         --- #
+# ----------------------------------------------------- #
+SELECT count(*) FROM t1;
+
+# ----------------------------------------------------- #
+# --- Final cleanup                                 --- #
+# ----------------------------------------------------- #
 DROP TABLE t1;

=== renamed file 'mysql-test/suite/falcon_team/t/falcon_bug_27997.test' => 'mysql-test/suite/falcon/t/falcon_bug_27997.test'
=== modified file 'mysql-test/suite/falcon/t/falcon_bug_31295.test'
--- a/mysql-test/suite/falcon/t/falcon_bug_31295.test	2008-04-15 17:29:36 +0000
+++ b/mysql-test/suite/falcon/t/falcon_bug_31295.test	2008-07-29 10:45:39 +0000
@@ -8,7 +8,7 @@
 # ----------------------------------------------------- #
 # --- Initialisation                                --- #
 # ----------------------------------------------------- #
-let $engine = 'Falcon';
+let $engine = Falcon;
 eval SET @@storage_engine = $engine;
 
 --disable_warnings
@@ -23,12 +23,14 @@ CREATE TABLE t1(a int);
 # ----------------------------------------------------- #
 # --- Test                                          --- #
 # ----------------------------------------------------- #
-SELECT * FROM INFORMATION_SCHEMA.FALCON_TABLES WHERE TABLE_NAME='t1';
+--replace_result $engine ENGINE
+SHOW CREATE TABLE t1;
 eval ALTER TABLE t1 TABLESPACE ts1 ENGINE $engine;
-SELECT * FROM INFORMATION_SCHEMA.FALCON_TABLES WHERE TABLE_NAME='t1';
+--replace_result $engine ENGINE
+SHOW CREATE TABLE t1;
 eval ALTER TABLE t1 ENGINE $engine;
-SELECT * FROM INFORMATION_SCHEMA.FALCON_TABLES WHERE TABLE_NAME='t1';
-
+--replace_result $engine ENGINE
+SHOW CREATE TABLE t1;
 
 # ----------------------------------------------------- #
 # --- Check                                         --- #

=== modified file 'mysql-test/suite/falcon/t/falcon_bug_33404.test'
--- a/mysql-test/suite/falcon/t/falcon_bug_33404.test	2008-04-23 06:54:13 +0000
+++ b/mysql-test/suite/falcon/t/falcon_bug_33404.test	2008-07-29 10:45:39 +0000
@@ -19,13 +19,10 @@ PARTITION BY RANGE(a) SUBPARTITION BY HA
     SUBPARTITION p2s2
   )
 );
-SELECT * FROM INFORMATION_SCHEMA.FALCON_TABLES WHERE
-  TABLE_NAME = 't1' AND SCHEMA_NAME='test';
 SHOW CREATE TABLE t1;
 
 ALTER TABLE t1 REMOVE PARTITIONING;
-SELECT * FROM INFORMATION_SCHEMA.FALCON_TABLES WHERE
-  TABLE_NAME = 't1' AND SCHEMA_NAME='test';
+SHOW CREATE TABLE t1;
 
 ALTER TABLE t1 TABLESPACE ts1
 PARTITION BY RANGE(a) SUBPARTITION BY HASH(a) (
@@ -38,27 +35,22 @@ PARTITION BY RANGE(a) SUBPARTITION BY HA
     SUBPARTITION p2s2
   )
 );
-SELECT * FROM INFORMATION_SCHEMA.FALCON_TABLES WHERE
-  TABLE_NAME = 't1' AND SCHEMA_NAME='test';
+SHOW CREATE TABLE t1;
 
 ALTER TABLE t1 ADD PARTITION (PARTITION p3 VALUES LESS THAN MAXVALUE);
-SELECT * FROM INFORMATION_SCHEMA.FALCON_TABLES WHERE
-  TABLE_NAME = 't1' AND SCHEMA_NAME='test';
+SHOW CREATE TABLE t1;
 
 ALTER TABLE t1 REORGANIZE PARTITION p3 INTO (PARTITION p3 VALUES LESS THAN
 MAXVALUE TABLESPACE ts1);
-SELECT * FROM INFORMATION_SCHEMA.FALCON_TABLES WHERE
-  TABLE_NAME = 't1' AND SCHEMA_NAME='test';
+SHOW CREATE TABLE t1;
 
 ALTER TABLE t1 REORGANIZE PARTITION p3 INTO (PARTITION p3 VALUES LESS THAN
 MAXVALUE TABLESPACE ts2);
-SELECT * FROM INFORMATION_SCHEMA.FALCON_TABLES WHERE
-  TABLE_NAME = 't1' AND SCHEMA_NAME='test';
+SHOW CREATE TABLE t1;
 
 ALTER TABLE t1 REORGANIZE PARTITION p1 INTO (PARTITION p1 VALUES LESS THAN
 (100) TABLESPACE ts2);
-SELECT * FROM INFORMATION_SCHEMA.FALCON_TABLES WHERE
-  TABLE_NAME = 't1' AND SCHEMA_NAME='test';
+SHOW CREATE TABLE t1;
 
 DROP TABLE t1;
 DROP TABLESPACE ts1 ENGINE=Falcon;

=== added file 'mysql-test/suite/falcon/t/falcon_bug_35939.test'
--- a/mysql-test/suite/falcon/t/falcon_bug_35939.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/falcon/t/falcon_bug_35939.test	2008-07-31 10:04:30 +0000
@@ -0,0 +1,86 @@
+--source include/have_falcon.inc
+
+#
+# Bug #35939: Drift in Falcon row count reported by SHOW TABLE STATUS
+#
+--echo *** Bug #35939 ***
+
+# ----------------------------------------------------- #
+# --- Initialisation                                --- #
+# ----------------------------------------------------- #
+let $engine = 'Falcon';
+eval SET @@storage_engine = $engine;
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+# ----------------------------------------------------- #
+# --- Test                                          --- #
+# ----------------------------------------------------- #
+CREATE TABLE t1(i int);
+INSERT INTO t1(i) VALUES (1),(2),(3),(4);
+SELECT TABLE_ROWS  FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
+# Expect 4 rows
+UPDATE t1 set i=i+1;
+SELECT TABLE_ROWS  FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
+# Expect 4 rows, nothing added or deleted
+DELETE FROM t1 WHERE i=2;
+# One row deleted, expect count=3
+SELECT TABLE_ROWS  FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
+
+# insert/delete on the same row, count does not change
+SET AUTOCOMMIT=OFF;
+# Next tests are transactional
+BEGIN;
+INSERT INTO t1(i) VALUES(42);
+DELETE FROM t1 WHERE i=42;
+COMMIT;
+SELECT TABLE_ROWS  FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
+# Count should not be changed,count=3
+
+#delete/insert, count does not change
+BEGIN;
+DELETE FROM t1 WHERE i=4;
+INSERT INTO t1(i) VALUES(4);
+COMMIT;
+SELECT TABLE_ROWS  FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
+# Count should not be changed,count=3
+
+# insert/update/delete on the same row, count does not change
+BEGIN;
+INSERT INTO t1(i) VALUES(42);
+UPDATE t1 SET i=43 WHERE i=42;
+DELETE FROM t1 WHERE i=43;
+COMMIT;
+SELECT TABLE_ROWS  FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
+# Count should not be changed,count=3
+
+#delete/insert/update/update, count does not change
+BEGIN;
+DELETE FROM t1 WHERE i=4;
+INSERT INTO t1(i) VALUES(4);
+UPDATE t1 SET i=42 WHERE i=4;
+UPDATE t1 SET i=4 WHERE i=42;
+COMMIT;
+SELECT TABLE_ROWS  FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
+# Count should not be changed,count=3
+
+# same as before, but with rollback
+BEGIN;
+INSERT INTO t1(i) VALUES(42);
+UPDATE t1 SET i=43 WHERE i=42;
+DELETE FROM t1 WHERE i=43;
+ROLLBACK;
+SELECT TABLE_ROWS  FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
+SET AUTOCOMMIT=ON;
+
+# ----------------------------------------------------- #
+# --- Check                                         --- #
+# ----------------------------------------------------- #
+SELECT count(*) FROM t1;
+
+# ----------------------------------------------------- #
+# --- Final cleanup                                 --- #
+# ----------------------------------------------------- #
+DROP TABLE t1;

=== renamed file 'mysql-test/suite/falcon_team/t/falcon_bug_37080.test' => 'mysql-test/suite/falcon/t/falcon_bug_37080.test'
--- a/mysql-test/suite/falcon_team/t/falcon_bug_37080.test	2008-07-03 08:46:37 +0000
+++ b/mysql-test/suite/falcon/t/falcon_bug_37080.test	2008-07-16 17:52:19 +0000
@@ -1,7 +1,8 @@
 --source include/have_falcon.inc
+
 #
 # Bug#37080: Falcon deadlock on parallel TRUNCATE  and INSERT
-# 
+#
 --echo *** Bug #37080 ***
 
 # ----------------------------------------------------- #
@@ -11,25 +12,24 @@ let $engine = 'Falcon';
 eval SET @@storage_engine = $engine;
 
 --disable_warnings
-DROP TABLE IF EXISTS t;
+DROP TABLE IF EXISTS t1;
 --enable_warnings
 
-
-CREATE TABLE t(i int);
+CREATE TABLE t1(a int);
 connect (conn1,localhost,root,,);
+
 # ----------------------------------------------------- #
 # --- Test                                          --- #
 # ----------------------------------------------------- #
 
-
 let $num=10000;
 --disable_query_log
 while ($num)

 {
    connection conn1;
-   --send insert into t values(1);
+   --send insert into t1 values(1), (3), (5), (7) , (11);
    connection default;
-   --send truncate table t;
+   --send truncate table t1;
    connection conn1;
    --reap
    connection default;
@@ -45,4 +45,4 @@ while ($num)
 # ----------------------------------------------------- #
 # --- Final cleanup                                 --- #
 # ----------------------------------------------------- #
-DROP TABLE t;
+DROP TABLE t1;

=== added file 'mysql-test/suite/falcon/t/falcon_bug_38039.test'
--- a/mysql-test/suite/falcon/t/falcon_bug_38039.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/falcon/t/falcon_bug_38039.test	2008-07-16 12:40:47 +0000
@@ -0,0 +1,43 @@
+--source include/have_falcon.inc
+
+#
+# Bug #38039: Assertion lockState == 0 failed in StorageTableShare::deleteTable SyncObject
+#
+
+--echo *** Bug #38039 ***
+
+# ----------------------------------------------------- #
+# --- Initialisation                                --- #
+# ----------------------------------------------------- #
+let $engine = 'Falcon';
+eval SET @@storage_engine = $engine;
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+CREATE TABLE t1 (a_int INT) Engine = Falcon;
+
+# ----------------------------------------------------- #
+# --- Test                                          --- #
+# ----------------------------------------------------- #
+
+## SHOW INDEXES is not required to reproduce the bug, but
+## is included here to verify correct behavior.
+
+ALTER TABLE t1 ADD KEY (a_int);
+SHOW INDEXES FROM t1;
+
+ALTER TABLE t1 ADD KEY (a_int);
+SHOW INDEXES FROM t1;
+
+ALTER TABLE t1 DROP KEY a_int;
+SHOW INDEXES FROM t1;
+
+DROP TABLE t1;
+
+# ----------------------------------------------------- #
+# --- Final cleanup                                 --- #
+# ----------------------------------------------------- #
+
+## None, DROP TABLE is part of the test.

=== modified file 'mysql-test/suite/falcon/t/falcon_options2.test'
--- a/mysql-test/suite/falcon/t/falcon_options2.test	2008-07-10 19:00:14 +0000
+++ b/mysql-test/suite/falcon/t/falcon_options2.test	2008-07-17 13:52:17 +0000
@@ -14,7 +14,6 @@ SELECT @@falcon_debug_trace;
 SELECT @@falcon_direct_io;
 SELECT @@falcon_gopher_threads;
 SELECT @@falcon_index_chill_threshold;
-SELECT @@falcon_initial_allocation;
 SELECT @@falcon_io_threads;
 SELECT @@falcon_large_blob_threshold;
 SELECT @@falcon_lock_wait_timeout;

=== modified file 'mysql-test/suite/funcs_1/r/falcon_storedproc.result'
--- a/mysql-test/suite/funcs_1/r/falcon_storedproc.result	2008-07-08 18:40:32 +0000
+++ b/mysql-test/suite/funcs_1/r/falcon_storedproc.result	2008-08-07 13:38:29 +0000
@@ -21942,9 +21942,9 @@ END	latin1	latin1_swedish_ci	latin1_swed
 set @@sql_mode='';
 CALL sp4();
 Level	Code	Message
-Error	1365	Division by 0
+Warning	1365	Division by 0
 Warnings:
-Error	1365	Division by 0
+Warning	1365	Division by 0
 DROP PROCEDURE sp4;
 set @@sql_mode='';
 

=== modified file 'mysql-test/suite/funcs_1/r/falcon_trig_03.result'
--- a/mysql-test/suite/funcs_1/r/falcon_trig_03.result	2008-06-03 12:10:33 +0000
+++ b/mysql-test/suite/funcs_1/r/falcon_trig_03.result	2008-08-07 13:38:29 +0000
@@ -77,7 +77,7 @@ grant ALL  on *.* to test_noprivs@localh
 revoke TRIGGER on *.* from test_noprivs@localhost;
 show grants for test_noprivs@localhost;
 Grants for test_noprivs@localhost
-GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
+GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, CREATE TABLESPACE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
 revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost;
 grant TRIGGER on *.* to test_yesprivs@localhost;
 grant SELECT on priv_db.t1 to test_yesprivs@localhost;
@@ -155,7 +155,7 @@ grant ALL  on *.* to test_noprivs@localh
 revoke UPDATE  on *.* from test_noprivs@localhost;
 show grants for test_noprivs@localhost;
 Grants for test_noprivs@localhost
-GRANT SELECT, INSERT, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
+GRANT SELECT, INSERT, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE TABLESPACE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
 revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost;
 grant TRIGGER, UPDATE on *.* to test_yesprivs@localhost;
 show grants for test_yesprivs@localhost;
@@ -169,7 +169,7 @@ test_noprivs@localhost
 use priv_db;
 show grants;
 Grants for test_noprivs@localhost
-GRANT SELECT, INSERT, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
+GRANT SELECT, INSERT, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE TABLESPACE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
 select f1 from t1 order by f1;
 f1
 insert 3.5.3.2-no
@@ -401,7 +401,7 @@ grant ALL  on *.* to test_noprivs@localh
 revoke SELECT  on *.* from test_noprivs@localhost;
 show grants for test_noprivs@localhost;
 Grants for test_noprivs@localhost
-GRANT INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
+GRANT INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE TABLESPACE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
 revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost;
 grant TRIGGER, SELECT on *.* to test_yesprivs@localhost;
 show grants for test_yesprivs@localhost;
@@ -415,7 +415,7 @@ test_noprivs@localhost
 use priv_db;
 show grants;
 Grants for test_noprivs@localhost
-GRANT INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
+GRANT INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE TABLESPACE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
 create trigger trg5a_1 before INSERT on t1 for each row
 set @test_var = new.f1;
 set @test_var = 'before trig 3.5.3.8-1a';

=== modified file 'mysql-test/suite/funcs_1/r/falcon_trig_03e.result'
--- a/mysql-test/suite/funcs_1/r/falcon_trig_03e.result	2008-04-01 21:01:02 +0000
+++ b/mysql-test/suite/funcs_1/r/falcon_trig_03e.result	2008-08-07 13:38:29 +0000
@@ -562,7 +562,7 @@ trig 1_1-yes
 revoke TRIGGER on *.* from test_yesprivs@localhost;
 show grants for test_yesprivs@localhost;
 Grants for test_yesprivs@localhost
-GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
+GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, CREATE TABLESPACE ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
 connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
 select current_user;
 current_user
@@ -609,7 +609,7 @@ root@localhost
 grant TRIGGER on priv_db.* to test_yesprivs@localhost;
 show grants for test_yesprivs@localhost;
 Grants for test_yesprivs@localhost
-GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
+GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, CREATE TABLESPACE ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
 GRANT TRIGGER ON `priv_db`.* TO 'test_yesprivs'@'localhost'
 
 trigger privilege on db level for create:

=== modified file 'mysql-test/suite/funcs_1/r/innodb_storedproc.result'
--- a/mysql-test/suite/funcs_1/r/innodb_storedproc.result	2008-07-08 18:40:32 +0000
+++ b/mysql-test/suite/funcs_1/r/innodb_storedproc.result	2008-08-07 13:38:29 +0000
@@ -21942,9 +21942,9 @@ END	latin1	latin1_swedish_ci	latin1_swed
 set @@sql_mode='';
 CALL sp4();
 Level	Code	Message
-Error	1365	Division by 0
+Warning	1365	Division by 0
 Warnings:
-Error	1365	Division by 0
+Warning	1365	Division by 0
 DROP PROCEDURE sp4;
 set @@sql_mode='';
 

=== modified file 'mysql-test/suite/funcs_1/r/innodb_trig_03.result'
--- a/mysql-test/suite/funcs_1/r/innodb_trig_03.result	2008-06-03 10:21:48 +0000
+++ b/mysql-test/suite/funcs_1/r/innodb_trig_03.result	2008-08-07 13:38:29 +0000
@@ -77,7 +77,7 @@ grant ALL  on *.* to test_noprivs@localh
 revoke TRIGGER on *.* from test_noprivs@localhost;
 show grants for test_noprivs@localhost;
 Grants for test_noprivs@localhost
-GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
+GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, CREATE TABLESPACE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
 revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost;
 grant TRIGGER on *.* to test_yesprivs@localhost;
 grant SELECT on priv_db.t1 to test_yesprivs@localhost;
@@ -155,7 +155,7 @@ grant ALL  on *.* to test_noprivs@localh
 revoke UPDATE  on *.* from test_noprivs@localhost;
 show grants for test_noprivs@localhost;
 Grants for test_noprivs@localhost
-GRANT SELECT, INSERT, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
+GRANT SELECT, INSERT, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE TABLESPACE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
 revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost;
 grant TRIGGER, UPDATE on *.* to test_yesprivs@localhost;
 show grants for test_yesprivs@localhost;
@@ -169,7 +169,7 @@ test_noprivs@localhost
 use priv_db;
 show grants;
 Grants for test_noprivs@localhost
-GRANT SELECT, INSERT, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
+GRANT SELECT, INSERT, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE TABLESPACE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
 select f1 from t1 order by f1;
 f1
 insert 3.5.3.2-no
@@ -401,7 +401,7 @@ grant ALL  on *.* to test_noprivs@localh
 revoke SELECT  on *.* from test_noprivs@localhost;
 show grants for test_noprivs@localhost;
 Grants for test_noprivs@localhost
-GRANT INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
+GRANT INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE TABLESPACE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
 revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost;
 grant TRIGGER, SELECT on *.* to test_yesprivs@localhost;
 show grants for test_yesprivs@localhost;
@@ -415,7 +415,7 @@ test_noprivs@localhost
 use priv_db;
 show grants;
 Grants for test_noprivs@localhost
-GRANT INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
+GRANT INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE TABLESPACE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
 create trigger trg5a_1 before INSERT on t1 for each row
 set @test_var = new.f1;
 set @test_var = 'before trig 3.5.3.8-1a';

=== modified file 'mysql-test/suite/funcs_1/r/innodb_trig_03e.result'
--- a/mysql-test/suite/funcs_1/r/innodb_trig_03e.result	2008-04-30 16:16:45 +0000
+++ b/mysql-test/suite/funcs_1/r/innodb_trig_03e.result	2008-08-07 13:38:29 +0000
@@ -562,7 +562,7 @@ trig 1_1-yes
 revoke TRIGGER on *.* from test_yesprivs@localhost;
 show grants for test_yesprivs@localhost;
 Grants for test_yesprivs@localhost
-GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
+GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, CREATE TABLESPACE ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
 connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
 select current_user;
 current_user
@@ -609,7 +609,7 @@ root@localhost
 grant TRIGGER on priv_db.* to test_yesprivs@localhost;
 show grants for test_yesprivs@localhost;
 Grants for test_yesprivs@localhost
-GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
+GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, CREATE TABLESPACE ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
 GRANT TRIGGER ON `priv_db`.* TO 'test_yesprivs'@'localhost'
 
 trigger privilege on db level for create:

=== modified file 'mysql-test/suite/funcs_1/r/is_columns_is_falcon.result'
--- a/mysql-test/suite/funcs_1/r/is_columns_is_falcon.result	2008-04-28 20:09:51 +0000
+++ b/mysql-test/suite/funcs_1/r/is_columns_is_falcon.result	2008-07-29 10:45:39 +0000
@@ -36,11 +36,6 @@ NULL	information_schema	FALCON_SYSTEM_ME
 NULL	information_schema	FALCON_SYSTEM_MEMORY_SUMMARY	SMALL_HUNKS	5	0	NO	int	NULL	NULL	10	0	NULL	NULL	int(4)			select		Default	Default
 NULL	information_schema	FALCON_SYSTEM_MEMORY_SUMMARY	TOTAL_SPACE	1	0	NO	bigint	NULL	NULL	19	0	NULL	NULL	bigint(4)			select		Default	Default
 NULL	information_schema	FALCON_SYSTEM_MEMORY_SUMMARY	UNIQUE_SIZES	6	0	NO	int	NULL	NULL	10	0	NULL	NULL	int(4)			select		Default	Default
-NULL	information_schema	FALCON_TABLES	INTERNAL_NAME	5		NO	varchar	127	508	NULL	NULL	utf8	utf8_general_ci	varchar(127)			select		Default	Default
-NULL	information_schema	FALCON_TABLES	PARTITION	3		NO	varchar	127	508	NULL	NULL	utf8	utf8_general_ci	varchar(127)			select		Default	Default
-NULL	information_schema	FALCON_TABLES	SCHEMA_NAME	1		NO	varchar	127	508	NULL	NULL	utf8	utf8_general_ci	varchar(127)			select		Default	Default
-NULL	information_schema	FALCON_TABLES	TABLESPACE	4		NO	varchar	127	508	NULL	NULL	utf8	utf8_general_ci	varchar(127)			select		Default	Default
-NULL	information_schema	FALCON_TABLES	TABLE_NAME	2		NO	varchar	127	508	NULL	NULL	utf8	utf8_general_ci	varchar(127)			select		Default	Default
 NULL	information_schema	FALCON_TABLESPACES	COMMENT	3		NO	varchar	127	508	NULL	NULL	utf8	utf8_general_ci	varchar(127)			select		Default	Default
 NULL	information_schema	FALCON_TABLESPACES	TABLESPACE_NAME	1		NO	varchar	127	508	NULL	NULL	utf8	utf8_general_ci	varchar(127)			select		Default	Default
 NULL	information_schema	FALCON_TABLESPACES	TYPE	2		NO	varchar	127	508	NULL	NULL	utf8	utf8_general_ci	varchar(127)			select		Default	Default
@@ -161,11 +156,6 @@ NULL	information_schema	FALCON_SYSTEM_ME
 NULL	information_schema	FALCON_SYSTEM_MEMORY_SUMMARY	BIG_HUNKS	int	NULL	NULL	NULL	NULL	int(4)
 NULL	information_schema	FALCON_SYSTEM_MEMORY_SUMMARY	SMALL_HUNKS	int	NULL	NULL	NULL	NULL	int(4)
 NULL	information_schema	FALCON_SYSTEM_MEMORY_SUMMARY	UNIQUE_SIZES	int	NULL	NULL	NULL	NULL	int(4)
-4.0000	information_schema	FALCON_TABLES	SCHEMA_NAME	varchar	127	508	utf8	utf8_general_ci	varchar(127)
-4.0000	information_schema	FALCON_TABLES	TABLE_NAME	varchar	127	508	utf8	utf8_general_ci	varchar(127)
-4.0000	information_schema	FALCON_TABLES	PARTITION	varchar	127	508	utf8	utf8_general_ci	varchar(127)
-4.0000	information_schema	FALCON_TABLES	TABLESPACE	varchar	127	508	utf8	utf8_general_ci	varchar(127)
-4.0000	information_schema	FALCON_TABLES	INTERNAL_NAME	varchar	127	508	utf8	utf8_general_ci	varchar(127)
 4.0000	information_schema	FALCON_TABLESPACES	TABLESPACE_NAME	varchar	127	508	utf8	utf8_general_ci	varchar(127)
 4.0000	information_schema	FALCON_TABLESPACES	TYPE	varchar	127	508	utf8	utf8_general_ci	varchar(127)
 4.0000	information_schema	FALCON_TABLESPACES	COMMENT	varchar	127	508	utf8	utf8_general_ci	varchar(127)

=== modified file 'mysql-test/suite/funcs_1/r/is_columns_mysql.result'
--- a/mysql-test/suite/funcs_1/r/is_columns_mysql.result	2008-07-10 09:49:53 +0000
+++ b/mysql-test/suite/funcs_1/r/is_columns_mysql.result	2008-08-07 13:38:29 +0000
@@ -209,6 +209,7 @@ NULL	mysql	user	Alter_priv	17	N	NO	enum	
 NULL	mysql	user	Alter_routine_priv	28	N	NO	enum	1	4	NULL	NULL	utf8	utf8_general_ci	enum('N','Y')			select,insert,update,references		Default	Default
 NULL	mysql	user	Create_priv	8	N	NO	enum	1	4	NULL	NULL	utf8	utf8_general_ci	enum('N','Y')			select,insert,update,references		Default	Default
 NULL	mysql	user	Create_routine_priv	27	N	NO	enum	1	4	NULL	NULL	utf8	utf8_general_ci	enum('N','Y')			select,insert,update,references		Default	Default
+NULL	mysql	user	Create_tablespace_priv	32	N	NO	enum	1	4	NULL	NULL	utf8	utf8_general_ci	enum('N','Y')			select,insert,update,references		Default	Default
 NULL	mysql	user	Create_tmp_table_priv	20	N	NO	enum	1	4	NULL	NULL	utf8	utf8_general_ci	enum('N','Y')			select,insert,update,references		Default	Default
 NULL	mysql	user	Create_user_priv	29	N	NO	enum	1	4	NULL	NULL	utf8	utf8_general_ci	enum('N','Y')			select,insert,update,references		Default	Default
 NULL	mysql	user	Create_view_priv	25	N	NO	enum	1	4	NULL	NULL	utf8	utf8_general_ci	enum('N','Y')			select,insert,update,references		Default	Default
@@ -222,10 +223,10 @@ NULL	mysql	user	Host	1		NO	char	60	240	N
 NULL	mysql	user	Index_priv	16	N	NO	enum	1	4	NULL	NULL	utf8	utf8_general_ci	enum('N','Y')			select,insert,update,references		Default	Default
 NULL	mysql	user	Insert_priv	5	N	NO	enum	1	4	NULL	NULL	utf8	utf8_general_ci	enum('N','Y')			select,insert,update,references		Default	Default
 NULL	mysql	user	Lock_tables_priv	21	N	NO	enum	1	4	NULL	NULL	utf8	utf8_general_ci	enum('N','Y')			select,insert,update,references		Default	Default
-NULL	mysql	user	max_connections	38	0	NO	int	NULL	NULL	10	0	NULL	NULL	int(11) unsigned			select,insert,update,references		Default	Default
-NULL	mysql	user	max_questions	36	0	NO	int	NULL	NULL	10	0	NULL	NULL	int(11) unsigned			select,insert,update,references		Default	Default
-NULL	mysql	user	max_updates	37	0	NO	int	NULL	NULL	10	0	NULL	NULL	int(11) unsigned			select,insert,update,references		Default	Default
-NULL	mysql	user	max_user_connections	39	0	NO	int	NULL	NULL	10	0	NULL	NULL	int(11) unsigned			select,insert,update,references		Default	Default
+NULL	mysql	user	max_connections	39	0	NO	int	NULL	NULL	10	0	NULL	NULL	int(11) unsigned			select,insert,update,references		Default	Default
+NULL	mysql	user	max_questions	37	0	NO	int	NULL	NULL	10	0	NULL	NULL	int(11) unsigned			select,insert,update,references		Default	Default
+NULL	mysql	user	max_updates	38	0	NO	int	NULL	NULL	10	0	NULL	NULL	int(11) unsigned			select,insert,update,references		Default	Default
+NULL	mysql	user	max_user_connections	40	0	NO	int	NULL	NULL	10	0	NULL	NULL	int(11) unsigned			select,insert,update,references		Default	Default
 NULL	mysql	user	Password	3		NO	char	41	41	NULL	NULL	latin1	latin1_bin	char(41)			select,insert,update,references		Default	Default
 NULL	mysql	user	Process_priv	12	N	NO	enum	1	4	NULL	NULL	utf8	utf8_general_ci	enum('N','Y')			select,insert,update,references		Default	Default
 NULL	mysql	user	References_priv	15	N	NO	enum	1	4	NULL	NULL	utf8	utf8_general_ci	enum('N','Y')			select,insert,update,references		Default	Default
@@ -236,14 +237,14 @@ NULL	mysql	user	Select_priv	4	N	NO	enum	
 NULL	mysql	user	Show_db_priv	18	N	NO	enum	1	4	NULL	NULL	utf8	utf8_general_ci	enum('N','Y')			select,insert,update,references		Default	Default
 NULL	mysql	user	Show_view_priv	26	N	NO	enum	1	4	NULL	NULL	utf8	utf8_general_ci	enum('N','Y')			select,insert,update,references		Default	Default
 NULL	mysql	user	Shutdown_priv	11	N	NO	enum	1	4	NULL	NULL	utf8	utf8_general_ci	enum('N','Y')			select,insert,update,references		Default	Default
-NULL	mysql	user	ssl_cipher	33	NULL	NO	blob	65535	65535	NULL	NULL	NULL	NULL	blob			select,insert,update,references		Default	Default
-NULL	mysql	user	ssl_type	32		NO	enum	9	36	NULL	NULL	utf8	utf8_general_ci	enum('','ANY','X509','SPECIFIED')			select,insert,update,references		Default	Default
+NULL	mysql	user	ssl_cipher	34	NULL	NO	blob	65535	65535	NULL	NULL	NULL	NULL	blob			select,insert,update,references		Default	Default
+NULL	mysql	user	ssl_type	33		NO	enum	9	36	NULL	NULL	utf8	utf8_general_ci	enum('','ANY','X509','SPECIFIED')			select,insert,update,references		Default	Default
 NULL	mysql	user	Super_priv	19	N	NO	enum	1	4	NULL	NULL	utf8	utf8_general_ci	enum('N','Y')			select,insert,update,references		Default	Default
 NULL	mysql	user	Trigger_priv	31	N	NO	enum	1	4	NULL	NULL	utf8	utf8_general_ci	enum('N','Y')			select,insert,update,references		Default	Default
 NULL	mysql	user	Update_priv	6	N	NO	enum	1	4	NULL	NULL	utf8	utf8_general_ci	enum('N','Y')			select,insert,update,references		Default	Default
 NULL	mysql	user	User	2		NO	char	16	64	NULL	NULL	utf8	utf8_bin	char(16)	PRI		select,insert,update,references		Default	Default
-NULL	mysql	user	x509_issuer	34	NULL	NO	blob	65535	65535	NULL	NULL	NULL	NULL	blob			select,insert,update,references		Default	Default
-NULL	mysql	user	x509_subject	35	NULL	NO	blob	65535	65535	NULL	NULL	NULL	NULL	blob			select,insert,update,references		Default	Default
+NULL	mysql	user	x509_issuer	35	NULL	NO	blob	65535	65535	NULL	NULL	NULL	NULL	blob			select,insert,update,references		Default	Default
+NULL	mysql	user	x509_subject	36	NULL	NO	blob	65535	65535	NULL	NULL	NULL	NULL	blob			select,insert,update,references		Default	Default
 ##########################################################################
 # Show the quotient of CHARACTER_OCTET_LENGTH and CHARACTER_MAXIMUM_LENGTH
 ##########################################################################
@@ -548,6 +549,7 @@ NULL	mysql	time_zone_transition_type	Is_
 4.0000	mysql	user	Create_user_priv	enum	1	4	utf8	utf8_general_ci	enum('N','Y')
 4.0000	mysql	user	Event_priv	enum	1	4	utf8	utf8_general_ci	enum('N','Y')
 4.0000	mysql	user	Trigger_priv	enum	1	4	utf8	utf8_general_ci	enum('N','Y')
+4.0000	mysql	user	Create_tablespace_priv	enum	1	4	utf8	utf8_general_ci	enum('N','Y')
 4.0000	mysql	user	ssl_type	enum	9	36	utf8	utf8_general_ci	enum('','ANY','X509','SPECIFIED')
 1.0000	mysql	user	ssl_cipher	blob	65535	65535	NULL	NULL	blob
 1.0000	mysql	user	x509_issuer	blob	65535	65535	NULL	NULL	blob

=== modified file 'mysql-test/suite/funcs_1/r/is_tables_is_falcon.result'
--- a/mysql-test/suite/funcs_1/r/is_tables_is_falcon.result	2008-06-19 18:56:48 +0000
+++ b/mysql-test/suite/funcs_1/r/is_tables_is_falcon.result	2008-07-29 10:45:39 +0000
@@ -153,29 +153,6 @@ user_comment	
 Separator	-----------------------------------------------------
 TABLE_CATALOG	NULL
 TABLE_SCHEMA	information_schema
-TABLE_NAME	FALCON_TABLES
-TABLE_TYPE	SYSTEM VIEW
-ENGINE	MEMORY
-VERSION	10
-ROW_FORMAT	Fixed
-TABLE_ROWS	#TBLR#
-AVG_ROW_LENGTH	#ARL#
-DATA_LENGTH	#DL#
-MAX_DATA_LENGTH	#MDL#
-INDEX_LENGTH	#IL#
-DATA_FREE	#DF#
-AUTO_INCREMENT	NULL
-CREATE_TIME	#CRT#
-UPDATE_TIME	#UT#
-CHECK_TIME	#CT#
-TABLE_COLLATION	utf8_general_ci
-CHECKSUM	NULL
-CREATE_OPTIONS	#CO#
-TABLE_COMMENT	#TC#
-user_comment	
-Separator	-----------------------------------------------------
-TABLE_CATALOG	NULL
-TABLE_SCHEMA	information_schema
 TABLE_NAME	FALCON_TABLESPACES
 TABLE_TYPE	SYSTEM VIEW
 ENGINE	MEMORY
@@ -469,29 +446,6 @@ user_comment	
 Separator	-----------------------------------------------------
 TABLE_CATALOG	NULL
 TABLE_SCHEMA	information_schema
-TABLE_NAME	FALCON_TABLES
-TABLE_TYPE	SYSTEM VIEW
-ENGINE	MEMORY
-VERSION	10
-ROW_FORMAT	Fixed
-TABLE_ROWS	#TBLR#
-AVG_ROW_LENGTH	#ARL#
-DATA_LENGTH	#DL#
-MAX_DATA_LENGTH	#MDL#
-INDEX_LENGTH	#IL#
-DATA_FREE	#DF#
-AUTO_INCREMENT	NULL
-CREATE_TIME	#CRT#
-UPDATE_TIME	#UT#
-CHECK_TIME	#CT#
-TABLE_COLLATION	utf8_general_ci
-CHECKSUM	NULL
-CREATE_OPTIONS	#CO#
-TABLE_COMMENT	#TC#
-user_comment	
-Separator	-----------------------------------------------------
-TABLE_CATALOG	NULL
-TABLE_SCHEMA	information_schema
 TABLE_NAME	FALCON_TABLESPACES
 TABLE_TYPE	SYSTEM VIEW
 ENGINE	MEMORY

=== modified file 'mysql-test/suite/funcs_1/r/is_user_privileges.result'
--- a/mysql-test/suite/funcs_1/r/is_user_privileges.result	2008-03-07 19:18:14 +0000
+++ b/mysql-test/suite/funcs_1/r/is_user_privileges.result	2008-08-07 13:38:29 +0000
@@ -76,10 +76,10 @@ GRANTEE	TABLE_CATALOG	PRIVILEGE_TYPE	IS_
 'testuser3'@'localhost'	NULL	USAGE	NO
 SELECT * FROM mysql.user
 WHERE user LIKE 'testuser%' ORDER BY host, user;
-Host	User	Password	Select_priv	Insert_priv	Update_priv	Delete_priv	Create_priv	Drop_priv	Reload_priv	Shutdown_priv	Process_priv	File_priv	Grant_priv	References_priv	Index_priv	Alter_priv	Show_db_priv	Super_priv	Create_tmp_table_priv	Lock_tables_priv	Execute_priv	Repl_slave_priv	Repl_client_priv	Create_view_priv	Show_view_priv	Create_routine_priv	Alter_routine_priv	Create_user_priv	Event_priv	Trigger_priv	ssl_type	ssl_cipher	x509_issuer	x509_subject	max_questions	max_updates	max_connections	max_user_connections
-localhost	testuser1		N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N					0	0	0	0
-localhost	testuser2		N	Y	Y	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N					0	0	0	0
-localhost	testuser3		N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N					0	0	0	0
+Host	User	Password	Select_priv	Insert_priv	Update_priv	Delete_priv	Create_priv	Drop_priv	Reload_priv	Shutdown_priv	Process_priv	File_priv	Grant_priv	References_priv	Index_priv	Alter_priv	Show_db_priv	Super_priv	Create_tmp_table_priv	Lock_tables_priv	Execute_priv	Repl_slave_priv	Repl_client_priv	Create_view_priv	Show_view_priv	Create_routine_priv	Alter_routine_priv	Create_user_priv	Event_priv	Trigger_priv	Create_tablespace_priv	ssl_type	ssl_cipher	x509_issuer	x509_subject	max_questions	max_updates	max_connections	max_user_connections
+localhost	testuser1		N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N					0	0	0	0
+localhost	testuser2		N	Y	Y	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N					0	0	0	0
+localhost	testuser3		N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N					0	0	0	0
 #
 # Add GRANT OPTION db_datadict.* to testuser1;
 GRANT UPDATE ON db_datadict.* TO 'testuser1'@'localhost' WITH GRANT OPTION;
@@ -93,10 +93,10 @@ GRANTEE	TABLE_CATALOG	PRIVILEGE_TYPE	IS_
 'testuser3'@'localhost'	NULL	USAGE	NO
 SELECT * FROM mysql.user
 WHERE user LIKE 'testuser%' ORDER BY host, user;
-Host	User	Password	Select_priv	Insert_priv	Update_priv	Delete_priv	Create_priv	Drop_priv	Reload_priv	Shutdown_priv	Process_priv	File_priv	Grant_priv	References_priv	Index_priv	Alter_priv	Show_db_priv	Super_priv	Create_tmp_table_priv	Lock_tables_priv	Execute_priv	Repl_slave_priv	Repl_client_priv	Create_view_priv	Show_view_priv	Create_routine_priv	Alter_routine_priv	Create_user_priv	Event_priv	Trigger_priv	ssl_type	ssl_cipher	x509_issuer	x509_subject	max_questions	max_updates	max_connections	max_user_connections
-localhost	testuser1		N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N					0	0	0	0
-localhost	testuser2		N	Y	Y	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N					0	0	0	0
-localhost	testuser3		N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N					0	0	0	0
+Host	User	Password	Select_priv	Insert_priv	Update_priv	Delete_priv	Create_priv	Drop_priv	Reload_priv	Shutdown_priv	Process_priv	File_priv	Grant_priv	References_priv	Index_priv	Alter_priv	Show_db_priv	Super_priv	Create_tmp_table_priv	Lock_tables_priv	Execute_priv	Repl_slave_priv	Repl_client_priv	Create_view_priv	Show_view_priv	Create_routine_priv	Alter_routine_priv	Create_user_priv	Event_priv	Trigger_priv	Create_tablespace_priv	ssl_type	ssl_cipher	x509_issuer	x509_subject	max_questions	max_updates	max_connections	max_user_connections
+localhost	testuser1		N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N					0	0	0	0
+localhost	testuser2		N	Y	Y	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N					0	0	0	0
+localhost	testuser3		N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N					0	0	0	0
 # Establish connection testuser1 (user=testuser1)
 SELECT * FROM information_schema.user_privileges
 WHERE grantee LIKE '''testuser%'''
@@ -105,10 +105,10 @@ GRANTEE	TABLE_CATALOG	PRIVILEGE_TYPE	IS_
 'testuser1'@'localhost'	NULL	USAGE	NO
 SELECT * FROM mysql.user
 WHERE user LIKE 'testuser%' ORDER BY host, user;
-Host	User	Password	Select_priv	Insert_priv	Update_priv	Delete_priv	Create_priv	Drop_priv	Reload_priv	Shutdown_priv	Process_priv	File_priv	Grant_priv	References_priv	Index_priv	Alter_priv	Show_db_priv	Super_priv	Create_tmp_table_priv	Lock_tables_priv	Execute_priv	Repl_slave_priv	Repl_client_priv	Create_view_priv	Show_view_priv	Create_routine_priv	Alter_routine_priv	Create_user_priv	Event_priv	Trigger_priv	ssl_type	ssl_cipher	x509_issuer	x509_subject	max_questions	max_updates	max_connections	max_user_connections
-localhost	testuser1		N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N					0	0	0	0
-localhost	testuser2		N	Y	Y	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N					0	0	0	0
-localhost	testuser3		N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N					0	0	0	0
+Host	User	Password	Select_priv	Insert_priv	Update_priv	Delete_priv	Create_priv	Drop_priv	Reload_priv	Shutdown_priv	Process_priv	File_priv	Grant_priv	References_priv	Index_priv	Alter_priv	Show_db_priv	Super_priv	Create_tmp_table_priv	Lock_tables_priv	Execute_priv	Repl_slave_priv	Repl_client_priv	Create_view_priv	Show_view_priv	Create_routine_priv	Alter_routine_priv	Create_user_priv	Event_priv	Trigger_priv	Create_tablespace_priv	ssl_type	ssl_cipher	x509_issuer	x509_subject	max_questions	max_updates	max_connections	max_user_connections
+localhost	testuser1		N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N					0	0	0	0
+localhost	testuser2		N	Y	Y	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N					0	0	0	0
+localhost	testuser3		N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N					0	0	0	0
 SHOW GRANTS;
 Grants for testuser1@localhost
 GRANT USAGE ON *.* TO 'testuser1'@'localhost'
@@ -130,10 +130,10 @@ GRANTEE	TABLE_CATALOG	PRIVILEGE_TYPE	IS_
 'testuser3'@'localhost'	NULL	USAGE	NO
 SELECT * FROM mysql.user
 WHERE user LIKE 'testuser%' ORDER BY host, user;
-Host	User	Password	Select_priv	Insert_priv	Update_priv	Delete_priv	Create_priv	Drop_priv	Reload_priv	Shutdown_priv	Process_priv	File_priv	Grant_priv	References_priv	Index_priv	Alter_priv	Show_db_priv	Super_priv	Create_tmp_table_priv	Lock_tables_priv	Execute_priv	Repl_slave_priv	Repl_client_priv	Create_view_priv	Show_view_priv	Create_routine_priv	Alter_routine_priv	Create_user_priv	Event_priv	Trigger_priv	ssl_type	ssl_cipher	x509_issuer	x509_subject	max_questions	max_updates	max_connections	max_user_connections
-localhost	testuser1		Y	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N					0	0	0	0
-localhost	testuser2		N	Y	Y	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N					0	0	0	0
-localhost	testuser3		N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N					0	0	0	0
+Host	User	Password	Select_priv	Insert_priv	Update_priv	Delete_priv	Create_priv	Drop_priv	Reload_priv	Shutdown_priv	Process_priv	File_priv	Grant_priv	References_priv	Index_priv	Alter_priv	Show_db_priv	Super_priv	Create_tmp_table_priv	Lock_tables_priv	Execute_priv	Repl_slave_priv	Repl_client_priv	Create_view_priv	Show_view_priv	Create_routine_priv	Alter_routine_priv	Create_user_priv	Event_priv	Trigger_priv	Create_tablespace_priv	ssl_type	ssl_cipher	x509_issuer	x509_subject	max_questions	max_updates	max_connections	max_user_connections
+localhost	testuser1		Y	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N					0	0	0	0
+localhost	testuser2		N	Y	Y	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N					0	0	0	0
+localhost	testuser3		N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N					0	0	0	0
 GRANT SELECT ON *.* TO 'testuser1'@'localhost' WITH GRANT OPTION;
 #
 # Here <SELECT YES> is shown correctly for testuser1;
@@ -147,10 +147,10 @@ GRANTEE	TABLE_CATALOG	PRIVILEGE_TYPE	IS_
 'testuser3'@'localhost'	NULL	USAGE	NO
 SELECT * FROM mysql.user
 WHERE user LIKE 'testuser%' ORDER BY host, user;
-Host	User	Password	Select_priv	Insert_priv	Update_priv	Delete_priv	Create_priv	Drop_priv	Reload_priv	Shutdown_priv	Process_priv	File_priv	Grant_priv	References_priv	Index_priv	Alter_priv	Show_db_priv	Super_priv	Create_tmp_table_priv	Lock_tables_priv	Execute_priv	Repl_slave_priv	Repl_client_priv	Create_view_priv	Show_view_priv	Create_routine_priv	Alter_routine_priv	Create_user_priv	Event_priv	Trigger_priv	ssl_type	ssl_cipher	x509_issuer	x509_subject	max_questions	max_updates	max_connections	max_user_connections
-localhost	testuser1		Y	N	N	N	N	N	N	N	N	N	Y	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N					0	0	0	0
-localhost	testuser2		N	Y	Y	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N					0	0	0	0
-localhost	testuser3		N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N					0	0	0	0
+Host	User	Password	Select_priv	Insert_priv	Update_priv	Delete_priv	Create_priv	Drop_priv	Reload_priv	Shutdown_priv	Process_priv	File_priv	Grant_priv	References_priv	Index_priv	Alter_priv	Show_db_priv	Super_priv	Create_tmp_table_priv	Lock_tables_priv	Execute_priv	Repl_slave_priv	Repl_client_priv	Create_view_priv	Show_view_priv	Create_routine_priv	Alter_routine_priv	Create_user_priv	Event_priv	Trigger_priv	Create_tablespace_priv	ssl_type	ssl_cipher	x509_issuer	x509_subject	max_questions	max_updates	max_connections	max_user_connections
+localhost	testuser1		Y	N	N	N	N	N	N	N	N	N	Y	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N					0	0	0	0
+localhost	testuser2		N	Y	Y	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N					0	0	0	0
+localhost	testuser3		N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N					0	0	0	0
 # Switch to connection testuser1
 SELECT * FROM information_schema.user_privileges
 WHERE grantee LIKE '''testuser%'''
@@ -159,10 +159,10 @@ GRANTEE	TABLE_CATALOG	PRIVILEGE_TYPE	IS_
 'testuser1'@'localhost'	NULL	SELECT	YES
 SELECT * FROM mysql.user
 WHERE user LIKE 'testuser%' ORDER BY host, user;
-Host	User	Password	Select_priv	Insert_priv	Update_priv	Delete_priv	Create_priv	Drop_priv	Reload_priv	Shutdown_priv	Process_priv	File_priv	Grant_priv	References_priv	Index_priv	Alter_priv	Show_db_priv	Super_priv	Create_tmp_table_priv	Lock_tables_priv	Execute_priv	Repl_slave_priv	Repl_client_priv	Create_view_priv	Show_view_priv	Create_routine_priv	Alter_routine_priv	Create_user_priv	Event_priv	Trigger_priv	ssl_type	ssl_cipher	x509_issuer	x509_subject	max_questions	max_updates	max_connections	max_user_connections
-localhost	testuser1		Y	N	N	N	N	N	N	N	N	N	Y	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N					0	0	0	0
-localhost	testuser2		N	Y	Y	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N					0	0	0	0
-localhost	testuser3		N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N					0	0	0	0
+Host	User	Password	Select_priv	Insert_priv	Update_priv	Delete_priv	Create_priv	Drop_priv	Reload_priv	Shutdown_priv	Process_priv	File_priv	Grant_priv	References_priv	Index_priv	Alter_priv	Show_db_priv	Super_priv	Create_tmp_table_priv	Lock_tables_priv	Execute_priv	Repl_slave_priv	Repl_client_priv	Create_view_priv	Show_view_priv	Create_routine_priv	Alter_routine_priv	Create_user_priv	Event_priv	Trigger_priv	Create_tablespace_priv	ssl_type	ssl_cipher	x509_issuer	x509_subject	max_questions	max_updates	max_connections	max_user_connections
+localhost	testuser1		Y	N	N	N	N	N	N	N	N	N	Y	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N					0	0	0	0
+localhost	testuser2		N	Y	Y	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N					0	0	0	0
+localhost	testuser3		N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N					0	0	0	0
 SHOW GRANTS;
 Grants for testuser1@localhost
 GRANT SELECT ON *.* TO 'testuser1'@'localhost' WITH GRANT OPTION
@@ -207,10 +207,10 @@ GRANTEE	TABLE_CATALOG	PRIVILEGE_TYPE	IS_
 'testuser3'@'localhost'	NULL	USAGE	NO
 SELECT * FROM mysql.user
 WHERE user LIKE 'testuser%' ORDER BY host, user;
-Host	User	Password	Select_priv	Insert_priv	Update_priv	Delete_priv	Create_priv	Drop_priv	Reload_priv	Shutdown_priv	Process_priv	File_priv	Grant_priv	References_priv	Index_priv	Alter_priv	Show_db_priv	Super_priv	Create_tmp_table_priv	Lock_tables_priv	Execute_priv	Repl_slave_priv	Repl_client_priv	Create_view_priv	Show_view_priv	Create_routine_priv	Alter_routine_priv	Create_user_priv	Event_priv	Trigger_priv	ssl_type	ssl_cipher	x509_issuer	x509_subject	max_questions	max_updates	max_connections	max_user_connections
-localhost	testuser1		N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N					0	0	0	0
-localhost	testuser2		N	Y	Y	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N					0	0	0	0
-localhost	testuser3		N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N					0	0	0	0
+Host	User	Password	Select_priv	Insert_priv	Update_priv	Delete_priv	Create_priv	Drop_priv	Reload_priv	Shutdown_priv	Process_priv	File_priv	Grant_priv	References_priv	Index_priv	Alter_priv	Show_db_priv	Super_priv	Create_tmp_table_priv	Lock_tables_priv	Execute_priv	Repl_slave_priv	Repl_client_priv	Create_view_priv	Show_view_priv	Create_routine_priv	Alter_routine_priv	Create_user_priv	Event_priv	Trigger_priv	Create_tablespace_priv	ssl_type	ssl_cipher	x509_issuer	x509_subject	max_questions	max_updates	max_connections	max_user_connections
+localhost	testuser1		N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N					0	0	0	0
+localhost	testuser2		N	Y	Y	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N					0	0	0	0
+localhost	testuser3		N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N					0	0	0	0
 # Switch to connection testuser1
 SELECT * FROM information_schema.user_privileges
 WHERE grantee LIKE '''testuser%'''
@@ -253,10 +253,10 @@ GRANTEE	TABLE_CATALOG	PRIVILEGE_TYPE	IS_
 'testuser3'@'localhost'	NULL	USAGE	NO
 SELECT * FROM mysql.user
 WHERE user LIKE 'testuser%' ORDER BY host, user;
-Host	User	Password	Select_priv	Insert_priv	Update_priv	Delete_priv	Create_priv	Drop_priv	Reload_priv	Shutdown_priv	Process_priv	File_priv	Grant_priv	References_priv	Index_priv	Alter_priv	Show_db_priv	Super_priv	Create_tmp_table_priv	Lock_tables_priv	Execute_priv	Repl_slave_priv	Repl_client_priv	Create_view_priv	Show_view_priv	Create_routine_priv	Alter_routine_priv	Create_user_priv	Event_priv	Trigger_priv	ssl_type	ssl_cipher	x509_issuer	x509_subject	max_questions	max_updates	max_connections	max_user_connections
-localhost	testuser1		N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N					0	0	0	0
-localhost	testuser2		N	Y	Y	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N					0	0	0	0
-localhost	testuser3		N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N					0	0	0	0
+Host	User	Password	Select_priv	Insert_priv	Update_priv	Delete_priv	Create_priv	Drop_priv	Reload_priv	Shutdown_priv	Process_priv	File_priv	Grant_priv	References_priv	Index_priv	Alter_priv	Show_db_priv	Super_priv	Create_tmp_table_priv	Lock_tables_priv	Execute_priv	Repl_slave_priv	Repl_client_priv	Create_view_priv	Show_view_priv	Create_routine_priv	Alter_routine_priv	Create_user_priv	Event_priv	Trigger_priv	Create_tablespace_priv	ssl_type	ssl_cipher	x509_issuer	x509_subject	max_questions	max_updates	max_connections	max_user_connections
+localhost	testuser1		N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N					0	0	0	0
+localhost	testuser2		N	Y	Y	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N					0	0	0	0
+localhost	testuser3		N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N					0	0	0	0
 # Switch to connection testuser1
 SELECT * FROM information_schema.user_privileges
 WHERE grantee LIKE '''testuser%'''
@@ -265,10 +265,10 @@ GRANTEE	TABLE_CATALOG	PRIVILEGE_TYPE	IS_
 'testuser1'@'localhost'	NULL	USAGE	NO
 SELECT * FROM mysql.user
 WHERE user LIKE 'testuser%' ORDER BY host, user;
-Host	User	Password	Select_priv	Insert_priv	Update_priv	Delete_priv	Create_priv	Drop_priv	Reload_priv	Shutdown_priv	Process_priv	File_priv	Grant_priv	References_priv	Index_priv	Alter_priv	Show_db_priv	Super_priv	Create_tmp_table_priv	Lock_tables_priv	Execute_priv	Repl_slave_priv	Repl_client_priv	Create_view_priv	Show_view_priv	Create_routine_priv	Alter_routine_priv	Create_user_priv	Event_priv	Trigger_priv	ssl_type	ssl_cipher	x509_issuer	x509_subject	max_questions	max_updates	max_connections	max_user_connections
-localhost	testuser1		N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N					0	0	0	0
-localhost	testuser2		N	Y	Y	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N					0	0	0	0
-localhost	testuser3		N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N					0	0	0	0
+Host	User	Password	Select_priv	Insert_priv	Update_priv	Delete_priv	Create_priv	Drop_priv	Reload_priv	Shutdown_priv	Process_priv	File_priv	Grant_priv	References_priv	Index_priv	Alter_priv	Show_db_priv	Super_priv	Create_tmp_table_priv	Lock_tables_priv	Execute_priv	Repl_slave_priv	Repl_client_priv	Create_view_priv	Show_view_priv	Create_routine_priv	Alter_routine_priv	Create_user_priv	Event_priv	Trigger_priv	Create_tablespace_priv	ssl_type	ssl_cipher	x509_issuer	x509_subject	max_questions	max_updates	max_connections	max_user_connections
+localhost	testuser1		N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N					0	0	0	0
+localhost	testuser2		N	Y	Y	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N					0	0	0	0
+localhost	testuser3		N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N					0	0	0	0
 SHOW GRANTS;
 Grants for testuser1@localhost
 GRANT USAGE ON *.* TO 'testuser1'@'localhost'
@@ -284,10 +284,10 @@ GRANTEE	TABLE_CATALOG	PRIVILEGE_TYPE	IS_
 'testuser1'@'localhost'	NULL	USAGE	NO
 SELECT * FROM mysql.user
 WHERE user LIKE 'testuser%' ORDER BY host, user;
-Host	User	Password	Select_priv	Insert_priv	Update_priv	Delete_priv	Create_priv	Drop_priv	Reload_priv	Shutdown_priv	Process_priv	File_priv	Grant_priv	References_priv	Index_priv	Alter_priv	Show_db_priv	Super_priv	Create_tmp_table_priv	Lock_tables_priv	Execute_priv	Repl_slave_priv	Repl_client_priv	Create_view_priv	Show_view_priv	Create_routine_priv	Alter_routine_priv	Create_user_priv	Event_priv	Trigger_priv	ssl_type	ssl_cipher	x509_issuer	x509_subject	max_questions	max_updates	max_connections	max_user_connections
-localhost	testuser1		N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N					0	0	0	0
-localhost	testuser2		N	Y	Y	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N					0	0	0	0
-localhost	testuser3		N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N					0	0	0	0
+Host	User	Password	Select_priv	Insert_priv	Update_priv	Delete_priv	Create_priv	Drop_priv	Reload_priv	Shutdown_priv	Process_priv	File_priv	Grant_priv	References_priv	Index_priv	Alter_priv	Show_db_priv	Super_priv	Create_tmp_table_priv	Lock_tables_priv	Execute_priv	Repl_slave_priv	Repl_client_priv	Create_view_priv	Show_view_priv	Create_routine_priv	Alter_routine_priv	Create_user_priv	Event_priv	Trigger_priv	Create_tablespace_priv	ssl_type	ssl_cipher	x509_issuer	x509_subject	max_questions	max_updates	max_connections	max_user_connections
+localhost	testuser1		N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N					0	0	0	0
+localhost	testuser2		N	Y	Y	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N					0	0	0	0
+localhost	testuser3		N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N					0	0	0	0
 SHOW GRANTS;
 Grants for testuser1@localhost
 GRANT USAGE ON *.* TO 'testuser1'@'localhost'
@@ -309,10 +309,10 @@ GRANTEE	TABLE_CATALOG	PRIVILEGE_TYPE	IS_
 'testuser3'@'localhost'	NULL	USAGE	NO
 SELECT * FROM mysql.user
 WHERE user LIKE 'testuser%' ORDER BY host, user;
-Host	User	Password	Select_priv	Insert_priv	Update_priv	Delete_priv	Create_priv	Drop_priv	Reload_priv	Shutdown_priv	Process_priv	File_priv	Grant_priv	References_priv	Index_priv	Alter_priv	Show_db_priv	Super_priv	Create_tmp_table_priv	Lock_tables_priv	Execute_priv	Repl_slave_priv	Repl_client_priv	Create_view_priv	Show_view_priv	Create_routine_priv	Alter_routine_priv	Create_user_priv	Event_priv	Trigger_priv	ssl_type	ssl_cipher	x509_issuer	x509_subject	max_questions	max_updates	max_connections	max_user_connections
-localhost	testuser1		N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N					0	0	0	0
-localhost	testuser2		N	Y	Y	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N					0	0	0	0
-localhost	testuser3		N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N					0	0	0	0
+Host	User	Password	Select_priv	Insert_priv	Update_priv	Delete_priv	Create_priv	Drop_priv	Reload_priv	Shutdown_priv	Process_priv	File_priv	Grant_priv	References_priv	Index_priv	Alter_priv	Show_db_priv	Super_priv	Create_tmp_table_priv	Lock_tables_priv	Execute_priv	Repl_slave_priv	Repl_client_priv	Create_view_priv	Show_view_priv	Create_routine_priv	Alter_routine_priv	Create_user_priv	Event_priv	Trigger_priv	Create_tablespace_priv	ssl_type	ssl_cipher	x509_issuer	x509_subject	max_questions	max_updates	max_connections	max_user_connections
+localhost	testuser1		N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N					0	0	0	0
+localhost	testuser2		N	Y	Y	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N					0	0	0	0
+localhost	testuser3		N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N					0	0	0	0
 # Switch to connection testuser1
 SELECT * FROM information_schema.user_privileges
 WHERE grantee LIKE '''testuser%'''

=== modified file 'mysql-test/suite/funcs_1/r/memory_storedproc.result'
--- a/mysql-test/suite/funcs_1/r/memory_storedproc.result	2008-07-08 18:40:32 +0000
+++ b/mysql-test/suite/funcs_1/r/memory_storedproc.result	2008-08-07 13:38:29 +0000
@@ -21943,9 +21943,9 @@ END	latin1	latin1_swedish_ci	latin1_swed
 set @@sql_mode='';
 CALL sp4();
 Level	Code	Message
-Error	1365	Division by 0
+Warning	1365	Division by 0
 Warnings:
-Error	1365	Division by 0
+Warning	1365	Division by 0
 DROP PROCEDURE sp4;
 set @@sql_mode='';
 

=== modified file 'mysql-test/suite/funcs_1/r/memory_trig_03.result'
--- a/mysql-test/suite/funcs_1/r/memory_trig_03.result	2008-06-18 17:23:55 +0000
+++ b/mysql-test/suite/funcs_1/r/memory_trig_03.result	2008-08-07 13:38:29 +0000
@@ -78,7 +78,7 @@ grant ALL  on *.* to test_noprivs@localh
 revoke TRIGGER on *.* from test_noprivs@localhost;
 show grants for test_noprivs@localhost;
 Grants for test_noprivs@localhost
-GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
+GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, CREATE TABLESPACE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
 revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost;
 grant TRIGGER on *.* to test_yesprivs@localhost;
 grant SELECT on priv_db.t1 to test_yesprivs@localhost;
@@ -156,7 +156,7 @@ grant ALL  on *.* to test_noprivs@localh
 revoke UPDATE  on *.* from test_noprivs@localhost;
 show grants for test_noprivs@localhost;
 Grants for test_noprivs@localhost
-GRANT SELECT, INSERT, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
+GRANT SELECT, INSERT, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE TABLESPACE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
 revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost;
 grant TRIGGER, UPDATE on *.* to test_yesprivs@localhost;
 show grants for test_yesprivs@localhost;
@@ -170,7 +170,7 @@ test_noprivs@localhost
 use priv_db;
 show grants;
 Grants for test_noprivs@localhost
-GRANT SELECT, INSERT, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
+GRANT SELECT, INSERT, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE TABLESPACE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
 select f1 from t1 order by f1;
 f1
 insert 3.5.3.2-no
@@ -402,7 +402,7 @@ grant ALL  on *.* to test_noprivs@localh
 revoke SELECT  on *.* from test_noprivs@localhost;
 show grants for test_noprivs@localhost;
 Grants for test_noprivs@localhost
-GRANT INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
+GRANT INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE TABLESPACE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
 revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost;
 grant TRIGGER, SELECT on *.* to test_yesprivs@localhost;
 show grants for test_yesprivs@localhost;
@@ -416,7 +416,7 @@ test_noprivs@localhost
 use priv_db;
 show grants;
 Grants for test_noprivs@localhost
-GRANT INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
+GRANT INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE TABLESPACE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
 create trigger trg5a_1 before INSERT on t1 for each row
 set @test_var = new.f1;
 set @test_var = 'before trig 3.5.3.8-1a';

=== modified file 'mysql-test/suite/funcs_1/r/memory_trig_03e.result'
--- a/mysql-test/suite/funcs_1/r/memory_trig_03e.result	2008-06-19 18:56:48 +0000
+++ b/mysql-test/suite/funcs_1/r/memory_trig_03e.result	2008-08-07 13:38:29 +0000
@@ -563,7 +563,7 @@ trig 1_1-yes
 revoke TRIGGER on *.* from test_yesprivs@localhost;
 show grants for test_yesprivs@localhost;
 Grants for test_yesprivs@localhost
-GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
+GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, CREATE TABLESPACE ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
 connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
 select current_user;
 current_user
@@ -610,7 +610,7 @@ root@localhost
 grant TRIGGER on priv_db.* to test_yesprivs@localhost;
 show grants for test_yesprivs@localhost;
 Grants for test_yesprivs@localhost
-GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
+GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, CREATE TABLESPACE ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
 GRANT TRIGGER ON `priv_db`.* TO 'test_yesprivs'@'localhost'
 
 trigger privilege on db level for create:

=== modified file 'mysql-test/suite/funcs_1/r/myisam_storedproc.result'
--- a/mysql-test/suite/funcs_1/r/myisam_storedproc.result	2008-07-08 18:40:32 +0000
+++ b/mysql-test/suite/funcs_1/r/myisam_storedproc.result	2008-08-07 13:38:29 +0000
@@ -21943,9 +21943,9 @@ END	latin1	latin1_swedish_ci	latin1_swed
 set @@sql_mode='';
 CALL sp4();
 Level	Code	Message
-Error	1365	Division by 0
+Warning	1365	Division by 0
 Warnings:
-Error	1365	Division by 0
+Warning	1365	Division by 0
 DROP PROCEDURE sp4;
 set @@sql_mode='';
 

=== modified file 'mysql-test/suite/funcs_1/r/myisam_trig_03.result'
--- a/mysql-test/suite/funcs_1/r/myisam_trig_03.result	2008-06-18 17:23:55 +0000
+++ b/mysql-test/suite/funcs_1/r/myisam_trig_03.result	2008-08-07 13:38:29 +0000
@@ -78,7 +78,7 @@ grant ALL  on *.* to test_noprivs@localh
 revoke TRIGGER on *.* from test_noprivs@localhost;
 show grants for test_noprivs@localhost;
 Grants for test_noprivs@localhost
-GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
+GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, CREATE TABLESPACE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
 revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost;
 grant TRIGGER on *.* to test_yesprivs@localhost;
 grant SELECT on priv_db.t1 to test_yesprivs@localhost;
@@ -156,7 +156,7 @@ grant ALL  on *.* to test_noprivs@localh
 revoke UPDATE  on *.* from test_noprivs@localhost;
 show grants for test_noprivs@localhost;
 Grants for test_noprivs@localhost
-GRANT SELECT, INSERT, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
+GRANT SELECT, INSERT, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE TABLESPACE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
 revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost;
 grant TRIGGER, UPDATE on *.* to test_yesprivs@localhost;
 show grants for test_yesprivs@localhost;
@@ -170,7 +170,7 @@ test_noprivs@localhost
 use priv_db;
 show grants;
 Grants for test_noprivs@localhost
-GRANT SELECT, INSERT, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
+GRANT SELECT, INSERT, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE TABLESPACE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
 select f1 from t1 order by f1;
 f1
 insert 3.5.3.2-no
@@ -402,7 +402,7 @@ grant ALL  on *.* to test_noprivs@localh
 revoke SELECT  on *.* from test_noprivs@localhost;
 show grants for test_noprivs@localhost;
 Grants for test_noprivs@localhost
-GRANT INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
+GRANT INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE TABLESPACE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
 revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost;
 grant TRIGGER, SELECT on *.* to test_yesprivs@localhost;
 show grants for test_yesprivs@localhost;
@@ -416,7 +416,7 @@ test_noprivs@localhost
 use priv_db;
 show grants;
 Grants for test_noprivs@localhost
-GRANT INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
+GRANT INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE TABLESPACE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
 create trigger trg5a_1 before INSERT on t1 for each row
 set @test_var = new.f1;
 set @test_var = 'before trig 3.5.3.8-1a';

=== modified file 'mysql-test/suite/funcs_1/r/myisam_trig_03e.result'
--- a/mysql-test/suite/funcs_1/r/myisam_trig_03e.result	2008-06-19 18:56:48 +0000
+++ b/mysql-test/suite/funcs_1/r/myisam_trig_03e.result	2008-08-07 13:38:29 +0000
@@ -563,7 +563,7 @@ trig 1_1-yes
 revoke TRIGGER on *.* from test_yesprivs@localhost;
 show grants for test_yesprivs@localhost;
 Grants for test_yesprivs@localhost
-GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
+GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, CREATE TABLESPACE ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
 connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
 select current_user;
 current_user
@@ -610,7 +610,7 @@ root@localhost
 grant TRIGGER on priv_db.* to test_yesprivs@localhost;
 show grants for test_yesprivs@localhost;
 Grants for test_yesprivs@localhost
-GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
+GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, CREATE TABLESPACE ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
 GRANT TRIGGER ON `priv_db`.* TO 'test_yesprivs'@'localhost'
 
 trigger privilege on db level for create:

=== modified file 'mysql-test/suite/funcs_1/r/ndb_storedproc.result'
--- a/mysql-test/suite/funcs_1/r/ndb_storedproc.result	2008-07-08 21:10:26 +0000
+++ b/mysql-test/suite/funcs_1/r/ndb_storedproc.result	2008-08-11 13:45:45 +0000
@@ -21942,9 +21942,9 @@ END	latin1	latin1_swedish_ci	latin1_swed
 set @@sql_mode='';
 CALL sp4();
 Level	Code	Message
-Error	1365	Division by 0
+Warning	1365	Division by 0
 Warnings:
-Error	1365	Division by 0
+Warning	1365	Division by 0
 DROP PROCEDURE sp4;
 set @@sql_mode='';
 

=== modified file 'mysql-test/suite/funcs_1/r/ndb_trig_03.result'
--- a/mysql-test/suite/funcs_1/r/ndb_trig_03.result	2008-06-03 10:21:48 +0000
+++ b/mysql-test/suite/funcs_1/r/ndb_trig_03.result	2008-08-11 13:45:45 +0000
@@ -77,7 +77,7 @@ grant ALL  on *.* to test_noprivs@localh
 revoke TRIGGER on *.* from test_noprivs@localhost;
 show grants for test_noprivs@localhost;
 Grants for test_noprivs@localhost
-GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
+GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, CREATE TABLESPACE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
 revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost;
 grant TRIGGER on *.* to test_yesprivs@localhost;
 grant SELECT on priv_db.t1 to test_yesprivs@localhost;
@@ -155,7 +155,7 @@ grant ALL  on *.* to test_noprivs@localh
 revoke UPDATE  on *.* from test_noprivs@localhost;
 show grants for test_noprivs@localhost;
 Grants for test_noprivs@localhost
-GRANT SELECT, INSERT, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
+GRANT SELECT, INSERT, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE TABLESPACE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
 revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost;
 grant TRIGGER, UPDATE on *.* to test_yesprivs@localhost;
 show grants for test_yesprivs@localhost;
@@ -169,7 +169,7 @@ test_noprivs@localhost
 use priv_db;
 show grants;
 Grants for test_noprivs@localhost
-GRANT SELECT, INSERT, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
+GRANT SELECT, INSERT, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE TABLESPACE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
 select f1 from t1 order by f1;
 f1
 insert 3.5.3.2-no
@@ -401,7 +401,7 @@ grant ALL  on *.* to test_noprivs@localh
 revoke SELECT  on *.* from test_noprivs@localhost;
 show grants for test_noprivs@localhost;
 Grants for test_noprivs@localhost
-GRANT INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
+GRANT INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE TABLESPACE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
 revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost;
 grant TRIGGER, SELECT on *.* to test_yesprivs@localhost;
 show grants for test_yesprivs@localhost;
@@ -415,7 +415,7 @@ test_noprivs@localhost
 use priv_db;
 show grants;
 Grants for test_noprivs@localhost
-GRANT INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
+GRANT INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE TABLESPACE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
 create trigger trg5a_1 before INSERT on t1 for each row
 set @test_var = new.f1;
 set @test_var = 'before trig 3.5.3.8-1a';

=== modified file 'mysql-test/suite/funcs_1/r/ndb_trig_03e.result'
--- a/mysql-test/suite/funcs_1/r/ndb_trig_03e.result	2008-04-30 16:16:45 +0000
+++ b/mysql-test/suite/funcs_1/r/ndb_trig_03e.result	2008-08-11 13:45:45 +0000
@@ -562,7 +562,7 @@ trig 1_1-yes
 revoke TRIGGER on *.* from test_yesprivs@localhost;
 show grants for test_yesprivs@localhost;
 Grants for test_yesprivs@localhost
-GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
+GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, CREATE TABLESPACE ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
 connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
 select current_user;
 current_user
@@ -609,7 +609,7 @@ root@localhost
 grant TRIGGER on priv_db.* to test_yesprivs@localhost;
 show grants for test_yesprivs@localhost;
 Grants for test_yesprivs@localhost
-GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
+GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, CREATE TABLESPACE ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
 GRANT TRIGGER ON `priv_db`.* TO 'test_yesprivs'@'localhost'
 
 trigger privilege on db level for create:

=== modified file 'mysql-test/suite/funcs_1/triggers/triggers_03.inc'
--- a/mysql-test/suite/funcs_1/triggers/triggers_03.inc	2008-07-19 08:31:33 +0000
+++ b/mysql-test/suite/funcs_1/triggers/triggers_03.inc	2008-07-25 17:14:52 +0000
@@ -13,12 +13,7 @@
 USE test;
 --source suite/funcs_1/include/tb3.inc
 
-# This test cannot be used for the embedded server because we check here
-# privilgeges.
---source include/not_embedded.inc
 
-USE test;
---source suite/funcs_1/include/tb3.inc
 
 --disable_abort_on_error
 

=== modified file 'mysql-test/suite/funcs_1/triggers/triggers_08.inc'
--- a/mysql-test/suite/funcs_1/triggers/triggers_08.inc	2008-07-19 08:31:33 +0000
+++ b/mysql-test/suite/funcs_1/triggers/triggers_08.inc	2008-07-25 17:14:52 +0000
@@ -8,8 +8,7 @@
 USE test;
 --source suite/funcs_1/include/tb3.inc
 
-USE test;
---source suite/funcs_1/include/tb3.inc
+
 
 # General setup for Trigger tests
 let $message= Testcase: 3.5:;

=== modified file 'mysql-test/suite/funcs_1/triggers/triggers_1011ext.inc'
--- a/mysql-test/suite/funcs_1/triggers/triggers_1011ext.inc	2008-07-19 08:31:33 +0000
+++ b/mysql-test/suite/funcs_1/triggers/triggers_1011ext.inc	2008-07-25 17:14:52 +0000
@@ -13,13 +13,6 @@ eval
 load data infile '$MYSQLTEST_VARDIR/std_data_ln/funcs_1/memory_tb3.txt'
 into table tb3;
 
-USE test;
---source suite/funcs_1/include/tb3.inc
-
---replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR>
-eval
-load data infile '$MYSQLTEST_VARDIR/std_data_ln/funcs_1/memory_tb3.txt'
-into table tb3;
 
 --disable_abort_on_error
 

=== modified file 'mysql-test/suite/ndb/r/ndb_basic.result'
--- a/mysql-test/suite/ndb/r/ndb_basic.result	2007-11-12 12:25:34 +0000
+++ b/mysql-test/suite/ndb/r/ndb_basic.result	2008-08-06 22:16:07 +0000
@@ -783,6 +783,7 @@ f1	f2	f3
 222222	bbbbbb	2
 drop table t1;
 Illegal ndb error code: 1186
+MySQL error code 1186 (ER_FLUSH_MASTER_BINLOG_CLOSED): Binlog closed, cannot RESET MASTER
 CREATE TABLE t1 (
 a VARBINARY(40) NOT NULL,
 b VARCHAR (256) CHARACTER SET UTF8 NOT NULL,

=== modified file 'mysql-test/suite/ndb/t/disabled.def'
--- a/mysql-test/suite/ndb/t/disabled.def	2008-04-27 01:02:09 +0000
+++ b/mysql-test/suite/ndb/t/disabled.def	2008-07-25 15:10:14 +0000
@@ -11,6 +11,7 @@
 ##############################################################################
 
 ndb_partition_error2	 : HF is not sure if the test can work as internded on all the platforms
+ndb_index_ordered        : Bug#38370 The test ndb.ndb_index_ordered fails with the community features on
 
 # the below testcase have been reworked to avoid the bug, test contains comment, keep bug open
 #ndb_binlog_ddl_multi     : BUG#18976 2006-04-10 kent    CRBR: multiple binlog, second binlog may miss schema log events

=== modified file 'mysql-test/suite/rpl/t/disabled.def'
--- a/mysql-test/suite/rpl/t/disabled.def	2008-07-22 10:51:13 +0000
+++ b/mysql-test/suite/rpl/t/disabled.def	2008-07-25 15:10:14 +0000
@@ -38,3 +38,4 @@ rpl_flushlog_loop          : Bug#37733 2
 rpl_locktrans_innodb       : Bug#37712 2008-07-17 alik Disabled to make 6.0 greaner (the test fails too often)
 rpl_temporary_errors       : Bug#36968 2008-07-17 alik Disabled to make 6.0 greaner (the test fails too often)
 rpl_temporary              : BUG#38269 2008-07-21 Sven valgrind error in pushbuild
+rpl_flushlog_loop          : BUG#37733 2008-07-23 Sven disabled in 5.1-bugteam. the bug has been fixed in 5.1-rpl: please re-enable when that gets pushed to main

=== added file 'mysql-test/suite/sys_vars/inc/multi_range_count_basic.inc'
--- a/mysql-test/suite/sys_vars/inc/multi_range_count_basic.inc	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/sys_vars/inc/multi_range_count_basic.inc	2008-07-23 14:06:44 +0000
@@ -0,0 +1,219 @@
+############## mysql-test\t\multi_range_count_basic.test ###############
+#                                                                             #
+# Variable Name: multi_range_count                                            #
+# Scope: GLOBAL | SESSION                                                     #
+# Access Type: Dynamic                                                        #
+# Data Type: numeric                                                          #
+# Default Value:  256                                                         #
+# Range:1-4294967295                                                          #
+#                                                                             #
+#                                                                             #
+# Creation Date: 2008-02-07                                                   #
+# Author:  Salman                                                             #
+#                                                                             #
+# Description: Test Cases of Dynamic System Variable multi_range_count        #
+#              that checks the behavior of this variable in the following ways#
+#              * Default Value                                                #
+#              * Valid & Invalid values                                       #
+#              * Scope & Access method                                        #
+#              * Data Integrity                                               #
+#                                                                             #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/                          #
+#  server-system-variables.html                                               #
+#                                                                             #
+###############################################################################
+
+--source include/load_sysvars.inc
+
+#################################################################
+#           START OF multi_range_count TESTS                    #
+#################################################################
+
+
+#############################################################
+#                 Save initial value                        #
+#############################################################
+
+SET @start_global_value = @@global.multi_range_count;
+SELECT @start_global_value;
+SET @start_session_value = @@session.multi_range_count;
+SELECT @start_session_value;
+
+
+--echo '#--------------------FN_DYNVARS_090_01-------------------------#'
+#################################################################
+#     Display the DEFAULT value of multi_range_count            #
+#################################################################
+
+SET @@global.multi_range_count = 100;
+SET @@global.multi_range_count = DEFAULT;
+SELECT @@global.multi_range_count;
+
+SET @@session.multi_range_count = 200;
+SET @@session.multi_range_count = DEFAULT;
+SELECT @@session.multi_range_count;
+
+
+--echo '#--------------------FN_DYNVARS_090_02-------------------------#'
+#################################################################
+#     Check the DEFAULT value of multi_range_count              #
+#################################################################
+
+SET @@global.multi_range_count = DEFAULT;
+SELECT @@global.multi_range_count = 256;
+
+SET @@session.multi_range_count = DEFAULT;
+SELECT @@session.multi_range_count = 256;
+
+
+--echo '#--------------------FN_DYNVARS_090_03-------------------------#'
+###########################################################################
+# Change the value of multi_range_count to a valid value for GLOBAL Scope #
+###########################################################################
+
+SET @@global.multi_range_count = 1;
+SELECT @@global.multi_range_count;
+SET @@global.multi_range_count = 60020;
+SELECT @@global.multi_range_count;
+SET @@global.multi_range_count = 65535;
+SELECT @@global.multi_range_count;
+SET @@global.multi_range_count = 4294967295;
+SELECT @@global.multi_range_count;
+SET @@global.multi_range_count = 4294967294;
+SELECT @@global.multi_range_count;
+
+
+
+--echo '#--------------------FN_DYNVARS_090_04-------------------------#'
+############################################################################
+# Change the value of multi_range_count to a valid value for SESSION Scope #
+############################################################################
+ 
+SET @@session.multi_range_count = 1;
+SELECT @@session.multi_range_count;
+SET @@session.multi_range_count = 50050;
+SELECT @@session.multi_range_count;
+SET @@session.multi_range_count = 65535;
+SELECT @@session.multi_range_count;
+SET @@session.multi_range_count = 4294967295;
+SELECT @@session.multi_range_count;
+SET @@session.multi_range_count = 4294967294;
+SELECT @@session.multi_range_count;
+
+
+--echo '#------------------FN_DYNVARS_090_05-----------------------#'
+#############################################################
+# Change the value of multi_range_count to an invalid value #
+#############################################################
+
+SET @@global.multi_range_count = 0;
+SELECT @@global.multi_range_count;
+SET @@global.multi_range_count = 4294967296;
+SELECT @@global.multi_range_count;
+SET @@global.multi_range_count = -1024;
+SELECT @@global.multi_range_count;
+SET @@global.multi_range_count = 429496729500;
+SELECT @@global.multi_range_count;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.multi_range_count = 65530.34;
+SELECT @@global.multi_range_count;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.multi_range_count = test;
+SELECT @@global.multi_range_count;
+
+SET @@session.multi_range_count = 0;
+SELECT @@session.multi_range_count;
+SET @@session.multi_range_count = 4294967296;
+SELECT @@session.multi_range_count;
+SET @@session.multi_range_count = -1;
+SELECT @@session.multi_range_count;
+--Error ER_PARSE_ERROR
+SET @@session.multi_range_count = 65530.34.;
+SET @@session.multi_range_count = 4294967295021;
+SELECT @@session.multi_range_count;
+--echo 'Bug # 34837: Errors are not coming on assigning invalid values to variable';
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.multi_range_count = test;
+SELECT @@session.multi_range_count;
+
+
+--echo '#------------------FN_DYNVARS_090_06-----------------------#'
+####################################################################
+#   Check if the value in GLOBAL Table matches value in variable   #
+####################################################################
+
+
+SELECT @@global.multi_range_count = VARIABLE_VALUE 
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES 
+WHERE VARIABLE_NAME='multi_range_count';
+
+--echo '#------------------FN_DYNVARS_090_07-----------------------#'
+####################################################################
+#  Check if the value in SESSION Table matches value in variable   #
+####################################################################
+
+SELECT @@session.multi_range_count = VARIABLE_VALUE 
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES 
+WHERE VARIABLE_NAME='multi_range_count';
+
+
+--echo '#------------------FN_DYNVARS_090_08-----------------------#'
+####################################################################
+#     Check if TRUE and FALSE values can be used on variable       #
+####################################################################
+
+SET @@global.multi_range_count = TRUE;
+SELECT @@global.multi_range_count;
+SET @@global.multi_range_count = FALSE;
+SELECT @@global.multi_range_count;
+
+
+--echo '#---------------------FN_DYNVARS_090_09----------------------#'
+################################################################################# 
+#  Check if accessing variable with and without GLOBAL point to same variable   #
+################################################################################# 
+
+SET @@global.multi_range_count = 10;
+SELECT @@multi_range_count = @@global.multi_range_count;
+
+
+--echo '#---------------------FN_DYNVARS_090_10----------------------#'
+########################################################################################################
+#    Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable  #
+########################################################################################################
+
+SET @@multi_range_count = 100;
+SELECT @@multi_range_count = @@local.multi_range_count;
+SELECT @@local.multi_range_count = @@session.multi_range_count;
+
+
+--echo '#---------------------FN_DYNVARS_090_11----------------------#'
+############################################################################  
+#   Check if multi_range_count can be accessed with and without @@ sign    #
+############################################################################
+
+SET multi_range_count = 1;
+SELECT @@multi_range_count;
+--Error ER_UNKNOWN_TABLE
+SELECT local.multi_range_count;
+--Error ER_UNKNOWN_TABLE
+SELECT session.multi_range_count;
+--Error ER_BAD_FIELD_ERROR
+SELECT multi_range_count = @@session.multi_range_count;
+
+
+####################################
+#     Restore initial value        #
+####################################
+
+SET @@global.multi_range_count = @start_global_value;
+SELECT @@global.multi_range_count;
+SET @@session.multi_range_count = @start_session_value;
+SELECT @@session.multi_range_count;
+
+
+######################################################
+#                 END OF multi_range_count TESTS     #
+######################################################
+

=== added file 'mysql-test/suite/sys_vars/r/multi_range_count_basic_32.result'
--- a/mysql-test/suite/sys_vars/r/multi_range_count_basic_32.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/sys_vars/r/multi_range_count_basic_32.result	2008-07-23 14:06:44 +0000
@@ -0,0 +1,192 @@
+SET @start_global_value = @@global.multi_range_count;
+SELECT @start_global_value;
+@start_global_value
+256
+SET @start_session_value = @@session.multi_range_count;
+SELECT @start_session_value;
+@start_session_value
+256
+'#--------------------FN_DYNVARS_090_01-------------------------#'
+SET @@global.multi_range_count = 100;
+SET @@global.multi_range_count = DEFAULT;
+SELECT @@global.multi_range_count;
+@@global.multi_range_count
+256
+SET @@session.multi_range_count = 200;
+SET @@session.multi_range_count = DEFAULT;
+SELECT @@session.multi_range_count;
+@@session.multi_range_count
+256
+'#--------------------FN_DYNVARS_090_02-------------------------#'
+SET @@global.multi_range_count = DEFAULT;
+SELECT @@global.multi_range_count = 256;
+@@global.multi_range_count = 256
+1
+SET @@session.multi_range_count = DEFAULT;
+SELECT @@session.multi_range_count = 256;
+@@session.multi_range_count = 256
+1
+'#--------------------FN_DYNVARS_090_03-------------------------#'
+SET @@global.multi_range_count = 1;
+SELECT @@global.multi_range_count;
+@@global.multi_range_count
+1
+SET @@global.multi_range_count = 60020;
+SELECT @@global.multi_range_count;
+@@global.multi_range_count
+60020
+SET @@global.multi_range_count = 65535;
+SELECT @@global.multi_range_count;
+@@global.multi_range_count
+65535
+SET @@global.multi_range_count = 4294967295;
+SELECT @@global.multi_range_count;
+@@global.multi_range_count
+4294967295
+SET @@global.multi_range_count = 4294967294;
+SELECT @@global.multi_range_count;
+@@global.multi_range_count
+4294967294
+'#--------------------FN_DYNVARS_090_04-------------------------#'
+SET @@session.multi_range_count = 1;
+SELECT @@session.multi_range_count;
+@@session.multi_range_count
+1
+SET @@session.multi_range_count = 50050;
+SELECT @@session.multi_range_count;
+@@session.multi_range_count
+50050
+SET @@session.multi_range_count = 65535;
+SELECT @@session.multi_range_count;
+@@session.multi_range_count
+65535
+SET @@session.multi_range_count = 4294967295;
+SELECT @@session.multi_range_count;
+@@session.multi_range_count
+4294967295
+SET @@session.multi_range_count = 4294967294;
+SELECT @@session.multi_range_count;
+@@session.multi_range_count
+4294967294
+'#------------------FN_DYNVARS_090_05-----------------------#'
+SET @@global.multi_range_count = 0;
+Warnings:
+Warning	1292	Truncated incorrect multi_range_count value: '0'
+SELECT @@global.multi_range_count;
+@@global.multi_range_count
+1
+SET @@global.multi_range_count = 4294967296;
+Warnings:
+Warning	1292	Truncated incorrect multi_range_count value: '4294967296'
+SELECT @@global.multi_range_count;
+@@global.multi_range_count
+4294967295
+SET @@global.multi_range_count = -1024;
+Warnings:
+Warning	1292	Truncated incorrect multi_range_count value: '0'
+SELECT @@global.multi_range_count;
+@@global.multi_range_count
+1
+SET @@global.multi_range_count = 429496729500;
+Warnings:
+Warning	1292	Truncated incorrect multi_range_count value: '429496729500'
+SELECT @@global.multi_range_count;
+@@global.multi_range_count
+4294967295
+SET @@global.multi_range_count = 65530.34;
+ERROR 42000: Incorrect argument type to variable 'multi_range_count'
+SELECT @@global.multi_range_count;
+@@global.multi_range_count
+4294967295
+SET @@global.multi_range_count = test;
+ERROR 42000: Incorrect argument type to variable 'multi_range_count'
+SELECT @@global.multi_range_count;
+@@global.multi_range_count
+4294967295
+SET @@session.multi_range_count = 0;
+Warnings:
+Warning	1292	Truncated incorrect multi_range_count value: '0'
+SELECT @@session.multi_range_count;
+@@session.multi_range_count
+1
+SET @@session.multi_range_count = 4294967296;
+Warnings:
+Warning	1292	Truncated incorrect multi_range_count value: '4294967296'
+SELECT @@session.multi_range_count;
+@@session.multi_range_count
+4294967295
+SET @@session.multi_range_count = -1;
+Warnings:
+Warning	1292	Truncated incorrect multi_range_count value: '0'
+SELECT @@session.multi_range_count;
+@@session.multi_range_count
+1
+SET @@session.multi_range_count = 65530.34.;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.' at line 1
+SET @@session.multi_range_count = 4294967295021;
+Warnings:
+Warning	1292	Truncated incorrect multi_range_count value: '4294967295021'
+SELECT @@session.multi_range_count;
+@@session.multi_range_count
+4294967295
+'Bug # 34837: Errors are not coming on assigning invalid values to variable';
+SET @@session.multi_range_count = test;
+ERROR 42000: Incorrect argument type to variable 'multi_range_count'
+SELECT @@session.multi_range_count;
+@@session.multi_range_count
+4294967295
+'#------------------FN_DYNVARS_090_06-----------------------#'
+SELECT @@global.multi_range_count = VARIABLE_VALUE 
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES 
+WHERE VARIABLE_NAME='multi_range_count';
+@@global.multi_range_count = VARIABLE_VALUE
+1
+'#------------------FN_DYNVARS_090_07-----------------------#'
+SELECT @@session.multi_range_count = VARIABLE_VALUE 
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES 
+WHERE VARIABLE_NAME='multi_range_count';
+@@session.multi_range_count = VARIABLE_VALUE
+1
+'#------------------FN_DYNVARS_090_08-----------------------#'
+SET @@global.multi_range_count = TRUE;
+SELECT @@global.multi_range_count;
+@@global.multi_range_count
+1
+SET @@global.multi_range_count = FALSE;
+Warnings:
+Warning	1292	Truncated incorrect multi_range_count value: '0'
+SELECT @@global.multi_range_count;
+@@global.multi_range_count
+1
+'#---------------------FN_DYNVARS_090_09----------------------#'
+SET @@global.multi_range_count = 10;
+SELECT @@multi_range_count = @@global.multi_range_count;
+@@multi_range_count = @@global.multi_range_count
+0
+'#---------------------FN_DYNVARS_090_10----------------------#'
+SET @@multi_range_count = 100;
+SELECT @@multi_range_count = @@local.multi_range_count;
+@@multi_range_count = @@local.multi_range_count
+1
+SELECT @@local.multi_range_count = @@session.multi_range_count;
+@@local.multi_range_count = @@session.multi_range_count
+1
+'#---------------------FN_DYNVARS_090_11----------------------#'
+SET multi_range_count = 1;
+SELECT @@multi_range_count;
+@@multi_range_count
+1
+SELECT local.multi_range_count;
+ERROR 42S02: Unknown table 'local' in field list
+SELECT session.multi_range_count;
+ERROR 42S02: Unknown table 'session' in field list
+SELECT multi_range_count = @@session.multi_range_count;
+ERROR 42S22: Unknown column 'multi_range_count' in 'field list'
+SET @@global.multi_range_count = @start_global_value;
+SELECT @@global.multi_range_count;
+@@global.multi_range_count
+256
+SET @@session.multi_range_count = @start_session_value;
+SELECT @@session.multi_range_count;
+@@session.multi_range_count
+256

=== added file 'mysql-test/suite/sys_vars/r/multi_range_count_basic_64.result'
--- a/mysql-test/suite/sys_vars/r/multi_range_count_basic_64.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/sys_vars/r/multi_range_count_basic_64.result	2008-07-23 14:06:44 +0000
@@ -0,0 +1,184 @@
+SET @start_global_value = @@global.multi_range_count;
+SELECT @start_global_value;
+@start_global_value
+256
+SET @start_session_value = @@session.multi_range_count;
+SELECT @start_session_value;
+@start_session_value
+256
+'#--------------------FN_DYNVARS_090_01-------------------------#'
+SET @@global.multi_range_count = 100;
+SET @@global.multi_range_count = DEFAULT;
+SELECT @@global.multi_range_count;
+@@global.multi_range_count
+256
+SET @@session.multi_range_count = 200;
+SET @@session.multi_range_count = DEFAULT;
+SELECT @@session.multi_range_count;
+@@session.multi_range_count
+256
+'#--------------------FN_DYNVARS_090_02-------------------------#'
+SET @@global.multi_range_count = DEFAULT;
+SELECT @@global.multi_range_count = 256;
+@@global.multi_range_count = 256
+1
+SET @@session.multi_range_count = DEFAULT;
+SELECT @@session.multi_range_count = 256;
+@@session.multi_range_count = 256
+1
+'#--------------------FN_DYNVARS_090_03-------------------------#'
+SET @@global.multi_range_count = 1;
+SELECT @@global.multi_range_count;
+@@global.multi_range_count
+1
+SET @@global.multi_range_count = 60020;
+SELECT @@global.multi_range_count;
+@@global.multi_range_count
+60020
+SET @@global.multi_range_count = 65535;
+SELECT @@global.multi_range_count;
+@@global.multi_range_count
+65535
+SET @@global.multi_range_count = 4294967295;
+SELECT @@global.multi_range_count;
+@@global.multi_range_count
+4294967295
+SET @@global.multi_range_count = 4294967294;
+SELECT @@global.multi_range_count;
+@@global.multi_range_count
+4294967294
+'#--------------------FN_DYNVARS_090_04-------------------------#'
+SET @@session.multi_range_count = 1;
+SELECT @@session.multi_range_count;
+@@session.multi_range_count
+1
+SET @@session.multi_range_count = 50050;
+SELECT @@session.multi_range_count;
+@@session.multi_range_count
+50050
+SET @@session.multi_range_count = 65535;
+SELECT @@session.multi_range_count;
+@@session.multi_range_count
+65535
+SET @@session.multi_range_count = 4294967295;
+SELECT @@session.multi_range_count;
+@@session.multi_range_count
+4294967295
+SET @@session.multi_range_count = 4294967294;
+SELECT @@session.multi_range_count;
+@@session.multi_range_count
+4294967294
+'#------------------FN_DYNVARS_090_05-----------------------#'
+SET @@global.multi_range_count = 0;
+Warnings:
+Warning	1292	Truncated incorrect multi_range_count value: '0'
+SELECT @@global.multi_range_count;
+@@global.multi_range_count
+1
+SET @@global.multi_range_count = 4294967296;
+SELECT @@global.multi_range_count;
+@@global.multi_range_count
+4294967296
+SET @@global.multi_range_count = -1024;
+Warnings:
+Warning	1292	Truncated incorrect multi_range_count value: '0'
+SELECT @@global.multi_range_count;
+@@global.multi_range_count
+1
+SET @@global.multi_range_count = 429496729500;
+SELECT @@global.multi_range_count;
+@@global.multi_range_count
+429496729500
+SET @@global.multi_range_count = 65530.34;
+ERROR 42000: Incorrect argument type to variable 'multi_range_count'
+SELECT @@global.multi_range_count;
+@@global.multi_range_count
+429496729500
+SET @@global.multi_range_count = test;
+ERROR 42000: Incorrect argument type to variable 'multi_range_count'
+SELECT @@global.multi_range_count;
+@@global.multi_range_count
+429496729500
+SET @@session.multi_range_count = 0;
+Warnings:
+Warning	1292	Truncated incorrect multi_range_count value: '0'
+SELECT @@session.multi_range_count;
+@@session.multi_range_count
+1
+SET @@session.multi_range_count = 4294967296;
+SELECT @@session.multi_range_count;
+@@session.multi_range_count
+4294967296
+SET @@session.multi_range_count = -1;
+Warnings:
+Warning	1292	Truncated incorrect multi_range_count value: '0'
+SELECT @@session.multi_range_count;
+@@session.multi_range_count
+1
+SET @@session.multi_range_count = 65530.34.;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.' at line 1
+SET @@session.multi_range_count = 4294967295021;
+SELECT @@session.multi_range_count;
+@@session.multi_range_count
+4294967295021
+'Bug # 34837: Errors are not coming on assigning invalid values to variable';
+SET @@session.multi_range_count = test;
+ERROR 42000: Incorrect argument type to variable 'multi_range_count'
+SELECT @@session.multi_range_count;
+@@session.multi_range_count
+4294967295021
+'#------------------FN_DYNVARS_090_06-----------------------#'
+SELECT @@global.multi_range_count = VARIABLE_VALUE 
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES 
+WHERE VARIABLE_NAME='multi_range_count';
+@@global.multi_range_count = VARIABLE_VALUE
+1
+'#------------------FN_DYNVARS_090_07-----------------------#'
+SELECT @@session.multi_range_count = VARIABLE_VALUE 
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES 
+WHERE VARIABLE_NAME='multi_range_count';
+@@session.multi_range_count = VARIABLE_VALUE
+1
+'#------------------FN_DYNVARS_090_08-----------------------#'
+SET @@global.multi_range_count = TRUE;
+SELECT @@global.multi_range_count;
+@@global.multi_range_count
+1
+SET @@global.multi_range_count = FALSE;
+Warnings:
+Warning	1292	Truncated incorrect multi_range_count value: '0'
+SELECT @@global.multi_range_count;
+@@global.multi_range_count
+1
+'#---------------------FN_DYNVARS_090_09----------------------#'
+SET @@global.multi_range_count = 10;
+SELECT @@multi_range_count = @@global.multi_range_count;
+@@multi_range_count = @@global.multi_range_count
+0
+'#---------------------FN_DYNVARS_090_10----------------------#'
+SET @@multi_range_count = 100;
+SELECT @@multi_range_count = @@local.multi_range_count;
+@@multi_range_count = @@local.multi_range_count
+1
+SELECT @@local.multi_range_count = @@session.multi_range_count;
+@@local.multi_range_count = @@session.multi_range_count
+1
+'#---------------------FN_DYNVARS_090_11----------------------#'
+SET multi_range_count = 1;
+SELECT @@multi_range_count;
+@@multi_range_count
+1
+SELECT local.multi_range_count;
+ERROR 42S02: Unknown table 'local' in field list
+SELECT session.multi_range_count;
+ERROR 42S02: Unknown table 'session' in field list
+SELECT multi_range_count = @@session.multi_range_count;
+ERROR 42S22: Unknown column 'multi_range_count' in 'field list'
+SET @@global.multi_range_count = @start_global_value;
+SELECT @@global.multi_range_count;
+@@global.multi_range_count
+256
+SET @@session.multi_range_count = @start_session_value;
+SELECT @@session.multi_range_count;
+@@session.multi_range_count
+256

=== added file 'mysql-test/suite/sys_vars/t/multi_range_count_basic_32.test'
--- a/mysql-test/suite/sys_vars/t/multi_range_count_basic_32.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/sys_vars/t/multi_range_count_basic_32.test	2008-07-23 14:06:44 +0000
@@ -0,0 +1,9 @@
+################################################################################
+# Created by Horst Hunger      2008-05-07                                      #
+#                                                                              #
+# Wrapper for 32 bit machines                                                  #
+################################################################################
+
+--source include/have_32bit.inc
+--source suite/sys_vars/inc/multi_range_count_basic.inc
+

=== added file 'mysql-test/suite/sys_vars/t/multi_range_count_basic_64.test'
--- a/mysql-test/suite/sys_vars/t/multi_range_count_basic_64.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/sys_vars/t/multi_range_count_basic_64.test	2008-07-23 14:06:44 +0000
@@ -0,0 +1,9 @@
+################################################################################
+# Created by Horst Hunger      2008-05-07                                      #
+#                                                                              #
+# Wrapper for 64 bit machines                                                  #
+################################################################################
+
+--source include/have_64bit.inc
+--source suite/sys_vars/inc/multi_range_count_basic.inc
+

=== modified file 'mysql-test/t/func_if.test'
--- a/mysql-test/t/func_if.test	2007-02-12 20:59:29 +0000
+++ b/mysql-test/t/func_if.test	2008-07-30 11:07:37 +0000
@@ -108,3 +108,46 @@ drop table t1;
 select if(0, 18446744073709551610, 18446744073709551610);
 
 
+#
+# Bug #37662: nested if() inside sum() is parsed in exponential time
+#
+
+CREATE TABLE t1(a DECIMAL(10,3));
+
+# check : should be fast. more than few secs means failure.
+SELECT t1.a,
+ IF((ROUND(t1.a,2)=1), 2,
+ IF((ROUND(t1.a,2)=1), 2,
+ IF((ROUND(t1.a,2)=1), 2,
+ IF((ROUND(t1.a,2)=1), 2,
+ IF((ROUND(t1.a,2)=1), 2,
+ IF((ROUND(t1.a,2)=1), 2,
+ IF((ROUND(t1.a,2)=1), 2,
+ IF((ROUND(t1.a,2)=1), 2,
+ IF((ROUND(t1.a,2)=1), 2,
+ IF((ROUND(t1.a,2)=1), 2,
+ IF((ROUND(t1.a,2)=1), 2,
+ IF((ROUND(t1.a,2)=1), 2,
+ IF((ROUND(t1.a,2)=1), 2,
+ IF((ROUND(t1.a,2)=1), 2,
+ IF((ROUND(t1.a,2)=1), 2,
+ IF((ROUND(t1.a,2)=1), 2,
+ IF((ROUND(t1.a,2)=1), 2,
+ IF((ROUND(t1.a,2)=1), 2,
+ IF((ROUND(t1.a,2)=1), 2,
+ IF((ROUND(t1.a,2)=1), 2,
+ IF((ROUND(t1.a,2)=1), 2,
+ IF((ROUND(t1.a,2)=1), 2,
+ IF((ROUND(t1.a,2)=1), 2,
+ IF((ROUND(t1.a,2)=1), 2,
+ IF((ROUND(t1.a,2)=1), 2,
+ IF((ROUND(t1.a,2)=1), 2,
+ IF((ROUND(t1.a,2)=1), 2,
+ IF((ROUND(t1.a,2)=1), 2,
+ IF((ROUND(t1.a,2)=1), 2,
+ IF((ROUND(t1.a,2)=1), 2,0)))))))))))))))))))))))))))))) + 1
+FROM t1;
+
+DROP TABLE t1;
+
+--echo End of 5.0 tests

=== modified file 'mysql-test/t/information_schema-master.opt'
--- a/mysql-test/t/information_schema-master.opt	2007-11-30 03:26:57 +0000
+++ b/mysql-test/t/information_schema-master.opt	2008-07-29 10:45:39 +0000
@@ -6,7 +6,6 @@
 --loose-skip-plugin-falcon_syncobjects
 --loose-skip-plugin-falcon_system_memory_detail
 --loose-skip-plugin-falcon_system_memory_summary
---loose-skip-plugin-falcon_tables
 --loose-skip-plugin-falcon_transaction_summary
 --loose-skip-plugin-falcon_transactions
 --loose-skip-plugin-falcon_version

=== modified file 'mysql-test/t/information_schema_db-master.opt'
--- a/mysql-test/t/information_schema_db-master.opt	2007-11-30 03:26:57 +0000
+++ b/mysql-test/t/information_schema_db-master.opt	2008-07-29 10:45:39 +0000
@@ -6,7 +6,6 @@
 --loose-skip-plugin-falcon_syncobjects
 --loose-skip-plugin-falcon_system_memory_detail
 --loose-skip-plugin-falcon_system_memory_summary
---loose-skip-plugin-falcon_tables
 --loose-skip-plugin-falcon_transaction_summary
 --loose-skip-plugin-falcon_transactions
 --loose-skip-plugin-falcon_version

=== added file 'mysql-test/t/innodb-autoinc-optimize.test'
--- a/mysql-test/t/innodb-autoinc-optimize.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/innodb-autoinc-optimize.test	2008-08-13 08:16:34 +0000
@@ -0,0 +1,16 @@
+-- source include/have_innodb.inc
+# embedded server ignores 'delayed', so skip this
+-- source include/not_embedded.inc
+
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+#
+# Bug 34286
+#
+create table t1(a int not null auto_increment primary key) engine=innodb;
+insert into t1 set a = -1;
+# NOTE: The database needs to be shutdown and restarted (here) for
+# the test to work. It's included for reference only.
+optimize table t1;

=== modified file 'mysql-test/t/mysqlshow-master.opt'
--- a/mysql-test/t/mysqlshow-master.opt	2007-11-30 03:26:57 +0000
+++ b/mysql-test/t/mysqlshow-master.opt	2008-07-29 10:45:39 +0000
@@ -6,7 +6,6 @@
 --loose-skip-plugin-falcon_syncobjects
 --loose-skip-plugin-falcon_system_memory_detail
 --loose-skip-plugin-falcon_system_memory_summary
---loose-skip-plugin-falcon_tables
 --loose-skip-plugin-falcon_transaction_summary
 --loose-skip-plugin-falcon_transactions
 --loose-skip-plugin-falcon_version

=== modified file 'mysql-test/t/perror.test'
--- a/mysql-test/t/perror.test	2006-08-01 09:29:10 +0000
+++ b/mysql-test/t/perror.test	2008-08-05 23:26:18 +0000
@@ -17,3 +17,17 @@ enable_query_log;
 # As there is no error code defined for 10000, expect error
 --error 1
 --exec $MY_PERROR 10000 2>&1
+
+#
+# Bug#10143 (Perror not showing error description)
+#
+
+# test reported case
+--exec $MY_PERROR 1062 2>&1
+
+# test errors that contain characters to escape in the text.
+--exec $MY_PERROR 1076 2>&1
+--exec $MY_PERROR 1459 2>&1
+--exec $MY_PERROR 1461 2>&1
+
+

=== added file 'mysql-test/t/sp-no-code.test'
--- a/mysql-test/t/sp-no-code.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/sp-no-code.test	2008-07-24 16:50:18 +0000
@@ -0,0 +1,12 @@
+#
+# Test the debugging feature "show procedure/function code <name>" 
+#
+
+-- source include/have_nodebug.inc
+
+--error ER_FEATURE_DISABLED
+show procedure code foo;
+
+--error ER_FEATURE_DISABLED
+show function code foo;
+

=== modified file 'mysql-test/t/subselect.test'
--- a/mysql-test/t/subselect.test	2008-07-10 23:29:27 +0000
+++ b/mysql-test/t/subselect.test	2008-07-31 11:37:07 +0000
@@ -3443,7 +3443,21 @@ SELECT * FROM t2 WHERE b NOT IN (SELECT 
 
 DROP TABLE t1,t2;
 
---echo End of 5.0 tests.
+
+#
+# Bug #38191: Server crash with subquery containing DISTINCT and ORDER BY
+#
+
+CREATE TABLE t1(pk int PRIMARY KEY, a int, INDEX idx(a));
+INSERT INTO t1 VALUES (1, 10), (3, 30), (2, 20);
+CREATE TABLE t2(pk int PRIMARY KEY, a int, b int, INDEX idxa(a));
+INSERT INTO t2 VALUES (2, 20, 700), (1, 10, 200), (4, 10, 100);
+SELECT * FROM t1
+   WHERE EXISTS (SELECT DISTINCT a FROM t2 WHERE t1.a < t2.a ORDER BY b);
+DROP TABLE t1,t2;
+
+--echo End of 5.1 tests.
+
 
 #
 # Bug#33204: INTO is allowed in subselect, causing inconsistent results

=== modified file 'mysql-test/t/variables-master.opt'
--- a/mysql-test/t/variables-master.opt	2007-09-28 19:51:23 +0000
+++ b/mysql-test/t/variables-master.opt	2008-07-29 10:45:39 +0000
@@ -6,6 +6,5 @@
 --loose-skip-plugin-falcon_syncobjects
 --loose-skip-plugin-falcon_system_memory_detail
 --loose-skip-plugin-falcon_system_memory_summary
---loose-skip-plugin-falcon_tables
 --loose-skip-plugin-falcon_transaction_summary
 --loose-skip-plugin-falcon_transactions

=== modified file 'scripts/mysql_system_tables_fix.sql'
--- a/scripts/mysql_system_tables_fix.sql	2008-07-24 07:44:21 +0000
+++ b/scripts/mysql_system_tables_fix.sql	2008-08-07 03:05:33 +0000
@@ -216,6 +216,52 @@ ALTER TABLE func
   MODIFY type enum ('function','aggregate') COLLATE utf8_general_ci NOT NULL;
 
 #
+# Convert miscellaneous tables to UTF-8.
+#
+# Tables coming from a old version might have the 3-byte Unicode
+# character set formerly known as utf8.
+#
+
+ALTER TABLE help_category CONVERT TO CHARACTER SET utf8;
+ALTER TABLE help_keyword CONVERT TO CHARACTER SET utf8;
+ALTER TABLE help_relation CONVERT TO CHARACTER SET utf8;
+ALTER TABLE servers CONVERT TO CHARACTER SET utf8;
+ALTER TABLE time_zone CONVERT TO CHARACTER SET utf8;
+ALTER TABLE time_zone_leap_second CONVERT TO CHARACTER SET utf8;
+ALTER TABLE time_zone_name CONVERT TO CHARACTER SET utf8;
+ALTER TABLE time_zone_transition CONVERT TO CHARACTER SET utf8;
+ALTER TABLE time_zone_transition_type CONVERT TO CHARACTER SET utf8;
+
+# Bug#31291: Avoid conversion from text to mediumtext
+ALTER TABLE help_topic
+  MODIFY description text NOT NULL,
+  MODIFY example text NOT NULL,
+CONVERT TO CHARACTER SET utf8;
+
+#
+# Convert log tables to UTF-8.
+#
+
+SET @old_log_state = @@global.general_log;
+SET GLOBAL general_log = 'OFF';
+ALTER TABLE general_log CONVERT TO CHARACTER SET utf8;
+SET GLOBAL general_log = @old_log_state;
+
+SET @old_log_state = @@global.slow_query_log;
+SET GLOBAL slow_query_log = 'OFF';
+ALTER TABLE slow_log CONVERT TO CHARACTER SET utf8;
+SET GLOBAL slow_query_log = @old_log_state;
+
+#
+# Convert plugin table to UTF-8 with binary collation.
+#
+
+ALTER TABLE plugin
+  MODIFY name char(64) COLLATE utf8_bin NOT NULL DEFAULT '',
+  MODIFY dl char(128) COLLATE utf8_bin NOT NULL DEFAULT '',
+  CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin;
+
+#
 # Detect whether we had Create_view_priv
 #
 SET @hadCreateViewPriv:=0;
@@ -431,6 +477,13 @@ ALTER TABLE db MODIFY Event_priv enum('N
 #
 # EVENT table
 #
+
+#
+# WARNING: Beware that some columns are added and modified multiple
+# times. Whether adding or modifying the column, it's specification
+# should always be the same.
+#
+
 ALTER TABLE event DROP PRIMARY KEY;
 ALTER TABLE event ADD PRIMARY KEY(db, name);
 # Add sql_mode column just in case.
@@ -499,6 +552,20 @@ ALTER TABLE event ADD body_utf8 longblob
                       AFTER db_collation;
 ALTER TABLE event MODIFY body_utf8 longblob DEFAULT NULL;
 
+#
+# Convert event table to UTF-8 with binary collation.
+#
+
+ALTER TABLE event
+  CONVERT TO CHARACTER SET utf8;
+ALTER TABLE event
+  MODIFY time_zone char(64) CHARACTER SET latin1 NOT NULL DEFAULT 'SYSTEM',
+  MODIFY db char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
+  MODIFY definer char(77) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
+  MODIFY comment char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
+  MODIFY character_set_client char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
+  MODIFY collation_connection char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
+  MODIFY db_collation char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL;
 
 #
 # TRIGGER privilege

=== modified file 'sql/field.h'
--- a/sql/field.h	2008-07-21 03:55:09 +0000
+++ b/sql/field.h	2008-08-01 15:38:05 +0000
@@ -13,7 +13,6 @@
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
 
-
 /*
   Because of the function new_field() all field classes that have static
   variables must declare the size_of() member function.
@@ -50,7 +49,8 @@ class Field
   Field(const Item &);				/* Prevent use of these */
   void operator=(Field &);
 public:
-  static void *operator new(size_t size) {return sql_alloc(size); }
+  static void *operator new(size_t size) throw ()
+  { return sql_alloc(size); }
   static void operator delete(void *ptr_arg, size_t size) { TRASH(ptr_arg, size); }
 
   uchar		*ptr;			// Position to field in record
@@ -1720,6 +1720,7 @@ public:
   }
   int reset(void) { bzero(ptr, packlength+sizeof(uchar*)); return 0; }
   void reset_fields() { bzero((uchar*) &value,sizeof(value)); }
+  uint32 get_field_buffer_size(void) { return value.alloced_length(); }
 #ifndef WORDS_BIGENDIAN
   static
 #endif

=== modified file 'sql/item.cc'
--- a/sql/item.cc	2008-07-24 10:00:56 +0000
+++ b/sql/item.cc	2008-08-07 03:05:33 +0000
@@ -436,8 +436,11 @@ uint Item::decimal_precision() const
   Item_result restype= result_type();
 
   if ((restype == DECIMAL_RESULT) || (restype == INT_RESULT))
-    return min(my_decimal_length_to_precision(max_length, decimals, unsigned_flag),
-               DECIMAL_MAX_PRECISION);
+  {
+    uint prec= 
+      my_decimal_length_to_precision(max_length, decimals, unsigned_flag);
+    return min(prec, DECIMAL_MAX_PRECISION);
+  }
   return min(max_length, DECIMAL_MAX_PRECISION);
 }
 
@@ -7028,8 +7031,9 @@ bool Item_type_holder::join_types(THD *t
   if (Field::result_merge_type(fld_type) == DECIMAL_RESULT)
   {
     decimals= min(max(decimals, item->decimals), DECIMAL_MAX_SCALE);
-    int precision= min(max(prev_decimal_int_part, item->decimal_int_part())
-                       + decimals, DECIMAL_MAX_PRECISION);
+    int item_int_part= item->decimal_int_part();
+    int item_prec = max(prev_decimal_int_part, item_int_part) + decimals;
+    int precision= min(item_prec, DECIMAL_MAX_PRECISION);
     unsigned_flag&= item->unsigned_flag;
     max_length= my_decimal_precision_to_length(precision, decimals,
                                                unsigned_flag);

=== modified file 'sql/item.h'
--- a/sql/item.h	2008-06-17 20:04:19 +0000
+++ b/sql/item.h	2008-08-01 15:38:05 +0000
@@ -472,9 +472,9 @@ class Item
   virtual bool is_expensive_processor(uchar *arg) { return 0; }
 
 public:
-  static void *operator new(size_t size)
+  static void *operator new(size_t size) throw ()
   { return sql_alloc(size); }
-  static void *operator new(size_t size, MEM_ROOT *mem_root)
+  static void *operator new(size_t size, MEM_ROOT *mem_root) throw ()
   { return alloc_root(mem_root, size); }
   static void operator delete(void *ptr,size_t size) { TRASH(ptr, size); }
   static void operator delete(void *ptr, MEM_ROOT *mem_root) {}

=== modified file 'sql/item_cmpfunc.cc'
--- a/sql/item_cmpfunc.cc	2008-07-15 12:17:01 +0000
+++ b/sql/item_cmpfunc.cc	2008-07-31 11:37:07 +0000
@@ -2227,8 +2227,11 @@ Item_func_ifnull::fix_length_and_dec()
 
 uint Item_func_ifnull::decimal_precision() const
 {
-  int max_int_part=max(args[0]->decimal_int_part(),args[1]->decimal_int_part());
-  return min(max_int_part + decimals, DECIMAL_MAX_PRECISION);
+  int arg0_int_part= args[0]->decimal_int_part();
+  int arg1_int_part= args[1]->decimal_int_part();
+  int max_int_part= max(arg0_int_part, arg1_int_part);
+  int precision= max_int_part + decimals;
+  return min(precision, DECIMAL_MAX_PRECISION);
 }
 
 
@@ -2409,8 +2412,9 @@ Item_func_if::fix_length_and_dec()
 
 uint Item_func_if::decimal_precision() const
 {
-  int precision=(max(args[1]->decimal_int_part(),args[2]->decimal_int_part())+
-                 decimals);
+  int arg1_prec= args[1]->decimal_int_part();
+  int arg2_prec= args[2]->decimal_int_part();
+  int precision=max(arg1_prec,arg2_prec) + decimals;
   return min(precision, DECIMAL_MAX_PRECISION);
 }
 

=== modified file 'sql/item_func.cc'
--- a/sql/item_func.cc	2008-07-24 10:00:56 +0000
+++ b/sql/item_func.cc	2008-08-07 03:05:33 +0000
@@ -1156,9 +1156,10 @@ my_decimal *Item_func_plus::decimal_op(m
 void Item_func_additive_op::result_precision()
 {
   decimals= max(args[0]->decimals, args[1]->decimals);
-  int max_int_part= max(args[0]->decimal_precision() - args[0]->decimals,
-                        args[1]->decimal_precision() - args[1]->decimals);
-  int precision= min(max_int_part + 1 + decimals, DECIMAL_MAX_PRECISION);
+  int arg1_int= args[0]->decimal_precision() - args[0]->decimals;
+  int arg2_int= args[1]->decimal_precision() - args[1]->decimals;
+  int est_prec= max(arg1_int, arg2_int) + 1 + decimals;
+  int precision= min(est_prec, DECIMAL_MAX_PRECISION);
 
   /* Integer operations keep unsigned_flag if one of arguments is unsigned */
   if (result_type() == INT_RESULT)
@@ -1269,8 +1270,8 @@ void Item_func_mul::result_precision()
   else
     unsigned_flag= args[0]->unsigned_flag & args[1]->unsigned_flag;
   decimals= min(args[0]->decimals + args[1]->decimals, DECIMAL_MAX_SCALE);
-  int precision= min(args[0]->decimal_precision() + args[1]->decimal_precision(),
-                     DECIMAL_MAX_PRECISION);
+  uint est_prec = args[0]->decimal_precision() + args[1]->decimal_precision();
+  uint precision= min(est_prec, DECIMAL_MAX_PRECISION);
   max_length= my_decimal_precision_to_length(precision, decimals,unsigned_flag);
 }
 
@@ -1317,8 +1318,8 @@ my_decimal *Item_func_div::decimal_op(my
 
 void Item_func_div::result_precision()
 {
-  uint precision=min(args[0]->decimal_precision() + prec_increment,
-                     DECIMAL_MAX_PRECISION);
+  uint arg_prec= args[0]->decimal_precision() + prec_increment;
+  uint precision=min(arg_prec, DECIMAL_MAX_PRECISION);
   /* Integer operations keep unsigned_flag if one of arguments is unsigned */
   if (result_type() == INT_RESULT)
     unsigned_flag= args[0]->unsigned_flag | args[1]->unsigned_flag;

=== modified file 'sql/mysql_priv.h'
--- a/sql/mysql_priv.h	2008-07-26 16:38:20 +0000
+++ b/sql/mysql_priv.h	2008-08-07 03:05:33 +0000
@@ -2233,6 +2233,7 @@ int writefrm(const char* name, const uch
 int closefrm(TABLE *table, bool free_share);
 int read_string(File file, uchar* *to, size_t length);
 void free_blobs(TABLE *table);
+void free_field_buffers_larger_than(TABLE *table, uint32 size);
 int set_zone(int nr,int min_zone,int max_zone);
 ulong convert_period_to_month(ulong period);
 ulong convert_month_to_period(ulong month);

=== modified file 'sql/probes.h'
--- a/sql/probes.h	2007-09-21 07:09:31 +0000
+++ b/sql/probes.h	2008-07-08 13:49:57 +0000
@@ -11,7 +11,7 @@
 extern "C" {
 #endif
 
-#if _DTRACE_VERSION
+#if _DTRACE_VERSION && defined(HAVE_DTRACE)
 
 #define	MYSQL_DELETE_END() \
 	__dtrace_mysql___delete_end()

=== modified file 'sql/share/errmsg.txt'
--- a/sql/share/errmsg.txt	2008-07-18 13:30:53 +0000
+++ b/sql/share/errmsg.txt	2008-08-06 14:39:03 +0000
@@ -4718,7 +4718,7 @@ ER_SLAVE_IGNORED_TABLE  
         swe "Slav SQL tr�den ignorerade fr�gan pga en replicate-*-table regel"
 ER_INCORRECT_GLOBAL_LOCAL_VAR  
         eng "Variable '%-.192s' is a %s variable"
-        serbian "Incorrect foreign key definition for '%-.192s': %s"
+        serbian "Promenljiva '%-.192s' je %s promenljiva"
         ger "Variable '%-.192s' ist eine %s-Variable"
         nla "Variabele '%-.192s' is geen %s variabele"
         spa "Variable '%-.192s' es una %s variable"

=== modified file 'sql/sp_head.cc'
--- a/sql/sp_head.cc	2008-07-25 17:21:55 +0000
+++ b/sql/sp_head.cc	2008-08-07 18:37:55 +0000
@@ -468,7 +468,7 @@ sp_head::operator new(size_t size) throw
   init_sql_alloc(&own_root, MEM_ROOT_BLOCK_SIZE, MEM_ROOT_PREALLOC);
   sp= (sp_head *) alloc_root(&own_root, size);
   if (sp == NULL)
-    return NULL;
+    DBUG_RETURN(NULL);
   sp->main_mem_root= own_root;
   DBUG_PRINT("info", ("mem_root %p", &sp->mem_root));
   DBUG_RETURN(sp);

=== modified file 'sql/sql_acl.cc'
--- a/sql/sql_acl.cc	2008-07-25 17:21:55 +0000
+++ b/sql/sql_acl.cc	2008-08-07 03:05:33 +0000
@@ -5811,7 +5811,6 @@ bool mysql_drop_user(THD *thd, List <LEX
 
   while ((tmp_user_name= user_list++))
   {
-    user_name= get_current_user(thd, tmp_user_name);
     if (!(user_name= get_current_user(thd, tmp_user_name)))
     {
       result= TRUE;

=== modified file 'sql/sql_base.cc'
--- a/sql/sql_base.cc	2008-07-09 14:27:18 +0000
+++ b/sql/sql_base.cc	2008-07-25 15:10:14 +0000
@@ -1466,6 +1466,8 @@ bool close_thread_table(THD *thd, TABLE 
     table->file->extra(HA_EXTRA_DETACH_CHILDREN);
 
     /* Free memory and reset for next loop */
+    free_field_buffers_larger_than(table,MAX_TDC_BLOB_SIZE);
+    
     table->file->ha_reset();
     table_def_unuse_table(table);
   }

=== modified file 'sql/sql_error.cc'
--- a/sql/sql_error.cc	2008-02-19 12:59:19 +0000
+++ b/sql/sql_error.cc	2008-07-29 22:03:57 +0000
@@ -97,12 +97,9 @@ void mysql_reset_errors(THD *thd, bool f
     level		Severity of warning (note, warning, error ...)
     code		Error number
     msg			Clear error message
-    
-  RETURN
-    pointer on MYSQL_ERROR object
 */
 
-MYSQL_ERROR *push_warning(THD *thd, MYSQL_ERROR::enum_warning_level level, 
+void push_warning(THD *thd, MYSQL_ERROR::enum_warning_level level, 
                           uint code, const char *msg)
 {
   MYSQL_ERROR *err= 0;
@@ -111,7 +108,7 @@ MYSQL_ERROR *push_warning(THD *thd, MYSQ
 
   if (level == MYSQL_ERROR::WARN_LEVEL_NOTE &&
       !(thd->options & OPTION_SQL_NOTES))
-    DBUG_RETURN(0);
+    DBUG_VOID_RETURN;
 
   if (thd->query_id != thd->warn_id && !thd->spcont)
     mysql_reset_errors(thd, 0);
@@ -138,12 +135,12 @@ MYSQL_ERROR *push_warning(THD *thd, MYSQ
   }
 
   if (thd->handle_error(code, msg, level))
-    DBUG_RETURN(NULL);
+    DBUG_VOID_RETURN;
 
   if (thd->spcont &&
       thd->spcont->handle_error(code, level, thd))
   {
-    DBUG_RETURN(NULL);
+    DBUG_VOID_RETURN;
   }
   query_cache_abort(&thd->query_cache_tls);
 
@@ -156,7 +153,7 @@ MYSQL_ERROR *push_warning(THD *thd, MYSQ
   }
   thd->warn_count[(uint) level]++;
   thd->total_warn_count++;
-  DBUG_RETURN(err);
+  DBUG_VOID_RETURN;
 }
 
 /*

=== modified file 'sql/sql_error.h'
--- a/sql/sql_error.h	2008-06-12 19:04:52 +0000
+++ b/sql/sql_error.h	2008-07-29 22:03:57 +0000
@@ -35,8 +35,8 @@ private:
   void set_msg(THD *thd, const char *msg_arg);
 };
 
-MYSQL_ERROR *push_warning(THD *thd, MYSQL_ERROR::enum_warning_level level,
-                          uint code, const char *msg);
+void push_warning(THD *thd, MYSQL_ERROR::enum_warning_level level,
+                  uint code, const char *msg);
 void push_warning_printf(THD *thd, MYSQL_ERROR::enum_warning_level level,
 			 uint code, const char *format, ...);
 void mysql_reset_errors(THD *thd, bool force);

=== modified file 'sql/sql_lex.h'
--- a/sql/sql_lex.h	2008-07-18 13:30:53 +0000
+++ b/sql/sql_lex.h	2008-08-01 15:38:05 +0000
@@ -422,11 +422,11 @@ public:
   bool no_table_names_allowed; /* used for global order by */
   bool no_error; /* suppress error message (convert it to warnings) */
 
-  static void *operator new(size_t size)
+  static void *operator new(size_t size) throw ()
   {
     return sql_alloc(size);
   }
-  static void *operator new(size_t size, MEM_ROOT *mem_root)
+  static void *operator new(size_t size, MEM_ROOT *mem_root) throw ()
   { return (void*) alloc_root(mem_root, (uint) size); }
   static void operator delete(void *ptr,size_t size) { TRASH(ptr, size); }
   static void operator delete(void *ptr, MEM_ROOT *mem_root) {}

=== modified file 'sql/sql_list.h'
--- a/sql/sql_list.h	2008-03-28 17:47:53 +0000
+++ b/sql/sql_list.h	2008-08-01 15:38:05 +0000
@@ -29,7 +29,7 @@ public:
   {
     return sql_alloc(size);
   }
-  static void *operator new[](size_t size)
+  static void *operator new[](size_t size) throw ()
   {
     return sql_alloc(size);
   }
@@ -450,7 +450,7 @@ public:
 struct ilink
 {
   struct ilink **prev,*next;
-  static void *operator new(size_t size)
+  static void *operator new(size_t size) throw ()
   {
     return (void*)my_malloc((uint)size, MYF(MY_WME | MY_FAE | ME_FATALERROR));
   }

=== modified file 'sql/sql_parse.cc'
--- a/sql/sql_parse.cc	2008-07-26 16:38:20 +0000
+++ b/sql/sql_parse.cc	2008-08-08 13:34:35 +0000
@@ -4440,10 +4440,10 @@ create_sp_error:
       }
       break;
     }
-#ifndef DBUG_OFF
   case SQLCOM_SHOW_PROC_CODE:
   case SQLCOM_SHOW_FUNC_CODE:
     {
+#ifndef DBUG_OFF
       sp_head *sp;
 
       if (lex->sql_command == SQLCOM_SHOW_PROC_CODE)
@@ -4460,8 +4460,12 @@ create_sp_error:
         goto error;
       }
       break;
-    }
+#else
+      my_error(ER_FEATURE_DISABLED, MYF(0),
+               "SHOW PROCEDURE|FUNCTION CODE", "--with-debug");
+      goto error;
 #endif // ifndef DBUG_OFF
+    }
   case SQLCOM_SHOW_CREATE_TRIGGER:
     {
       if (lex->spname->m_name.length > NAME_LEN)
@@ -6667,15 +6671,24 @@ bool reload_acl_and_cache(THD *thd, ulon
       thd->store_globals();
       lex_start(thd);
     }
+    
     if (thd)
     {
-      if (acl_reload(thd))
-        result= 1;
-      if (grant_reload(thd))
+      bool reload_acl_failed= acl_reload(thd);
+      bool reload_grants_failed= grant_reload(thd);
+      bool reload_servers_failed= servers_reload(thd);
+      
+      if (reload_acl_failed || reload_grants_failed || reload_servers_failed)
+      {
         result= 1;
-      if (servers_reload(thd))
-        result= 1; /* purecov: inspected */
+        /*
+          When an error is returned, my_message may have not been called and
+          the client will hang waiting for a response.
+        */
+        my_error(ER_UNKNOWN_ERROR, MYF(0), "FLUSH PRIVILEGES failed");
+      }
     }
+
     if (tmp_thd)
     {
       delete tmp_thd;
@@ -6756,8 +6769,10 @@ bool reload_acl_and_cache(THD *thd, ulon
       tmp_write_to_binlog= 0;
       if (lock_global_read_lock(thd))
 	return 1;                               // Killed
-      result= close_cached_tables(thd, tables, FALSE, (options & REFRESH_FAST) ?
-                                  FALSE : TRUE);
+      if (close_cached_tables(thd, tables, FALSE, (options & REFRESH_FAST) ?
+                                  FALSE : TRUE))
+          result= 1;
+      
       if (make_global_read_lock_block_commit(thd)) // Killed
       {
         /* Don't leave things in a half-locked state */
@@ -6819,8 +6834,8 @@ bool reload_acl_and_cache(THD *thd, ulon
 #ifdef OPENSSL
    if (options & REFRESH_DES_KEY_FILE)
    {
-     if (des_key_file)
-       result=load_des_key_file(des_key_file);
+     if (des_key_file && load_des_key_file(des_key_file))
+         result= 1;
    }
 #endif
 #ifdef HAVE_REPLICATION

=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc	2008-07-25 17:21:55 +0000
+++ b/sql/sql_select.cc	2008-08-07 03:05:33 +0000
@@ -8687,6 +8687,12 @@ void JOIN::cleanup(bool full)
     if (tmp_join)
       tmp_table_param.copy_field= 0;
     group_fields.delete_elements();
+    /* 
+      Ensure that the above delete_elements() would not be called
+      twice for the same list.
+    */
+    if (tmp_join && tmp_join != this)
+      tmp_join->group_fields= group_fields;
     /*
       We can't call delete_elements() on copy_funcs as this will cause
       problems in free_elements() as some of the elements are then deleted.

=== modified file 'sql/sql_string.h'
--- a/sql/sql_string.h	2008-04-21 07:30:39 +0000
+++ b/sql/sql_string.h	2008-08-01 15:38:05 +0000
@@ -75,7 +75,7 @@ public:
     Alloced_length=str.Alloced_length; alloced=0; 
     str_charset=str.str_charset;
   }
-  static void *operator new(size_t size, MEM_ROOT *mem_root)
+  static void *operator new(size_t size, MEM_ROOT *mem_root) throw ()
   { return (void*) alloc_root(mem_root, (uint) size); }
   static void operator delete(void *ptr_arg,size_t size)
   { TRASH(ptr_arg, size); }

=== modified file 'sql/sql_yacc.yy'
--- a/sql/sql_yacc.yy	2008-07-25 17:21:55 +0000
+++ b/sql/sql_yacc.yy	2008-08-07 18:37:55 +0000
@@ -2024,7 +2024,10 @@ opt_ev_status:
 ev_starts:
           /* empty */
           {
-            Lex->event_parse_data->item_starts= new Item_func_now_local();
+            Item *item= new (YYTHD->mem_root) Item_func_now_local();
+            if (item == NULL)
+              MYSQL_YYABORT;
+            Lex->event_parse_data->item_starts= item;
           }
         | STARTS_SYM expr
           {
@@ -2171,6 +2174,8 @@ sp_name:
               MYSQL_YYABORT;
             }
             $$= new sp_name($1, $3, true);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
             $$->init_qname(YYTHD);
           }
         | ident
@@ -2185,8 +2190,9 @@ sp_name:
             if (lex->copy_db_to(&db.str, &db.length))
               MYSQL_YYABORT;
             $$= new sp_name(db, $1, false);
-            if ($$)
-              $$->init_qname(thd);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+            $$->init_qname(thd);
           }
         ;
 
@@ -2423,6 +2429,7 @@ sp_decl:
           type
           sp_opt_default
           {
+            THD *thd= YYTHD;
             LEX *lex= Lex;
             sp_pcontext *pctx= lex->spcont;
             uint num_vars= pctx->context_var_count();
@@ -2431,7 +2438,9 @@ sp_decl:
             
             if (!dflt_value_item)
             {
-              dflt_value_item= new Item_null();
+              dflt_value_item= new (thd->mem_root) Item_null();
+              if (dflt_value_item == NULL)
+                MYSQL_YYABORT;
               /* QQ Set to the var_type with null_value? */
             }
             
@@ -2457,10 +2466,17 @@ sp_decl:
             
               /* The last instruction is responsible for freeing LEX. */
 
-              lex->sphead->add_instr(
-                new sp_instr_set(lex->sphead->instructions(), pctx, var_idx,
-                                 dflt_value_item, var_type, lex,
-                                 (i == num_vars - 1)));
+              sp_instr_set *is= new sp_instr_set(lex->sphead->instructions(),
+                                                 pctx,
+                                                 var_idx,
+                                                 dflt_value_item,
+                                                 var_type,
+                                                 lex,
+                                                 (i == num_vars - 1));
+              if (is == NULL)
+                MYSQL_YYABORT;
+
+              lex->sphead->add_instr(is);
             }
 
             pctx->declare_var_boundary(0);
@@ -2612,6 +2628,8 @@ sp_cond:
           ulong_num
           { /* mysql errno */
             $$= (sp_cond_type_t *)YYTHD->alloc(sizeof(sp_cond_type_t));
+            if ($$ == NULL)
+              MYSQL_YYABORT;
             $$->type= sp_cond_type_t::number;
             $$->mysqlerr= $1;
           }
@@ -2623,6 +2641,8 @@ sp_cond:
               MYSQL_YYABORT;
             }
             $$= (sp_cond_type_t *)YYTHD->alloc(sizeof(sp_cond_type_t));
+            if ($$ == NULL)
+              MYSQL_YYABORT;
             $$->type= sp_cond_type_t::state;
             memcpy($$->sqlstate, $3.str, 5);
             $$->sqlstate[5]= '\0';
@@ -2651,16 +2671,22 @@ sp_hcond:
         | SQLWARNING_SYM /* SQLSTATEs 01??? */
           {
             $$= (sp_cond_type_t *)YYTHD->alloc(sizeof(sp_cond_type_t));
+            if ($$ == NULL)
+              MYSQL_YYABORT;
             $$->type= sp_cond_type_t::warning;
           }
         | not FOUND_SYM /* SQLSTATEs 02??? */
           {
             $$= (sp_cond_type_t *)YYTHD->alloc(sizeof(sp_cond_type_t));
+            if ($$ == NULL)
+              MYSQL_YYABORT;
             $$->type= sp_cond_type_t::notfound;
           }
         | SQLEXCEPTION_SYM /* All other SQLSTATEs */
           {
             $$= (sp_cond_type_t *)YYTHD->alloc(sizeof(sp_cond_type_t));
+            if ($$ == NULL)
+              MYSQL_YYABORT;
             $$->type= sp_cond_type_t::exception;
           }
         ;
@@ -5133,7 +5159,12 @@ attribute:
             Lex->alter_info.flags|= ALTER_COLUMN_DEFAULT;
           }
         | ON UPDATE_SYM NOW_SYM optional_braces 
-          { Lex->on_update_value= new Item_func_now_local(); }
+          {
+            Item *item= new (YYTHD->mem_root) Item_func_now_local();
+            if (item == NULL)
+              MYSQL_YYABORT;
+            Lex->on_update_value= item;
+          }
         | AUTO_INC { Lex->type|= AUTO_INCREMENT_FLAG | NOT_NULL_FLAG; }
         | SERIAL_SYM DEFAULT VALUE_SYM
           { 
@@ -5177,7 +5208,11 @@ attribute:
 
 now_or_signed_literal:
           NOW_SYM optional_braces
-          { $$= new Item_func_now_local(); }
+          {
+            $$= new (YYTHD->mem_root) Item_func_now_local();
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | signed_literal
           { $$=$1; }
         ;
@@ -5559,7 +5594,12 @@ key_list:
         ;
 
 key_part:
-          ident { $$=new Key_part_spec($1, 0); }
+          ident
+          {
+            $$= new Key_part_spec($1, 0);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | ident '(' NUM ')'
           {
             int key_part_len= atoi($3.str);
@@ -5567,7 +5607,9 @@ key_part:
             {
               my_error(ER_KEY_PART_0, MYF(0), $1.str);
             }
-            $$=new Key_part_spec($1, (uint) key_part_len);
+            $$= new Key_part_spec($1, (uint) key_part_len);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
           }
         ;
 
@@ -5946,7 +5988,7 @@ reorg_partition_rule:
             lex->part_info= new partition_info();
             if (!lex->part_info)
             {
-            mem_alloc_error(sizeof(partition_info));
+              mem_alloc_error(sizeof(partition_info));
               MYSQL_YYABORT;
             }
             lex->no_write_to_binlog= $3;
@@ -6049,8 +6091,10 @@ alter_list_item:
         | DROP opt_column field_ident opt_restrict
           {
             LEX *lex=Lex;
-            lex->alter_info.drop_list.push_back(new Alter_drop(Alter_drop::COLUMN,
-                                                               $3.str));
+            Alter_drop *ad= new Alter_drop(Alter_drop::COLUMN, $3.str);
+            if (ad == NULL)
+              MYSQL_YYABORT;
+            lex->alter_info.drop_list.push_back(ad);
             lex->alter_info.flags|= ALTER_DROP_COLUMN;
           }
         | DROP FOREIGN KEY_SYM opt_ident
@@ -6060,15 +6104,19 @@ alter_list_item:
         | DROP PRIMARY_SYM KEY_SYM
           {
             LEX *lex=Lex;
-            lex->alter_info.drop_list.push_back(new Alter_drop(Alter_drop::KEY,
-                                                               primary_key_name));
+            Alter_drop *ad= new Alter_drop(Alter_drop::KEY, primary_key_name);
+            if (ad == NULL)
+              MYSQL_YYABORT;
+            lex->alter_info.drop_list.push_back(ad);
             lex->alter_info.flags|= ALTER_DROP_INDEX;
           }
         | DROP key_or_index field_ident
           {
             LEX *lex=Lex;
-            lex->alter_info.drop_list.push_back(new Alter_drop(Alter_drop::KEY,
-                                                               $3.str));
+            Alter_drop *ad= new Alter_drop(Alter_drop::KEY, $3.str);
+            if (ad == NULL)
+              MYSQL_YYABORT;
+            lex->alter_info.drop_list.push_back(ad);
             lex->alter_info.flags|= ALTER_DROP_INDEX;
           }
         | DISABLE_SYM KEYS
@@ -6086,14 +6134,19 @@ alter_list_item:
         | ALTER opt_column field_ident SET DEFAULT signed_literal
           {
             LEX *lex=Lex;
-            lex->alter_info.alter_list.push_back(new Alter_column($3.str,$6));
+            Alter_column *ac= new Alter_column($3.str,$6);
+            if (ac == NULL)
+              MYSQL_YYABORT;
+            lex->alter_info.alter_list.push_back(ac);
             lex->alter_info.flags|= ALTER_COLUMN_DEFAULT;
           }
         | ALTER opt_column field_ident DROP DEFAULT
           {
             LEX *lex=Lex;
-            lex->alter_info.alter_list.push_back(new Alter_column($3.str,
-                                                                  (Item*) 0));
+            Alter_column *ac= new Alter_column($3.str, (Item*) 0);
+            if (ac == NULL)
+              MYSQL_YYABORT;
+            lex->alter_info.alter_list.push_back(ac);
             lex->alter_info.flags|= ALTER_COLUMN_DEFAULT;
           }
         | RENAME opt_to table_ident
@@ -6361,15 +6414,19 @@ database_ident_list:
           ident
           {
             LEX *lex= Lex;
+            LEX_STRING* ls= (LEX_STRING*) sql_memdup(&$1, sizeof(LEX_STRING));
+            if (ls == NULL)
+              MYSQL_YYABORT;
             lex->db_list.empty();
-            if (lex->db_list.push_back((LEX_STRING*)
-                sql_memdup(&$1, sizeof(LEX_STRING))))
+            if (lex->db_list.push_back(ls))
               YYABORT;
           }
         | database_ident_list ',' ident
           {
-            if (Lex->db_list.push_back((LEX_STRING*)
-                sql_memdup(&$3, sizeof(LEX_STRING))))
+            LEX_STRING *ls= (LEX_STRING*) sql_memdup(&$3, sizeof(LEX_STRING));
+            if (ls == NULL)
+              MYSQL_YYABORT;
+            if (Lex->db_list.push_back(ls))
               YYABORT;
           }
         ;
@@ -6806,10 +6863,12 @@ select_item_list:
         | '*'
           {
             THD *thd= YYTHD;
-            if (add_item_to_list(thd,
-                                 new Item_field(&thd->lex->current_select->
-                                                context,
-                                                NULL, NULL, "*")))
+            Item *item= new (thd->mem_root)
+                          Item_field(&thd->lex->current_select->context,
+                                     NULL, NULL, "*");
+            if (item == NULL)
+              MYSQL_YYABORT;
+            if (add_item_to_list(thd, item))
               MYSQL_YYABORT;
             (thd->lex->current_select->with_wild)++;
           }
@@ -6922,6 +6981,8 @@ expr:
             {
               /* X OR Y */
               $$ = new (YYTHD->mem_root) Item_cond_or($1, $3);
+              if ($$ == NULL)
+                MYSQL_YYABORT;
             }
           }
         | expr XOR expr %prec XOR
@@ -6968,36 +7029,86 @@ expr:
             {
               /* X AND Y */
               $$ = new (YYTHD->mem_root) Item_cond_and($1, $3);
+              if ($$ == NULL)
+                MYSQL_YYABORT;
             }
           }
         | NOT_SYM expr %prec NOT_SYM
-          { $$= negate_expression(YYTHD, $2); }
+          {
+            $$= negate_expression(YYTHD, $2);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | bool_pri IS TRUE_SYM %prec IS
-          { $$= new (YYTHD->mem_root) Item_func_istrue($1); }
+          {
+            $$= new (YYTHD->mem_root) Item_func_istrue($1);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | bool_pri IS not TRUE_SYM %prec IS
-          { $$= new (YYTHD->mem_root) Item_func_isnottrue($1); }
+          {
+            $$= new (YYTHD->mem_root) Item_func_isnottrue($1);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | bool_pri IS FALSE_SYM %prec IS
-          { $$= new (YYTHD->mem_root) Item_func_isfalse($1); }
+          {
+            $$= new (YYTHD->mem_root) Item_func_isfalse($1);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | bool_pri IS not FALSE_SYM %prec IS
-          { $$= new (YYTHD->mem_root) Item_func_isnotfalse($1); }
+          {
+            $$= new (YYTHD->mem_root) Item_func_isnotfalse($1);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | bool_pri IS UNKNOWN_SYM %prec IS
-          { $$= new Item_func_isnull($1); }
+          {
+            $$= new (YYTHD->mem_root) Item_func_isnull($1);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | bool_pri IS not UNKNOWN_SYM %prec IS
-          { $$= new Item_func_isnotnull($1); }
+          {
+            $$= new (YYTHD->mem_root) Item_func_isnotnull($1);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | bool_pri
         ;
 
 bool_pri:
           bool_pri IS NULL_SYM %prec IS
-          { $$= new Item_func_isnull($1); }
+          {
+            $$= new (YYTHD->mem_root) Item_func_isnull($1);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | bool_pri IS not NULL_SYM %prec IS
-          { $$= new Item_func_isnotnull($1); }
+          {
+            $$= new (YYTHD->mem_root) Item_func_isnotnull($1);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | bool_pri EQUAL_SYM predicate %prec EQUAL_SYM
-          { $$= new Item_func_equal($1,$3); }
+          {
+            $$= new (YYTHD->mem_root) Item_func_equal($1,$3);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | bool_pri comp_op predicate %prec EQ
-          { $$= (*$2)(0)->create($1,$3); }
+          {
+            $$= (*$2)(0)->create($1,$3);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | bool_pri comp_op all_or_any '(' subselect ')' %prec EQ
-          { $$= all_any_subquery_creator($1, $2, $3, $5); }
+          {
+            $$= all_any_subquery_creator($1, $2, $3, $5);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | predicate
         ;
 
@@ -7005,87 +7116,193 @@ predicate:
           bit_expr IN_SYM '(' subselect ')'
           {
             $$= new (YYTHD->mem_root) Item_in_subselect($1, $4);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
           }
         | bit_expr not IN_SYM '(' subselect ')'
           {
             THD *thd= YYTHD;
             Item *item= new (thd->mem_root) Item_in_subselect($1, $5);
+            if (item == NULL)
+              MYSQL_YYABORT;
             $$= negate_expression(thd, item);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
           }
         | bit_expr IN_SYM '(' expr ')'
           {
             $$= handle_sql2003_note184_exception(YYTHD, $1, true, $4);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
           }
         | bit_expr IN_SYM '(' expr ',' expr_list ')'
           { 
             $6->push_front($4);
             $6->push_front($1);
             $$= new (YYTHD->mem_root) Item_func_in(*$6);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
           }
         | bit_expr not IN_SYM '(' expr ')'
           {
             $$= handle_sql2003_note184_exception(YYTHD, $1, false, $5);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
           }
         | bit_expr not IN_SYM '(' expr ',' expr_list ')'
           {
             $7->push_front($5);
             $7->push_front($1);
             Item_func_in *item = new (YYTHD->mem_root) Item_func_in(*$7);
+            if (item == NULL)
+              MYSQL_YYABORT;
             item->negate();
             $$= item;
           }
         | bit_expr BETWEEN_SYM bit_expr AND_SYM predicate
-          { $$= new Item_func_between($1,$3,$5); }
+          {
+            $$= new (YYTHD->mem_root) Item_func_between($1,$3,$5);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | bit_expr not BETWEEN_SYM bit_expr AND_SYM predicate
           {
-            Item_func_between *item= new Item_func_between($1,$4,$6);
+            Item_func_between *item;
+            item= new (YYTHD->mem_root) Item_func_between($1,$4,$6);
+            if (item == NULL)
+              MYSQL_YYABORT;
             item->negate();
             $$= item;
           }
         | bit_expr SOUNDS_SYM LIKE bit_expr
           {
-            $$= new Item_func_eq(new Item_func_soundex($1),
-                                 new Item_func_soundex($4));
+            Item *item1= new (YYTHD->mem_root) Item_func_soundex($1);
+            Item *item4= new (YYTHD->mem_root) Item_func_soundex($4);
+            if ((item1 == NULL) || (item4 == NULL))
+              MYSQL_YYABORT;
+            $$= new (YYTHD->mem_root) Item_func_eq(item1, item4);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
           }
         | bit_expr LIKE simple_expr opt_escape
-          { $$= new Item_func_like($1,$3,$4,Lex->escape_used); }
+          {
+            $$= new (YYTHD->mem_root) Item_func_like($1,$3,$4,Lex->escape_used);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | bit_expr not LIKE simple_expr opt_escape
-          { $$= new Item_func_not(new Item_func_like($1,$4,$5, Lex->escape_used)); }
-        | bit_expr REGEXP bit_expr { $$= new Item_func_regex($1,$3); }
+          {
+            Item *item= new (YYTHD->mem_root) Item_func_like($1,$4,$5,
+                                                             Lex->escape_used);
+            if (item == NULL)
+              MYSQL_YYABORT;
+            $$= new (YYTHD->mem_root) Item_func_not(item);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
+        | bit_expr REGEXP bit_expr
+          {
+            $$= new (YYTHD->mem_root) Item_func_regex($1,$3);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | bit_expr not REGEXP bit_expr
-          { $$= negate_expression(YYTHD, new Item_func_regex($1,$4)); }
+          {
+            Item *item= new (YYTHD->mem_root) Item_func_regex($1,$4);
+            if (item == NULL)
+              MYSQL_YYABORT;
+            $$= negate_expression(YYTHD, item);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | bit_expr
         ;
 
 bit_expr:
           bit_expr '|' bit_expr %prec '|'
-          { $$= new Item_func_bit_or($1,$3); }
+          {
+            $$= new (YYTHD->mem_root) Item_func_bit_or($1,$3);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | bit_expr '&' bit_expr %prec '&'
-          { $$= new Item_func_bit_and($1,$3); }
+          {
+            $$= new (YYTHD->mem_root) Item_func_bit_and($1,$3);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | bit_expr SHIFT_LEFT bit_expr %prec SHIFT_LEFT
-          { $$= new Item_func_shift_left($1,$3); }
+          {
+            $$= new (YYTHD->mem_root) Item_func_shift_left($1,$3);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | bit_expr SHIFT_RIGHT bit_expr %prec SHIFT_RIGHT
-          { $$= new Item_func_shift_right($1,$3); }
+          {
+            $$= new (YYTHD->mem_root) Item_func_shift_right($1,$3);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | bit_expr '+' bit_expr %prec '+'
-          { $$= new Item_func_plus($1,$3); }
+          {
+            $$= new (YYTHD->mem_root) Item_func_plus($1,$3);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | bit_expr '-' bit_expr %prec '-'
-          { $$= new Item_func_minus($1,$3); }
+          {
+            $$= new (YYTHD->mem_root) Item_func_minus($1,$3);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | bit_expr '+' INTERVAL_SYM expr interval %prec '+'
-          { $$= new Item_date_add_interval($1,$4,$5,0); }
+          {
+            $$= new (YYTHD->mem_root) Item_date_add_interval($1,$4,$5,0);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | bit_expr '-' INTERVAL_SYM expr interval %prec '-'
-          { $$= new Item_date_add_interval($1,$4,$5,1); }
+          {
+            $$= new (YYTHD->mem_root) Item_date_add_interval($1,$4,$5,1);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | bit_expr '*' bit_expr %prec '*'
-          { $$= new Item_func_mul($1,$3); }
+          {
+            $$= new (YYTHD->mem_root) Item_func_mul($1,$3);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | bit_expr '/' bit_expr %prec '/'
-          { $$= new Item_func_div($1,$3); }
+          {
+            $$= new (YYTHD->mem_root) Item_func_div($1,$3);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | bit_expr '%' bit_expr %prec '%'
-          { $$= new Item_func_mod($1,$3); }
+          {
+            $$= new (YYTHD->mem_root) Item_func_mod($1,$3);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | bit_expr DIV_SYM bit_expr %prec DIV_SYM
-          { $$= new Item_func_int_div($1,$3); }
+          {
+            $$= new (YYTHD->mem_root) Item_func_int_div($1,$3);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | bit_expr MOD_SYM bit_expr %prec MOD_SYM
-          { $$= new Item_func_mod($1,$3); }
+          {
+            $$= new (YYTHD->mem_root) Item_func_mod($1,$3);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | bit_expr '^' bit_expr
-          { $$= new Item_func_bit_xor($1,$3); }
+          {
+            $$= new (YYTHD->mem_root) Item_func_bit_xor($1,$3);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | simple_expr
         ;
 
@@ -7135,45 +7352,80 @@ simple_expr:
             Item *i1= new (thd->mem_root) Item_string($3.str,
                                                       $3.length,
                                                       thd->charset());
+            if (i1 == NULL)
+              MYSQL_YYABORT;
             $$= new (thd->mem_root) Item_func_set_collation($1, i1);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
           }
         | literal
         | param_marker
         | variable
         | sum_expr
         | simple_expr OR_OR_SYM simple_expr
-          { $$= new (YYTHD->mem_root) Item_func_concat($1, $3); }
-        | '+' simple_expr %prec NEG { $$= $2; }
+          {
+            $$= new (YYTHD->mem_root) Item_func_concat($1, $3);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
+        | '+' simple_expr %prec NEG
+          {
+            $$= $2;
+          }
         | '-' simple_expr %prec NEG
-          { $$= new (YYTHD->mem_root) Item_func_neg($2); }
+          {
+            $$= new (YYTHD->mem_root) Item_func_neg($2);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | '~' simple_expr %prec NEG
-          { $$= new (YYTHD->mem_root) Item_func_bit_neg($2); }
+          {
+            $$= new (YYTHD->mem_root) Item_func_bit_neg($2);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | not2 simple_expr %prec NEG
-          { $$= negate_expression(YYTHD, $2); }
+          {
+            $$= negate_expression(YYTHD, $2);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | '(' subselect ')'
           { 
             $$= new (YYTHD->mem_root) Item_singlerow_subselect($2);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
           }
-        | '(' expr ')' { $$= $2; }
+        | '(' expr ')'
+          { $$= $2; }
         | '(' expr ',' expr_list ')'
           {
             $4->push_front($2);
             $$= new (YYTHD->mem_root) Item_row(*$4);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
           }
         | ROW_SYM '(' expr ',' expr_list ')'
           {
             $5->push_front($3);
             $$= new (YYTHD->mem_root) Item_row(*$5);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
           }
         | EXISTS '(' subselect ')'
           {
             $$= new (YYTHD->mem_root) Item_exists_subselect($3);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
           }
-        | '{' ident expr '}' { $$= $3; }
+        | '{' ident expr '}'
+          { $$= $3; }
         | MATCH ident_list_arg AGAINST '(' bit_expr fulltext_options ')'
           {
             $2->push_front($5);
             Item_func_match *i1= new (YYTHD->mem_root) Item_func_match(*$2, $6);
+            if (i1 == NULL)
+              MYSQL_YYABORT;
             Select->add_ftfunc_to_list(i1);
             $$= i1;
           }
@@ -7181,26 +7433,36 @@ simple_expr:
           {
             $$= create_func_cast(YYTHD, $2, ITEM_CAST_CHAR, NULL, NULL,
                                  &my_charset_bin);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
           }
         | CAST_SYM '(' expr AS cast_type ')'
           {
             LEX *lex= Lex;
             $$= create_func_cast(YYTHD, $3, $5, lex->length, lex->dec,
                                  lex->charset);
-            if (!$$)
+            if ($$ == NULL)
               MYSQL_YYABORT;
           }
         | CASE_SYM opt_expr when_list opt_else END
-          { $$= new (YYTHD->mem_root) Item_func_case(* $3, $2, $4 ); }
+          {
+            $$= new (YYTHD->mem_root) Item_func_case(* $3, $2, $4 );
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | CONVERT_SYM '(' expr ',' cast_type ')'
           {
             $$= create_func_cast(YYTHD, $3, $5, Lex->length, Lex->dec,
                                  Lex->charset);
-            if (!$$)
+            if ($$ == NULL)
               MYSQL_YYABORT;
           }
         | CONVERT_SYM '(' expr USING charset_name ')'
-          { $$= new (YYTHD->mem_root) Item_func_conv_charset($3,$5); }
+          {
+            $$= new (YYTHD->mem_root) Item_func_conv_charset($3,$5);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | DEFAULT '(' simple_ident ')'
           {
             if ($3->is_splocal())
@@ -7212,15 +7474,23 @@ simple_expr:
             }
             $$= new (YYTHD->mem_root) Item_default_value(Lex->current_context(),
                                                          $3);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
           }
         | VALUES '(' simple_ident_nospvar ')'
           {
             $$= new (YYTHD->mem_root) Item_insert_value(Lex->current_context(),
                                                         $3);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
           }
         | INTERVAL_SYM expr interval '+' expr %prec INTERVAL_SYM
           /* we cannot put interval before - */
-          { $$= new (YYTHD->mem_root) Item_date_add_interval($5,$2,$3,0); }
+          {
+            $$= new (YYTHD->mem_root) Item_date_add_interval($5,$2,$3,0);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         ;
 
 /*
@@ -7231,31 +7501,63 @@ simple_expr:
 */
 function_call_keyword:
           CHAR_SYM '(' expr_list ')'
-          { $$= new (YYTHD->mem_root) Item_func_char(*$3); }
+          {
+            $$= new (YYTHD->mem_root) Item_func_char(*$3);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | CHAR_SYM '(' expr_list USING charset_name ')'
-          { $$= new (YYTHD->mem_root) Item_func_char(*$3, $5); }
+          {
+            $$= new (YYTHD->mem_root) Item_func_char(*$3, $5);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | CURRENT_USER optional_braces
           {
             $$= new (YYTHD->mem_root) Item_func_current_user(Lex->current_context());
+            if ($$ == NULL)
+              MYSQL_YYABORT;
             Lex->set_stmt_unsafe();
             Lex->safe_to_cache_query= 0;
           }
         | DATE_SYM '(' expr ')'
-          { $$= new (YYTHD->mem_root) Item_date_typecast($3); }
+          {
+            $$= new (YYTHD->mem_root) Item_date_typecast($3);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | DAY_SYM '(' expr ')'
-          { $$= new (YYTHD->mem_root) Item_func_dayofmonth($3); }
-        | HOUR_SYM '(' expr ')'
-          { $$= new (YYTHD->mem_root) Item_func_hour($3); }
-        | INSERT '(' expr ',' expr ',' expr ',' expr ')'
-          { $$= new (YYTHD->mem_root) Item_func_insert($3,$5,$7,$9); }
-        | INTERVAL_SYM '(' expr ',' expr ')' %prec INTERVAL_SYM
           {
-            THD *thd= YYTHD;
+            $$= new (YYTHD->mem_root) Item_func_dayofmonth($3);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
+        | HOUR_SYM '(' expr ')'
+          {
+            $$= new (YYTHD->mem_root) Item_func_hour($3);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
+        | INSERT '(' expr ',' expr ',' expr ',' expr ')'
+          {
+            $$= new (YYTHD->mem_root) Item_func_insert($3,$5,$7,$9);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
+        | INTERVAL_SYM '(' expr ',' expr ')' %prec INTERVAL_SYM
+          {
+            THD *thd= YYTHD;
             List<Item> *list= new (thd->mem_root) List<Item>;
+            if (list == NULL)
+              MYSQL_YYABORT;
             list->push_front($5);
             list->push_front($3);
             Item_row *item= new (thd->mem_root) Item_row(*list);
+            if (item == NULL)
+              MYSQL_YYABORT;
             $$= new (thd->mem_root) Item_func_interval(item);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
           }
         | INTERVAL_SYM '(' expr ',' expr ',' expr_list ')' %prec INTERVAL_SYM
           {
@@ -7263,48 +7565,120 @@ function_call_keyword:
             $7->push_front($5);
             $7->push_front($3);
             Item_row *item= new (thd->mem_root) Item_row(*$7);
+            if (item == NULL)
+              MYSQL_YYABORT;
             $$= new (thd->mem_root) Item_func_interval(item);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
           }
         | LEFT '(' expr ',' expr ')'
-          { $$= new (YYTHD->mem_root) Item_func_left($3,$5); }
+          {
+            $$= new (YYTHD->mem_root) Item_func_left($3,$5);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | MINUTE_SYM '(' expr ')'
-          { $$= new (YYTHD->mem_root) Item_func_minute($3); }
+          {
+            $$= new (YYTHD->mem_root) Item_func_minute($3);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | MONTH_SYM '(' expr ')'
-          { $$= new (YYTHD->mem_root) Item_func_month($3); }
+          {
+            $$= new (YYTHD->mem_root) Item_func_month($3);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | RIGHT '(' expr ',' expr ')'
-          { $$= new (YYTHD->mem_root) Item_func_right($3,$5); }
+          {
+            $$= new (YYTHD->mem_root) Item_func_right($3,$5);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | SECOND_SYM '(' expr ')'
-          { $$= new (YYTHD->mem_root) Item_func_second($3); }
+          {
+            $$= new (YYTHD->mem_root) Item_func_second($3);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | TIME_SYM '(' expr ')'
-          { $$= new (YYTHD->mem_root) Item_time_typecast($3); }
+          {
+            $$= new (YYTHD->mem_root) Item_time_typecast($3);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | TIMESTAMP '(' expr ')'
-          { $$= new (YYTHD->mem_root) Item_datetime_typecast($3); }
+          {
+            $$= new (YYTHD->mem_root) Item_datetime_typecast($3);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | TIMESTAMP '(' expr ',' expr ')'
-          { $$= new (YYTHD->mem_root) Item_func_add_time($3, $5, 1, 0); }
+          {
+            $$= new (YYTHD->mem_root) Item_func_add_time($3, $5, 1, 0);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | TRIM '(' expr ')'
-          { $$= new (YYTHD->mem_root) Item_func_trim($3); }
+          {
+            $$= new (YYTHD->mem_root) Item_func_trim($3);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | TRIM '(' LEADING expr FROM expr ')'
-          { $$= new (YYTHD->mem_root) Item_func_ltrim($6,$4); }
+          {
+            $$= new (YYTHD->mem_root) Item_func_ltrim($6,$4);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | TRIM '(' TRAILING expr FROM expr ')'
-          { $$= new (YYTHD->mem_root) Item_func_rtrim($6,$4); }
+          {
+            $$= new (YYTHD->mem_root) Item_func_rtrim($6,$4);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | TRIM '(' BOTH expr FROM expr ')'
-          { $$= new (YYTHD->mem_root) Item_func_trim($6,$4); }
+          {
+            $$= new (YYTHD->mem_root) Item_func_trim($6,$4);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | TRIM '(' LEADING FROM expr ')'
-          { $$= new (YYTHD->mem_root) Item_func_ltrim($5); }
+          {
+            $$= new (YYTHD->mem_root) Item_func_ltrim($5);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | TRIM '(' TRAILING FROM expr ')'
-          { $$= new (YYTHD->mem_root) Item_func_rtrim($5); }
+          {
+            $$= new (YYTHD->mem_root) Item_func_rtrim($5);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | TRIM '(' BOTH FROM expr ')'
-          { $$= new (YYTHD->mem_root) Item_func_trim($5); }
+          {
+            $$= new (YYTHD->mem_root) Item_func_trim($5);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | TRIM '(' expr FROM expr ')'
-          { $$= new (YYTHD->mem_root) Item_func_trim($5,$3); }
+          {
+            $$= new (YYTHD->mem_root) Item_func_trim($5,$3);
+          }
         | USER '(' ')'
           {
             $$= new (YYTHD->mem_root) Item_func_user();
+            if ($$ == NULL)
+              MYSQL_YYABORT;
             Lex->set_stmt_unsafe();
             Lex->safe_to_cache_query=0;
           }
         | YEAR_SYM '(' expr ')'
-          { $$= new (YYTHD->mem_root) Item_func_year($3); }
+          {
+            $$= new (YYTHD->mem_root) Item_func_year($3);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         ;
 
 /*
@@ -7324,65 +7698,127 @@ function_call_nonkeyword:
           {
             $$= new (YYTHD->mem_root) Item_date_add_interval($3, $5,
                                                              INTERVAL_DAY, 0);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
           }
         | ADDDATE_SYM '(' expr ',' INTERVAL_SYM expr interval ')'
-          { $$= new (YYTHD->mem_root) Item_date_add_interval($3, $6, $7, 0); }
+          {
+            $$= new (YYTHD->mem_root) Item_date_add_interval($3, $6, $7, 0);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | CURDATE optional_braces
           {
             $$= new (YYTHD->mem_root) Item_func_curdate_local();
+            if ($$ == NULL)
+              MYSQL_YYABORT;
             Lex->safe_to_cache_query=0;
           }
         | CURTIME optional_braces
           {
             $$= new (YYTHD->mem_root) Item_func_curtime_local();
+            if ($$ == NULL)
+              MYSQL_YYABORT;
             Lex->safe_to_cache_query=0;
           }
         | CURTIME '(' expr ')'
           {
             $$= new (YYTHD->mem_root) Item_func_curtime_local($3);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
             Lex->safe_to_cache_query=0;
           }
-        | DATE_ADD_INTERVAL '(' expr ',' INTERVAL_SYM expr interval ')' %prec INTERVAL_SYM
-          { $$= new (YYTHD->mem_root) Item_date_add_interval($3,$6,$7,0); }
-        | DATE_SUB_INTERVAL '(' expr ',' INTERVAL_SYM expr interval ')' %prec INTERVAL_SYM
-          { $$= new (YYTHD->mem_root) Item_date_add_interval($3,$6,$7,1); }
+        | DATE_ADD_INTERVAL '(' expr ',' INTERVAL_SYM expr interval ')'
+          %prec INTERVAL_SYM
+          {
+            $$= new (YYTHD->mem_root) Item_date_add_interval($3,$6,$7,0);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
+        | DATE_SUB_INTERVAL '(' expr ',' INTERVAL_SYM expr interval ')'
+          %prec INTERVAL_SYM
+          {
+            $$= new (YYTHD->mem_root) Item_date_add_interval($3,$6,$7,1);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | EXTRACT_SYM '(' interval FROM expr ')'
-          { $$=new (YYTHD->mem_root) Item_extract( $3, $5); }
+          {
+            $$=new (YYTHD->mem_root) Item_extract( $3, $5);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | GET_FORMAT '(' date_time_type  ',' expr ')'
-          { $$= new (YYTHD->mem_root) Item_func_get_format($3, $5); }
+          {
+            $$= new (YYTHD->mem_root) Item_func_get_format($3, $5);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | NOW_SYM optional_braces
           {
             $$= new (YYTHD->mem_root) Item_func_now_local();
+            if ($$ == NULL)
+              MYSQL_YYABORT;
             Lex->safe_to_cache_query=0;
           }
         | NOW_SYM '(' expr ')'
           {
             $$= new (YYTHD->mem_root) Item_func_now_local($3);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
             Lex->safe_to_cache_query=0;
           }
         | POSITION_SYM '(' bit_expr IN_SYM expr ')'
-          { $$ = new (YYTHD->mem_root) Item_func_locate($5,$3); }
+          {
+            $$ = new (YYTHD->mem_root) Item_func_locate($5,$3);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | SUBDATE_SYM '(' expr ',' expr ')'
           {
             $$= new (YYTHD->mem_root) Item_date_add_interval($3, $5,
                                                              INTERVAL_DAY, 1);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
           }
         | SUBDATE_SYM '(' expr ',' INTERVAL_SYM expr interval ')'
-          { $$= new (YYTHD->mem_root) Item_date_add_interval($3, $6, $7, 1); }
+          {
+            $$= new (YYTHD->mem_root) Item_date_add_interval($3, $6, $7, 1);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | SUBSTRING '(' expr ',' expr ',' expr ')'
-          { $$= new (YYTHD->mem_root) Item_func_substr($3,$5,$7); }
+          {
+            $$= new (YYTHD->mem_root) Item_func_substr($3,$5,$7);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | SUBSTRING '(' expr ',' expr ')'
-          { $$= new (YYTHD->mem_root) Item_func_substr($3,$5); }
+          {
+            $$= new (YYTHD->mem_root) Item_func_substr($3,$5);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | SUBSTRING '(' expr FROM expr FOR_SYM expr ')'
-          { $$= new (YYTHD->mem_root) Item_func_substr($3,$5,$7); }
+          {
+            $$= new (YYTHD->mem_root) Item_func_substr($3,$5,$7);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | SUBSTRING '(' expr FROM expr ')'
-          { $$= new (YYTHD->mem_root) Item_func_substr($3,$5); }
+          {
+            $$= new (YYTHD->mem_root) Item_func_substr($3,$5);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | SYSDATE optional_braces
           {
             if (global_system_variables.sysdate_is_now == 0)
               $$= new (YYTHD->mem_root) Item_func_sysdate_local();
             else
               $$= new (YYTHD->mem_root) Item_func_now_local();
+            if ($$ == NULL)
+              MYSQL_YYABORT;
             Lex->safe_to_cache_query=0;
           }
         | SYSDATE '(' expr ')'
@@ -7391,25 +7827,41 @@ function_call_nonkeyword:
               $$= new (YYTHD->mem_root) Item_func_sysdate_local($3);
             else
               $$= new (YYTHD->mem_root) Item_func_now_local($3);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
             Lex->safe_to_cache_query=0;
           }
         | TIMESTAMP_ADD '(' interval_time_stamp ',' expr ',' expr ')'
-          { $$= new (YYTHD->mem_root) Item_date_add_interval($7,$5,$3,0); }
+          {
+            $$= new (YYTHD->mem_root) Item_date_add_interval($7,$5,$3,0);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | TIMESTAMP_DIFF '(' interval_time_stamp ',' expr ',' expr ')'
-          { $$= new (YYTHD->mem_root) Item_func_timestamp_diff($5,$7,$3); }
+          {
+            $$= new (YYTHD->mem_root) Item_func_timestamp_diff($5,$7,$3);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | UTC_DATE_SYM optional_braces
           {
             $$= new (YYTHD->mem_root) Item_func_curdate_utc();
+            if ($$ == NULL)
+              MYSQL_YYABORT;
             Lex->safe_to_cache_query=0;
           }
         | UTC_TIME_SYM optional_braces
           {
             $$= new (YYTHD->mem_root) Item_func_curtime_utc();
+            if ($$ == NULL)
+              MYSQL_YYABORT;
             Lex->safe_to_cache_query=0;
           }
         | UTC_TIMESTAMP_SYM optional_braces
           {
             $$= new (YYTHD->mem_root) Item_func_now_utc();
+            if ($$ == NULL)
+              MYSQL_YYABORT;
             Lex->safe_to_cache_query=0;
           }
         ;
@@ -7421,26 +7873,60 @@ function_call_nonkeyword:
 */
 function_call_conflict:
           ASCII_SYM '(' expr ')'
-          { $$= new (YYTHD->mem_root) Item_func_ascii($3); }
+          {
+            $$= new (YYTHD->mem_root) Item_func_ascii($3);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | CHARSET '(' expr ')'
-          { $$= new (YYTHD->mem_root) Item_func_charset($3); }
+          {
+            $$= new (YYTHD->mem_root) Item_func_charset($3);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | COALESCE '(' expr_list ')'
-          { $$= new (YYTHD->mem_root) Item_func_coalesce(* $3); }
+          {
+            $$= new (YYTHD->mem_root) Item_func_coalesce(* $3);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | COLLATION_SYM '(' expr ')'
-          { $$= new (YYTHD->mem_root) Item_func_collation($3); }
+          {
+            $$= new (YYTHD->mem_root) Item_func_collation($3);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | DATABASE '(' ')'
           {
             $$= new (YYTHD->mem_root) Item_func_database();
+            if ($$ == NULL)
+              MYSQL_YYABORT;
             Lex->safe_to_cache_query=0;
           }
         | IF '(' expr ',' expr ',' expr ')'
-          { $$= new (YYTHD->mem_root) Item_func_if($3,$5,$7); }
+          {
+            $$= new (YYTHD->mem_root) Item_func_if($3,$5,$7);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | MICROSECOND_SYM '(' expr ')'
-          { $$= new (YYTHD->mem_root) Item_func_microsecond($3); }
+          {
+            $$= new (YYTHD->mem_root) Item_func_microsecond($3);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | MOD_SYM '(' expr ',' expr ')'
-          { $$ = new (YYTHD->mem_root) Item_func_mod( $3, $5); }
+          {
+            $$ = new (YYTHD->mem_root) Item_func_mod($3, $5);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | OLD_PASSWORD '(' expr ')'
-          { $$=  new (YYTHD->mem_root) Item_func_old_password($3); }
+          {
+            $$=  new (YYTHD->mem_root) Item_func_old_password($3);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | PASSWORD '(' expr ')'
           {
             THD *thd= YYTHD;
@@ -7449,51 +7935,95 @@ function_call_conflict:
               i1= new (thd->mem_root) Item_func_old_password($3);
             else
               i1= new (thd->mem_root) Item_func_password($3);
+            if (i1 == NULL)
+              MYSQL_YYABORT;
             $$= i1;
           }
         | QUARTER_SYM '(' expr ')'
-          { $$ = new (YYTHD->mem_root) Item_func_quarter($3); }
+          {
+            $$ = new (YYTHD->mem_root) Item_func_quarter($3);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | REPEAT_SYM '(' expr ',' expr ')'
-          { $$= new (YYTHD->mem_root) Item_func_repeat($3,$5); }
+          {
+            $$= new (YYTHD->mem_root) Item_func_repeat($3,$5);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | REPLACE '(' expr ',' expr ',' expr ')'
-          { $$= new (YYTHD->mem_root) Item_func_replace($3,$5,$7); }
+          {
+            $$= new (YYTHD->mem_root) Item_func_replace($3,$5,$7);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | REVERSE_SYM '(' expr ')'
-          { $$= new (YYTHD->mem_root) Item_func_reverse($3); }
+          {
+            $$= new (YYTHD->mem_root) Item_func_reverse($3);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | TRUNCATE_SYM '(' expr ',' expr ')'
-          { $$= new (YYTHD->mem_root) Item_func_round($3,$5,1); }
+          {
+            $$= new (YYTHD->mem_root) Item_func_round($3,$5,1);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | WEEK_SYM '(' expr ')'
           {
             THD *thd= YYTHD;
             Item *i1= new (thd->mem_root) Item_int((char*) "0",
                                            thd->variables.default_week_format,
                                                    1);
-
+            if (i1 == NULL)
+              MYSQL_YYABORT;
             $$= new (thd->mem_root) Item_func_week($3, i1);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
           }
         | WEEK_SYM '(' expr ',' expr ')'
-          { $$= new (YYTHD->mem_root) Item_func_week($3,$5); }
+          {
+            $$= new (YYTHD->mem_root) Item_func_week($3,$5);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | WEIGHT_STRING_SYM '(' expr opt_ws_levels ')'
-          { $$= new (YYTHD->mem_root) Item_func_weight_string($3, 0, 0, $4); }
+          {
+            $$= new (YYTHD->mem_root) Item_func_weight_string($3, 0, 0, $4);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | WEIGHT_STRING_SYM '(' expr AS CHAR_SYM ws_nweights opt_ws_levels ')'
           {
             $$= new (YYTHD->mem_root)
                 Item_func_weight_string($3, 0, $6,
                                         $7 | MY_STRXFRM_PAD_WITH_SPACE);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
           }
         | WEIGHT_STRING_SYM '(' expr AS BINARY ws_nweights ')'
           {
-            $3= create_func_char_cast(YYTHD, $3, $6, &my_charset_bin);
+            Item *item= create_func_char_cast(YYTHD, $3, $6, &my_charset_bin);
+            if (item == NULL)
+              MYSQL_YYABORT;
             $$= new (YYTHD->mem_root)
-                Item_func_weight_string($3, 0, $6, MY_STRXFRM_PAD_WITH_SPACE);
+                Item_func_weight_string(item, 0, $6, MY_STRXFRM_PAD_WITH_SPACE);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
           }
         | WEIGHT_STRING_SYM '(' expr ',' ulong_num ',' ulong_num ',' ulong_num ')'
           {
             $$= new (YYTHD->mem_root) Item_func_weight_string($3, $5, $7, $9);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
           }
         | geometry_function
           {
 #ifdef HAVE_SPATIAL
             $$= $1;
+            /* $1 may be NULL, GEOM_NEW not tested for out of memory */
+            if ($$ == NULL)
+              MYSQL_YYABORT;
 #else
             my_error(ER_FEATURE_DISABLED, MYF(0),
                      sym_group_geom.name, sym_group_geom.needed_define);
@@ -7502,6 +8032,7 @@ function_call_conflict:
           }
         ;
 
+/* may return NULL */
 geometry_function:
           CONTAINS_SYM '(' expr ',' expr ')'
           {
@@ -7545,7 +8076,9 @@ geometry_function:
                            Geometry::wkb_polygon));
           }
         | POINT_SYM '(' expr ',' expr ')'
-          { $$= GEOM_NEW(YYTHD, Item_func_point($3,$5)); }
+          {
+            $$= GEOM_NEW(YYTHD, Item_func_point($3,$5));
+          }
         | POLYGON '(' expr_list ')'
           {
             $$= GEOM_NEW(YYTHD,
@@ -7690,6 +8223,8 @@ udf_expr_list:
           udf_expr
           {
             $$= new (YYTHD->mem_root) List<Item>;
+            if ($$ == NULL)
+              MYSQL_YYABORT;
             $$->push_back($1);
           }
         | udf_expr_list ',' udf_expr
@@ -7721,50 +8256,125 @@ udf_expr:
 
 sum_expr:
           AVG_SYM '(' in_sum_expr ')'
-          { $$=new Item_sum_avg($3); }
+          {
+            $$= new (YYTHD->mem_root) Item_sum_avg($3);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | AVG_SYM '(' DISTINCT in_sum_expr ')'
-          { $$=new Item_sum_avg_distinct($4); }
+          {
+            $$= new (YYTHD->mem_root) Item_sum_avg_distinct($4);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | BIT_AND  '(' in_sum_expr ')'
-          { $$=new Item_sum_and($3); }
+          {
+            $$= new (YYTHD->mem_root) Item_sum_and($3);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | BIT_OR  '(' in_sum_expr ')'
-          { $$=new Item_sum_or($3); }
+          {
+            $$= new (YYTHD->mem_root) Item_sum_or($3);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | BIT_XOR  '(' in_sum_expr ')'
-          { $$=new Item_sum_xor($3); }
+          {
+            $$= new (YYTHD->mem_root) Item_sum_xor($3);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | COUNT_SYM '(' opt_all '*' ')'
-          { $$=new Item_sum_count(new Item_int((int32) 0L,1)); }
+          {
+            Item *item= new (YYTHD->mem_root) Item_int((int32) 0L,1);
+            if (item == NULL)
+              MYSQL_YYABORT;
+            $$= new (YYTHD->mem_root) Item_sum_count(item);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | COUNT_SYM '(' in_sum_expr ')'
-          { $$=new Item_sum_count($3); }
+          {
+            $$= new (YYTHD->mem_root) Item_sum_count($3);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | COUNT_SYM '(' DISTINCT
           { Select->in_sum_expr++; }
           expr_list
           { Select->in_sum_expr--; }
           ')'
-          { $$=new Item_sum_count_distinct(* $5); }
+          {
+            $$= new (YYTHD->mem_root) Item_sum_count_distinct(* $5);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | MIN_SYM '(' in_sum_expr ')'
-          { $$=new Item_sum_min($3); }
+          {
+            $$= new (YYTHD->mem_root) Item_sum_min($3);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         /*
           According to ANSI SQL, DISTINCT is allowed and has
           no sense inside MIN and MAX grouping functions; so MIN|MAX(DISTINCT ...)
           is processed like an ordinary MIN | MAX()
         */
         | MIN_SYM '(' DISTINCT in_sum_expr ')'
-          { $$=new Item_sum_min($4); }
+          {
+            $$= new (YYTHD->mem_root) Item_sum_min($4);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | MAX_SYM '(' in_sum_expr ')'
-          { $$=new Item_sum_max($3); }
+          {
+            $$= new (YYTHD->mem_root) Item_sum_max($3);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | MAX_SYM '(' DISTINCT in_sum_expr ')'
-          { $$=new Item_sum_max($4); }
+          {
+            $$= new (YYTHD->mem_root) Item_sum_max($4);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | STD_SYM '(' in_sum_expr ')'
-          { $$=new Item_sum_std($3, 0); }
+          {
+            $$= new (YYTHD->mem_root) Item_sum_std($3, 0);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | VARIANCE_SYM '(' in_sum_expr ')'
-          { $$=new Item_sum_variance($3, 0); }
+          {
+            $$= new (YYTHD->mem_root) Item_sum_variance($3, 0);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | STDDEV_SAMP_SYM '(' in_sum_expr ')'
-          { $$=new Item_sum_std($3, 1); }
+          {
+            $$= new (YYTHD->mem_root) Item_sum_std($3, 1);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | VAR_SAMP_SYM '(' in_sum_expr ')'
-          { $$=new Item_sum_variance($3, 1); }
+          {
+            $$= new (YYTHD->mem_root) Item_sum_variance($3, 1);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | SUM_SYM '(' in_sum_expr ')'
-          { $$=new Item_sum_sum($3); }
+          {
+            $$= new (YYTHD->mem_root) Item_sum_sum($3);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | SUM_SYM '(' DISTINCT in_sum_expr ')'
-          { $$=new Item_sum_sum_distinct($4); }
+          {
+            $$= new (YYTHD->mem_root) Item_sum_sum_distinct($4);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | GROUP_CONCAT_SYM '(' opt_distinct
           { Select->in_sum_expr++; }
           expr_list opt_gorder_clause
@@ -7773,8 +8383,11 @@ sum_expr:
           {
             SELECT_LEX *sel= Select;
             sel->in_sum_expr--;
-            $$=new Item_func_group_concat(Lex->current_context(), $3, $5,
-                                          sel->gorder_list, $7);
+            $$= new (YYTHD->mem_root)
+                  Item_func_group_concat(Lex->current_context(), $3, $5,
+                                         sel->gorder_list, $7);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
             $5->empty();
           }
         ;
@@ -7797,13 +8410,17 @@ variable:
 variable_aux:
           ident_or_text SET_VAR expr
           {
-            $$= new Item_func_set_user_var($1, $3);
+            $$= new (YYTHD->mem_root) Item_func_set_user_var($1, $3);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
             LEX *lex= Lex;
             lex->uncacheable(UNCACHEABLE_RAND);
           }
         | ident_or_text
           {
-            $$= new Item_func_get_user_var($1);
+            $$= new (YYTHD->mem_root) Item_func_get_user_var($1);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
             LEX *lex= Lex;
             lex->uncacheable(UNCACHEABLE_RAND);
           }
@@ -7829,9 +8446,11 @@ opt_distinct:
 
 opt_gconcat_separator:
           /* empty */
-            {
-              $$= new (YYTHD->mem_root) String(",", 1, &my_charset_latin1);
-            }
+          {
+            $$= new (YYTHD->mem_root) String(",", 1, &my_charset_latin1);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | SEPARATOR_SYM text_string { $$ = $2; }
         ;
 
@@ -7846,6 +8465,8 @@ opt_gorder_clause:
             select->gorder_list=
               (SQL_LIST*) sql_memdup((char*) &select->order_list,
                                      sizeof(st_sql_list));
+            if (select->gorder_list == NULL)
+              MYSQL_YYABORT;
             select->order_list.empty();
           }
         ;
@@ -7901,6 +8522,8 @@ expr_list:
           expr
           {
             $$= new (YYTHD->mem_root) List<Item>;
+            if ($$ == NULL)
+              MYSQL_YYABORT;
             $$->push_back($1);
           }
         | expr_list ',' expr
@@ -7919,6 +8542,8 @@ ident_list:
           simple_ident
           {
             $$= new (YYTHD->mem_root) List<Item>;
+            if ($$ == NULL)
+              MYSQL_YYABORT;
             $$->push_back($1);
           }
         | ident_list ',' simple_ident
@@ -7942,6 +8567,8 @@ when_list:
           WHEN_SYM expr THEN_SYM expr
           {
             $$= new List<Item>;
+            if ($$ == NULL)
+              MYSQL_YYABORT;
             $$->push_back($2);
             $$->push_back($4);
           }
@@ -8444,15 +9071,21 @@ using_list:
           {
             if (!($$= new List<String>))
               MYSQL_YYABORT;
-            $$->push_back(new (YYTHD->mem_root)
-                              String((const char *) $1.str, $1.length,
-                                      system_charset_info));
+            String *s= new (YYTHD->mem_root) String((const char *) $1.str,
+                                                    $1.length,
+                                                    system_charset_info);
+            if (s == NULL)
+              MYSQL_YYABORT;
+            $$->push_back(s);
           }
         | using_list ',' ident
           {
-            $1->push_back(new (YYTHD->mem_root)
-                              String((const char *) $3.str, $3.length,
-                                      system_charset_info));
+            String *s= new (YYTHD->mem_root) String((const char *) $3.str,
+                                                    $3.length,
+                                                    system_charset_info);
+            if (s == NULL)
+              MYSQL_YYABORT;
+            $1->push_back(s);
             $$= $1;
           }
         ;
@@ -8520,7 +9153,11 @@ table_alias:
 opt_table_alias:
           /* empty */ { $$=0; }
         | table_alias ident
-          { $$= (LEX_STRING*) sql_memdup(&$2,sizeof(LEX_STRING)); }
+          {
+            $$= (LEX_STRING*) sql_memdup(&$2,sizeof(LEX_STRING));
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         ;
 
 opt_all:
@@ -8568,10 +9205,13 @@ opt_escape:
           }
         | /* empty */
           {
+            THD *thd= YYTHD;
             Lex->escape_used= FALSE;
-            $$= ((YYTHD->variables.sql_mode & MODE_NO_BACKSLASH_ESCAPES) ?
-                 new Item_string("", 0, &my_charset_latin1) :
-                 new Item_string("\\", 1, &my_charset_latin1));
+            $$= ((thd->variables.sql_mode & MODE_NO_BACKSLASH_ESCAPES) ?
+                 new (thd->mem_root) Item_string("", 0, &my_charset_latin1) :
+                 new (thd->mem_root) Item_string("\\", 1, &my_charset_latin1));
+            if ($$ == NULL)
+              MYSQL_YYABORT;
           }
         ;
 
@@ -8758,13 +9398,28 @@ limit_options:
         ;
 
 limit_option:
-        param_marker
-        {
-          ((Item_param *) $1)->limit_clause_param= TRUE;
-        }
-        | ULONGLONG_NUM { $$= new Item_uint($1.str, $1.length); }
-        | LONG_NUM      { $$= new Item_uint($1.str, $1.length); }
-        | NUM           { $$= new Item_uint($1.str, $1.length); }
+          param_marker
+          {
+            ((Item_param *) $1)->limit_clause_param= TRUE;
+          }
+        | ULONGLONG_NUM
+          {
+            $$= new (YYTHD->mem_root) Item_uint($1.str, $1.length);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
+        | LONG_NUM
+          {
+            $$= new (YYTHD->mem_root) Item_uint($1.str, $1.length);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
+        | NUM
+          {
+            $$= new (YYTHD->mem_root) Item_uint($1.str, $1.length);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         ;
 
 delete_limit_clause:
@@ -8848,10 +9503,12 @@ procedure_clause:
             lex->proc_list.elements=0;
             lex->proc_list.first=0;
             lex->proc_list.next= (uchar**) &lex->proc_list.first;
-            if (add_proc_to_list(lex->thd, new Item_field(&lex->
-                                                          current_select->
-                                                          context,
-                                                          NULL,NULL,$2.str)))
+            Item_field *item= new (YYTHD->mem_root)
+                                Item_field(&lex->current_select->context,
+                                           NULL, NULL, $2.str);
+            if (item == NULL)
+              MYSQL_YYABORT;
+            if (add_proc_to_list(lex->thd, item))
               MYSQL_YYABORT;
             Lex->uncacheable(UNCACHEABLE_SIDEEFFECT);
           }
@@ -8900,13 +9557,20 @@ select_var_ident:  
           {
             LEX *lex=Lex;
             if (lex->result) 
-              ((select_dumpvar *)lex->result)->var_list.push_back( new my_var($2,0,0,(enum_field_types)0));
+            {
+              my_var *var= new my_var($2,0,0,(enum_field_types)0);
+              if (var == NULL)
+                MYSQL_YYABORT;
+              ((select_dumpvar *)lex->result)->var_list.push_back(var);
+            }
             else
+            {
               /*
                 The parser won't create select_result instance only
                 if it's an EXPLAIN.
               */
               DBUG_ASSERT(lex->describe);
+            }
           }
         | ident_or_text
           {
@@ -8920,12 +9584,12 @@ select_var_ident:  
             }
             if (lex->result)
             {
-              my_var *var;
-              ((select_dumpvar *)lex->result)->
-                var_list.push_back(var= new my_var($1,1,t->offset,t->type));
+              my_var *var= new my_var($1,1,t->offset,t->type);
+              if (var == NULL)
+                MYSQL_YYABORT;
+              ((select_dumpvar *)lex->result)->var_list.push_back(var);
 #ifndef DBUG_OFF
-              if (var)
-                var->sp= lex->sphead;
+              var->sp= lex->sphead;
 #endif
             }
             else
@@ -9011,12 +9675,14 @@ drop:
         | DROP build_method INDEX_SYM ident ON table_ident {}
           {
             LEX *lex=Lex;
+            Alter_drop *ad= new Alter_drop(Alter_drop::KEY, $4.str);
+            if (ad == NULL)
+              MYSQL_YYABORT;
             lex->sql_command= SQLCOM_DROP_INDEX;
             lex->alter_info.reset();
             lex->alter_info.flags= ALTER_DROP_INDEX;
             lex->alter_info.build_method= $2;
-            lex->alter_info.drop_list.push_back(new Alter_drop(Alter_drop::KEY,
-                                                               $4.str));
+            lex->alter_info.drop_list.push_back(ad);
             if (!lex->current_select->add_table_to_list(lex->thd, $6, NULL,
                                                         TL_OPTION_UPDATING))
               MYSQL_YYABORT;
@@ -9041,6 +9707,8 @@ drop:
             lex->sql_command = SQLCOM_DROP_FUNCTION;
             lex->drop_if_exists= $3;
             spname= new sp_name($4, $6, true);
+            if (spname == NULL)
+              MYSQL_YYABORT;
             spname->init_qname(thd);
             lex->spname= spname;
           }
@@ -9060,6 +9728,8 @@ drop:
             lex->sql_command = SQLCOM_DROP_FUNCTION;
             lex->drop_if_exists= $3;
             spname= new sp_name(db, $4, false);
+            if (spname == NULL)
+              MYSQL_YYABORT;
             spname->init_qname(thd);
             lex->spname= spname;
           }
@@ -9327,7 +9997,12 @@ values:
 
 expr_or_default:
           expr { $$= $1;}
-        | DEFAULT {$$= new Item_default_value(Lex->current_context()); }
+        | DEFAULT
+          {
+            $$= new (YYTHD->mem_root) Item_default_value(Lex->current_context());
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         ;
 
 opt_insert_update:
@@ -9451,7 +10126,11 @@ table_wild_list:
 table_wild_one:
           ident opt_wild
           {
-            if (!Select->add_table_to_list(YYTHD, new Table_ident($1),
+            Table_ident *ti= new Table_ident($1);
+            if (ti == NULL)
+              MYSQL_YYABORT;
+            if (!Select->add_table_to_list(YYTHD,
+                                           ti,
                                            NULL,
                                            TL_OPTION_UPDATING | TL_OPTION_ALIAS,
                                            Lex->lock_option))
@@ -9459,8 +10138,11 @@ table_wild_one:
           }
         | ident '.' ident opt_wild
           {
+            Table_ident *ti= new Table_ident(YYTHD, $1, $3, 0);
+            if (ti == NULL)
+              MYSQL_YYABORT;
             if (!Select->add_table_to_list(YYTHD,
-                                           new Table_ident(YYTHD, $1, $3, 0),
+                                           ti,
                                            NULL,
                                            TL_OPTION_UPDATING | TL_OPTION_ALIAS,
                                            Lex->lock_option))
@@ -9832,23 +10514,13 @@ show_param:
           }
         | PROCEDURE CODE_SYM sp_name
           {
-#ifdef DBUG_OFF
-            my_parse_error(ER(ER_SYNTAX_ERROR));
-            MYSQL_YYABORT;
-#else
             Lex->sql_command= SQLCOM_SHOW_PROC_CODE;
             Lex->spname= $3;
-#endif
           }
         | FUNCTION_SYM CODE_SYM sp_name
           {
-#ifdef DBUG_OFF
-            my_parse_error(ER(ER_SYNTAX_ERROR));
-            MYSQL_YYABORT;
-#else
             Lex->sql_command= SQLCOM_SHOW_FUNC_CODE;
             Lex->spname= $3;
-#endif
           }
         | CREATE EVENT_SYM sp_name
           {
@@ -9907,6 +10579,8 @@ wild_and_where:
           {
             Lex->wild= new (YYTHD->mem_root) String($2.str, $2.length,
                                                     system_charset_info);
+            if (Lex->wild == NULL)
+              MYSQL_YYABORT;
           }
         | WHERE expr
           {
@@ -9959,6 +10633,8 @@ opt_describe_column:
             Lex->wild= new (YYTHD->mem_root) String((const char*) $1.str,
                                                     $1.length,
                                                     system_charset_info);
+            if (Lex->wild == NULL)
+              MYSQL_YYABORT;
           }
         ;
 
@@ -10268,7 +10944,11 @@ fields_or_vars:
 field_or_var:
           simple_ident_nospvar {$$= $1;}
         | '@' ident_or_text
-          { $$= new Item_user_var_as_out_param($2); }
+          {
+            $$= new (YYTHD->mem_root) Item_user_var_as_out_param($2);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         ;
 
 opt_load_data_set_spec:
@@ -10294,20 +10974,30 @@ text_literal:
               tmp= $1;
             else
               thd->convert_string(&tmp, cs_con, $1.str, $1.length, cs_cli);
-            $$= new Item_string(tmp.str, tmp.length, cs_con,
-                                DERIVATION_COERCIBLE, repertoire);
+            $$= new (thd->mem_root) Item_string(tmp.str, tmp.length, cs_con,
+                                                DERIVATION_COERCIBLE,
+                                                repertoire);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
           }
         | NCHAR_STRING
           {
             uint repertoire= Lex->text_string_is_7bit ?
                              MY_REPERTOIRE_ASCII : MY_REPERTOIRE_UNICODE30;
             DBUG_ASSERT(my_charset_is_ascii_based(national_charset_info));
-            $$= new Item_string($1.str, $1.length, national_charset_info,
-                                DERIVATION_COERCIBLE, repertoire);
+            $$= new (YYTHD->mem_root) Item_string($1.str, $1.length,
+                                                  national_charset_info,
+                                                  DERIVATION_COERCIBLE,
+                                                  repertoire);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
           }
         | UNDERSCORE_CHARSET TEXT_STRING
           {
-            Item_string *str= new Item_string($2.str, $2.length, $1);
+            Item_string *str= new (YYTHD->mem_root) Item_string($2.str,
+                                                                $2.length, $1);
+            if (str == NULL)
+              MYSQL_YYABORT;
             str->set_repertoire_from_value();
             str->set_cs_specified(TRUE);
 
@@ -10337,27 +11027,30 @@ text_string:
             $$= new (YYTHD->mem_root) String($1.str,
                                              $1.length,
                                              YYTHD->variables.collation_connection);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
           }
         | HEX_NUM
           {
-            Item *tmp= new Item_hex_string($1.str, $1.length);
+            Item *tmp= new (YYTHD->mem_root) Item_hex_string($1.str, $1.length);
+            if (tmp == NULL)
+              MYSQL_YYABORT;
             /*
               it is OK only emulate fix_fields, because we need only
               value of constant
             */
-            $$= tmp ?
-              tmp->quick_fix_field(), tmp->val_str((String*) 0) :
-              (String*) 0;
+            tmp->quick_fix_field();
+            $$= tmp->val_str((String*) 0);
           }
         | BIN_NUM
           {
-            Item *tmp= new Item_bin_string($1.str, $1.length);
+            Item *tmp= new (YYTHD->mem_root) Item_bin_string($1.str, $1.length);
             /*
               it is OK only emulate fix_fields, because we need only
               value of constant
             */
-            $$= tmp ? tmp->quick_fix_field(), tmp->val_str((String*) 0) :
-              (String*) 0;
+            tmp->quick_fix_field();
+            $$= tmp->val_str((String*) 0);
           }
         ;
 
@@ -10373,7 +11066,7 @@ param_marker:
               my_error(ER_VIEW_SELECT_VARIABLE, MYF(0));
               MYSQL_YYABORT;
             }
-            item= new Item_param((uint) (lip->get_tok_start() - thd->query));
+            item= new (thd->mem_root) Item_param((uint) (lip->get_tok_start() - thd->query));
             if (!($$= item) || lex->param_list.push_back(item))
             {
               my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0));
@@ -10397,29 +11090,53 @@ literal:
         | NUM_literal { $$ = $1; }
         | NULL_SYM
           {
-            $$ = new Item_null();
+            $$ = new (YYTHD->mem_root) Item_null();
+            if ($$ == NULL)
+              MYSQL_YYABORT;
             YYLIP->next_state= MY_LEX_OPERATOR_OR_IDENT;
           }
-        | FALSE_SYM { $$= new Item_int((char*) "FALSE",0,1); }
-        | TRUE_SYM { $$= new Item_int((char*) "TRUE",1,1); }
-        | HEX_NUM { $$ = new Item_hex_string($1.str, $1.length);}
-        | BIN_NUM { $$= new Item_bin_string($1.str, $1.length); }
+        | FALSE_SYM
+          {
+            $$= new (YYTHD->mem_root) Item_int((char*) "FALSE",0,1);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
+        | TRUE_SYM
+          {
+            $$= new (YYTHD->mem_root) Item_int((char*) "TRUE",1,1);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
+        | HEX_NUM
+          {
+            $$ = new (YYTHD->mem_root) Item_hex_string($1.str, $1.length);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
+        | BIN_NUM
+          {
+            $$= new (YYTHD->mem_root) Item_bin_string($1.str, $1.length);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | UNDERSCORE_CHARSET HEX_NUM
           {
-            Item *tmp= new Item_hex_string($2.str, $2.length);
+            Item *tmp= new (YYTHD->mem_root) Item_hex_string($2.str, $2.length);
+            if (tmp == NULL)
+              MYSQL_YYABORT;
             /*
               it is OK only emulate fix_fieds, because we need only
               value of constant
             */
-            String *str= tmp ?
-              tmp->quick_fix_field(), tmp->val_str((String*) 0) :
-              (String*) 0;
-
-            Item_string *item_str=
-              new Item_string(NULL, /* name will be set in select_item */
-                              str ? str->ptr() : "",
-                              str ? str->length() : 0,
-                              $1);
+            tmp->quick_fix_field();
+            String *str= tmp->val_str((String*) 0);
+
+            Item_string *item_str;
+            item_str= new (YYTHD->mem_root)
+                        Item_string(NULL, /* name will be set in select_item */
+                                    str ? str->ptr() : "",
+                                    str ? str->length() : 0,
+                                    $1);
             if (!item_str ||
                 !item_str->check_well_formed_result(&item_str->str_value, TRUE))
             {
@@ -10433,20 +11150,22 @@ literal:
           }
         | UNDERSCORE_CHARSET BIN_NUM
           {
-            Item *tmp= new Item_bin_string($2.str, $2.length);
+            Item *tmp= new (YYTHD->mem_root) Item_bin_string($2.str, $2.length);
+            if (tmp == NULL)
+              MYSQL_YYABORT;
             /*
               it is OK only emulate fix_fieds, because we need only
               value of constant
             */
-            String *str= tmp ?
-              tmp->quick_fix_field(), tmp->val_str((String*) 0) :
-              (String*) 0;
-
-            Item_string *item_str=
-              new Item_string(NULL, /* name will be set in select_item */
-                              str ? str->ptr() : "",
-                              str ? str->length() : 0,
-                              $1);
+            tmp->quick_fix_field();
+            String *str= tmp->val_str((String*) 0);
+
+            Item_string *item_str;
+            item_str= new (YYTHD->mem_root)
+                        Item_string(NULL, /* name will be set in select_item */
+                                    str ? str->ptr() : "",
+                                    str ? str->length() : 0,
+                                    $1);
             if (!item_str ||
                 !item_str->check_well_formed_result(&item_str->str_value, TRUE))
             {
@@ -10466,27 +11185,42 @@ NUM_literal:
           NUM
           {
             int error;
-            $$ = new Item_int($1.str, (longlong) my_strtoll10($1.str, NULL, &error), $1.length);
+            $$= new (YYTHD->mem_root)
+                  Item_int($1.str,
+                           (longlong) my_strtoll10($1.str, NULL, &error),
+                           $1.length);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
           }
         | LONG_NUM
           {
             int error;
-            $$ = new Item_int($1.str, (longlong) my_strtoll10($1.str, NULL, &error), $1.length);
+            $$= new (YYTHD->mem_root)
+                  Item_int($1.str,
+                           (longlong) my_strtoll10($1.str, NULL, &error),
+                           $1.length);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
           }
         | ULONGLONG_NUM
-          { $$ = new Item_uint($1.str, $1.length); }
+          {
+            $$= new (YYTHD->mem_root) Item_uint($1.str, $1.length);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         | DECIMAL_NUM
           {
-            $$= new Item_decimal($1.str, $1.length, YYTHD->charset());
-            if (YYTHD->is_error())
+            $$= new (YYTHD->mem_root) Item_decimal($1.str, $1.length,
+                                                   YYTHD->charset());
+            if (($$ == NULL) || (YYTHD->is_error()))
             {
               MYSQL_YYABORT;
             }
           }
         | FLOAT_NUM
           {
-            $$ = new Item_float($1.str, $1.length);
-            if (YYTHD->is_error())
+            $$ = new (YYTHD->mem_root) Item_float($1.str, $1.length);
+            if (($$ == NULL) || (YYTHD->is_error()))
             {
               MYSQL_YYABORT;
             }
@@ -10506,15 +11240,23 @@ table_wild:
           ident '.' '*'
           {
             SELECT_LEX *sel= Select;
-            $$ = new Item_field(Lex->current_context(), NullS, $1.str, "*");
+            $$ = new (YYTHD->mem_root) Item_field(Lex->current_context(),
+                                                  NullS, $1.str, "*");
+            if ($$ == NULL)
+              MYSQL_YYABORT;
             sel->with_wild++;
           }
         | ident '.' ident '.' '*'
           {
+            THD *thd= YYTHD;
             SELECT_LEX *sel= Select;
-            $$ = new Item_field(Lex->current_context(), (YYTHD->client_capabilities &
-                                CLIENT_NO_SCHEMA ? NullS : $1.str),
-                                $3.str,"*");
+            const char* schema= thd->client_capabilities & CLIENT_NO_SCHEMA ?
+                                  NullS : $1.str;
+            $$ = new (thd->mem_root) Item_field(Lex->current_context(),
+                                                schema,
+                                                $3.str,"*");
+            if ($$ == NULL)
+              MYSQL_YYABORT;
             sel->with_wild++;
           }
         ;
@@ -10541,24 +11283,35 @@ simple_ident:
               }
 
               Item_splocal *splocal;
-              splocal= new Item_splocal($1, spv->offset, spv->type,
-                                        lip->get_tok_start_prev() -
-                                        lex->sphead->m_tmp_query,
-                                        lip->get_tok_end() - lip->get_tok_start_prev());
+              splocal= new (thd->mem_root)
+                         Item_splocal($1,
+                                      spv->offset, spv->type,
+                                      lip->get_tok_start_prev() - lex->sphead->m_tmp_query,
+                                      lip->get_tok_end() - lip->get_tok_start_prev());
+              if (splocal == NULL)
+                MYSQL_YYABORT;
 #ifndef DBUG_OFF
-              if (splocal)
-                splocal->m_sp= lex->sphead;
+              splocal->m_sp= lex->sphead;
 #endif
-              $$ = (Item*) splocal;
+              $$= splocal;
               lex->safe_to_cache_query=0;
             }
             else
             {
-              SELECT_LEX *sel=Select;
-              $$= (sel->parsing_place != IN_HAVING ||
-                  sel->get_in_sum_expr() > 0) ?
-                  (Item*) new Item_field(Lex->current_context(), NullS, NullS, $1.str) :
-                  (Item*) new Item_ref(Lex->current_context(), NullS, NullS, $1.str);
+              SELECT_LEX *sel= Select;
+              if ((sel->parsing_place != IN_HAVING) ||
+                  (sel->get_in_sum_expr() > 0))
+              {
+                $$= new (thd->mem_root) Item_field(Lex->current_context(),
+                                                   NullS, NullS, $1.str);
+              }
+              else
+              {
+                $$= new (thd->mem_root) Item_ref(Lex->current_context(),
+                                                 NullS, NullS, $1.str);
+              }
+              if ($$ == NULL)
+                MYSQL_YYABORT;
             }
           }
         | simple_ident_q { $$= $1; }
@@ -10567,11 +11320,21 @@ simple_ident:
 simple_ident_nospvar:
           ident
           {
-            SELECT_LEX *sel=Select;
-            $$= (sel->parsing_place != IN_HAVING ||
-                sel->get_in_sum_expr() > 0) ?
-                (Item*) new Item_field(Lex->current_context(), NullS, NullS, $1.str) :
-                (Item*) new Item_ref(Lex->current_context(), NullS, NullS, $1.str);
+            THD *thd= YYTHD;
+            SELECT_LEX *sel= Select;
+            if ((sel->parsing_place != IN_HAVING) ||
+                (sel->get_in_sum_expr() > 0))
+            {
+              $$= new (thd->mem_root) Item_field(Lex->current_context(),
+                                                 NullS, NullS, $1.str);
+            }
+            else
+            {
+              $$= new (thd->mem_root) Item_ref(Lex->current_context(),
+                                               NullS, NullS, $1.str);
+            }
+            if ($$ == NULL)
+              MYSQL_YYABORT;
           }
         | simple_ident_q { $$= $1; }
         ;
@@ -10613,13 +11376,16 @@ simple_ident_q:
                            lex->trg_chistics.event == TRG_EVENT_UPDATE));
               const bool read_only=
                 !(new_row && lex->trg_chistics.action_time == TRG_ACTION_BEFORE);
-              if (!(trg_fld= new Item_trigger_field(Lex->current_context(),
-                                                    new_row ?
-                                                    Item_trigger_field::NEW_ROW:
-                                                    Item_trigger_field::OLD_ROW,
-                                                    $3.str,
-                                                    SELECT_ACL,
-                                                    read_only)))
+
+              trg_fld= new (thd->mem_root)
+                         Item_trigger_field(Lex->current_context(),
+                                            new_row ?
+                                              Item_trigger_field::NEW_ROW:
+                                              Item_trigger_field::OLD_ROW,
+                                            $3.str,
+                                            SELECT_ACL,
+                                            read_only);
+              if (trg_fld == NULL)
                 MYSQL_YYABORT;
 
               /*
@@ -10629,7 +11395,7 @@ simple_ident_q:
               lex->trg_table_fields.link_in_list((uchar*) trg_fld,
                                                  (uchar**) &trg_fld->next_trg_field);
 
-              $$= (Item *)trg_fld;
+              $$= trg_fld;
             }
             else
             {
@@ -10639,10 +11405,19 @@ simple_ident_q:
                 my_error(ER_TABLENAME_NOT_ALLOWED_HERE,
                          MYF(0), $1.str, thd->where);
               }
-              $$= (sel->parsing_place != IN_HAVING ||
-                  sel->get_in_sum_expr() > 0) ?
-                  (Item*) new Item_field(Lex->current_context(), NullS, $1.str, $3.str) :
-                  (Item*) new Item_ref(Lex->current_context(), NullS, $1.str, $3.str);
+              if ((sel->parsing_place != IN_HAVING) ||
+                  (sel->get_in_sum_expr() > 0))
+              {
+                $$= new (thd->mem_root) Item_field(Lex->current_context(),
+                                                   NullS, $1.str, $3.str);
+              }
+              else
+              {
+                $$= new (thd->mem_root) Item_ref(Lex->current_context(),
+                                                 NullS, $1.str, $3.str);
+              }
+              if ($$ == NULL)
+                MYSQL_YYABORT;
             }
           }
         | '.' ident '.' ident
@@ -10655,31 +11430,45 @@ simple_ident_q:
               my_error(ER_TABLENAME_NOT_ALLOWED_HERE,
                        MYF(0), $2.str, thd->where);
             }
-            $$= (sel->parsing_place != IN_HAVING ||
-                sel->get_in_sum_expr() > 0) ?
-                (Item*) new Item_field(Lex->current_context(), NullS, $2.str, $4.str) :
-                (Item*) new Item_ref(Lex->current_context(), NullS, $2.str, $4.str);
+            if ((sel->parsing_place != IN_HAVING) ||
+                (sel->get_in_sum_expr() > 0))
+            {
+              $$= new (thd->mem_root) Item_field(Lex->current_context(),
+                                                 NullS, $2.str, $4.str);
+            }
+            else
+            {
+              $$= new (thd->mem_root) Item_ref(Lex->current_context(),
+                                               NullS, $2.str, $4.str);
+            }
+            if ($$ == NULL)
+              MYSQL_YYABORT;
           }
         | ident '.' ident '.' ident
           {
             THD *thd= YYTHD;
             LEX *lex= thd->lex;
             SELECT_LEX *sel= lex->current_select;
+            const char* schema= (thd->client_capabilities & CLIENT_NO_SCHEMA ?
+                                 NullS : $1.str);
             if (sel->no_table_names_allowed)
             {
               my_error(ER_TABLENAME_NOT_ALLOWED_HERE,
                        MYF(0), $3.str, thd->where);
             }
-            $$= (sel->parsing_place != IN_HAVING ||
-                sel->get_in_sum_expr() > 0) ?
-                (Item*) new Item_field(Lex->current_context(),
-                                       (YYTHD->client_capabilities &
-                                       CLIENT_NO_SCHEMA ? NullS : $1.str),
-                                       $3.str, $5.str) :
-                (Item*) new Item_ref(Lex->current_context(),
-                                     (YYTHD->client_capabilities &
-                                     CLIENT_NO_SCHEMA ? NullS : $1.str),
-                                     $3.str, $5.str);
+            if ((sel->parsing_place != IN_HAVING) ||
+                (sel->get_in_sum_expr() > 0))
+            {
+              $$= new (thd->mem_root) Item_field(Lex->current_context(),
+                                                 schema, $3.str, $5.str);
+            }
+            else
+            {
+              $$= new (thd->mem_root) Item_ref(Lex->current_context(),
+                                               schema, $3.str, $5.str);
+            }
+            if ($$ == NULL)
+              MYSQL_YYABORT;
           }
         ;
 
@@ -10715,16 +11504,34 @@ field_ident:
         ;
 
 table_ident:
-          ident { $$=new Table_ident($1); }
-        | ident '.' ident { $$=new Table_ident(YYTHD, $1,$3,0);}
-        | '.' ident { $$=new Table_ident($2);} /* For Delphi */
+          ident
+          {
+            $$= new Table_ident($1);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
+        | ident '.' ident
+          {
+            $$= new Table_ident(YYTHD, $1,$3,0);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
+        | '.' ident
+          {
+            /* For Delphi */
+            $$= new Table_ident($2);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         ;
 
 table_ident_nodb:
           ident
           {
             LEX_STRING db={(char*) any_db,3};
-            $$=new Table_ident(YYTHD, db,$1,0);
+            $$= new Table_ident(YYTHD, db,$1,0);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
           }
         ;
 
@@ -10750,8 +11557,11 @@ IDENT_sys:
               $$= $1;
             }
             else
-              thd->convert_string(&$$, system_charset_info,
-                                  $1.str, $1.length, thd->charset());
+            {
+              if (thd->convert_string(&$$, system_charset_info,
+                                      $1.str, $1.length, thd->charset()))
+                MYSQL_YYABORT;
+            }
           }
         ;
 
@@ -10763,8 +11573,11 @@ TEXT_STRING_sys:
             if (thd->charset_is_system_charset)
               $$= $1;
             else
-              thd->convert_string(&$$, system_charset_info,
-                                  $1.str, $1.length, thd->charset());
+            {
+              if (thd->convert_string(&$$, system_charset_info,
+                                      $1.str, $1.length, thd->charset()))
+                MYSQL_YYABORT;
+            }
           }
         ;
 
@@ -10776,8 +11589,11 @@ TEXT_STRING_literal:
             if (thd->charset_is_collation_connection)
               $$= $1;
             else
-              thd->convert_string(&$$, thd->variables.collation_connection,
-                                  $1.str, $1.length, thd->charset());
+            {
+              if (thd->convert_string(&$$, thd->variables.collation_connection,
+                                      $1.str, $1.length, thd->charset()))
+                MYSQL_YYABORT;
+            }
           }
         ;
 
@@ -10789,8 +11605,12 @@ TEXT_STRING_filesystem:
             if (thd->charset_is_character_set_filesystem)
               $$= $1;
             else
-              thd->convert_string(&$$, thd->variables.character_set_filesystem,
-                                  $1.str, $1.length, thd->charset());
+            {
+              if (thd->convert_string(&$$,
+                                      thd->variables.character_set_filesystem,
+                                      $1.str, $1.length, thd->charset()))
+                MYSQL_YYABORT;
+            }
           }
         ;
 
@@ -10800,6 +11620,8 @@ ident:
           {
             THD *thd= YYTHD;
             $$.str= thd->strmake($1.str, $1.length);
+            if ($$.str == NULL)
+              MYSQL_YYABORT;
             $$.length= $1.length;
           }
         ;
@@ -10810,6 +11632,8 @@ label_ident:
           {
             THD *thd= YYTHD;
             $$.str= thd->strmake($1.str, $1.length);
+            if ($$.str == NULL)
+              MYSQL_YYABORT;
             $$.length= $1.length;
           }
         ;
@@ -11337,6 +12161,7 @@ ext_option_value:
 sys_option_value:
           option_type internal_variable_name equal set_expr_or_default
           {
+            THD *thd= YYTHD;
             LEX *lex=Lex;
 
             if ($2.var == trg_new_row_fake_var)
@@ -11356,21 +12181,29 @@ sys_option_value:
               else
               {
                 /* QQ: Shouldn't this be field's default value ? */
-                it= new Item_null();
+                it= new (thd->mem_root) Item_null();
+                if (it == NULL)
+                  MYSQL_YYABORT;
               }
 
               DBUG_ASSERT(lex->trg_chistics.action_time == TRG_ACTION_BEFORE &&
                           (lex->trg_chistics.event == TRG_EVENT_INSERT ||
                            lex->trg_chistics.event == TRG_EVENT_UPDATE));
-              if (!(trg_fld= new Item_trigger_field(Lex->current_context(),
-                                                    Item_trigger_field::NEW_ROW,
-                                                    $2.base_name.str,
-                                                    UPDATE_ACL, FALSE)) ||
-                  !(sp_fld= new sp_instr_set_trigger_field(lex->sphead->
-                                                           instructions(),
-                                                           lex->spcont,
-                                                           trg_fld,
-                                                           it, lex)))
+
+              trg_fld= new (thd->mem_root)
+                         Item_trigger_field(Lex->current_context(),
+                                            Item_trigger_field::NEW_ROW,
+                                            $2.base_name.str,
+                                            UPDATE_ACL, FALSE);
+              if (trg_fld == NULL)
+                MYSQL_YYABORT;
+              
+              sp_fld= new sp_instr_set_trigger_field(lex->sphead->
+                                                     instructions(),
+                                                     lex->spcont,
+                                                     trg_fld,
+                                                     it, lex);
+              if (sp_fld == NULL)
                 MYSQL_YYABORT;
 
               /*
@@ -11387,8 +12220,11 @@ sys_option_value:
             { /* System variable */
               if ($1)
                 lex->option_type= $1;
-              lex->var_list.push_back(new set_var(lex->option_type, $2.var,
-                                      &$2.base_name, $4));
+              set_var *var= new set_var(lex->option_type, $2.var,
+                                        &$2.base_name, $4);
+              if (var == NULL)
+                MYSQL_YYABORT;
+              lex->var_list.push_back(var);
             }
             else
             {
@@ -11410,39 +12246,69 @@ sys_option_value:
               else if (spv->dflt)
                 it= spv->dflt;
               else
-                it= new Item_null();
+              {
+                it= new (thd->mem_root) Item_null();
+                if (it == NULL)
+                  MYSQL_YYABORT;
+              }
               sp_set= new sp_instr_set(lex->sphead->instructions(), ctx,
                                        spv->offset, it, spv->type, lex, TRUE);
+              if (sp_set == NULL)
+                MYSQL_YYABORT;
               lex->sphead->add_instr(sp_set);
             }
           }
         | option_type TRANSACTION_SYM ISOLATION LEVEL_SYM isolation_types
           {
+            THD *thd= YYTHD;
             LEX *lex=Lex;
             lex->option_type= $1;
-            lex->var_list.push_back(new set_var(lex->option_type,
-                                                find_sys_var(YYTHD, "tx_isolation"),
-                                                &null_lex_str,
-                                                new Item_int((int32) $5)));
+            Item *item= new (thd->mem_root) Item_int((int32) $5);
+            if (item == NULL)
+              MYSQL_YYABORT;
+            set_var *var= new set_var(lex->option_type,
+                                      find_sys_var(thd, "tx_isolation"),
+                                      &null_lex_str,
+                                      item);
+            if (var == NULL)
+              MYSQL_YYABORT;
+            lex->var_list.push_back(var);
           }
         ;
 
 option_value:
           '@' ident_or_text equal expr
           {
-            Lex->var_list.push_back(new set_var_user(new Item_func_set_user_var($2,$4)));
+            Item_func_set_user_var *item;
+            item= new (YYTHD->mem_root) Item_func_set_user_var($2, $4);
+            if (item == NULL)
+              MYSQL_YYABORT;
+            set_var_user *var= new set_var_user(item);
+            if (var == NULL)
+              MYSQL_YYABORT;
+            Lex->var_list.push_back(var);
           }
         | '@' '@' opt_var_ident_type internal_variable_name equal set_expr_or_default
           {
             LEX *lex=Lex;
-            lex->var_list.push_back(new set_var($3, $4.var, &$4.base_name, $6));
+            set_var *var= new set_var($3, $4.var, &$4.base_name, $6);
+            if (var == NULL)
+              MYSQL_YYABORT;
+            lex->var_list.push_back(var);
           }
         | charset old_or_new_charset_name_or_default
           {
             THD *thd= YYTHD;
             LEX *lex= thd->lex;
-            $2= $2 ? $2: global_system_variables.character_set_client;
-            lex->var_list.push_back(new set_var_collation_client($2,thd->variables.collation_database,$2));
+            CHARSET_INFO *cs2;
+            cs2= $2 ? $2: global_system_variables.character_set_client;
+            set_var_collation_client *var;
+            var= new set_var_collation_client(cs2,
+                                              thd->variables.collation_database,
+                                              cs2);
+            if (var == NULL)
+              MYSQL_YYABORT;
+            lex->var_list.push_back(var);
           }
         | NAMES_SYM equal expr
           {
@@ -11462,15 +12328,21 @@ option_value:
         | NAMES_SYM charset_name_or_default opt_collate
           {
             LEX *lex= Lex;
-            $2= $2 ? $2 : global_system_variables.character_set_client;
-            $3= $3 ? $3 : $2;
-            if (!my_charset_same($2,$3))
+            CHARSET_INFO *cs2;
+            CHARSET_INFO *cs3;
+            cs2= $2 ? $2 : global_system_variables.character_set_client;
+            cs3= $3 ? $3 : cs2;
+            if (!my_charset_same(cs2, cs3))
             {
               my_error(ER_COLLATION_CHARSET_MISMATCH, MYF(0),
-                       $3->name, $2->csname);
+                       cs3->name, cs2->csname);
               MYSQL_YYABORT;
             }
-            lex->var_list.push_back(new set_var_collation_client($3,$3,$3));
+            set_var_collation_client *var;
+            var= new set_var_collation_client(cs3, cs3, cs3);
+            if (var == NULL)
+              MYSQL_YYABORT;
+            lex->var_list.push_back(var);
           }
         | PASSWORD equal text_or_password
           {
@@ -11491,14 +12363,20 @@ option_value:
               MYSQL_YYABORT;
             user->host=null_lex_str;
             user->user.str=thd->security_ctx->priv_user;
-            thd->lex->var_list.push_back(new set_var_password(user, $3));
+            set_var_password *var= new set_var_password(user, $3);
+            if (var == NULL)
+              MYSQL_YYABORT;
+            thd->lex->var_list.push_back(var);
             thd->lex->autocommit= TRUE;
             if (lex->sphead)
               lex->sphead->m_flags|= sp_head::HAS_SET_AUTOCOMMIT_STMT;
           }
         | PASSWORD FOR_SYM user equal text_or_password
           {
-            Lex->var_list.push_back(new set_var_password($3,$5));
+            set_var_password *var= new set_var_password($3,$5);
+            if (var == NULL)
+              MYSQL_YYABORT;
+            Lex->var_list.push_back(var);
             Lex->autocommit= TRUE;
             if (Lex->sphead)
               Lex->sphead->m_flags|= sp_head::HAS_SET_AUTOCOMMIT_STMT;
@@ -11609,11 +12487,15 @@ text_or_password:
               Item_func_old_password::alloc(YYTHD, $3.str) :
               Item_func_password::alloc(YYTHD, $3.str) :
               $3.str;
+            if ($$ == NULL)
+              MYSQL_YYABORT;
           }
         | OLD_PASSWORD '(' TEXT_STRING ')'
           {
             $$= $3.length ? Item_func_old_password::alloc(YYTHD, $3.str) :
               $3.str;
+            if ($$ == NULL)
+              MYSQL_YYABORT;
           }
         ;
 
@@ -11621,9 +12503,27 @@ text_or_password:
 set_expr_or_default:
           expr { $$=$1; }
         | DEFAULT { $$=0; }
-        | ON     { $$=new Item_string("ON",  2, system_charset_info); }
-        | ALL    { $$=new Item_string("ALL", 3, system_charset_info); }
-        | BINARY { $$=new Item_string("binary", 6, system_charset_info); }
+        | ON
+          {
+            $$= new (YYTHD->mem_root) Item_string("ON",  2,
+                                                  system_charset_info);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
+        | ALL
+          {
+            $$= new (YYTHD->mem_root) Item_string("ALL", 3,
+                                                  system_charset_info);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
+        | BINARY
+          {
+            $$= new (YYTHD->mem_root) Item_string("binary", 6,
+                                                  system_charset_info);
+            if ($$ == NULL)
+              MYSQL_YYABORT;
+          }
         ;
 
 /* Lock function */
@@ -11802,7 +12702,10 @@ handler:
             lex->expr_allows_subselect= FALSE;
             lex->sql_command = SQLCOM_HA_READ;
             lex->ha_rkey_mode= HA_READ_KEY_EXACT; /* Avoid purify warnings */
-            lex->current_select->select_limit= new Item_int((int32) 1);
+            Item *one= new (YYTHD->mem_root) Item_int((int32) 1);
+            if (one == NULL)
+              MYSQL_YYABORT;
+            lex->current_select->select_limit= one;
             lex->current_select->offset_limit= 0;
             if (!lex->current_select->add_table_to_list(lex->thd, $2, 0, 0))
               MYSQL_YYABORT;
@@ -12126,8 +13029,9 @@ grant_user:
               {
                 char *buff= 
                   (char *) YYTHD->alloc(SCRAMBLED_PASSWORD_CHAR_LENGTH_323+1);
-                if (buff)
-                  make_scrambled_password_323(buff, $4.str);
+                if (buff == NULL)
+                  MYSQL_YYABORT;
+                make_scrambled_password_323(buff, $4.str);
                 $1->password.str= buff;
                 $1->password.length= SCRAMBLED_PASSWORD_CHAR_LENGTH_323;
               }
@@ -12135,8 +13039,9 @@ grant_user:
               {
                 char *buff= 
                   (char *) YYTHD->alloc(SCRAMBLED_PASSWORD_CHAR_LENGTH+1);
-                if (buff)
-                  make_scrambled_password(buff, $4.str);
+                if (buff == NULL)
+                  MYSQL_YYABORT;
+                make_scrambled_password(buff, $4.str);
                 $1->password.str= buff;
                 $1->password.length= SCRAMBLED_PASSWORD_CHAR_LENGTH;
               }
@@ -12166,6 +13071,8 @@ column_list_id:
           ident
           {
             String *new_str = new (YYTHD->mem_root) String((const char*) $1.str,$1.length,system_charset_info);
+            if (new_str == NULL)
+              MYSQL_YYABORT;
             List_iterator <LEX_COLUMN> iter(Lex->columns);
             class LEX_COLUMN *point;
             LEX *lex=Lex;
@@ -12179,7 +13086,12 @@ column_list_id:
             if (point)
               point->rights |= lex->which_columns;
             else
-              lex->columns.push_back(new LEX_COLUMN (*new_str,lex->which_columns));
+            {
+              LEX_COLUMN *col= new LEX_COLUMN (*new_str,lex->which_columns);
+              if (col == NULL)
+                MYSQL_YYABORT;
+              lex->columns.push_back(col);
+            }
           }
         ;
 
@@ -12617,21 +13529,24 @@ view_list_opt:
         ;
 
 view_list:
-          ident 
-            {
-              Lex->view_list.push_back((LEX_STRING*)
-              sql_memdup(&$1, sizeof(LEX_STRING)));
-            }
+          ident
+          {
+            LEX_STRING *ls= (LEX_STRING*) sql_memdup(&$1, sizeof(LEX_STRING));
+            if (ls == NULL)
+              MYSQL_YYABORT;
+            Lex->view_list.push_back(ls);
+          }
         | view_list ',' ident
-            {
-              Lex->view_list.push_back((LEX_STRING*)
-              sql_memdup(&$3, sizeof(LEX_STRING)));
-            }
+          {
+            LEX_STRING *ls= (LEX_STRING*) sql_memdup(&$3, sizeof(LEX_STRING));
+            if (ls == NULL)
+              MYSQL_YYABORT;
+            Lex->view_list.push_back(ls);
+          }
         ;
 
 view_select:
           {
-            THD *thd= YYTHD;
             LEX *lex= Lex;
             lex->parsing_options.allows_variable= FALSE;
             lex->parsing_options.allows_select_into= FALSE;
@@ -12817,6 +13732,8 @@ sf_tail:
             }
             /* Order is important here: new - reset - init */
             sp= new sp_head();
+            if (sp == NULL)
+              MYSQL_YYABORT;
             sp->reset_thd_mem_root(thd);
             sp->init(lex);
             sp->init_sp_name(thd, lex->spname);
@@ -12944,6 +13861,8 @@ sp_tail:
 
             /* Order is important here: new - reset - init */
             sp= new sp_head();
+            if (sp == NULL)
+              MYSQL_YYABORT;
             sp->reset_thd_mem_root(YYTHD);
             sp->init(lex);
             sp->m_type= TYPE_ENUM_PROCEDURE;

=== modified file 'sql/table.cc'
--- a/sql/table.cc	2008-07-29 12:08:01 +0000
+++ b/sql/table.cc	2008-08-07 03:05:33 +0000
@@ -2125,6 +2125,28 @@ void free_blobs(register TABLE *table)
 }
 
 
+/**
+  Reclaim temporary blob storage which is bigger than 
+  a threshold.
+ 
+  @param table A handle to the TABLE object containing blob fields
+  @param size The threshold value.
+ 
+*/
+
+void free_field_buffers_larger_than(TABLE *table, uint32 size)
+{
+  uint *ptr, *end;
+  for (ptr= table->s->blob_field, end=ptr + table->s->blob_fields ;
+       ptr != end ;
+       ptr++)
+  {
+    Field_blob *blob= (Field_blob*) table->field[*ptr];
+    if (blob->get_field_buffer_size() > size)
+        blob->free();
+  }
+}
+
 	/* Find where a form starts */
 	/* if formname is NullS then only formnames is read */
 

=== modified file 'sql/table.h'
--- a/sql/table.h	2008-06-28 11:00:59 +0000
+++ b/sql/table.h	2008-07-25 15:10:14 +0000
@@ -952,6 +952,9 @@ typedef struct st_schema_table
 #define VIEW_CHECK_ERROR      1
 #define VIEW_CHECK_SKIP       2
 
+/** The threshold size a blob field buffer before it is freed */
+#define MAX_TDC_BLOB_SIZE 65536
+
 struct st_lex;
 class select_union;
 class TMP_TABLE_PARAM;

=== modified file 'sql/thr_malloc.cc'
--- a/sql/thr_malloc.cc	2008-03-28 17:47:53 +0000
+++ b/sql/thr_malloc.cc	2008-08-01 15:38:05 +0000
@@ -22,6 +22,33 @@ extern "C" {
   void sql_alloc_error_handler(void)
   {
     sql_print_error(ER(ER_OUT_OF_RESOURCES));
+
+    THD *thd= current_thd;
+    if (thd)
+    {
+      if (! thd->is_error())
+      {
+        /*
+          This thread is Out Of Memory.
+          An OOM condition is a fatal error.
+          It should not be caught by error handlers in stored procedures.
+          Also, recording that SQL condition in the condition area could
+          cause more memory allocations, which in turn could raise more
+          OOM conditions, causing recursion in the error handling code itself.
+          As a result, my_error() should not be invoked, and the
+          thread diagnostics area is set to an error status directly.
+          Note that Diagnostics_area::set_error_status() is safe,
+          since it does not call any memory allocation routines.
+          The visible result for a client application will be:
+          - a query fails with an ER_OUT_OF_RESOURCES error,
+          returned in the error packet.
+          - SHOW ERROR/SHOW WARNINGS may be empty.
+        */
+        thd->main_da.set_error_status(thd,
+                                      ER_OUT_OF_RESOURCES,
+                                      ER(ER_OUT_OF_RESOURCES));
+      }
+    }
   }
 }
 

=== modified file 'storage/falcon/BDB.cpp'
--- a/storage/falcon/BDB.cpp	2008-05-08 20:37:28 +0000
+++ b/storage/falcon/BDB.cpp	2008-07-24 08:45:03 +0000
@@ -57,8 +57,11 @@ Bdb::Bdb()
 	priorDirty = nextDirty = NULL;
 	flushIt = false;
 	dbb = NULL;
+	syncObject.setName("Bdb::syncObject");
+	syncWrite.setName("Bdb::syncWrite");
 
 #ifdef COLLECT_BDB_HISTORY
+	syncHistory.setName("Bdb::syncHistory");
 	lockType = None;
 	initCount = 0;
 	historyCount = 0;
@@ -203,7 +206,7 @@ void Bdb::initHistory()
 
 void Bdb::addHistory(int delta, const char *file, int line)
 {
-	Sync sync (&historySyncObject, "Bdb::addHistory");
+	Sync sync (&syncHistory, "Bdb::addHistory");
 	sync.lock (Exclusive);
 	unsigned int historyOffset = historyCount++ % MAX_BDB_HISTORY;
 

=== modified file 'storage/falcon/BDB.h'
--- a/storage/falcon/BDB.h	2008-05-10 04:18:41 +0000
+++ b/storage/falcon/BDB.h	2008-07-24 08:45:03 +0000
@@ -103,7 +103,7 @@ public:
 	volatile INTERLOCK_TYPE	useCount;
 
 #ifdef COLLECT_BDB_HISTORY
-	SyncObject	historySyncObject;
+	SyncObject	syncHistory;
 	uint initCount;
 	uint historyCount;
 	struct bdb_history		history[MAX_BDB_HISTORY];

=== modified file 'storage/falcon/BackLog.cpp'
--- a/storage/falcon/BackLog.cpp	2008-04-12 02:22:50 +0000
+++ b/storage/falcon/BackLog.cpp	2008-07-17 13:52:17 +0000
@@ -38,7 +38,7 @@ BackLog::BackLog(Database *db, const cha
 	database = db;
 	dbb = new Dbb(database->dbb, 0);
 	dbb->createPath(fileName);
-	dbb->create(fileName, dbb->pageSize, 0, HdrTableSpace, 0, NULL, 0);
+	dbb->create(fileName, dbb->pageSize, 0, HdrTableSpace, 0, NULL);
 	dbb->noLog = true;
 	dbb->tableSpaceId = -1;
 	int32 sectionId = Section::createSection (dbb, NO_TRANSACTION);

=== modified file 'storage/falcon/Cache.cpp'
--- a/storage/falcon/Cache.cpp	2008-07-09 12:35:48 +0000
+++ b/storage/falcon/Cache.cpp	2008-07-24 08:45:03 +0000
@@ -89,9 +89,12 @@ Cache::Cache(Database *db, int pageSz, i
 	bufferHunks = new char* [numberHunks];
 	memset(bufferHunks, 0, numberHunks * sizeof(char*));
 	syncObject.setName("Cache::syncObject");
-	syncDirty.setName("Cache::syncDirty");
 	syncFlush.setName("Cache::syncFlush");
+	syncDirty.setName("Cache::syncDirty");
+	syncThreads.setName("Cache::syncThreads");
 	syncWait.setName("Cache::syncWait");
+	bufferQueue.syncObject.setName("Cache::bufferQueue.syncObject");
+
 	flushBitmap = new Bitmap;
 	numberIoThreads = falcon_io_threads;
 	ioThreads = new Thread*[numberIoThreads];
@@ -359,8 +362,8 @@ Bdb* Cache::fakePage(Dbb *dbb, int32 pag
 
 void Cache::flush(int64 arg)
 {
-	Sync flushLock(&syncFlush, "Cache::flush");
-	Sync sync(&syncDirty, "Cache::ioThread");
+	Sync flushLock(&syncFlush, "Cache::flush(1)");
+	Sync sync(&syncDirty, "Cache::flush(2)");
 	flushLock.lock(Exclusive);
 	
 	if (flushing)
@@ -513,7 +516,7 @@ void Cache::markClean(Bdb *bdb)
 
 void Cache::writePage(Bdb *bdb, int type)
 {
-	Sync writer(&bdb->syncWrite, "Cache::writePage");
+	Sync writer(&bdb->syncWrite, "Cache::writePage(1)");
 	writer.lock(Exclusive);
 
 	if (!bdb->isDirty)
@@ -597,7 +600,7 @@ void Cache::writePage(Bdb *bdb, int type
 
 	if (dbb->shadows)
 		{
-		Sync sync (&dbb->cloneSyncObject, "Cache::writePage");
+		Sync sync (&dbb->syncClone, "Cache::writePage(2)");
 		sync.lock (Shared);
 
 		for (DatabaseCopy *shadow = dbb->shadows; shadow; shadow = shadow->next)
@@ -665,9 +668,9 @@ void Cache::freePage(Dbb *dbb, int32 pag
 
 void Cache::flush(Dbb *dbb)
 {
-	//Sync sync (&syncDirty, "Cache::flush(Dbb)");
+	//Sync sync (&syncDirty, "Cache::flush(1)");
 	//sync.lock (Exclusive);
-	Sync sync (&syncObject, "Cache::freePage");
+	Sync sync (&syncObject, "Cache::flush(3)");
 	sync.lock (Shared);
 
 	for (Bdb *bdb = bdbs; bdb < endBdbs; ++bdb)
@@ -761,10 +764,10 @@ void Cache::ioThread(void* arg)
 
 void Cache::ioThread(void)
 {
-	Sync syncThread(&syncThreads, "Cache::ioThread");
+	Sync syncThread(&syncThreads, "Cache::ioThread(1)");
 	syncThread.lock(Shared);
-	Sync flushLock(&syncFlush, "Cache::ioThread");
-	Sync sync(&syncObject, "Cache::ioThread");
+	Sync flushLock(&syncFlush, "Cache::ioThread(2)");
+	Sync sync(&syncObject, "Cache::ioThread(3)");
 	Priority priority(database->ioScheduler);
 	Thread *thread = Thread::getThread("Cache::ioThread");
 	UCHAR *rawBuffer = new UCHAR[ASYNC_BUFFER_SIZE];

=== modified file 'storage/falcon/CollationManager.cpp'
--- a/storage/falcon/CollationManager.cpp	2007-09-20 15:44:25 +0000
+++ b/storage/falcon/CollationManager.cpp	2008-07-24 08:45:03 +0000
@@ -42,6 +42,7 @@ CollationManager::CollationManager()
 {
 	memset(hashTable, 0, sizeof(hashTable));
 	add(&collationCaseless);
+	syncObject.setName("CollationManager::syncObject");
 }
 
 CollationManager::~CollationManager()
@@ -87,7 +88,7 @@ void CollationManager::add(Collation* co
 
 Collation* CollationManager::find(const char* collationName)
 {
-	Sync sync(&syncObject, "CollationManager::addCollation");
+	Sync sync(&syncObject, "CollationManager::find");
 	sync.lock(Shared);
 	int slot = JString::hash(collationName, COLLATION_HASH_SIZE);
 	

=== modified file 'storage/falcon/CompiledStatement.cpp'
--- a/storage/falcon/CompiledStatement.cpp	2007-09-20 15:44:25 +0000
+++ b/storage/falcon/CompiledStatement.cpp	2008-07-24 08:45:03 +0000
@@ -96,6 +96,7 @@ CompiledStatement::CompiledStatement(Con
 	firstInstance = lastInstance = NULL;
 	select = NULL;
 	parse = NULL;
+	syncObject.setName("CompiledStatement::syncObject");
 }
 
 CompiledStatement::~CompiledStatement()
@@ -1093,7 +1094,7 @@ bool CompiledStatement::addFilter(TableF
 
 int CompiledStatement::countInstances()
 {
-	Sync sync (&syncObject, "CompiledStatement::addInstance");
+	Sync sync (&syncObject, "CompiledStatement::countInstances");
 	sync.lock (Shared);
 	int count = 0;
 
@@ -1163,7 +1164,7 @@ Type CompiledStatement::getType(Syntax *
 
 void CompiledStatement::invalidate()
 {
-	Sync sync (&syncObject, "CompiledStatement::addInstance");
+	Sync sync (&syncObject, "CompiledStatement::invalidate");
 	sync.lock (Shared);
 
 	for (Statement *instance = firstInstance; instance; instance = instance->next)

=== modified file 'storage/falcon/Configuration.cpp'
--- a/storage/falcon/Configuration.cpp	2008-07-10 09:01:32 +0000
+++ b/storage/falcon/Configuration.cpp	2008-07-17 13:52:17 +0000
@@ -62,7 +62,6 @@
 extern uint64		max_memory_address;
 
 extern uint64		falcon_record_memory_max;
-extern uint64		falcon_initial_allocation;
 extern uint			falcon_allocation_extent;
 extern uint64		falcon_page_cache_size;
 //extern uint		falcon_debug_mask;
@@ -116,7 +115,6 @@ Configuration::Configuration(const char 
 	recordMemoryMax				= falcon_record_memory_max;
 	recordScavengeThresholdPct	= falcon_record_scavenge_threshold;
 	recordScavengeFloorPct		= falcon_record_scavenge_floor;
-	initialAllocation			= falcon_initial_allocation;
 	allocationExtent			= falcon_allocation_extent;
 	serialLogWindows			= falcon_serial_log_buffers;
 	pageCacheSize				= falcon_page_cache_size;
@@ -164,7 +162,6 @@ Configuration::Configuration(const char 
 	recordScavengeThreshold		= (recordMemoryMax * 100) / recordScavengeThresholdPct;
 	recordScavengeFloor			= (recordMemoryMax * 100) / recordScavengeFloorPct;
 	serialLogWindows			= 10;
-	initialAllocation			= 0;
 	allocationExtent			= 10;
 	pageCacheSize				= getMemorySize(PAGE_CACHE_MEMORY);
 	indexChillThreshold			= 4 * ONE_MB;

=== modified file 'storage/falcon/Configuration.h'
--- a/storage/falcon/Configuration.h	2008-03-11 16:15:47 +0000
+++ b/storage/falcon/Configuration.h	2008-07-17 13:52:17 +0000
@@ -49,7 +49,6 @@ public:
 	uint64		recordScavengeFloor;
 	int			recordScavengeThresholdPct;
 	int			recordScavengeFloorPct;
-	uint64		initialAllocation;
 	uint64		allocationExtent;
 	uint64		pageCacheSize;
 	int64		javaInitialAllocation;

=== modified file 'storage/falcon/Connection.cpp'
--- a/storage/falcon/Connection.cpp	2008-07-10 09:01:32 +0000
+++ b/storage/falcon/Connection.cpp	2008-07-24 08:45:03 +0000
@@ -89,7 +89,7 @@ static Server		*server;
 static bool			panicShutdown;
 
 static Registry		registry;
-static SyncObject	databaseList;
+static SyncObject	syncDatabaseList;
 
 static const char *ddl [] = {
 	"grant all on system.sequences to %s",
@@ -169,6 +169,9 @@ void Connection::init(Configuration *con
 	isolationLevel = TRANSACTION_CONSISTENT_READ;
 	mySqlThreadId = 0;
 	currentStatement = NULL;
+	syncObject.setName("Connection::syncObject");
+	syncResultSets.setName("Connection::syncResultSets");
+	syncDatabaseList.setName("Connection::syncDatabaseList");
 }
 
 Connection::~Connection()
@@ -923,7 +926,7 @@ void Connection::openDatabase(const char
 	if (filename)
 		IO::expandFileName(filename, sizeof(dbFileName), dbFileName);
 	else
-		{ 
+		{
 		if (!registry.findDatabase (dbName, sizeof (dbFileName), dbFileName))
 			throw SQLEXCEPTION (CONNECTION_ERROR, "can't find database \"%s\"", dbName);
 		}
@@ -968,7 +971,7 @@ void Connection::createDatabase(const ch
 	const char *password = parameters->findValue ("password", "");
 	char dbFileName [1024];
 	const char *dbFile = registry.findDatabase (dbName, sizeof (dbFileName), dbFileName);
-	Sync sync (&databaseList, "Connection::createDatabase");
+	Sync sync (&syncDatabaseList, "Connection::createDatabase(1)");
 	sync.lock (Exclusive);
 	
 	if (dbFile)
@@ -1027,7 +1030,10 @@ Database* Connection::createDatabase(con
 	if (database)
 		throw SQLEXCEPTION (CONNECTION_ERROR, "database is already open");
 
-	Sync sync (&databaseList, "Connection::createDatabase");
+	if (!firstDatabase)
+		syncDatabaseList.setName("Connection::syncDatabaseList");
+
+	Sync sync (&syncDatabaseList, "Connection::createDatabase(2)");
 	sync.lock (Exclusive);
 
 #ifndef STORAGE_ENGINE
@@ -1042,7 +1048,7 @@ Database* Connection::createDatabase(con
 				}
 
 #ifdef STORAGE_ENGINE
-        strcpy(dbFileName, fileName);
+	strcpy(dbFileName, fileName);
 #else
 	registry.defineDatabase (dbName, fileName);
 	
@@ -1617,7 +1623,7 @@ ResultList* Connection::findResultList(i
 
 Database* Connection::getDatabase(const char* dbName, const char* dbFileName, Threads* threads)
 {
-	Sync sync (&databaseList, "Connection::getDatabase");
+	Sync sync (&syncDatabaseList, "Connection::getDatabase");
 	sync.lock (Shared);
 	Database *db;
 
@@ -1665,7 +1671,7 @@ void Connection::dropDatabase()
 	if (!database)
 		throw SQLEXCEPTION (CONNECTION_ERROR, "database isn't open");
 		
-	Sync sync (&databaseList, "Connection::dropDatabase");
+	Sync sync (&syncDatabaseList, "Connection::dropDatabase");
 	sync.lock (Exclusive);
 	unlink(database);
 	detachDatabase();

=== modified file 'storage/falcon/Database.cpp'
--- a/storage/falcon/Database.cpp	2008-06-17 17:41:54 +0000
+++ b/storage/falcon/Database.cpp	2008-07-17 13:52:17 +0000
@@ -323,14 +323,6 @@ static const char *createTableSpaces =
 		"tablespace_id int not null,"
 		"filename varchar(512) not null,"
 		"type int,"
-		/***
-		"initial_size bigint,"
-		"extent_size bigint,"
-		"autoextend_size bigint,"
-		"max_size bigint,"
-		"nodegroup int,"
-		"wait int,"
-		***/
 		"comment text)";
 
 static const char *createTableSpaceSequence = 
@@ -634,7 +626,7 @@ void Database::createDatabase(const char
 	int page_size = PAGE_SIZE;
 #endif
 
-	cache = dbb->create(filename, page_size, configuration->pageCacheSize, HdrDatabaseFile, 0, "", 0);
+	cache = dbb->create(filename, page_size, configuration->pageCacheSize, HdrDatabaseFile, 0, "");
 	
 	try
 		{
@@ -995,7 +987,7 @@ Table* Database::findTable (const char *
 	schema = symbolManager->getSymbol (schema);
 	name = symbolManager->getSymbol (name);
 
-	Sync syncTbl (&syncTables, "Database::findTable");
+	Sync syncTbl (&syncTables, "Database::findTable(1)");
 	syncTbl.lock (Shared);
 	
 	int slot = HASH (name, TABLE_HASH_SIZE);
@@ -1012,7 +1004,7 @@ Table* Database::findTable (const char *
 		if (untable->name == name && untable->schemaName == schema)
 			return NULL;
 
-	Sync syncDDL(&syncSysDDL, "Database::findTable");
+	Sync syncDDL(&syncSysDDL, "Database::findTable(2)");
 	syncDDL.lock(Shared);
 	
 	PStatement statement = prepareStatement (
@@ -1145,7 +1137,7 @@ CompiledStatement* Database::getCompiled
 	Sync syncDDL(&syncSysDDL, "Database::getCompiledStatement(1)");
 	syncDDL.lock(Shared);
 
-	Sync syncStmt(&syncStatements, "Database::getCompiledStatement(1)");
+	Sync syncStmt(&syncStatements, "Database::getCompiledStatement(2)");
 	syncStmt.lock(Shared);
 	
 	//printf("%s\n", (const char*) sqlString);
@@ -1174,10 +1166,10 @@ CompiledStatement* Database::getCompiled
 
 CompiledStatement* Database::getCompiledStatement(Connection *connection, const WCString *sqlString)
 {
-	Sync syncDDL(&syncSysDDL, "Database::getCompiledStatement(WC)");
+	Sync syncDDL(&syncSysDDL, "Database::getCompiledStatement(3)");
 	syncDDL.lock(Shared);
 	
-	Sync syncStmt(&syncStatements, "Database::getCompiledStatement(WC)");
+	Sync syncStmt(&syncStatements, "Database::getCompiledStatement(4)");
 	syncStmt.lock(Shared);
 	
 	//JString str(sqlString);
@@ -1208,7 +1200,7 @@ CompiledStatement* Database::getCompiled
 
 CompiledStatement* Database::compileStatement(Connection *connection, JString sqlString)
 {
-	Sync syncDDL(&syncSysDDL, "Database::getCompiledStatement(WC)");
+	Sync syncDDL(&syncSysDDL, "Database::compileStatement(1)");
 	syncDDL.lock(Shared);
 	
 	CompiledStatement *statement = new CompiledStatement (connection);
@@ -1227,9 +1219,9 @@ CompiledStatement* Database::compileStat
 	if (statement->useable && 
 		(statement->numberParameters > 0 || !statement->filters.isEmpty()))
 		{
-		Sync syncStmt (&syncStatements, "Database::compileStatement(1)");
+		Sync syncStmt (&syncStatements, "Database::compileStatement(2)");
 		syncStmt.lock (Shared);
-		Sync syncAddStmt (&syncAddStatement, "Database::compileStatement(2)");
+		Sync syncAddStmt (&syncAddStatement, "Database::compileStatement(3)");
 		syncAddStmt.lock (Exclusive);
 		statement->addRef();
 		statement->next = compiledStatements;
@@ -1265,7 +1257,7 @@ void Database::commitSystemTransaction()
 
 void Database::rollbackSystemTransaction(void)
 {
-	Sync sync (&syncSysDDL, "Database::commitSystemTransaction");
+	Sync sync (&syncSysDDL, "Database::rollbackSystemTransaction");
 	sync.lock (Exclusive);
 	systemConnection->rollback();
 }
@@ -1331,10 +1323,10 @@ Table* Database::getTable(int tableId)
 
 Table* Database::loadTable(ResultSet * resultSet)
 {
-	Sync syncDDL(&syncSysDDL, "Database::loadTable");
+	Sync syncDDL(&syncSysDDL, "Database::loadTable(1)");
 	syncDDL.lock(Shared);
 
-	Sync syncObj(&syncTables, "Database::loadTable");
+	Sync syncObj(&syncTables, "Database::loadTable(2)");
 	
 	if (!resultSet->next())
 		return NULL;
@@ -1399,7 +1391,7 @@ void Database::flushInversion(Transactio
 
 void Database::dropTable(Table *table, Transaction *transaction)
 {
-	Sync syncDDL(&syncSysDDL, "Database::dropTable");
+	Sync syncDDL(&syncSysDDL, "Database::dropTable(1)");
 	syncDDL.lock(Exclusive);
 	
 	table->checkDrop();
@@ -1414,7 +1406,7 @@ void Database::dropTable(Table *table, T
 	
 	transactionManager->dropTable(table, transaction);
 
-	Sync syncTbl(&syncTables, "Database::dropTable");
+	Sync syncTbl(&syncTables, "Database::dropTable(2)");
 	syncTbl.lock(Exclusive);
 
 	// Remove table from linear table list
@@ -1455,7 +1447,7 @@ void Database::dropTable(Table *table, T
 
 	// Lock sections (factored out of SRLDropTable to avoid a deadlock)
 
-	Sync syncSections(&serialLog->syncSections, "Database::dropTable");
+	Sync syncSections(&serialLog->syncSections, "Database::dropTable(3)");
 	syncSections.lock(Exclusive);
 	table->expunge(getSystemTransaction());
 	delete table;
@@ -1463,7 +1455,7 @@ void Database::dropTable(Table *table, T
 
 void Database::truncateTable(Table *table, Sequence *sequence, Transaction *transaction)
 {
-	Sync syncDDL(&syncSysDDL, "Database::truncateTable");
+	Sync syncDDL(&syncSysDDL, "Database::truncateTable(1)");
 	syncDDL.lock(Exclusive);
 	
 	table->checkDrop();
@@ -1476,19 +1468,19 @@ void Database::truncateTable(Table *tabl
 						   
 	// Block table drop/add, table list scans ok
 	
-	Sync syncTbl(&syncTables, "Database::truncateTable");
+	Sync syncTbl(&syncTables, "Database::truncateTable(2)");
 	syncTbl.lock(Shared);
 	
 	//Lock sections (factored out of SRLDropTable to avoid a deadlock)
 	//The lock order (serialLog->syncSections before table->syncObject) is 
 	//important
 
-	Sync syncSections(&serialLog->syncSections, "Database::truncateTable");
+	Sync syncSections(&serialLog->syncSections, "Database::truncateTable(3)");
 	syncSections.lock(Exclusive);
 	
 	// No table access until truncate completes
 	
-	Sync syncObj(&table->syncObject, "Database::truncateTable");
+	Sync syncObj(&table->syncObject, "Database::truncateTable(4)");
 	syncObj.lock(Exclusive);
 	
 	table->deleting = true;
@@ -1675,10 +1667,10 @@ Role* Database::findRole(const WCString 
 
 void Database::validate(int optionMask)
 {
-	Sync syncDDL(&syncSysDDL, "Database::validate");
+	Sync syncDDL(&syncSysDDL, "Database::validate(1)");
 	syncDDL.lock(Shared);
 	
-	Sync syncObj(&syncObject, "Database::validate");
+	Sync syncObj(&syncObject, "Database::validate(2)");
 	syncObj.lock (Exclusive);
 	
 	Log::debug ("Validation:\n");
@@ -1764,7 +1756,7 @@ void Database::retireRecords(bool forced
 {
 	int cycle = scavengeCycle;
 	
-	Sync syncScavenger(&syncScavenge, "Database::retireRecords");
+	Sync syncScavenger(&syncScavenge, "Database::retireRecords(1)");
 	syncScavenger.lock(Exclusive);
 
 	if (forced && scavengeCycle > cycle)
@@ -1792,7 +1784,7 @@ void Database::retireRecords(bool forced
 		//LogStream stream;
 		//recordDataPool->analyze(0, &stream, NULL, NULL);
 		
-		Sync syncTbl(&syncTables, "Database::retireRecords");
+		Sync syncTbl(&syncTables, "Database::retireRecords(2)");
 		syncTbl.lock(Shared);
 		
 		Table *table;
@@ -2006,7 +1998,7 @@ JString Database::analyze(int mask)
 {
 	Stream stream;
 	stream.setMalloc (true);
-	Sync syncDDL(&syncSysDDL, "Database::analyze");
+	Sync syncDDL(&syncSysDDL, "Database::analyze(1)");
 
 	if (mask & analyzeMemory)
 		MemMgrAnalyze (mask, &stream);
@@ -2048,7 +2040,7 @@ JString Database::analyze(int mask)
 	if (mask & analyzeStatements)
 		{
 		stream.putSegment ("\nStatements\n");
-		Sync syncStmt(&syncStatements, "Database::analyze");
+		Sync syncStmt(&syncStatements, "Database::analyze(2)");
 		syncStmt.lock(Shared);
 
 		for (CompiledStatement *statement = compiledStatements; statement;
@@ -2359,10 +2351,10 @@ void Database::getTableSpaceFilesInfo(In
 
 void Database::updateCardinalities(void)
 {
-	Sync syncDDL(&syncSysDDL, "Database::updateCardinalities");
+	Sync syncDDL(&syncSysDDL, "Database::updateCardinalities(1)");
 	syncDDL.lock(Shared);
 	
-	Sync syncTbl(&syncTables, "Database::updateCardinalities");
+	Sync syncTbl(&syncTables, "Database::updateCardinalities(2)");
 	syncTbl.lock(Shared);
 	
 	bool hit = false;

=== modified file 'storage/falcon/DatabaseClone.cpp'
--- a/storage/falcon/DatabaseClone.cpp	2007-10-08 17:20:26 +0000
+++ b/storage/falcon/DatabaseClone.cpp	2008-07-17 13:52:17 +0000
@@ -50,7 +50,7 @@ void DatabaseClone::createFile(const cha
 	shadow = new IO;
 	shadow->pageSize = dbb->pageSize;
 	shadow->dbb = dbb;
-	shadow->createFile(fileName, 0);
+	shadow->createFile(fileName);
 }
 
 const char* DatabaseClone::getFileName(void)
@@ -78,7 +78,7 @@ void DatabaseClone::writePage(Bdb* bdb)
 
 void DatabaseClone::clone(void)
 {
-	Sync sync(&syncObject, "DatabaseClone::clone");
+	Sync sync(&syncObject, "DatabaseClone::clone(1)");
 	int n = 0;
 
 	for (;;)
@@ -111,7 +111,7 @@ void DatabaseClone::clone(void)
 			
 			//  In theory, we're done.  Lock the cache against changes, and check again
 			
-			Sync syncCache(&dbb->cache->syncObject, "Dbb::cloneFile");
+			Sync syncCache(&dbb->cache->syncObject, "DatabaseClone::clone(2)");
 			syncCache.lock(Exclusive);
 			lastPage = PageInventoryPage::getLastPage(dbb);
 

=== modified file 'storage/falcon/DatabaseCopy.cpp'
--- a/storage/falcon/DatabaseCopy.cpp	2007-09-20 15:44:25 +0000
+++ b/storage/falcon/DatabaseCopy.cpp	2008-07-24 08:45:03 +0000
@@ -31,6 +31,7 @@ DatabaseCopy::DatabaseCopy(Dbb *db)
 	rewrittenPages = NULL;
 	highWater = 0;
 	atEnd = false;
+	syncObject.setName("DatabaseCopy::syncObject");
 }
 
 DatabaseCopy::~DatabaseCopy(void)

=== modified file 'storage/falcon/Dbb.cpp'
--- a/storage/falcon/Dbb.cpp	2008-04-12 02:22:50 +0000
+++ b/storage/falcon/Dbb.cpp	2008-07-24 08:45:03 +0000
@@ -89,6 +89,8 @@ Dbb::Dbb(Database *dbase)
 	tableSpaceSectionId = 0;
 	tableSpaceId = 0;
 	noLog = false;
+	syncClone.setName("Dbb::syncClone");
+	syncSequences.setName("Dbb::syncSequences");
 }
 
 
@@ -147,7 +149,7 @@ Dbb::~Dbb()
 		dbb->close();
 }
 
-Cache* Dbb::create(const char * fileName, int pageSz, int64 cacheSize, FileType fileType, TransId transId, const char *logRoot, uint64 initialAllocation)
+Cache* Dbb::create(const char * fileName, int pageSz, int64 cacheSize, FileType fileType, TransId transId, const char *logRoot)
 {
 	serialLog = database->serialLog;
 	odsVersion = ODS_VERSION;
@@ -155,7 +157,7 @@ Cache* Dbb::create(const char * fileName
 	sequence = 1;
 
 	init(pageSz, (int) ((cacheSize + pageSz - 1) / pageSz));
-	createFile(fileName, initialAllocation);
+	createFile(fileName);
 	try
 		{
 		Hdr::create(this, fileType, transId, logRoot);
@@ -749,7 +751,7 @@ Bdb* Dbb::getSequencePage(int sequenceId
 	else
 	***/
 		{
-		Sync sync(&sequencesSyncObject, "Dbb::updateSequence");
+		Sync sync(&syncSequences, "Dbb::getSequencePage");
 		sync.lock(Shared);
 		int sequencePageSequence = sequenceId / sequencesPerPage;
 		int32 sequencePageNumber = sequencePages.get(sequencePageSequence);
@@ -970,7 +972,7 @@ void Dbb::cloneFile(Database *database, 
 /***
 void Dbb::cloneFile(DatabaseClone *shadow, bool isShadow)
 {
-	Sync sync (&cloneSyncObject, "Dbb::cloneFile(2)");
+	Sync sync (&syncClone, "Dbb::cloneFile(2)");
 	sync.lock (Exclusive);
 	shadow->next = shadows;
 	shadows = shadow;
@@ -1023,7 +1025,7 @@ void Dbb::cloneFile(DatabaseClone *shado
 
 bool Dbb::deleteShadow(DatabaseCopy *shadow)
 {
-	Sync sync (&cloneSyncObject, "Dbb::deleteShadow");
+	Sync sync (&syncClone, "Dbb::deleteShadow");
 	sync.lock (Exclusive);
 
 	for (DatabaseCopy **ptr = &shadows; *ptr; ptr = &(*ptr)->next)
@@ -1352,7 +1354,7 @@ void Dbb::upgradeSequenceSection(void)
 
 void Dbb::addShadow(DatabaseCopy* shadow)
 {
-	Sync sync (&cloneSyncObject, "Dbb::addShadow");
+	Sync sync (&syncClone, "Dbb::addShadow");
 	sync.lock (Exclusive);
 	shadow->next = shadows;
 	shadows = shadow;

=== modified file 'storage/falcon/Dbb.h'
--- a/storage/falcon/Dbb.h	2008-03-27 06:09:29 +0000
+++ b/storage/falcon/Dbb.h	2008-07-24 08:45:03 +0000
@@ -61,11 +61,11 @@ static const int FillLevels = 5;
 
 struct SectionAnalysis 
 {
-   int32		recordLocatorPages;
-   int32		dataPages;
-   int32		overflowPages;
-   int32		spaceAvailable;
-   int32		records;
+	int32		recordLocatorPages;
+	int32		dataPages;
+	int32		overflowPages;
+	int32		spaceAvailable;
+	int32		records;
 };
 
 struct IndexAnalysis
@@ -168,7 +168,7 @@ public:
 	Bdb*	fakePage (int32 pageNumber, PageType pageType, TransId transId);
 	Bdb*	trialFetch(int32 pageNumber, PageType pageType, LockType lockType);
 	void	init(int pageSz, int cacheSize);
-	Cache*	create (const char *fileName, int pageSize, int64 cacheSize, FileType fileType, TransId transId, const char *logRoot, uint64 initialAllocation);
+	Cache*	create (const char *fileName, int pageSize, int64 cacheSize, FileType fileType, TransId transId, const char *logRoot);
 	void	validateCache(void);
 	void	logUpdatedRecords(Transaction* transaction, RecordVersion* records, bool chill = false);
 	void	logIndexUpdates(DeferredIndex* deferredIndex);
@@ -214,8 +214,8 @@ public:
 	HdrState	priorState;
 	Inversion	*inversion;
 	DatabaseCopy *shadows;
-	SyncObject	cloneSyncObject;
-	SyncObject	sequencesSyncObject;
+	SyncObject	syncClone;
+	SyncObject	syncSequences;
 	SerialLog	*serialLog;
 	JString		logRoot;
 	SparseArray<int32, 100>	sequencePages;

=== modified file 'storage/falcon/DeferredIndex.cpp'
--- a/storage/falcon/DeferredIndex.cpp	2008-04-12 02:22:50 +0000
+++ b/storage/falcon/DeferredIndex.cpp	2008-07-25 18:07:24 +0000
@@ -60,6 +60,8 @@ DeferredIndex::DeferredIndex(Index *idx,
 	haveMinValue = true;
 	haveMaxValue = true;
 	window = NULL;
+	syncObject.setName("DeferredIndex::syncObject");
+	useCount = 1;   // the transaction that created it
 }
 
 DeferredIndex::~DeferredIndex(void)
@@ -357,11 +359,11 @@ bool DeferredIndex::deleteNode(IndexKey*
 	bool doingDIHash = (   (index->database->configuration->useDeferredIndexHash)
 	                    && (INDEX_IS_UNIQUE(index->type)));
 
-	Sync syncHash(&index->syncDIHash, "DeferredIndex::deleteNode");
+	Sync syncHash(&index->syncDIHash, "DeferredIndex::deleteNode(1)");
 	if (doingDIHash)
 		syncHash.lock(Exclusive);
 
-	Sync sync(&syncObject, "DeferredIndex::deleteNode");
+	Sync sync(&syncObject, "DeferredIndex::deleteNode(2)");
 	sync.lock(Exclusive);
 
 	DIBucket *buckets[DEFERRED_INDEX_MAX_LEVELS];
@@ -823,7 +825,7 @@ void DeferredIndex::detachIndex(void)
 
 void DeferredIndex::detachTransaction(void)
 {
-	Sync sync(&syncObject, "DeferredIndex::detachIndex");
+	Sync sync(&syncObject, "DeferredIndex::detachTransaction");
 	sync.lock(Exclusive);
 	transaction = NULL;
 
@@ -838,7 +840,7 @@ void DeferredIndex::detachTransaction(vo
 	else
 		sync.unlock();
 
-	delete this;
+	releaseRef();
 }
 
 void DeferredIndex::chill(Dbb *dbb)
@@ -874,3 +876,16 @@ DINode* DeferredIndex::findMinValue(void
 {
 	return NULL;
 }
+
+void DeferredIndex::addRef()
+{
+	INTERLOCKED_INCREMENT (useCount);
+}
+
+void DeferredIndex::releaseRef()
+{
+	INTERLOCKED_DECREMENT(useCount);
+
+	if (useCount == 0)
+		delete this;
+}
\ No newline at end of file

=== modified file 'storage/falcon/DeferredIndex.h'
--- a/storage/falcon/DeferredIndex.h	2008-06-08 06:52:51 +0000
+++ b/storage/falcon/DeferredIndex.h	2008-07-25 18:07:24 +0000
@@ -102,6 +102,7 @@ public:
 	DINode*			findMinValue(void);
 
 	SyncObject		syncObject;	
+	volatile INTERLOCK_TYPE useCount;
 	DeferredIndex	*next;
 	DeferredIndex	*prior;
 	DeferredIndex	*nextInTransaction;
@@ -123,6 +124,8 @@ public:
 	uint64			virtualOffset;		// virtual offset into the serial log where this DI was flushed.
 	uint64			virtualOffsetAtEnd;
 	SerialLogWindow	*window;
+	void			addRef();
+	void			releaseRef();
 };
 
 #endif

=== modified file 'storage/falcon/Gopher.cpp'
--- a/storage/falcon/Gopher.cpp	2008-07-09 19:23:23 +0000
+++ b/storage/falcon/Gopher.cpp	2008-07-15 18:57:27 +0000
@@ -39,11 +39,11 @@ void Gopher::gopherThread(void* arg)
 
 void Gopher::gopherThread(void)
 {
-	Sync deadMan(&log->syncGopher, "Gopher::gopherThread");
+	Sync deadMan(&log->syncGopher, "Gopher::gopherThread(1)");
 	deadMan.lock(Shared);
 	workerThread = Thread::getThread("Gopher::gopherThread");
 	active = true;
-	Sync syncPending (&log->pending.syncObject, "Gopher::gopherThread pending");
+	Sync syncPending (&log->pending.syncObject, "Gopher::gopherThread(2)");
 	syncPending.lock(Exclusive);
 	
 	while (!workerThread->shutdownInProgress && !log->finishing)

=== modified file 'storage/falcon/IO.cpp'
--- a/storage/falcon/IO.cpp	2008-07-08 21:36:34 +0000
+++ b/storage/falcon/IO.cpp	2008-07-24 08:45:03 +0000
@@ -133,6 +133,7 @@ IO::IO()
 	forceFsync = true;
 	fatalError = false;
 	memset(writeTypes, 0, sizeof(writeTypes));
+	syncObject.setName("IO::syncObject");
 }
 
 IO::~IO()
@@ -184,7 +185,7 @@ bool IO::openFile(const char * name, boo
 	return fileId != -1;
 }
 
-bool IO::createFile(const char *name, uint64 initialAllocation)
+bool IO::createFile(const char *name)
 {
 	Log::debug("IO::createFile: creating file \"%s\"\n", name);
 
@@ -218,26 +219,6 @@ bool IO::createFile(const char *name, ui
 #endif
 #endif
 
-	if (initialAllocation)
-		{
-		UCHAR *raw = new UCHAR[8192 * 257];
-		UCHAR *aligned = (UCHAR*) (((UIPTR) raw + 8191) / 8192 * 8192);
-		uint size = 8192 * 256;
-		memset(aligned, 0, size);
-		uint64 offset = 0;
-		
-		for (uint64 remaining = initialAllocation; remaining;)
-			{
-			uint n = (int) MIN(remaining, size);
-			write(offset, n, aligned);
-			offset += n;
-			remaining -= n;
-			}
-		
-		delete [] raw;
-		sync();
-		}
-
 	return fileId != -1;
 }
 

=== modified file 'storage/falcon/IOx.h'
--- a/storage/falcon/IOx.h	2008-07-07 14:00:45 +0000
+++ b/storage/falcon/IOx.h	2008-07-18 08:15:54 +0000
@@ -54,8 +54,8 @@ public:
 	void	writeHeader (Hdr *header);
 	int		read(int length, UCHAR *buffer);
 	void	write(uint32 length, const UCHAR *data);
-	bool	doesFileExist(const char *fileName);
-	int		fileStat(const char *fileName, struct stat *stats = NULL, int *errnum = NULL);
+	static bool	doesFileExist(const char *fileName);
+	static int	fileStat(const char *fileName, struct stat *stats = NULL, int *errnum = NULL);
 	void	declareFatalError();
 	void	seek (int pageNumber);
 	void	closeFile();
@@ -63,7 +63,7 @@ public:
 	void	writePage (Bdb *buffer, int type);
 	void	writePages(int32 pageNumber, int length, const UCHAR* data, int type);
 	void	readPage (Bdb *page);
-	bool	createFile (const char *name, uint64 initialAllocation);
+	bool	createFile (const char *name);
 	bool	openFile (const char *name, bool readOnly);
 	void	longSeek(int64 offset);
 	void	read(int64 offset, int length, UCHAR* buffer);

=== modified file 'storage/falcon/Index.cpp'
--- a/storage/falcon/Index.cpp	2008-05-07 22:37:18 +0000
+++ b/storage/falcon/Index.cpp	2008-07-25 18:07:24 +0000
@@ -107,6 +107,10 @@ void Index::init(Table *tbl, const char 
 	DIHashTable = NULL;
 	DIHashTableCounts =  0;
 	DIHashTableSlotsUsed =  0;
+
+	syncDIHash.setName("Index::syncDIHash");
+	syncUnique.setName("Index::syncUnique");
+	deferredIndexes.syncObject.setName("Index::deferredIndexes.syncObject");
 }
 
 Index::~Index()
@@ -227,7 +231,7 @@ DeferredIndex *Index::getDeferredIndex(T
 
 	if (deferredIndexes.count < transaction->deferredIndexCount)
 		{
-		Sync sync(&deferredIndexes.syncObject, "Index::insert");
+		Sync sync(&deferredIndexes.syncObject, "Index::getDeferredIndex(1)");
 		sync.lock(Shared);
 		for (deferredIndex = deferredIndexes.first; 
 			 deferredIndex; 
@@ -270,7 +274,7 @@ DeferredIndex *Index::getDeferredIndex(T
 
 	// Make a new one and attach to Index and Transaction.
 
-	Sync sync(&deferredIndexes.syncObject, "Index::insert");
+	Sync sync(&deferredIndexes.syncObject, "Index::getDeferredIndex(2)");
 	deferredIndex = new DeferredIndex(this, transaction);
 	sync.lock(Exclusive);
 	deferredIndexes.append(deferredIndex);
@@ -510,12 +514,14 @@ IndexWalker* Index::positionIndex(IndexK
 		for (DeferredIndex *deferredIndex = deferredIndexes.first; deferredIndex; deferredIndex = deferredIndex->next)
 			if (transaction->visible(deferredIndex->transaction, deferredIndex->transactionId, FOR_WRITING))
 				{
+				deferredIndex->addRef();
+
 				if (!indexWalker)
 					{
 					indexWalker = new IndexWalker(this, transaction, searchFlags);
 					indexWalker->addWalker(walkIndex);
 					}
-				
+
 				WalkDeferred *walkDeferred = new WalkDeferred(deferredIndex, transaction, searchFlags, &walkIndex->lowerBound, &walkIndex->upperBound);
 				indexWalker->addWalker(walkDeferred);
 				}
@@ -835,7 +841,7 @@ UCHAR Index::getPadByte(void)
 
 void Index::detachDeferredIndex(DeferredIndex *deferredIndex)
 {
-	Sync sync(&deferredIndexes.syncObject, "Index::detachDeferredIndex");
+	Sync sync(&deferredIndexes.syncObject, "Index::detachDeferredIndex(1)");
 	sync.lock(Exclusive);
 	deferredIndexes.remove(deferredIndex);
 	sync.unlock();
@@ -843,9 +849,9 @@ void Index::detachDeferredIndex(Deferred
 	if (   (database->configuration->useDeferredIndexHash)
 		&& (INDEX_IS_UNIQUE(type)))
 		{
-		Sync syncHash(&syncDIHash, "Index::detachDeferredIndex");
+		Sync syncHash(&syncDIHash, "Index::detachDeferredIndex(2)");
 		syncHash.lock(Exclusive);
-		Sync syncDI(&deferredIndex->syncObject, "Index::detachDeferredIndex");
+		Sync syncDI(&deferredIndex->syncObject, "Index::detachDeferredIndex(3)");
 		syncDI.lock(Exclusive);
 
 		DeferredIndexWalker walker(deferredIndex, NULL);

=== modified file 'storage/falcon/IndexWalker.cpp'
--- a/storage/falcon/IndexWalker.cpp	2008-07-14 16:53:51 +0000
+++ b/storage/falcon/IndexWalker.cpp	2008-07-29 11:12:34 +0000
@@ -39,6 +39,8 @@ IndexWalker::IndexWalker(Index *idx, Tra
 	balance = 0;
 	higher = NULL;
 	lower = NULL;
+	lastRecordNumber = 0;
+	firstRecord = true;
 }
 
 IndexWalker::~IndexWalker(void)
@@ -124,6 +126,18 @@ Record* IndexWalker::getNext(bool lockFo
 
 Record* IndexWalker::getValidatedRecord(int32 recordId, bool lockForUpdate)
 {
+	// If this is the same recordId as the last record we returned,
+	// then either we've got a duplicate copy because a deferred
+	// index has been merged with the main index and we read both
+	// or we're looking at a version we don't care about.
+
+	if (firstRecord)
+		firstRecord = false;
+	else if (recordId == lastRecordNumber)
+		return NULL;
+
+
+
 	// Fetch record.  If it doesn't exist, that's ok.
 	
 	Record *candidate = table->fetch(recordId);
@@ -165,7 +179,11 @@ Record* IndexWalker::getValidatedRecord(
 		
 		return NULL;
 		}
-	
+
+	// remember this record
+
+	lastRecordNumber = recordId;
+
 	return record;
 }
 
@@ -334,7 +352,7 @@ void IndexWalker::rotateLeft(void)
 
 	root->lower = this;
 	balance -= (1 + MAX(root->balance, 0));
-	validate ();
+//	validate ();
 	root->balance -= (1 - MIN(balance, 0));
 	RESET_PARENT(root);
 	root->parent = parent;
@@ -363,7 +381,7 @@ void IndexWalker::rotateRight(void)
 	root->higher = this;
 	balance += (1 - MIN(root->balance, 0));
 
-	validate ();
+//	validate ();
 	root->balance += (1 + MAX(balance, 0));
 	RESET_PARENT(root);
 	root->parent = parent;
@@ -454,7 +472,7 @@ void IndexWalker::remove(void)
 			{
 			parent->higher = next;
 			parent->rebalanceUpward(-1);
-            }	
+			}	
 		
 		return;	
 		}

=== modified file 'storage/falcon/IndexWalker.h'
--- a/storage/falcon/IndexWalker.h	2008-07-12 21:01:04 +0000
+++ b/storage/falcon/IndexWalker.h	2008-07-28 14:31:20 +0000
@@ -57,9 +57,11 @@ public:
 	UCHAR			*key;
 	uint			keyLength;
 	int32			recordNumber;
+	int32			lastRecordNumber;
 	int				balance;
 	int				searchFlags;
 	bool			first;
+	bool			firstRecord;
 };
 
 #endif

=== modified file 'storage/falcon/Inversion.cpp'
--- a/storage/falcon/Inversion.cpp	2008-02-26 20:18:33 +0000
+++ b/storage/falcon/Inversion.cpp	2008-07-24 08:45:03 +0000
@@ -61,6 +61,7 @@ Inversion::Inversion(Dbb *db)
 	runs = 0;
 	inserting = true;
 	state = 0;
+	syncObject.setName("Inversion::syncObject");
 }
 
 Inversion::~Inversion()

=== modified file 'storage/falcon/LicenseManager.cpp'
--- a/storage/falcon/LicenseManager.cpp	2008-03-03 18:40:17 +0000
+++ b/storage/falcon/LicenseManager.cpp	2008-07-15 18:57:27 +0000
@@ -130,7 +130,7 @@ void LicenseManager::initialize()
 LicenseProduct* LicenseManager::getProduct(const char *name)
 {
 	int slot = JString::hash (name, HASH_SIZE);
-    LicenseProduct *product;
+	LicenseProduct *product;
 
 	for (product = hashTable [slot]; product; product->collision)
 		if (product->product.equalsNoCase (name))

=== modified file 'storage/falcon/Makefile.am'
--- a/storage/falcon/Makefile.am	2008-07-19 03:03:39 +0000
+++ b/storage/falcon/Makefile.am	2008-08-07 14:19:54 +0000
@@ -22,9 +22,8 @@ DEFS= @DEFS@ \
       -D_REENTRANT -D_PTHREADS -DFALCONDB -DSTORAGE_ENGINE -DNAMESPACE=Nfs
 
 INCLUDES= -I$(top_srcdir)/include -I$(top_builddir)/include \
-	  -I$(top_srcdir)/regex -I$(top_srcdir)/sql \
-	  -I$(srcdir) -I$(srcdir)/TransformLib @ZLIB_INCLUDES@ \
-	  @FALCON_SPARC_ASSEMBLY@
+	  -I$(top_srcdir)/regex -I$(top_srcdir)/sql -I$(srcdir) \
+	  -I$(srcdir)/TransformLib @ZLIB_INCLUDES@ @FALCON_SPARC_ASSEMBLY@
 
 falcon_headers= Agent.h Alias.h Application.h \
 		AsciiBlob.h \
@@ -381,7 +380,7 @@ noinst_HEADERS=	$(falcon_headers) \
 
 EXTRA_LTLIBRARIES=	ha_falcon.la
 pkglib_LTLIBRARIES=	@plugin_falcon_shared_target@
-ha_falcon_la_LDFLAGS=	-module -rpath $(pkglibdir) -lstdc++
+ha_falcon_la_LDFLAGS=	-module -rpath $(pkglibdir)
 ha_falcon_la_CXXFLAGS=	$(AM_CXXFLAGS) -DMYSQL_DYNAMIC_PLUGIN
 ha_falcon_la_CFLAGS=	$(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN
 ha_falcon_la_LIBADD=	TransformLib/libtransform.la

=== modified file 'storage/falcon/MemMgr.cpp'
--- a/storage/falcon/MemMgr.cpp	2008-06-19 15:09:45 +0000
+++ b/storage/falcon/MemMgr.cpp	2008-08-07 14:19:54 +0000
@@ -543,7 +543,9 @@ void* MemMgr::allocateDebug(int size, co
 		{
 		length = ROUNDUP(size, defaultRounding) + OFFSET(MemBlock*, body) + sizeof(long);
 		memory = (MemBlock*) allocRaw(length);
+		memory->length = length;
 		memory->pool = NULL;
+		memory->length = length;
 		}
 
 #ifdef MEM_DEBUG

=== modified file 'storage/falcon/RecordLeaf.cpp'
--- a/storage/falcon/RecordLeaf.cpp	2008-05-09 19:58:50 +0000
+++ b/storage/falcon/RecordLeaf.cpp	2008-07-15 18:57:27 +0000
@@ -118,7 +118,7 @@ int RecordLeaf::retireRecords (Table *ta
 {
 	int count = 0;
 	Record **ptr, **end;
-	Sync sync(&syncObject, "RecordLeaf::retireRecords");
+	Sync sync(&syncObject, "RecordLeaf::retireRecords(1)");
 	sync.lock(Shared);
 	
 	// Get a shared lock to find at least one record to scavenge
@@ -134,7 +134,7 @@ int RecordLeaf::retireRecords (Table *ta
 				++count;
 			else if (record->isVersion())
 				{
-				Sync syncPrior(record->getSyncPrior(), "RecordLeaf::retireRecords1");
+				Sync syncPrior(record->getSyncPrior(), "RecordLeaf::retireRecords(2)");
 				syncPrior.lock(Shared);
 	
 				if (record->scavenge(recordScavenge, Shared))
@@ -167,7 +167,7 @@ int RecordLeaf::retireRecords (Table *ta
 			{
 			if (record->isVersion())
 				{
-				Sync syncPrior(record->getSyncPrior(), "RecordLeaf::retireRecords2");
+				Sync syncPrior(record->getSyncPrior(), "RecordLeaf::retireRecords(3)");
 				syncPrior.lock(Exclusive);
 				
 				if (record->scavenge(recordScavenge, Exclusive))

=== modified file 'storage/falcon/RecordVersion.cpp'
--- a/storage/falcon/RecordVersion.cpp	2008-04-27 03:13:23 +0000
+++ b/storage/falcon/RecordVersion.cpp	2008-07-15 18:57:27 +0000
@@ -247,7 +247,7 @@ void RecordVersion::scavenge(TransId tar
 	if (!priorVersion)
 		return;
 
-	Sync syncPrior(getSyncPrior(), "RecordVersion::scavenge()-savepoint");
+	Sync syncPrior(getSyncPrior(), "RecordVersion::scavenge");
 	syncPrior.lock(Shared);
 	
 	Record *rec = priorVersion;

=== modified file 'storage/falcon/RecoveryObjects.cpp'
--- a/storage/falcon/RecoveryObjects.cpp	2007-09-20 15:44:25 +0000
+++ b/storage/falcon/RecoveryObjects.cpp	2008-07-24 08:45:03 +0000
@@ -23,6 +23,8 @@
 #include "RecoveryObjects.h"
 #include "RecoveryPage.h"
 #include "SerialLog.h"
+#include "SyncObject.h"
+#include "Sync.h"
 
 #ifdef _DEBUG
 #undef THIS_FILE
@@ -38,6 +40,8 @@ RecoveryObjects::RecoveryObjects(SerialL
 {
 	serialLog = log;
 	memset(recoveryObjects, 0, sizeof(recoveryObjects));
+	for (int n = 0; n < RPG_HASH_SIZE; n++)
+		syncArray[n].setName("RecoveryObjects::syncArray");
 }
 
 RecoveryObjects::~RecoveryObjects()
@@ -95,17 +99,24 @@ bool RecoveryObjects::isObjectActive(int
 	return object->pass1Count == object->currentCount;
 }
 
-RecoveryPage* RecoveryObjects::findRecoveryObject(int objectNumber, int tableSpaceId)
-{
-	int slot = objectNumber % RPG_HASH_SIZE;
 
-	for (RecoveryPage *object = recoveryObjects[slot]; object; object = object->collision)
+static inline RecoveryPage * findInHashBucket(RecoveryPage *head, int objectNumber, int tableSpaceId)
+{
+	for (RecoveryPage *object = head ; object; object = object->collision)
 		if (object->objectNumber == objectNumber && object->tableSpaceId == tableSpaceId)
 			return object;
 
 	return NULL;
 }
 
+RecoveryPage* RecoveryObjects::findRecoveryObject(int objectNumber, int tableSpaceId)
+{
+	int slot = objectNumber % RPG_HASH_SIZE;
+	Sync sync(&syncArray[slot], "RecoveryObjects::findRecoveryObject");
+	sync.lock(Shared);
+	return findInHashBucket(recoveryObjects[slot], objectNumber, tableSpaceId);
+}
+
 void RecoveryObjects::setActive(int objectNumber, int tableSpaceId)
 {
 	RecoveryPage *object = findRecoveryObject(objectNumber, tableSpaceId);
@@ -129,10 +140,25 @@ RecoveryPage* RecoveryObjects::getRecove
 	int slot = objectNumber % RPG_HASH_SIZE;
 	RecoveryPage *object;
 
-	for (object = recoveryObjects[slot]; object; object = object->collision)
-		if (object->objectNumber == objectNumber && object->tableSpaceId == tableSpaceId)
-			return object;
+	Sync sync(&syncArray[slot], "RecoveryObjects::getRecoveryObject");
+	sync.lock(Shared);
+	object = findInHashBucket(recoveryObjects[slot], objectNumber, tableSpaceId);
+
+	if(object)
+		return object;
+
+	// Object not found, insert (need exlusive lock for this)
+	sync.unlock();
+	sync.lock(Exclusive);
+
+	// We need to traverse the collision list once again. Another thread 
+	// may have inserted the entry while current thread was waiting 
+	// for exclusive lock.
+	object = findInHashBucket(recoveryObjects[slot], objectNumber, tableSpaceId);
+	if (object)
+		return object;
 
+	// Add object to the start of the collision list
 	object = new RecoveryPage(objectNumber, tableSpaceId);
 	object->collision = recoveryObjects[slot];
 	recoveryObjects[slot] = object;
@@ -143,7 +169,9 @@ RecoveryPage* RecoveryObjects::getRecove
 void RecoveryObjects::deleteObject(int objectNumber, int tableSpaceId)
 {
 	int slot = objectNumber % RPG_HASH_SIZE;
-	
+	Sync sync(&syncArray[slot], "RecoveryObjects::deleteObject");
+	sync.lock(Exclusive);
+
 	for (RecoveryPage **ptr = recoveryObjects + slot, *object; (object = *ptr); ptr = &object->collision)
 		if (object->objectNumber == objectNumber && object->tableSpaceId == tableSpaceId)
 			{

=== modified file 'storage/falcon/RecoveryObjects.h'
--- a/storage/falcon/RecoveryObjects.h	2007-09-20 15:44:25 +0000
+++ b/storage/falcon/RecoveryObjects.h	2008-07-18 21:24:52 +0000
@@ -26,6 +26,7 @@
 
 static const int RPG_HASH_SIZE			= 101;
 
+#include "SyncObject.h"
 class RecoveryPage;
 class SerialLog;
 
@@ -48,6 +49,7 @@ public:
 
 	SerialLog			*serialLog;
 	RecoveryPage		*recoveryObjects[RPG_HASH_SIZE];
+	SyncObject			syncArray[RPG_HASH_SIZE];
 };
 
 #endif // !defined(AFX_RECOVERYOBJECTS_H__00C7CE5F_3C33_435C_9521_9C274CAB0581__INCLUDED_)

=== modified file 'storage/falcon/Repository.cpp'
--- a/storage/falcon/Repository.cpp	2008-03-03 18:40:17 +0000
+++ b/storage/falcon/Repository.cpp	2008-07-24 08:45:03 +0000
@@ -61,6 +61,7 @@ Repository::Repository(const char *repos
 		setRollover (rollovers);
 
 	memset (volumes, 0, sizeof (volumes));
+	syncObject.setName("Repository::syncObject");
 }
 
 Repository::~Repository()
@@ -339,7 +340,7 @@ void Repository::setVolume(int volume)
 
 void Repository::save()
 {
-	Sync syncDDL(&database->syncSysDDL, "Repository::update");
+	Sync syncDDL(&database->syncSysDDL, "Repository::save");
 	syncDDL.lock (Shared);
 	PreparedStatement *statement = database->prepareStatement (
 		"replace into system.repositories (repositoryName,schema,sequenceName,filename,rollovers,currentVolume)"

=== modified file 'storage/falcon/RepositoryManager.cpp'
--- a/storage/falcon/RepositoryManager.cpp	2007-09-20 15:44:25 +0000
+++ b/storage/falcon/RepositoryManager.cpp	2008-07-24 08:45:03 +0000
@@ -46,6 +46,7 @@ RepositoryManager::RepositoryManager(Dat
 {
 	database = db;
 	memset (repositories, 0, sizeof (repositories));
+	syncObject.setName("RepositoryManager::syncObject");
 }
 
 RepositoryManager::~RepositoryManager()
@@ -113,7 +114,7 @@ Repository* RepositoryManager::getReposi
 
 Repository* RepositoryManager::createRepository(const char *name, const char *schema, Sequence *sequence, const char *fileName, int volume, const char *rolloverString)
 {
-	Sync sync (&syncObject, "RepositoryManager::getRepository");
+	Sync sync (&syncObject, "RepositoryManager::createRepository");
 	sync.lock (Exclusive);
 	Repository *repository = findRepository (schema, database->getSymbol (name));
 
@@ -135,7 +136,7 @@ Repository* RepositoryManager::createRep
 void RepositoryManager::deleteRepository(Repository *repository)
 {
 	repository->drop();
-	Sync sync (&syncObject, "RepositoryManager::getRepository");
+	Sync sync (&syncObject, "RepositoryManager::deleteRepository");
 	sync.lock (Exclusive);
 	int slot = HASH (repository->schema, REPOSITORY_HASH_SIZE);
 

=== modified file 'storage/falcon/RepositoryVolume.cpp'
--- a/storage/falcon/RepositoryVolume.cpp	2008-03-28 22:44:36 +0000
+++ b/storage/falcon/RepositoryVolume.cpp	2008-07-24 08:45:03 +0000
@@ -75,6 +75,7 @@ RepositoryVolume::RepositoryVolume(Repos
 	lastAccess = 0;
 	rootPage = 0;
 	section = NULL;
+	syncObject.setName("RepositoryVolume::syncObject");
 }
 
 RepositoryVolume::~RepositoryVolume()
@@ -90,7 +91,7 @@ void RepositoryVolume::storeBlob(BlobRef
 
 void RepositoryVolume::storeBlob(int64 blobId, Stream *stream, Transaction *transaction)
 {
-	Sync sync (&syncObject, "RepositoryVolume::getBlob");
+	Sync sync (&syncObject, "RepositoryVolume::storeBlob");
 	sync.lock (Shared);
 
 	while (!isWritable)
@@ -216,7 +217,7 @@ void RepositoryVolume::makeWritable()
 	if (isWritable)
 		return;
 
-	Sync sync(&syncObject, "RepositoryVolume::getBlob");
+	Sync sync(&syncObject, "RepositoryVolume::makeWritable");
 	sync.lock(Exclusive);
 
 	if (isWritable)
@@ -232,7 +233,7 @@ void RepositoryVolume::makeWritable()
 void RepositoryVolume::create()
 {
 	IO::createPath (fileName);
-	dbb->create(fileName, dbb->pageSize, 0, HdrRepositoryFile, 0, NULL, 0);
+	dbb->create(fileName, dbb->pageSize, 0, HdrRepositoryFile, 0, NULL);
 	Sync syncDDL(&database->syncSysDDL, "RepositoryVolume::create");
 	Transaction *transaction = database->getSystemTransaction();
 	syncDDL.lock(Exclusive);
@@ -399,7 +400,7 @@ int64 RepositoryVolume::getRepositorySiz
 
 void RepositoryVolume::deleteBlob(int64 blobId, Transaction *transaction)
 {
-	Sync sync (&syncObject, "RepositoryVolume::getBlob");
+	Sync sync (&syncObject, "RepositoryVolume::deleteBlob");
 	sync.lock (Shared);
 
 	while (!isWritable)
@@ -464,7 +465,7 @@ void RepositoryVolume::scavenge()
 	if (!isOpen || lastAccess + TIMEOUT > database->timestamp)
 		return;
 
-	Sync sync (&syncObject, "RepositoryVolume::getBlob");
+	Sync sync (&syncObject, "RepositoryVolume::scavenge");
 	sync.lock (Exclusive);
 
 	if (!isOpen || lastAccess + TIMEOUT > database->timestamp)

=== modified file 'storage/falcon/ResultSet.cpp'
--- a/storage/falcon/ResultSet.cpp	2007-09-20 15:44:25 +0000
+++ b/storage/falcon/ResultSet.cpp	2008-07-24 08:45:03 +0000
@@ -96,6 +96,7 @@ void ResultSet::init(int count)
 	javaStatementCount = 0;
 	connection = NULL;
 	database = NULL;
+	syncObject.setName("ResultSet::syncObject");
 }
 
 ResultSet::~ResultSet()

=== modified file 'storage/falcon/Role.cpp'
--- a/storage/falcon/Role.cpp	2008-03-03 18:40:17 +0000
+++ b/storage/falcon/Role.cpp	2008-07-24 08:45:03 +0000
@@ -44,6 +44,7 @@ Role::Role(Database *db, const char* rol
 	setName (roleSchema, roleName);
 	useCount = 1;
 	memset (privileges, 0, sizeof (privileges));
+	syncObject.setName("Role::syncObject");
 }
 
 Role::~Role()

=== modified file 'storage/falcon/SQLParse.cpp'
--- a/storage/falcon/SQLParse.cpp	2008-04-05 22:09:17 +0000
+++ b/storage/falcon/SQLParse.cpp	2008-07-17 13:52:17 +0000
@@ -3298,21 +3298,6 @@ Syntax* SQLParse::parseCreateTableSpace(
 
 	for (;;)
 		{
-		/***
-		if (match("INITIAL_SIZE"))
-			options.append (makeNode(nod_initial_size, parseNumber()));
-		else if (match ("EXTENT_SIZE"))
-			options.append (makeNode(nod_extent_size, parseNumber()));
-		else if (match ("AUTOEXTEND_SIZE"))
-			options.append (makeNode(nod_autoextend_size, parseNumber()));
-		else if (match ("MAX_SIZE"))
-			options.append (makeNode(nod_max_size, parseNumber()));
-		else if (match ("NODEGROUP"))
-			options.append (makeNode(nod_nodegroup, parseNumber()));
-		else if (match ("WAIT"))
-			options.append (makeNode(nod_wait, parseNumber()));
-		else
-		***/ 
 		if (match ("COMMENT"))
 			options.append (makeNode(nod_comment, parseQuotedString()));
 		else if (match (","))

=== modified file 'storage/falcon/SRLCreateTableSpace.cpp'
--- a/storage/falcon/SRLCreateTableSpace.cpp	2008-04-05 22:09:17 +0000
+++ b/storage/falcon/SRLCreateTableSpace.cpp	2008-07-17 13:52:17 +0000
@@ -52,14 +52,6 @@ void SRLCreateTableSpace::append(TableSp
 	putInt(len);
 	putData(len, (const UCHAR*) p);
 	putInt(tableSpace->type);
-	/***
-	putInt64(tableSpace->initialSize);
-	putInt64(tableSpace->extentSize);
-	putInt64(tableSpace->autoextendSize);
-	putInt64(tableSpace->maxSize);
-	putInt(tableSpace->nodegroup);
-	putInt(tableSpace->wait);
-	***/
 	p = tableSpace->comment;
 	len = (int)strlen(p);
 	putInt(len);
@@ -81,27 +73,11 @@ void SRLCreateTableSpace::read()
 		
 	if (control->version >= srlVersion15)
 		{
-		/***
-		initialSize	= getInt64();
-		extentSize	= getInt64();
-		autoextendSize= getInt64();
-		maxSize		= getInt64();
-		nodegroup	= getInt();
-		wait		= getInt();
-		***/
 		commentLength = getInt();
 		comment = (const char*) getData(commentLength);
 		}
 	else
 		{
-		/***
-		initialSize	= 0;
-		extentSize	= 0;
-		autoextendSize= 0;
-		maxSize		= 0;
-		nodegroup	= 0;
-		wait		= 0;
-		***/
 		commentLength = 0;
 		comment = NULL;
 		}
@@ -110,17 +86,7 @@ void SRLCreateTableSpace::read()
 void SRLCreateTableSpace::pass1()
 {
 	TableSpaceInit tsInit;
-	
-	/***
-	tsInit.initialSize	= initialSize;
-	tsInit.extentSize	= extentSize;
-	tsInit.autoextendSize = autoextendSize;
-	tsInit.maxSize		= maxSize;
-	tsInit.nodegroup	= nodegroup;
-	tsInit.wait			= wait;
-	***/
 	tsInit.comment		= comment;
-		
 	log->database->tableSpaceManager->redoCreateTableSpace(tableSpaceId, nameLength, name, filenameLength, filename, type, &tsInit);
 }
 

=== modified file 'storage/falcon/SRLCreateTableSpace.h'
--- a/storage/falcon/SRLCreateTableSpace.h	2008-04-05 22:09:17 +0000
+++ b/storage/falcon/SRLCreateTableSpace.h	2008-07-17 13:52:17 +0000
@@ -48,14 +48,6 @@ public:
 	int			nameLength;
 	int			filenameLength;
 	int			type;
-	/***
-	int64		initialSize;
-	int64		extentSize;
-	int64		autoExtendSize;
-	int64		maxSize;
-	int			nodegroup;
-	int			wait;
-	***/
 	const char	*comment;
 	int			commentLength;
 };

=== modified file 'storage/falcon/SRLDeleteIndex.cpp'
--- a/storage/falcon/SRLDeleteIndex.cpp	2007-10-11 12:12:16 +0000
+++ b/storage/falcon/SRLDeleteIndex.cpp	2008-07-15 18:57:27 +0000
@@ -44,10 +44,10 @@ SRLDeleteIndex::~SRLDeleteIndex()
 
 void SRLDeleteIndex::append(Dbb *dbb, TransId transId, int id, int idxVersion)
 {
-	Sync syncIndexes(&log->syncIndexes, "SRLDeleteIndex::append");
+	Sync syncIndexes(&log->syncIndexes, "SRLDeleteIndex::append(1)");
 	syncIndexes.lock(Exclusive);
 
-	START_RECORD(srlDeleteIndex, "SRLDeleteIndex::append");
+	START_RECORD(srlDeleteIndex, "SRLDeleteIndex::append(2)");
 	putInt(dbb->tableSpaceId);
 	log->getTransaction(transId);
 	log->setIndexInactive(id, dbb->tableSpaceId);

=== modified file 'storage/falcon/SRLPrepare.cpp'
--- a/storage/falcon/SRLPrepare.cpp	2007-12-02 20:17:29 +0000
+++ b/storage/falcon/SRLPrepare.cpp	2008-07-24 08:45:03 +0000
@@ -43,7 +43,7 @@ SRLPrepare::~SRLPrepare()
 
 void SRLPrepare::append(TransId transId, int xidLength, const UCHAR *xid)
 {
-	START_RECORD(srlPrepare, "");
+	START_RECORD(srlPrepare, "SRLPrepare::append");
 	putInt(transId);
 	putInt(xidLength);
 	putData(xidLength, xid);

=== modified file 'storage/falcon/SRLRollback.cpp'
--- a/storage/falcon/SRLRollback.cpp	2007-09-20 15:44:25 +0000
+++ b/storage/falcon/SRLRollback.cpp	2008-07-24 08:45:03 +0000
@@ -40,7 +40,7 @@ SRLRollback::~SRLRollback()
 
 void SRLRollback::append(TransId transId, bool updateTransaction)
 {
-	START_RECORD(srlRollback, "");
+	START_RECORD(srlRollback, "SRLRollback::append");
 	putInt(transId);
 	uint64 commitBlockNumber = log->nextBlockNumber;
 	SerialLogTransaction *transaction = log->findTransaction(transId);

=== modified file 'storage/falcon/SRLUpdateIndex.cpp'
--- a/storage/falcon/SRLUpdateIndex.cpp	2008-04-12 02:22:50 +0000
+++ b/storage/falcon/SRLUpdateIndex.cpp	2008-07-15 18:57:27 +0000
@@ -40,7 +40,7 @@ SRLUpdateIndex::~SRLUpdateIndex(void)
 
 void SRLUpdateIndex::append(DeferredIndex* deferredIndex)
 {
-	Sync syncIndexes(&log->syncIndexes, "SRLUpdateIndex::append");
+	Sync syncIndexes(&log->syncIndexes, "SRLUpdateIndex::append(1)");
 	syncIndexes.lock(Shared);
 
 	Transaction *transaction = deferredIndex->transaction;
@@ -57,7 +57,7 @@ void SRLUpdateIndex::append(DeferredInde
 
 	for (DINode *node = walker.next(); node;)
 		{
-		START_RECORD(srlUpdateIndex, "SRLUpdateIndex::append");
+		START_RECORD(srlUpdateIndex, "SRLUpdateIndex::append(2)");
 		log->updateIndexUseVector(indexId, tableSpaceId, 1);
 		SerialLogTransaction *srlTrans = log->getTransaction(transaction->transactionId);
 		srlTrans->setTransaction(transaction);

=== modified file 'storage/falcon/Scheduler.cpp'
--- a/storage/falcon/Scheduler.cpp	2008-03-05 20:28:53 +0000
+++ b/storage/falcon/Scheduler.cpp	2008-07-24 08:45:03 +0000
@@ -66,6 +66,7 @@ Scheduler::Scheduler(Database *db)
 	events = NULL;
 	useCount = 1;
 	thread = NULL;
+	syncObject.setName("Scheduler::syncObject");
 }
 
 Scheduler::~Scheduler()
@@ -210,10 +211,10 @@ void Scheduler::start()
 
 void Scheduler::updateSchedule(const char *appName, const char *eventName, User *user, const char *schedule)
 {
-	Sync syncDDL (&database->syncSysDDL, "Scheduler::updateSchedule(2)");
+	Sync syncDDL (&database->syncSysDDL, "Scheduler::updateSchedule(1)");
 	syncDDL.lock (Exclusive);
 
-	Sync syncObj(&syncObject, "Scheduler::updateSchedule");
+	Sync syncObj(&syncObject, "Scheduler::updateSchedule(2)");
 	syncObj.lock(Exclusive);
 
 	// Ditch old event

=== modified file 'storage/falcon/SectorBuffer.cpp'
--- a/storage/falcon/SectorBuffer.cpp	2008-07-10 19:00:14 +0000
+++ b/storage/falcon/SectorBuffer.cpp	2008-07-24 08:45:03 +0000
@@ -25,6 +25,7 @@ SectorBuffer::SectorBuffer()
 {
 	activeLength = 0;
 	sectorNumber = -1;
+	syncObject.setName("SectorBuffer::syncObject");
 }
 
 SectorBuffer::~SectorBuffer(void)

=== modified file 'storage/falcon/SectorCache.cpp'
--- a/storage/falcon/SectorCache.cpp	2008-06-17 21:00:45 +0000
+++ b/storage/falcon/SectorCache.cpp	2008-07-24 08:45:03 +0000
@@ -46,6 +46,8 @@ SectorCache::SectorCache(int numBuffers,
 		buffer->cache = this;
 		buffer->buffer = p;
 		}
+
+	syncObject.setName("SectorCache::syncObject");
 }
 
 SectorCache::~SectorCache(void)
@@ -56,7 +58,7 @@ SectorCache::~SectorCache(void)
 
 void SectorCache::readPage(Bdb* bdb)
 {
-	Sync sync(&syncObject, "SectorCache::readPage");
+	Sync sync(&syncObject, "SectorCache::readPage(1)");
 	sync.lock(Shared);
 	int sectorNumber = bdb->pageNumber / pagesPerSector;
 	int slot = sectorNumber % SECTOR_HASH_SIZE;
@@ -89,7 +91,7 @@ void SectorCache::readPage(Bdb* bdb)
 	
 	buffer = nextBuffer;
 	nextBuffer = buffer->next;
-	Sync syncBuffer(&buffer->syncObject, "SectorCache::readPage(3)");
+	Sync syncBuffer(&buffer->syncObject, "SectorCache::readPage(4)");
 	syncBuffer.lock(Exclusive);
 	
 	if (buffer->sectorNumber >= 0)
@@ -111,7 +113,7 @@ void SectorCache::readPage(Bdb* bdb)
 
 void SectorCache::writePage(Bdb* bdb)
 {
-	Sync sync(&syncObject, "SectorCache::writePage");
+	Sync sync(&syncObject, "SectorCache::writePage(1)");
 	sync.lock(Shared);
 	int sectorNumber = bdb->pageNumber / pagesPerSector;
 	int slot = sectorNumber % SECTOR_HASH_SIZE;

=== modified file 'storage/falcon/SequenceManager.cpp'
--- a/storage/falcon/SequenceManager.cpp	2008-03-03 18:40:17 +0000
+++ b/storage/falcon/SequenceManager.cpp	2008-07-24 08:45:03 +0000
@@ -54,6 +54,7 @@ SequenceManager::SequenceManager(Databas
 {
 	database = db;
 	memset (sequences, 0, sizeof (sequences));
+	syncObject.setName("SequenceManager::syncObject");
 }
 
 SequenceManager::~SequenceManager()

=== modified file 'storage/falcon/SerialLog.cpp'
--- a/storage/falcon/SerialLog.cpp	2008-07-09 19:23:23 +0000
+++ b/storage/falcon/SerialLog.cpp	2008-07-24 08:45:03 +0000
@@ -125,7 +125,9 @@ SerialLog::SerialLog(Database *db, JStri
 	syncIndexes.setName("SerialLog::syncIndexes");
 	syncGopher.setName("SerialLog::syncGopher");
 	syncUpdateStall.setName("SerialLog::syncUpdateStall");
-	pending.syncObject.setName("SerialLog::pending transactions");
+	pending.syncObject.setName("SerialLog::pending.syncObject");
+	inactions.syncObject.setName("SerialLog::inactions.syncObject");
+	running.syncObject.setName("SerialLog::running.syncObject");
 	gophers = NULL;
 	wantToSerializeGophers = 0;
 	serializeGophers = 0;
@@ -1292,11 +1294,12 @@ bool SerialLog::indexInUse(int indexId, 
 	TableSpaceInfo *info = getTableSpaceInfo(tableSpaceId);
 	return info->indexUseVector.get(indexId) > 0;
 }
-
+/*
 int SerialLog::getPageState(int32 pageNumber, int tableSpaceId)
 {
 	return recoveryPages->getCurrentState(pageNumber, tableSpaceId);
 }
+*/
 
 void SerialLog::redoFreePage(int32 pageNumber, int tableSpaceId)
 {
@@ -1366,7 +1369,7 @@ void SerialLog::reportStatistics(void)
 
 void SerialLog::getSerialLogInfo(InfoTable* tableInfo)
 {
-	Sync sync(&pending.syncObject, "SerialLog::getSerialLogInfo");
+	Sync sync(&pending.syncObject, "SerialLog::getSerialLogInfo(1)");
 	sync.lock(Shared);
 	int numberTransactions = 0;
 	uint64 minBlockNumber = writeBlock->blockNumber;
@@ -1382,7 +1385,7 @@ void SerialLog::getSerialLogInfo(InfoTab
 	int64 delta = writeBlock->blockNumber - minBlockNumber;
 	sync.unlock();
 	
-	Sync syncWindows(&syncWrite, "SerialLog::getSerialLogInfo");
+	Sync syncWindows(&syncWrite, "SerialLog::getSerialLogInfo(1)");
 	syncWindows.lock(Shared);
 	int windows = 0;
 	int buffers = 0;
@@ -1439,13 +1442,13 @@ void SerialLog::preCommit(Transaction* t
 	
 	if (!serialLogTransaction)
 		{
-		Sync writeSync(&syncWrite, "SerialLog::preCommit");
+		Sync writeSync(&syncWrite, "SerialLog::preCommit(1)");
 		writeSync.lock(Exclusive);
 		startRecord();
 		serialLogTransaction = getTransaction(transaction->transactionId);
 		}
 		
-	Sync sync (&pending.syncObject, "SerialLog::activate");
+	Sync sync (&pending.syncObject, "SerialLog::preCommit(2)");
 	sync.lock(Exclusive);
 	running.remove(serialLogTransaction);
 	pending.append(serialLogTransaction);

=== modified file 'storage/falcon/SerialLog.h'
--- a/storage/falcon/SerialLog.h	2008-07-09 19:23:23 +0000
+++ b/storage/falcon/SerialLog.h	2008-07-24 08:45:03 +0000
@@ -132,7 +132,7 @@ public:
 	bool			bumpSectionIncarnation (int sectionId, int tableSpaceId, int state);
 	bool			bumpPageIncarnation (int32 pageNumber, int tableSpaceId, int state);
 
-	int				getPageState(int32 pageNumber, int tableSpaceId);
+//	int				getPageState(int32 pageNumber, int tableSpaceId);
 	void			redoFreePage(int32 pageNumber, int tableSpaceId);
 	
 	bool			indexInUse(int indexId, int tableSpaceId);

=== modified file 'storage/falcon/SerialLogFile.cpp'
--- a/storage/falcon/SerialLogFile.cpp	2008-07-08 21:36:34 +0000
+++ b/storage/falcon/SerialLogFile.cpp	2008-07-15 18:57:27 +0000
@@ -169,7 +169,7 @@ void SerialLogFile::close()
 void SerialLogFile::write(int64 position, uint32 length, const SerialLogBlock *data)
 {
 	uint32 effectiveLength = ROUNDUP(length, sectorSize);
-    time_t start = database->timestamp;
+	time_t start = database->timestamp;
 	Priority priority(database->ioScheduler);
 	
 	if (!(position == writePoint || position == 0 || writePoint == 0))
@@ -202,7 +202,7 @@ void SerialLogFile::write(int64 position
 #if defined(HAVE_PREAD) && !defined(HAVE_BROKEN_PREAD)
 	uint32 n = ::pwrite (handle, data, effectiveLength, position);
 #else
-	Sync sync (&syncObject, "IO::pwrite");
+	Sync sync (&syncObject, "SerialLogFile::write");
 	sync.lock (Exclusive);
 
 	if (position != offset)
@@ -244,7 +244,7 @@ void SerialLogFile::write(int64 position
 uint32 SerialLogFile::read(int64 position, uint32 length, UCHAR *data)
 {
 	uint32 effectiveLength = ROUNDUP(length, sectorSize);
-	//Sync syncIO(&database->syncSerialLogIO, "SerialLogFile::read");
+	//Sync syncIO(&database->syncSerialLogIO, "SerialLogFile::read(1)");
 	Priority priority(database->ioScheduler);
 
 	if (falcon_serial_log_priority)
@@ -274,7 +274,7 @@ uint32 SerialLogFile::read(int64 positio
 #if defined(HAVE_PREAD) && !defined(HAVE_BROKEN_PREAD)
 	int n = ::pread (handle, data, effectiveLength, position);
 #else
-	Sync sync(&syncObject, "SerialLogFile::read");
+	Sync sync(&syncObject, "SerialLogFile::read(2)");
 	sync.lock(Exclusive);
 	ASSERT(position < writePoint || writePoint == 0);
 	off_t loc = lseek(handle, position, SEEK_SET);

=== modified file 'storage/falcon/Server.cpp'
--- a/storage/falcon/Server.cpp	2007-09-20 15:44:25 +0000
+++ b/storage/falcon/Server.cpp	2008-07-24 08:45:03 +0000
@@ -72,6 +72,7 @@ Server::Server(Server *server, Protocol 
 
 	protocol = proto;
 	threads = NULL;
+	syncObject.setName("Server::syncObject");
 }
 
 Server::Server(int requestedPort, const char *configFileName)

=== modified file 'storage/falcon/SessionManager.cpp'
--- a/storage/falcon/SessionManager.cpp	2007-09-20 15:44:25 +0000
+++ b/storage/falcon/SessionManager.cpp	2008-07-15 18:57:27 +0000
@@ -454,7 +454,7 @@ void SessionManager::purged(Session *ses
 
 void SessionManager::removeSession(Session *session)
 {
-	Sync sync (&syncObject, "SessionManager::close");
+	Sync sync (&syncObject, "SessionManager::removeSession");
 	sync.lock (Exclusive);
 
 	// If it's in a queue, take it out now
@@ -485,7 +485,7 @@ LicenseToken* SessionManager::waitForLic
 	// If somebody else if waiting, and we're unwilling to
 	// wait, just say no.
 
-	Sync sync (&syncObject, "SessionManager::getLicenseToken");
+	Sync sync (&syncObject, "SessionManager::waitForLicense");
 	sync.lock (Exclusive);
 
 	if (waiting.first && !target)
@@ -495,7 +495,7 @@ LicenseToken* SessionManager::waitForLic
 
 	if (target)
 		{
-		target->thread = Thread::getThread("SessionManager::getLicenseToken");
+		target->thread = Thread::getThread("SessionManager::waitForLicense");
 		waiting.insert (target);
 		}
 

=== modified file 'storage/falcon/Statement.cpp'
--- a/storage/falcon/Statement.cpp	2008-07-09 04:38:02 +0000
+++ b/storage/falcon/Statement.cpp	2008-07-24 08:45:03 +0000
@@ -144,6 +144,7 @@ Statement::Statement(Connection *pConnec
 	special = false;
 	active = false;
 	memset (&stats, 0, sizeof (stats));
+	syncObject.setName("Statement::syncObject");
 }
 
 Statement::~Statement()
@@ -1959,7 +1960,7 @@ const char* Statement::getName(Syntax * 
 void Statement::connectionClosed()
 {
 	addRef();
-	Sync sync (&syncObject, "Statement::close");
+	Sync sync (&syncObject, "Statement::connectionClosed");
 	sync.lock (Exclusive);
 
 	/***
@@ -2965,26 +2966,6 @@ void Statement::createTableSpace(Syntax 
 
 		switch (child->type)
 			{
-			/***
-			case nod_initial_size:
-				tsInit.initial_size = child->getChild(0)->getQuad();
-				break;
-			case nod_extent_size:
-				tsInit.extent_size = child->getChild(0)->getQuad();
-				break;
-			case nod_autoextend_size:
-				tsInit.autoextend_size = child->getChild(0)->getQuad();
-				break;
-			case nod_max_size:
-				tsInit.maxSize = child->getChild(0)->getQuad();
-				break;
-			case nod_nodegroup:
-				tsInit.nodegroup = child->getChild(0)->getNumber();
-				break;
-			case nod_wait:
-				tsInit.wait = child->getChild(0)->getNumber();
-				break;
-			***/
 			case nod_comment:
 				tsInit.comment = child->getChild(0)->getString();
 				break;

=== modified file 'storage/falcon/StorageDatabase.cpp'
--- a/storage/falcon/StorageDatabase.cpp	2008-07-09 04:38:02 +0000
+++ b/storage/falcon/StorageDatabase.cpp	2008-07-24 08:45:03 +0000
@@ -100,6 +100,8 @@ StorageDatabase::StorageDatabase(Storage
 		//SyncTest syncTest;
 		//syncTest.test();
 		}
+	syncObject.setName("StorageDatabase::syncObject");
+	syncTrace.setName("StorageDatabase::syncTrace");
 }
 
 StorageDatabase::~StorageDatabase(void)
@@ -756,10 +758,10 @@ int StorageDatabase::renameTable(Storage
 			++numberIndexes;
 			}
 
-		Sync syncDDL(&database->syncSysDDL, "StorageDatabase::renameTable");
+		Sync syncDDL(&database->syncSysDDL, "StorageDatabase::renameTable(1)");
 		syncDDL.lock(Exclusive);
 		
-		Sync syncTables(&database->syncTables, "StorageDatabase::renameTable");
+		Sync syncTables(&database->syncTables, "StorageDatabase::renameTable(2)");
 		syncTables.lock(Exclusive);
 		
 		for (int n = firstIndex; n < numberIndexes; ++n)
@@ -1206,7 +1208,7 @@ void StorageDatabase::clearTransactions(
 {
 #ifdef TRACE_TRANSACTIONS
 
-	Sync sync(&traceSyncObject, "StorageDatabase::clearTransactions");
+	Sync sync(&syncTrace, "StorageDatabase::clearTransactions");
 	sync.lock(Exclusive);
 	Statement *statement = masterConnection->createStatement();
 	statement->execute(traceTable);
@@ -1224,7 +1226,7 @@ void StorageDatabase::traceTransaction(i
 {
 	try
 		{
-		Sync sync(&traceSyncObject, "StorageDatabase::traceTransaction");
+		Sync sync(&syncTrace, "StorageDatabase::traceTransaction");
 		sync.lock(Exclusive);
 		char buffer [10000];
 		int length = stream->getSegment(0, sizeof(buffer) - 1, buffer);

=== modified file 'storage/falcon/StorageDatabase.h'
--- a/storage/falcon/StorageDatabase.h	2008-07-09 04:38:02 +0000
+++ b/storage/falcon/StorageDatabase.h	2008-07-24 08:45:03 +0000
@@ -111,7 +111,7 @@ public:
 	StorageDatabase		*next;
 	StorageHandler		*storageHandler;
 	SyncObject			syncObject;
-	SyncObject			traceSyncObject;
+	SyncObject			syncTrace;
 	User				*user;
 	PreparedStatement	*lookupIndexAlias;
 	PreparedStatement	*insertTrace;

=== modified file 'storage/falcon/StorageHandler.cpp'
--- a/storage/falcon/StorageHandler.cpp	2008-07-10 19:00:14 +0000
+++ b/storage/falcon/StorageHandler.cpp	2008-07-31 08:52:32 +0000
@@ -35,6 +35,8 @@
 #include "InfoTable.h"
 #include "CmdGen.h"
 #include "Dbb.h"
+#include "Database.h"
+#include "TableSpaceManager.h"
 
 #define DICTIONARY_ACCOUNT		"mysql"
 #define DICTIONARY_PW			"mysql"
@@ -51,7 +53,6 @@ struct StorageSavepoint {
 	int					savepoint;
 	};
 
-extern uint64		falcon_initial_allocation;
 
 static const char *createTempSpace = "upgrade tablespace " TEMPORARY_TABLESPACE " filename '" FALCON_TEMPORARY "'";
 //static const char *dropTempSpace = "drop tablespace " TEMPORARY_TABLESPACE;
@@ -122,6 +123,9 @@ StorageHandler::StorageHandler(int lockS
 	databaseList = NULL;
 	defaultDatabase = NULL;
 	initialized = false;
+	syncObject.setName("StorageHandler::syncObject");
+	hashSyncObject.setName("StorageHandler::hashSyncObject");
+	dictionarySyncObject.setName("StorageHandler::dictionarySyncObject");
 }
 
 StorageHandler::~StorageHandler(void)
@@ -191,7 +195,7 @@ void StorageHandler::databaseDropped(Sto
 		
 	if (storageDatabase)
 		{
-		Sync syncHash(&hashSyncObject, "StorageHandler::dropDatabase");
+		Sync syncHash(&hashSyncObject, "StorageHandler::databaseDropped(1)");
 		int slot = JString::hash(storageDatabase->name, databaseHashSize);
 		syncHash.lock(Exclusive);
 		StorageDatabase **ptr;
@@ -214,7 +218,7 @@ void StorageHandler::databaseDropped(Sto
 		storageDatabase->release();
 		}
 
-	Sync sync(&syncObject, "StorageHandler::~dropDatabase");
+	Sync sync(&syncObject, "StorageHandler::databaseDropped(2)");
 	sync.lock(Exclusive);
 
 	for (int n = 0; n < connectionHashSize; ++n)
@@ -424,7 +428,7 @@ StorageDatabase* StorageHandler::getStor
 
 void StorageHandler::closeDatabase(const char* path)
 {
-	Sync sync(&hashSyncObject, "StorageHandler::getStorageDatabase");
+	Sync sync(&hashSyncObject, "StorageHandler::closeDatabase");
 	int slot = JString::hash(path, databaseHashSize);
 	sync.lock(Exclusive);
 	
@@ -464,43 +468,33 @@ Connection* StorageHandler::getDictionar
 	return dictionaryConnection;
 }
 
-JString StorageHandler::genCreateTableSpace(const char* tableSpaceName, const char* filename,
-												unsigned long long initialSize,
-												unsigned long long extentSize,
-												unsigned long long autoextendSize,
-												unsigned long long maxSize,
-												int nodegroup, bool wait, const char* comment)
+JString StorageHandler::genCreateTableSpace(const char* tableSpaceName, const char* filename, const char* comment)
 {
 	CmdGen gen;
-	/***
-	gen.gen("create tablespace \"%s\" filename '%s' initial_size " I64FORMAT " extent_size " I64FORMAT 
-				" autoextend_size " I64FORMAT " max_size " I64FORMAT " nodegroup %d wait %d comment '%s'",
-				tableSpaceName, filename, initialSize, extentSize, autoextendSize, maxSize, nodegroup, (int)wait, comment ? comment : "");
-	***/
 	gen.gen("create tablespace \"%s\" filename '%s' comment '%s'", tableSpaceName, filename, comment ? comment : "");
 	return (gen.getString());
 }
 
-int StorageHandler::createTablespace(const char* tableSpaceName, const char* filename,
-										unsigned long long initialSize,
-										unsigned long long extentSize,
-										unsigned long long autoextendSize,
-										unsigned long long maxSize,
-										int nodegroup, bool wait, const char* comment)
+int StorageHandler::createTablespace(const char* tableSpaceName, const char* filename, const char* comment)
 {
 	if (!defaultDatabase)
 		initialize();
 
 	if (!dictionaryConnection)
 		return StorageErrorTablesSpaceOperationFailed;
-		
-	//StorageDatabase *storageDatabase = NULL;
+
 	JString tableSpace = JString::upcase(tableSpaceName);
-	
+
+	TableSpaceManager *tableSpaceManager = 
+		dictionaryConnection->database->tableSpaceManager;
+
+	if (!tableSpaceManager->waitForPendingDrop(tableSpaceName, 10))
+		// file still exists after waiting for 10 seconds
+		return  StorageErrorTableSpaceExist;
+
 	try
 		{
-		JString cmd = genCreateTableSpace(tableSpaceName, filename, initialSize, extentSize,
-											autoextendSize, maxSize, nodegroup, wait, comment);
+		JString cmd = genCreateTableSpace(tableSpaceName, filename, comment);
 		Sync sync(&dictionarySyncObject, "StorageHandler::createTablespace");
 		sync.lock(Exclusive);
 		Statement *statement = dictionaryConnection->createStatement();
@@ -543,7 +537,7 @@ int StorageHandler::deleteTablespace(con
 		{
 		CmdGen gen;
 		gen.gen("drop tablespace \"%s\"", tableSpaceName);
-		Sync sync(&dictionarySyncObject, "StorageHandler::createTablespace");
+		Sync sync(&dictionarySyncObject, "StorageHandler::deleteTablespace");
 		sync.lock(Exclusive);
 		Statement *statement = dictionaryConnection->createStatement();
 		statement->executeUpdate(gen.getString());
@@ -664,7 +658,7 @@ StorageTableShare* StorageHandler::creat
 void StorageHandler::addTable(StorageTableShare* table)
 {
 	int slot = JString::hash(table->pathName, tableHashSize);
-	Sync sync(&hashSyncObject, "StorageHandler::add");
+	Sync sync(&hashSyncObject, "StorageHandler::addTable");
 	sync.lock(Exclusive);
 	table->collision = tables[slot];
 	tables[slot] = table;
@@ -674,7 +668,7 @@ void StorageHandler::addTable(StorageTab
 
 void StorageHandler::removeTable(StorageTableShare* table)
 {
-	Sync sync(&hashSyncObject, "StorageHandler::deleteTable");
+	Sync sync(&hashSyncObject, "StorageHandler::removeTable");
 	sync.lock(Exclusive);
 	int slot = JString::hash(table->pathName, tableHashSize);
 	
@@ -688,7 +682,7 @@ void StorageHandler::removeTable(Storage
 
 StorageConnection* StorageHandler::getStorageConnection(StorageTableShare* tableShare, THD* mySqlThread, int mySqlThdId, OpenOption createFlag)
 {
-	Sync sync(&syncObject, "StorageConnection::getStorageConnection");
+	Sync sync(&syncObject, "StorageHandler::getStorageConnection");
 	
 	if (!defaultDatabase)
 		initialize();
@@ -921,7 +915,7 @@ void StorageHandler::getTransactionInfo(
 
 void StorageHandler::getSerialLogInfo(InfoTable* infoTable)
 {
-	Sync sync(&hashSyncObject, "StorageHandler::getTransactionInfo");
+	Sync sync(&hashSyncObject, "StorageHandler::getSerialLogInfo");
 	sync.lock(Shared);
 	
 	for (StorageDatabase *storageDatabase = databaseList; storageDatabase; storageDatabase = storageDatabase->next)
@@ -965,7 +959,7 @@ void StorageHandler::initialize(void)
 	if (initialized)
 		return;
 	
-	Sync sync(&syncObject, "StorageConnection::initialize");
+	Sync sync(&syncObject, "StorageHandler::initialize");
 	sync.lock(Exclusive);
 	
 	if (initialized)
@@ -998,7 +992,7 @@ void StorageHandler::initialize(void)
 		IO::deleteFile(FALCON_TEMPORARY);
 		dictionaryConnection = defaultDatabase->getOpenConnection();
 		Statement *statement = dictionaryConnection->createStatement();
-		JString createTableSpace = genCreateTableSpace(DEFAULT_TABLESPACE, FALCON_USER, falcon_initial_allocation);
+		JString createTableSpace = genCreateTableSpace(DEFAULT_TABLESPACE, FALCON_USER);
 		statement->executeUpdate(createTableSpace);
 			
 		for (const char **ddl = falconSchema; *ddl; ++ddl)
@@ -1047,67 +1041,6 @@ void StorageHandler::dropTempTables(void
 	statement->close();
 }
 
-void StorageHandler::getTablesInfo(InfoTable* infoTable)
-{
-	if (!defaultDatabase)
-		initialize();
-	
-	if (!dictionaryConnection)
-		return;
-		
-	try
-		{
-		PStatement statement = dictionaryConnection->prepareStatement(
-			"select schema,tablename,tablespace from system.tables where tablespace <> ''");
-		RSet resultSet = statement->executeQuery();
-		
-		while (resultSet->next())
-			{
-
-			// Parse table and partition name
-			
-			const char *pStr = resultSet->getString(2);
-			char *pTable = NULL;
-			char *pPart = NULL;
-			
-			if (pStr)
-				{
-				const int max_buf = 1024;
-				char buffer[max_buf+1];
-				
-				pTable = buffer;
-				*pTable = 0;
-				strncpy(buffer, pStr, (size_t)max_buf);
-				
-				char *pBuf = strchr(buffer, '#');
-				
-				if (pBuf)
-					{
-					*pBuf = 0;
-					if ((pPart = strrchr(++pBuf, '#')) != NULL)
-						pPart++;
-					}
-				}
-					
-			infoTable->putString(0, resultSet->getString(1));	// database
-			infoTable->putString(1, (pTable ? pTable : pStr));	// table
-			infoTable->putString(2, (pPart ? pPart : ""));		// partition
-			infoTable->putString(3, resultSet->getString(3));	// tablespace
-			infoTable->putString(4, resultSet->getString(2));	// internal name
-		
-			//for (int n = 0; n < 3; ++n)
-			//	infoTable->putString(n, resultSet->getString(n + 1));
-			
-			infoTable->putRecord();
-			}
-		
-		dictionaryConnection->commit();
-		}
-	catch(...)
-		{
-		}
-}
-
 void StorageHandler::setRecordMemoryMax(uint64 value)
 {
 	if (dictionaryConnection)

=== modified file 'storage/falcon/StorageHandler.h'
--- a/storage/falcon/StorageHandler.h	2008-04-05 22:09:17 +0000
+++ b/storage/falcon/StorageHandler.h	2008-07-29 10:45:39 +0000
@@ -85,12 +85,7 @@ public:
 	virtual int			rollbackByXid(int xidLength, const unsigned char* xis);
 
 	virtual Connection*	getDictionaryConnection(void);
-	virtual int			createTablespace(const char* tableSpaceName, const char* filename,
-											unsigned long long initialSize = 0,
-											unsigned long long extentSize = 0,
-											unsigned long long autoextendSize = 0,
-											unsigned long long maxSize = 0,
-											int nodegroup = 0, bool wait = false, const char* comment = NULL);
+	virtual int			createTablespace(const char* tableSpaceName, const char* filename, const char* comment = NULL);
 	virtual int			deleteTablespace(const char* tableSpaceName);
 
 	virtual StorageTableShare* findTable(const char* pathname);
@@ -108,7 +103,6 @@ public:
 	virtual void		getTransactionSummaryInfo(InfoTable* infoTable);
 	virtual void		getTableSpaceInfo(InfoTable* infoTable);
 	virtual void		getTableSpaceFilesInfo(InfoTable* infoTable);
-	virtual void		getTablesInfo(InfoTable* infoTable);
 
 	virtual void		setIndexChillThreshold(uint value);
 	virtual void		setRecordChillThreshold(uint value);
@@ -134,12 +128,7 @@ public:
 	void				initialize(void);
 	void				dropTempTables(void);
 	void				cleanFileName(const char* pathname, char* filename, int filenameLength);
-	JString				genCreateTableSpace(const char* tableSpaceName, const char* filename,
-											unsigned long long initialSize = 0,
-											unsigned long long extentSize = 0,
-											unsigned long long autoextendSize = 0,
-											unsigned long long maxSize = 0,
-											int nodegroup = 0, bool wait = false, const char* comment = NULL);
+	JString				genCreateTableSpace(const char* tableSpaceName, const char* filename, const char* comment = NULL);
 	
 	StorageConnection	*connections[connectionHashSize];
 	StorageDatabase		*defaultDatabase;

=== modified file 'storage/falcon/StorageTableShare.cpp'
--- a/storage/falcon/StorageTableShare.cpp	2008-07-14 05:27:57 +0000
+++ b/storage/falcon/StorageTableShare.cpp	2008-07-15 18:57:27 +0000
@@ -463,7 +463,7 @@ void StorageTableShare::registerTable(vo
 	
 	try
 		{
-		Sync sync(&storageHandler->dictionarySyncObject, "StorageTableShare::save");
+		Sync sync(&storageHandler->dictionarySyncObject, "StorageTableShare::registerTable");
 		sync.lock(Exclusive);
 		connection = storageHandler->getDictionaryConnection();
 		statement = connection->prepareStatement(
@@ -494,7 +494,7 @@ void StorageTableShare::registerTable(vo
 
 void StorageTableShare::unRegisterTable(void)
 {
-	Sync sync(&storageHandler->dictionarySyncObject, "StorageTableShare::unsave");
+	Sync sync(&storageHandler->dictionarySyncObject, "StorageTableShare::unRegisterTable");
 	sync.lock(Exclusive);
 	Connection *connection = storageHandler->getDictionaryConnection();
 	PreparedStatement *statement = connection->prepareStatement(

=== modified file 'storage/falcon/SymbolManager.cpp'
--- a/storage/falcon/SymbolManager.cpp	2008-06-06 12:34:19 +0000
+++ b/storage/falcon/SymbolManager.cpp	2008-07-24 08:45:03 +0000
@@ -55,6 +55,7 @@ SymbolManager::SymbolManager()
 	sections->next = NULL;
 	next = sections->space;
 	memset (hashTable, 0, sizeof (hashTable));
+	syncObject.setName("SymbolManager::syncObject");
 }
 
 SymbolManager::~SymbolManager()
@@ -98,7 +99,7 @@ const char* SymbolManager::getSymbol(con
 		if (section->space <= string && string < section->space + sizeof (section->space))
 			return string;
 
-	Sync sync (&syncObject, "SymbolManager::getSymbol");
+	Sync sync (&syncObject, "SymbolManager::getSymbol(1)");
 	sync.lock (Shared);
 	int	value = 0, c;
 	const char *p;
@@ -156,7 +157,7 @@ const char* SymbolManager::getString(con
 		if (section->space <= string && string < section->space + sizeof (section->space))
 			return string;
 
-	Sync sync (&syncObject, "SymbolManager::getSymbol");
+	Sync sync (&syncObject, "SymbolManager::getString");
 	sync.lock (Shared);
 	int	value = 0, c;
 	const char *p;
@@ -218,7 +219,7 @@ bool SymbolManager::isSymbol(const char 
 
 const char* SymbolManager::getSymbol(const WCString *string)
 {
-	Sync sync (&syncObject, "SymbolManager::getSymbol(WC)");
+	Sync sync (&syncObject, "SymbolManager::getSymbol(2)");
 	sync.lock (Shared);
 	int	value = 0, c;
 	//int length = Unicode::getUtf8Length(string->count, (UCHAR*) string->string);

=== modified file 'storage/falcon/Sync.cpp'
--- a/storage/falcon/Sync.cpp	2007-10-31 20:06:07 +0000
+++ b/storage/falcon/Sync.cpp	2008-07-24 08:45:03 +0000
@@ -37,7 +37,7 @@ Sync::Sync(SynchronizationObject *obj, c
 	ASSERT (obj);
 	state = None;
 	syncObject = obj;
-	where = fromWhere;
+	location = fromWhere;
 	prior = NULL;
 	marked = NULL;
 }
@@ -70,7 +70,7 @@ void Sync::lock(LockType type, int timeo
 /***
 void Sync::lock(LockType type, const char *fromWhere)
 {
-	where = fromWhere;
+	location = fromWhere;
 	lock(type);
 }
 ***/
@@ -110,7 +110,7 @@ void Sync::findLocks(LinkedList &threads
 void Sync::print(const char *label)
 {
 	LOG_DEBUG ("%s %s state %d (%d) syncObject %p\n", 
-			   label, where, state, request, syncObject);
+			   label, location, state, request, syncObject);
 }
 
 void Sync::mark(const char* text)

=== modified file 'storage/falcon/Sync.h'
--- a/storage/falcon/Sync.h	2007-10-31 20:06:07 +0000
+++ b/storage/falcon/Sync.h	2008-07-24 08:45:03 +0000
@@ -28,10 +28,10 @@
 
 class LinkedList;
 
-class Sync  
+class Sync
 {
 public:
-	Sync(SynchronizationObject *obj, const char *where);
+	Sync(SynchronizationObject *obj, const char *location);
 	virtual ~Sync();
 
 	void	print (const char* label);
@@ -40,14 +40,14 @@ public:
 	//void	print(int level);
 	void	setObject (SynchronizationObject *obj);
 	void	unlock();
-	void	lock (LockType type);
+	void	lock(LockType type);
 	void	lock(LockType type, int timeout);
 
 	SynchronizationObject	*syncObject;
 	LockType	state;
 	LockType	request;
 	Sync		*prior;
-	const char	*where;
+	const char	*location;
 	const char	*marked;
 	void mark(const char* text);
 };

=== modified file 'storage/falcon/SyncObject.cpp'
--- a/storage/falcon/SyncObject.cpp	2008-07-08 16:01:41 +0000
+++ b/storage/falcon/SyncObject.cpp	2008-08-01 17:56:28 +0000
@@ -117,7 +117,7 @@ SyncObject::SyncObject()
 	exclusiveCount = 0;
 	waitCount = 0;
 	queueLength = 0;
-	where = NULL;
+	location = NULL;
 	name = NULL;
 	objectId = INTERLOCKED_INCREMENT(nextSyncObjectId);
 	
@@ -133,9 +133,6 @@ SyncObject::~SyncObject()
 #ifdef TRACE_SYNC_OBJECTS
 	if (objectId < MAX_SYNC_OBJECTS)
 		syncObjects[objectId] = NULL;
-		
-	if (name)
-		delete [] name;
 #endif
 }
 
@@ -146,7 +143,7 @@ void SyncObject::lock(Sync *sync, LockTy
 
 #ifdef TRACE_SYNC_OBJECTS
 	if (sync)
-		where = sync->where;
+		location = sync->location;
 #endif
 	
 	// Shared case
@@ -313,7 +310,7 @@ void SyncObject::lock(Sync *sync, LockTy
 
 #ifdef TRACE_SYNC_OBJECTS
 	if (sync)
-		where = sync->where;
+		location = sync->location;
 #endif
 	
 	if (type == Shared)
@@ -979,7 +976,7 @@ void SyncObject::frequentStaller(Thread 
 	Sync *lockPending = thread->lockPending;
 
 	if (sync)
-		LOG_DEBUG("Frequent stall from %s\n", sync->where);
+		LOG_DEBUG("Frequent stall from %s\n", sync->location);
 	else
 		LOG_DEBUG("Frequent stall from unknown\n");
 		
@@ -995,9 +992,9 @@ void SyncObject::analyze(Stream* stream)
 	stream->format("Where\tShares\tExclusives\tWaits\tAverage Queue\n");
 	
 	for (int n = 1; n < MAX_SYNC_OBJECTS; ++n)
-		if ( (syncObject = syncObjects[n]) && syncObject->where)
+		if ( (syncObject = syncObjects[n]) && syncObject->location)
 			stream->format("%s\t%d\t%d\t%d\t%d\t\n",
-					syncObject->where,
+					syncObject->location,
 					syncObject->sharedCount,
 					syncObject->exclusiveCount,
 					syncObject->waitCount,
@@ -1019,7 +1016,7 @@ void SyncObject::dump(void)
 	for (int n = 1; n < MAX_SYNC_OBJECTS; ++n)
 		if ( (syncObject = syncObjects[n]) )
 			{
-			const char *name = (syncObject->name) ? syncObject->name : syncObject->where;
+			const char *name = (syncObject->name) ? syncObject->name : syncObject->location;
 			
 			if (name)
 				fprintf(out, "%s\t%d\t%d\t%d\t%d\t\n",
@@ -1044,10 +1041,10 @@ void SyncObject::getSyncInfo(InfoTable* 
 	SyncObject *syncObject;
 	
 	for (int index = 1; index < MAX_SYNC_OBJECTS; ++index)
-		if ( (syncObject = syncObjects[index]) && syncObject->where)
+		if ( (syncObject = syncObjects[index]) && syncObject->location)
 			{
 			int n = 0;
-			infoTable->putString(n++, syncObject->where);
+			infoTable->putString(n++, syncObject->location);
 			infoTable->putInt(n++, syncObject->sharedCount);
 			infoTable->putInt(n++, syncObject->exclusiveCount);
 			infoTable->putInt(n++, syncObject->waitCount);
@@ -1060,19 +1057,7 @@ void SyncObject::getSyncInfo(InfoTable* 
 void SyncObject::setName(const char* string)
 {
 #ifdef TRACE_SYNC_OBJECTS
-	if (name)
-		{
-		delete [] name;
-		name = NULL;
-		}
-	
-	if (string)
-		{
-		name = new char[strlen(string)+1];
-		strcpy(name, string);
-		}
-		
-	//name = string;
+	name = string;
 #endif
 }
 

=== modified file 'storage/falcon/SyncObject.h'
--- a/storage/falcon/SyncObject.h	2008-06-19 15:09:45 +0000
+++ b/storage/falcon/SyncObject.h	2008-08-01 17:56:28 +0000
@@ -108,8 +108,8 @@ protected:
 	int					exclusiveCount;
 	int					waitCount;
 	int					queueLength;
-	const char*			where;
-	char*				name;
+	const char*			location;
+	const char*			name;
 #endif
 };
 

=== modified file 'storage/falcon/SyncTest.cpp'
--- a/storage/falcon/SyncTest.cpp	2008-06-30 16:58:45 +0000
+++ b/storage/falcon/SyncTest.cpp	2008-07-15 18:57:27 +0000
@@ -115,10 +115,10 @@ void SyncTest::testThread(void* paramete
 void SyncTest::testThread(void)
 {
 	count = 0;
-	Sync syncStart(&starter, "SyncTest::thread");
+	Sync syncStart(&starter, "SyncTest::testThread(1)");
 	ready = true;
 	syncStart.lock(Shared);
-	Sync sync(&parent->syncObject, "SyncTest::thread");
+	Sync sync(&parent->syncObject, "SyncTest::testThread(2)");
 	
 	while (!parent->stop)
 		{

=== modified file 'storage/falcon/Table.cpp'
--- a/storage/falcon/Table.cpp	2008-05-21 15:21:46 +0000
+++ b/storage/falcon/Table.cpp	2008-08-01 17:56:28 +0000
@@ -396,10 +396,10 @@ Format* Table::getFormat(int version)
 		 if (format->version == version)
 			return format;
 
-	Sync syncObj(&syncObject, "Table::getFormat");
+	Sync syncObj(&syncObject, "Table::getFormat(1)");
 	syncObj.lock(Exclusive);
 
-	Sync syncDDL(&database->syncSysDDL, "Table::getFormat");
+	Sync syncDDL(&database->syncSysDDL, "Table::getFormat(2)");
 	syncDDL.lock(Shared);
 
 	PStatement statement = database->prepareStatement(
@@ -814,11 +814,11 @@ void Table::init(int id, const char *sch
 	primaryKey = NULL;
 	formats = NEW Format* [FORMAT_HASH_SIZE];
 
+	static char name[SYNC_VERSIONS_SIZE][64];
 	for (int n = 0; n < SYNC_VERSIONS_SIZE; n++)
 		{
-		char name[64];
-		sprintf(name, "syncPriorVersions[%02d]", n);
-		syncPriorVersions[n].setName(name);
+		sprintf(name[n], "syncPriorVersions[%02d]", n);
+		syncPriorVersions[n].setName(name[n]);
 		}
 		
 	triggers = NULL;
@@ -836,6 +836,8 @@ void Table::init(int id, const char *sch
 	syncTriggers.setName("Table::syncTriggers");
 	syncScavenge.setName("Table::syncScavenge");
 	syncAlter.setName("Table::syncAlter");
+	for (int n = 0; n < SYNC_VERSIONS_SIZE; n++)
+		syncPriorVersions[n].setName("Table::syncPriorVersions");
 }
 
 Record* Table::fetch(int32 recordNumber)
@@ -1227,7 +1229,7 @@ void Table::update(Transaction * transac
 	RecordVersion *record = NULL;
 	bool updated = false;
 	int recordNumber = oldRecord->recordNumber;
-	Sync scavenge(&syncScavenge, "Table::update(2)");
+	Sync scavenge(&syncScavenge, "Table::update(1)");
 	//scavenge.lock(Shared);
 	
 	try
@@ -3064,7 +3066,7 @@ void Table::update(Transaction * transac
 
 	RecordVersion *record = NULL;
 	bool updated = false;
-	Sync scavenge(&syncScavenge, "Table::update");
+	Sync scavenge(&syncScavenge, "Table::update(2)");
 	//scavenge.lock(Shared);
 	
 	if (candidate->state == recLock && candidate->getTransaction() == transaction)

=== modified file 'storage/falcon/TableSpace.cpp'
--- a/storage/falcon/TableSpace.cpp	2008-04-05 22:09:17 +0000
+++ b/storage/falcon/TableSpace.cpp	2008-07-17 13:52:17 +0000
@@ -50,15 +50,7 @@ TableSpace::TableSpace(Database *db, con
 	
 	TableSpaceInit spaceInit;
 	TableSpaceInit *init = (tsInit ? tsInit : &spaceInit);
-	initialSize	= init->initialSize;
 	comment	= init->comment;
-	/***
-	extentSize	= init->extentSize;
-	autoExtendSize = init->autoExtendSize;
-	maxSize		= init->maxSize;
-	nodegroup	= init->nodegroup;
-	wait		= init->wait;
-	***/
 }
 
 TableSpace::~TableSpace()
@@ -132,7 +124,7 @@ void TableSpace::open()
 void TableSpace::create()
 {
 	dbb->createPath(filename);
-	dbb->create(filename, dbb->pageSize, 0, HdrTableSpace, 0, NULL, initialSize);
+	dbb->create(filename, dbb->pageSize, 0, HdrTableSpace, 0, NULL);
 	active = true;
 	dbb->flush();
 }
@@ -169,14 +161,6 @@ void TableSpace::save(void)
 	statement->setInt(n++, tableSpaceId);
 	statement->setString(n++, filename);
 	statement->setInt(n++, type);
-	/***
-	statement->setLong(n++, initialSize);
-	statement->setLong(n++, extentSize);
-	statement->setLong(n++, autoExtendSize);
-	statement->setLong(n++, maxSize);
-	statement->setInt(n++, nodegroup);
-	statement->setInt(n++, wait);
-	***/
 	statement->setString(n++, comment);
 	statement->executeUpdate();
 	needSave = false;

=== modified file 'storage/falcon/TableSpace.h'
--- a/storage/falcon/TableSpace.h	2008-04-05 22:09:17 +0000
+++ b/storage/falcon/TableSpace.h	2008-07-17 13:52:17 +0000
@@ -29,17 +29,8 @@ static const int TABLESPACE_TYPE_REPOSIT
 
 struct TableSpaceInit
 {
-	int64	initialSize;
 	JString	comment;
-	TableSpaceInit(): initialSize(0), comment("") {}
-	/***
-	int64	extentSize;
-	int64	autoExtendSize;
-	int64	maxSize;
-	int		nodegroup;
-	int		wait;
-	TableSpaceInit(): initialSize(0), extentSize(0), autoExtendSize(0), maxSize(0), nodegroup(0), wait(0), comment("") {}
-	***/
+	TableSpaceInit(): comment("") {}
 };
 
 class Dbb;
@@ -75,14 +66,6 @@ public:
 	bool		active;
 	bool		needSave;
 	
-	int64		initialSize;
-	/***
-	int64		extentSize;
-	int64		autoExtendSize;
-	int64		maxSize;
-	int			nodegroup;
-	int			wait;
-	***/
 	JString		comment;
 };
 

=== modified file 'storage/falcon/TableSpaceManager.cpp'
--- a/storage/falcon/TableSpaceManager.cpp	2008-07-09 19:23:23 +0000
+++ b/storage/falcon/TableSpaceManager.cpp	2008-07-24 08:45:03 +0000
@@ -59,6 +59,7 @@ TableSpaceManager::TableSpaceManager(Dat
 	memset(idHash, 0, sizeof(nameHash));
 	tableSpaces = NULL;
 	pendingDrops = 0;
+	syncObject.setName("TableSpaceManager::syncObject");
 }
 
 TableSpaceManager::~TableSpaceManager()
@@ -86,7 +87,7 @@ void TableSpaceManager::add(TableSpace *
 
 TableSpace* TableSpaceManager::findTableSpace(const char *name)
 {
-	Sync syncObj(&syncObject, "TableSpaceManager::findTableSpace");
+	Sync syncObj(&syncObject, "TableSpaceManager::findTableSpace(1)");
 	syncObj.lock(Shared);
 	TableSpace *tableSpace;
 
@@ -101,7 +102,7 @@ TableSpace* TableSpaceManager::findTable
 		if (tableSpace->name == name)
 			return tableSpace;
 
-	Sync syncDDL(&database->syncSysDDL, "TableSpaceManager::findTableSpace");
+	Sync syncDDL(&database->syncSysDDL, "TableSpaceManager::findTableSpace(2)");
 	syncDDL.lock(Shared);
 	
 	PStatement statement = database->prepareStatement(
@@ -117,14 +118,6 @@ TableSpace* TableSpaceManager::findTable
 		int type = TABLESPACE_TYPE_TABLESPACE;				// type (forced)
 		
 		TableSpaceInit tsInit;
-		/***
-		tsInit.initialSize	= resultSet->getLong(n++);
-		tsInit.extentSize	= resultSet->getLong(n++);
-		tsInit.autoExtendSize = resultSet->getLong(n++);
-		tsInit.maxSize		= resultSet->getLong(n++);
-		tsInit.nodegroup	= resultSet->getInt(n++);
-		tsInit.wait			= resultSet->getInt(n++);
-		***/
 		tsInit.comment		= resultSet->getString(n++);	// comment
 		
 		tableSpace = new TableSpace(database, name, id, fileName, type, &tsInit);
@@ -170,32 +163,10 @@ TableSpace* TableSpaceManager::createTab
 	
 	TableSpace *tableSpace = new TableSpace(database, name, id, fileName, type, tsInit);
 	
-	if (!repository)
+	if (!repository && IO::doesFileExist(fileName))
 		{
-		bool fileExists;
-
-		// Check if table space file already exists.
-		// Take into account, that tablespace might have been already  dropped
-		// by another transaction, yet file can still be present on the disk,
-		// if log record is not yet fully committed by the gopher thread).
-		// So we'll wait for a few seconds if there are pending drops and 
-		// tablespace file exists.
-
-		for (int i=0; i < 10; i++)
-			{
-			fileExists = tableSpace->dbb->doesFileExist(fileName);
-
-			if (fileExists && pendingDrops > 0)
-				Thread::getThread("TableSpaceManager::createTableSpace")->sleep(1000);
-			else
-				break;
-			}
-
-		if (fileExists)
-			{
-			delete tableSpace;
-			throw SQLError(TABLESPACE_DATAFILE_EXIST_ERROR, "table space file name \"%s\" already exists\n", fileName);
-			}
+		delete tableSpace;
+		throw SQLError(TABLESPACE_DATAFILE_EXIST_ERROR, "table space file name \"%s\" already exists\n", fileName);
 		}
 		
 	try
@@ -239,21 +210,9 @@ void TableSpaceManager::bootstrap(int se
 		p = EncodedDataStream::decode(p, &fileName, true);
 		p = EncodedDataStream::decode(p, &type, true);
 		/***
-		p = EncodedDataStream::decode(p, &initialSize, true);
-		p = EncodedDataStream::decode(p, &extentSsize, true);
-		p = EncodedDataStream::decode(p, &autoExtendSize, true);
-		p = EncodedDataStream::decode(p, &maxSize, true);
-		p = EncodedDataStream::decode(p, &nodegroup, true);
-		p = EncodedDataStream::decode(p, &wait, true);
 		p = EncodedDataStream::decode(p, &comment, true);
 
 		TableSpaceInit tsInit;
-		tsInit.initialSize	= initialSize.getQuad();
-		tsInit.extentSize	= extentSize.getQuad();
-		tsInit.autoExtendSize = autoExtendSize.getQuad();
-		tsInit.maxSize		= maxSize.getQuad();
-		tsInit.nodegroup	= nodegroup.getInt();
-		tsInit.wait			= wait.getInt();
 		tsInit.comment		= comment.getString();
 		***/
 		
@@ -314,10 +273,10 @@ void TableSpaceManager::dropDatabase(voi
 
 void TableSpaceManager::dropTableSpace(TableSpace* tableSpace)
 {
-	Sync syncObj(&syncObject, "TableSpaceManager::dropTableSpace");
+	Sync syncObj(&syncObject, "TableSpaceManager::dropTableSpace(1)");
 	syncObj.lock(Exclusive);
 
-	Sync syncDDL(&database->syncSysDDL, "TableSpaceManager::dropTableSpace");
+	Sync syncDDL(&database->syncSysDDL, "TableSpaceManager::dropTableSpace(2)");
 	syncDDL.lock(Shared);
 	
 	PStatement statement = database->prepareStatement(
@@ -542,3 +501,25 @@ void TableSpaceManager::getTableSpaceFil
 }
 
 
+// Wait for specified amount of time for a  file to be deleted.
+// Don't wait if pendingDrops count is 0.
+//
+// The function returns true, if wait was successfull, i.e file does not exist
+//(anymore)
+bool TableSpaceManager::waitForPendingDrop(const char  *filename, int seconds)
+{
+	bool fileExists;
+
+	do
+		{
+		fileExists = IO::doesFileExist(filename);
+		if (fileExists && pendingDrops > 0 && seconds-- > 0)
+			Thread::getThread("TransactionManager::waitForPendingDrop")->sleep(1000);
+		else
+			break;
+		}
+	while(true);
+
+	return !fileExists;
+}
+

=== modified file 'storage/falcon/TableSpaceManager.h'
--- a/storage/falcon/TableSpaceManager.h	2008-06-08 22:12:35 +0000
+++ b/storage/falcon/TableSpaceManager.h	2008-07-17 20:38:45 +0000
@@ -62,6 +62,7 @@ public:
 	void			reportWrites(void);
 	void			redoCreateTableSpace(int id, int nameLength, const char* name, int fileNameLength, const char* fileName, int type, TableSpaceInit* tsInit);
 	void			initialize(void);
+	bool			waitForPendingDrop(const char *filename, int seconds);
 
 	Database	*database;
 	TableSpace	*tableSpaces;

=== modified file 'storage/falcon/Thread.cpp'
--- a/storage/falcon/Thread.cpp	2008-06-19 15:09:45 +0000
+++ b/storage/falcon/Thread.cpp	2008-07-24 08:45:03 +0000
@@ -310,7 +310,7 @@ void Thread::validateLocks()
 		{
 		LOG_DEBUG ("thread %d has active locks:\n", thread->threadId);
 		for (Sync *sync = thread->locks; sync; sync = sync->prior)
-			LOG_DEBUG ("   %s\n", sync->where);
+			LOG_DEBUG ("   %s\n", sync->location);
 		}
 
 }
@@ -381,7 +381,7 @@ void Thread::setLock(Sync *sync)
 	ASSERT (sync->request == Shared || sync->request == Exclusive);
 	sync->prior = locks;
 	locks = sync;
-	where = locks->where;
+	where = locks->location;
 }
 
 void Thread::clearLock(Sync *sync)
@@ -396,7 +396,7 @@ void Thread::clearLock(Sync *sync)
 	if ( (locks = sync->prior) )
 		{
 		ASSERT (locks->state == Shared || locks->state == Exclusive);
-		where = locks->where;
+		where = locks->location;
 		}
 }
 
@@ -467,8 +467,8 @@ void Thread::print(const char *label)
 
 const char* Thread::getWhere()
 {
-	if (lockPending && lockPending->where)
-		return lockPending->where;
+	if (lockPending && lockPending->location)
+		return lockPending->location;
 
 	return "";
 }

=== modified file 'storage/falcon/Threads.cpp'
--- a/storage/falcon/Threads.cpp	2007-09-20 15:44:25 +0000
+++ b/storage/falcon/Threads.cpp	2008-07-24 08:45:03 +0000
@@ -46,6 +46,7 @@ Threads::Threads(Threads *parentThreads,
 	threadsActive = 0;
 	firstPending = NULL;
 	lastPending = NULL;
+	syncObject.setName("Threads::syncObject");
 }
 
 Threads::~Threads()

=== modified file 'storage/falcon/Transaction.cpp'
--- a/storage/falcon/Transaction.cpp	2008-07-11 10:23:03 +0000
+++ b/storage/falcon/Transaction.cpp	2008-07-31 10:04:30 +0000
@@ -95,7 +95,7 @@ Transaction::Transaction(Connection *cnc
 
 void Transaction::initialize(Connection* cnct, TransId seq)
 {
-	Sync sync(&syncObject, "Transaction::initialize");
+	Sync sync(&syncObject, "Transaction::initialize(1)");
 	sync.lock(Exclusive);
 	ASSERT(savePoints == NULL);
 	ASSERT(freeSavePoints == NULL);
@@ -155,7 +155,7 @@ void Transaction::initialize(Connection*
 	
 	startTime = database->deltaTime;
 	blockingRecord = NULL;
-	thread = Thread::getThread("Transaction::init");
+	thread = Thread::getThread("Transaction::initialize");
 	syncActive.lock(NULL, Exclusive);
 	Transaction *oldest = transactionManager->findOldest();
 	oldestActive = (oldest) ? oldest->transactionId : transactionId;
@@ -174,7 +174,7 @@ void Transaction::initialize(Connection*
 				 !transaction->systemTransaction &&
 				 transaction->transactionId < transactionId)
 				{
-				Sync syncDependency(&transaction->syncObject, "Transaction::initialize");
+				Sync syncDependency(&transaction->syncObject, "Transaction::initialize(2)");
 				syncDependency.lock(Shared);
 
 				if (transaction->isActive() && 
@@ -254,7 +254,7 @@ void Transaction::commit()
 
 	if (state == Active)
 		{
-		Sync sync(&syncIndexes, "Transaction::commit");
+		Sync sync(&syncIndexes, "Transaction::commit(1)");
 		sync.lock(Shared);
 		
 		for (DeferredIndex *deferredIndex= deferredIndexes; deferredIndex;  
@@ -290,19 +290,21 @@ void Transaction::commit()
 	releaseDependencies();
 	database->flushInversion(this);
 
-	Sync syncActiveTransactions(&transactionManager->activeTransactions.syncObject, "Transaction::commit");
-	syncActiveTransactions.lock(Exclusive);
-	Sync syncCommitted(&transactionManager->committedTransactions.syncObject, "Transaction::commit");
+	Sync syncCommitted(&transactionManager->committedTransactions.syncObject, "Transaction::commit(2)");
 	syncCommitted.lock(Exclusive);
 
+	Sync syncActiveTransactions(&transactionManager->activeTransactions.syncObject, "Transaction::commit(3)");
+	syncActiveTransactions.lock(Exclusive);
 	transactionManager->activeTransactions.remove(this);
 	syncActiveTransactions.unlock();
 	
 	for (RecordVersion *record = firstRecord; record; record = record->nextInTrans)
+		{
 		if (!record->getPriorVersion())
 			++record->format->table->cardinality;
-		else if (record->state == recDeleted && record->format->table->cardinality > 0)
+		if (record->state == recDeleted && record->format->table->cardinality > 0)
 			--record->format->table->cardinality;
+		}
 	transactionManager->committedTransactions.append(this);
 	syncCommitted.unlock();
 	database->commit(this);
@@ -333,7 +335,7 @@ void Transaction::commitNoUpdates(void)
 	
 	if (deferredIndexes)
 		{
-		Sync sync(&syncIndexes, "Transaction::commitNoUpdates");
+		Sync sync(&syncIndexes, "Transaction::commitNoUpdates(1)");
 		sync.lock(Exclusive);
 		releaseDeferredIndexes();
 		}
@@ -341,7 +343,7 @@ void Transaction::commitNoUpdates(void)
 	if (hasLocks)
 		releaseRecordLocks();
 
-	Sync syncActiveTransactions(&transactionManager->activeTransactions.syncObject, "Transaction::commitNoUpdates");
+	Sync syncActiveTransactions(&transactionManager->activeTransactions.syncObject, "Transaction::commitNoUpdates(2)");
 	syncActiveTransactions.lock(Shared);
 	releaseDependencies();
 
@@ -352,7 +354,7 @@ void Transaction::commitNoUpdates(void)
 		xidLength = 0;
 		}
 	
-	Sync sync(&syncObject, "Transaction::commitNoUpdates");
+	Sync sync(&syncObject, "Transaction::commitNoUpdates(3)");
 	sync.lock(Exclusive);
 	
 	if (dependencies)
@@ -379,7 +381,7 @@ void Transaction::rollback()
 
 	if (deferredIndexes)
 		{
-		Sync sync(&syncIndexes, "Transaction::rollback");
+		Sync sync(&syncIndexes, "Transaction::rollback(1)");
 		sync.lock(Exclusive);
 		releaseDeferredIndexes();
 		}
@@ -445,7 +447,7 @@ void Transaction::rollback()
 		xidLength = 0;
 		}
 	
-	Sync syncActiveTransactions (&transactionManager->activeTransactions.syncObject, "Transaction::rollback");
+	Sync syncActiveTransactions (&transactionManager->activeTransactions.syncObject, "Transaction::rollback(2)");
 	syncActiveTransactions.lock (Exclusive);
 	++transactionManager->rolledBack;
 	
@@ -982,7 +984,7 @@ State Transaction::waitForTransaction(Tr
 
 	TransactionManager *transactionManager = database->transactionManager;
 	Sync syncActiveTransactions(&transactionManager->activeTransactions.syncObject,
-		"Transaction::waitForTransaction");
+		"Transaction::waitForTransaction(1)");
 	syncActiveTransactions.lock(Shared);
 
 	if (!transaction)
@@ -1058,7 +1060,7 @@ void Transaction::waitForTransaction()
 		}
 	***/
 	
-	Sync sync(&syncActive, "Transaction::waitForTransaction");
+	Sync sync(&syncActive, "Transaction::waitForTransaction(2)");
 	sync.lock(Shared, falcon_lock_wait_timeout * 1000);
 }
 

=== modified file 'storage/falcon/Transaction.h'
--- a/storage/falcon/Transaction.h	2008-06-16 15:39:33 +0000
+++ b/storage/falcon/Transaction.h	2008-07-24 08:45:03 +0000
@@ -168,9 +168,9 @@ public:
 	bool			writePending;
 	bool			pendingPageWrites;
 	bool			hasLocks;
+	SyncObject		syncObject;
 	SyncObject		syncActive;
 	SyncObject		syncIndexes;
-	SyncObject		syncObject;
 	SyncObject		syncSavepoints;
 	uint64			totalRecordData;	// total bytes of record data for this transaction (unchilled + thawed)
 	uint32			totalRecords;		// total record count

=== modified file 'storage/falcon/TransactionManager.cpp'
--- a/storage/falcon/TransactionManager.cpp	2008-06-17 18:34:46 +0000
+++ b/storage/falcon/TransactionManager.cpp	2008-07-24 08:45:03 +0000
@@ -52,6 +52,8 @@ TransactionManager::TransactionManager(D
 	rolledBackTransaction->state = RolledBack;
 	rolledBackTransaction->inList = false;
 	syncObject.setName("TransactionManager::syncObject");
+	activeTransactions.syncObject.setName("TransactionManager::activeTransactions");
+	committedTransactions.syncObject.setName("TransactionManager::committedTransactions");
 }
 
 TransactionManager::~TransactionManager(void)
@@ -69,7 +71,7 @@ TransactionManager::~TransactionManager(
 
 TransId TransactionManager::findOldestActive()
 {
-	Sync syncCommitted(&committedTransactions.syncObject, "TransactionManager::findOldestActive");
+	Sync syncCommitted(&committedTransactions.syncObject, "TransactionManager::findOldestActive(1)");
 	syncCommitted.lock(Shared);
 	TransId oldestActive = transactionSequence;
 	
@@ -77,7 +79,7 @@ TransId TransactionManager::findOldestAc
 		oldestActive = MIN(trans->transactionId, oldestActive);
 
 	syncCommitted.unlock();
-	Sync sync(&activeTransactions.syncObject, "TransactionManager::findOldestActive");
+	Sync sync(&activeTransactions.syncObject, "TransactionManager::findOldestActive(2)");
 	sync.lock(Shared);
 	Transaction *oldest = findOldest();
 
@@ -216,9 +218,9 @@ void TransactionManager::rollbackByXid(i
 
 void TransactionManager::print(void)
 {
-	Sync sync (&activeTransactions.syncObject, "TransactionManager::print");
+	Sync sync (&activeTransactions.syncObject, "TransactionManager::print(1)");
 	sync.lock (Exclusive);
-	Sync committedTrans (&committedTransactions.syncObject, "TransactionManager::print");
+	Sync committedTrans (&committedTransactions.syncObject, "TransactionManager::print(2)");
 	committedTrans.lock (Exclusive);
 	Transaction *transaction;
 	Log::debug("Active Transaction:\n");
@@ -235,9 +237,9 @@ void TransactionManager::print(void)
 
 void TransactionManager::getTransactionInfo(InfoTable* infoTable)
 {
-	Sync sync (&activeTransactions.syncObject, "TransactionManager::getTransactionInfo");
+	Sync sync (&activeTransactions.syncObject, "TransactionManager::getTransactionInfo(1)");
 	sync.lock (Exclusive);
-	Sync committedTrans (&committedTransactions.syncObject, "TransactionManager::getTransactionInfo");
+	Sync committedTrans (&committedTransactions.syncObject, "TransactionManager::getTransactionInfo(2)");
 	committedTrans.lock (Exclusive);
 	Transaction *transaction;
 	
@@ -250,7 +252,7 @@ void TransactionManager::getTransactionI
 
 void TransactionManager::purgeTransactions()
 {
-	Sync syncCommitted(&committedTransactions.syncObject, "Transaction::commit");
+	Sync syncCommitted(&committedTransactions.syncObject, "Transaction::purgeTransactions");
 	syncCommitted.lock(Exclusive);
 	
 	// And, while we're at it, check for any fully mature transactions to ditch
@@ -276,9 +278,9 @@ void TransactionManager::purgeTransactio
 
 void TransactionManager::getSummaryInfo(InfoTable* infoTable)
 {
-	Sync sync (&activeTransactions.syncObject, "TransactionManager::getSummaryInfo");
+	Sync sync (&activeTransactions.syncObject, "TransactionManager::getSummaryInfo(1)");
 	sync.lock (Exclusive);
-	Sync committedTrans (&committedTransactions.syncObject, "TransactionManager::getSummaryInfo");
+	Sync committedTrans (&committedTransactions.syncObject, "TransactionManager::getSummaryInfo(2)");
 	committedTrans.lock (Exclusive);
 	int numberCommitted = committed;
 	int numberRolledBack = rolledBack;
@@ -371,7 +373,7 @@ void TransactionManager::expungeTransact
 
 Transaction* TransactionManager::findTransaction(TransId transactionId)
 {
-	Sync syncActiveTrans(&activeTransactions.syncObject, "TransactionManager::findTransaction");
+	Sync syncActiveTrans(&activeTransactions.syncObject, "TransactionManager::findTransaction(1)");
 	syncActiveTrans.lock(Shared);
 	Transaction *transaction;
 
@@ -392,7 +394,7 @@ Transaction* TransactionManager::findTra
 
 void TransactionManager::validateDependencies(void)
 {
-	Sync sync(&committedTransactions.syncObject, "TransactionManager::validateDepedendencies");
+	Sync sync(&committedTransactions.syncObject, "TransactionManager::validateDepedendencies(1)");
 	sync.lock(Shared);
 	Transaction *transaction;
 
@@ -401,7 +403,7 @@ void TransactionManager::validateDepende
 			transaction->validateDependencies(false);
 			
 	sync.unlock();
-	Sync syncCommitted(&committedTransactions.syncObject, "TransactionManager::validateDepedendencies");
+	Sync syncCommitted(&committedTransactions.syncObject, "TransactionManager::validateDepedendencies(2)");
 	syncCommitted.lock(Shared);
 
 	for (transaction = committedTransactions.first; transaction; transaction = transaction->next)
@@ -412,7 +414,7 @@ void TransactionManager::removeTransacti
 {
 	if (transaction->state == Committed)
 		{
-		Sync sync(&committedTransactions.syncObject, "TransactionManager::removeTransaction");
+		Sync sync(&committedTransactions.syncObject, "TransactionManager::removeTransaction(1)");
 		sync.lock(Exclusive);
 		
 		for (Transaction *trans = committedTransactions.first; trans; trans = trans->next)
@@ -424,7 +426,7 @@ void TransactionManager::removeTransacti
 		}
 	else
 		{
-		Sync sync(&activeTransactions.syncObject, "TransactionManager::removeTransaction");
+		Sync sync(&activeTransactions.syncObject, "TransactionManager::removeTransaction(2)");
 		sync.lock(Exclusive);
 		
 		for (Transaction *trans = activeTransactions.first; trans; trans = trans->next)

=== modified file 'storage/falcon/WalkDeferred.cpp'
--- a/storage/falcon/WalkDeferred.cpp	2008-07-14 16:53:51 +0000
+++ b/storage/falcon/WalkDeferred.cpp	2008-07-25 18:07:24 +0000
@@ -16,15 +16,17 @@
 #include "Engine.h"
 #include "WalkDeferred.h"
 
-WalkDeferred::WalkDeferred(DeferredIndex *deferredIndex, Transaction *transaction, int flags, IndexKey *lower, IndexKey *upper) 
-	: IndexWalker(deferredIndex->index, transaction, flags)
+WalkDeferred::WalkDeferred(DeferredIndex *deferredIdx, Transaction *transaction, int flags, IndexKey *lower, IndexKey *upper) 
+	: IndexWalker(deferredIdx->index, transaction, flags)
 {
+	deferredIndex = deferredIdx;
 	walker.initialize(deferredIndex, lower, flags);
 	node = NULL;
 }
 
 WalkDeferred::~WalkDeferred(void)
 {
+	deferredIndex->releaseRef();
 }
 
 Record* WalkDeferred::getNext(bool lockForUpdate)

=== modified file 'storage/falcon/WalkDeferred.h'
--- a/storage/falcon/WalkDeferred.h	2008-05-07 22:37:18 +0000
+++ b/storage/falcon/WalkDeferred.h	2008-07-25 18:07:24 +0000
@@ -22,13 +22,14 @@
 class WalkDeferred : public IndexWalker
 {
 public:
-	WalkDeferred(DeferredIndex *deferredIndex, Transaction *transaction, int flags, IndexKey *lower, IndexKey *upper);
+	WalkDeferred(DeferredIndex *deferredIdx, Transaction *transaction, int flags, IndexKey *lower, IndexKey *upper);
 	virtual ~WalkDeferred(void);
 
 	virtual Record*		getNext(bool lockForUpdate);
 	
 	DeferredIndexWalker		walker;
 	DINode					*node;
+	DeferredIndex			*deferredIndex;
 };
 
 #endif

=== modified file 'storage/falcon/WalkIndex.cpp'
--- a/storage/falcon/WalkIndex.cpp	2008-07-09 21:37:50 +0000
+++ b/storage/falcon/WalkIndex.cpp	2008-07-15 18:57:27 +0000
@@ -88,9 +88,9 @@ int32 WalkIndex::getNextNode(void)
 			recordNumber = node.getNumber();
 			
 			if (recordNumber >= 0)
-				return recordNumber;
-			else if (recordNumber == END_LEVEL)
-				return -1;
+				return recordNumber;
+			else if (recordNumber == END_LEVEL)
+				return -1;
 			}
 			
 		node.getNext(endNodes);

=== modified file 'storage/falcon/ha_falcon.cpp'
--- a/storage/falcon/ha_falcon.cpp	2008-07-19 03:03:39 +0000
+++ b/storage/falcon/ha_falcon.cpp	2008-08-07 14:19:54 +0000
@@ -83,7 +83,6 @@ static StorageHandler	*storageHandler;
 #undef PARAMETER_BOOL
 
 ulonglong	falcon_record_memory_max;
-ulonglong	falcon_initial_allocation;
 ulonglong	falcon_serial_log_file_size;
 uint		falcon_allocation_extent;
 ulonglong	falcon_page_cache_size;
@@ -2041,16 +2040,22 @@ int StorageInterface::alter_tablespace(h
 	/*
 	CREATE TABLESPACE tablespace
 		ADD DATAFILE 'file'
-		USE LOGFILE GROUP logfile_group
-		[EXTENT_SIZE [=] extent_size]
-		[INITIAL_SIZE [=] initial_size]
-		[AUTOEXTEND_SIZE [=] autoextend_size]
-		[MAX_SIZE [=] max_size]
-		[NODEGROUP [=] nodegroup_id]
-		[WAIT]
+		USE LOGFILE GROUP logfile_group         // NDB only
+		[EXTENT_SIZE [=] extent_size]           // Not supported
+		[INITIAL_SIZE [=] initial_size]         // Not supported
+		[AUTOEXTEND_SIZE [=] autoextend_size]   // Not supported
+		[MAX_SIZE [=] max_size]                 // Not supported
+		[NODEGROUP [=] nodegroup_id]            // NDB only
+		[WAIT]                                  // NDB only
 		[COMMENT [=] comment_text]
 		ENGINE [=] engine
+
+
+	Parameters EXTENT_SIZE, INITIAL,SIZE, AUTOEXTEND_SIZE and MAX_SIZE are
+	currently not supported by Falcon. LOGFILE GROUP, NODEGROUP and WAIT are
+	for NDB only.
 	*/
+
 	if (ts_info->data_file_name)
 		{
 		char buff[FN_REFLEN];
@@ -2068,15 +2073,7 @@ int StorageInterface::alter_tablespace(h
 	switch (ts_info->ts_cmd_type)
 		{
 		case CREATE_TABLESPACE:
-			ret = storageHandler->createTablespace(	ts_info->tablespace_name,
-													ts_info->data_file_name,
-													ts_info->initial_size,
-													ts_info->extent_size,
-													ts_info->autoextend_size,
-													ts_info->max_size,
-													ts_info->nodegroup_id,
-													ts_info->wait_until_completed,
-													ts_info->ts_comment);
+			ret = storageHandler->createTablespace(	ts_info->tablespace_name, ts_info->data_file_name, ts_info->ts_comment);
 			break;
 
 		case DROP_TABLESPACE:
@@ -3246,48 +3243,6 @@ int NfsPluginHandler::deinitTableSpaceFi
 
 //*****************************************************************************
 //
-// FALCON_TABLES
-//
-//*****************************************************************************
-
-int NfsPluginHandler::getTablesInfo(THD *thd, TABLE_LIST *tables, COND *cond)
-{
-	InfoTableImpl infoTable(thd, tables, system_charset_info);
-
-	if (storageHandler)
-		storageHandler->getTablesInfo(&infoTable);
-
-	return infoTable.error;
-}
-
-ST_FIELD_INFO tablesFieldInfo[]=
-{
-	{"SCHEMA_NAME",	  127, MYSQL_TYPE_STRING,	0, 0, "Schema Name", SKIP_OPEN_TABLE},
-	{"TABLE_NAME",	  127, MYSQL_TYPE_STRING,	0, 0, "Table Name", SKIP_OPEN_TABLE},
-	{"PARTITION",	  127, MYSQL_TYPE_STRING,	0, 0, "Partition Name", SKIP_OPEN_TABLE},
-	{"TABLESPACE",	  127, MYSQL_TYPE_STRING,	0, 0, "Tablespace", SKIP_OPEN_TABLE},
-	{"INTERNAL_NAME", 127, MYSQL_TYPE_STRING,	0, 0, "Internal Name", SKIP_OPEN_TABLE},
-	{0,					0, MYSQL_TYPE_STRING,	0, 0, 0, SKIP_OPEN_TABLE}
-};
-
-int NfsPluginHandler::initTablesInfo(void *p)
-{
-	DBUG_ENTER("initTablesInfo");
-	ST_SCHEMA_TABLE *schema = (ST_SCHEMA_TABLE *)p;
-	schema->fields_info = tablesFieldInfo;
-	schema->fill_table = NfsPluginHandler::getTablesInfo;
-
-	DBUG_RETURN(0);
-}
-
-int NfsPluginHandler::deinitTablesInfo(void *p)
-{
-	DBUG_ENTER("deinitTablesInfo");
-	DBUG_RETURN(0);
-}
-
-//*****************************************************************************
-//
 // FALCON_TRANSACTIONS
 //
 //*****************************************************************************
@@ -3627,11 +3582,6 @@ static MYSQL_SYSVAR_ULONGLONG(record_mem
   "The maximum size of the record memory cache.",
   NULL, StorageInterface::updateRecordMemoryMax, LL(250)<<20, 0, (ulonglong) max_memory_address, LL(1)<<20);
 
-static MYSQL_SYSVAR_ULONGLONG(initial_allocation, falcon_initial_allocation,
-  PLUGIN_VAR_RQCMDARG, // | PLUGIN_VAR_READONLY,
-  "Initial allocation (in bytes) of falcon user tablespace.",
-  NULL, NULL, 0, 0, LL(4000000000), LL(1)<<20);
-
 static MYSQL_SYSVAR_ULONGLONG(serial_log_file_size, falcon_serial_log_file_size,
   PLUGIN_VAR_RQCMDARG,
   "If serial log file grows larger than this value, it will be truncated when it is reused",
@@ -3680,7 +3630,6 @@ static struct st_mysql_sys_var* falconVa
 	MYSQL_SYSVAR(scavenge_schedule),
 	//MYSQL_SYSVAR(debug_mask),
 	MYSQL_SYSVAR(record_memory_max),
-	MYSQL_SYSVAR(initial_allocation),
 	//MYSQL_SYSVAR(allocation_extent),
 	MYSQL_SYSVAR(page_cache_size),
 	MYSQL_SYSVAR(consistent_read),
@@ -3700,7 +3649,6 @@ static st_mysql_information_schema falco
 static st_mysql_information_schema falcon_serial_log_info		=	{ MYSQL_INFORMATION_SCHEMA_INTERFACE_VERSION};
 static st_mysql_information_schema falcon_tablespaces			=	{ MYSQL_INFORMATION_SCHEMA_INTERFACE_VERSION};
 static st_mysql_information_schema falcon_tablespace_files		=	{ MYSQL_INFORMATION_SCHEMA_INTERFACE_VERSION};
-static st_mysql_information_schema falcon_tables				=	{ MYSQL_INFORMATION_SCHEMA_INTERFACE_VERSION};
 static st_mysql_information_schema falcon_version				=	{ MYSQL_INFORMATION_SCHEMA_INTERFACE_VERSION};
 
 mysql_declare_plugin(falcon)
@@ -3897,21 +3845,6 @@ mysql_declare_plugin(falcon)
 	NULL,										/* status variables */
 	NULL,										/* system variables */
 	NULL										/* config options   */
-	},
-	
-	{
-	MYSQL_INFORMATION_SCHEMA_PLUGIN,
-	&falcon_tables,
-	"FALCON_TABLES",
-	"MySQL AB",
-	"Falcon Tables.",
-	PLUGIN_LICENSE_GPL,
-	NfsPluginHandler::initTablesInfo,			/* plugin init */
-	NfsPluginHandler::deinitTablesInfo,			/* plugin deinit */
-	0x0005,
-	NULL,										/* status variables */
-	NULL,										/* system variables */
-	NULL										/* config options   */
 	}
 
 mysql_declare_plugin_end;

=== modified file 'storage/falcon/ha_falcon.h'
--- a/storage/falcon/ha_falcon.h	2008-07-09 04:38:02 +0000
+++ b/storage/falcon/ha_falcon.h	2008-07-29 10:45:39 +0000
@@ -253,8 +253,4 @@ public:
 	static int getTableSpaceFilesInfo(THD *thd, TABLE_LIST *tables, COND *cond);
 	static int initTableSpaceFilesInfo(void *p);
 	static int deinitTableSpaceFilesInfo(void *p);
-	
-	static int getTablesInfo(THD *thd, TABLE_LIST *tables, COND *cond);
-	static int initTablesInfo(void *p);
-	static int deinitTablesInfo(void *p);
 };

=== modified file 'support-files/build-tags'
--- a/support-files/build-tags	2008-05-23 07:42:40 +0000
+++ b/support-files/build-tags	2008-08-07 20:33:48 +0000
@@ -1,9 +1,12 @@
 #! /bin/sh
 
 rm -f TAGS
-filter='\.cc$\|\.c$\|\.h$\|\.yy\|\.[ch]pp$'
-files=`find . | grep $filter `
-for f in $files ;
+filter='\.cc$\|\.c$\|\.h$\|\.yy$'
+
+list="find . -type f"
+bzr root >/dev/null 2>/dev/null && list="bzr ls --kind=file --versioned"
+
+$list |grep $filter |while read f; 
 do
 	 etags -o TAGS --append $f
 done

Thread
bzr push into mysql-6.0 branch (hezx:2683 to 2684) Bug#10143 Bug#21226Bug#22165 Bug#29211 Bug#29738 Bug#31605 Bug#33002 Bug#33053 Bug#33362Bug#33637 B...He Zhenxing14 Aug