[Commits] bzr commit into MariaDB 5.1, with Maria 1.5:maria branch (monty:2898)

Michael Widenius monty at askmonty.org
Fri Sep 3 19:20:34 EEST 2010


#At lp:maria based on revid:monty at askmonty.org-20100903100147-tkzhd1vkk9fccmb9

 2898 Michael Widenius	2010-09-03
      Fix that one can run mysql_upgrade with long table names
      Fall back to use ALTER TABLE for engines that doesn't support REPAIR when doing repair for upgrade.
      Nicer output from mysql_upgrade and mysql_check
      Updated all arrays that used NAME_LEN to use SAFE_NAME_LEN to ensure that we don't break things accidently as names can now have a #mysql50# prefix.
      added:
        mysql-test/std_data/ltoriaeinnovacionendesarrolloempres?9120761097220077376?cio_com.MYD
        mysql-test/std_data/ltoriaeinnovacionendesarrolloempres?9120761097220077376?cio_com.MYI
        mysql-test/std_data/ltoriaeinnovacionendesarrolloempres?9120761097220077376?cio_com.frm
      modified:
        client/mysql_upgrade.c
        client/mysqlcheck.c
        mysql-test/r/drop.result
        mysql-test/r/grant.result
        mysql-test/r/show_check.result
        mysql-test/r/upgrade.result
        mysql-test/suite/funcs_1/r/is_tables_is.result
        mysql-test/t/drop.test
        mysql-test/t/grant.test
        mysql-test/t/upgrade.test
        sql/ha_partition.cc
        sql/item.cc
        sql/log_event.cc
        sql/mysql_priv.h
        sql/rpl_filter.cc
        sql/sp.cc
        sql/sp_head.cc
        sql/sql_acl.cc
        sql/sql_base.cc
        sql/sql_connect.cc
        sql/sql_parse.cc
        sql/sql_prepare.cc
        sql/sql_select.cc
        sql/sql_show.cc
        sql/sql_table.cc
        sql/sql_trigger.cc
        sql/sql_udf.cc
        sql/sql_view.cc
        sql/table.cc

per-file messages:
  client/mysql_upgrade.c
    If we are using verbose, also run mysqlcheck in verbose mode.
  client/mysqlcheck.c
    Add more information if running in verbose mode
    Print 'Needs upgrade' instead of complex error if table needs to be upgraded
    Don't write connect information if verbose is not 2 or above
  mysql-test/r/drop.result
    Updated test and results as we now support full table names
  mysql-test/r/grant.result
    Now you get a correct error message if using #mysql with paths
  mysql-test/r/show_check.result
    Update results as table names can temporarly be bigger than NAME_LEN (during upgrade)
  mysql-test/r/upgrade.result
    Test upgrade for long table names.
  mysql-test/suite/funcs_1/r/is_tables_is.result
    Updated old test result (had note been updated in a while)
  mysql-test/t/drop.test
    Updated test and results as we now support full table names
  mysql-test/t/grant.test
    Now you get a correct error message if using #mysql with paths
  mysql-test/t/upgrade.test
    Test upgrade for long table names.
  sql/ha_partition.cc
    NAME_LEN -> SAFE_NAME_LEN
  sql/item.cc
    NAME_LEN -> SAFE_NAME_LEN
  sql/log_event.cc
    NAME_LEN -> SAFE_NAME_LEN
  sql/mysql_priv.h
    Added SAFE_NAME_LEN
  sql/rpl_filter.cc
    NAME_LEN -> SAFE_NAME_LEN
  sql/sp.cc
    NAME_LEN -> SAFE_NAME_LEN
  sql/sp_head.cc
    NAME_LEN -> SAFE_NAME_LEN
  sql/sql_acl.cc
    NAME_LEN -> SAFE_NAME_LEN
  sql/sql_base.cc
    NAME_LEN -> SAFE_NAME_LEN
  sql/sql_connect.cc
    NAME_LEN -> SAFE_NAME_LEN
  sql/sql_parse.cc
    NAME_LEN -> SAFE_NAME_LEN
  sql/sql_prepare.cc
    NAME_LEN -> SAFE_NAME_LEN
  sql/sql_select.cc
    NAME_LEN -> SAFE_NAME_LEN
  sql/sql_show.cc
    NAME_LEN -> SAFE_NAME_LEN
    Enlarge table names for SHOW TABLES to also include optional #mysql50#
  sql/sql_table.cc
    Fall back to use ALTER TABLE for engines that doesn't support REPAIR when doing repair for upgrade.
  sql/sql_trigger.cc
    NAME_LEN -> SAFE_NAME_LEN
  sql/sql_udf.cc
    NAME_LEN -> SAFE_NAME_LEN
  sql/sql_view.cc
    NAME_LEN -> SAFE_NAME_LEN
  sql/table.cc
    Fixed check_table_name() to not count #mysql50# as part of name
    If #mysql50# is part of the name, don't allow path characters in name.
=== modified file 'client/mysql_upgrade.c'
--- a/client/mysql_upgrade.c	2010-08-27 14:12:44 +0000
+++ b/client/mysql_upgrade.c	2010-09-03 16:20:30 +0000
@@ -672,6 +672,7 @@ static int run_mysqlcheck_upgrade(void)
                   "--check-upgrade",
                   "--all-databases",
                   "--auto-repair",
+                  opt_verbose ? "--verbose": "",
                   opt_write_binlog ? "--write-binlog" : "--skip-write-binlog",
                   NULL);
 }
@@ -687,6 +688,7 @@ static int run_mysqlcheck_fixnames(void)
                   "--all-databases",
                   "--fix-db-names",
                   "--fix-table-names",
+                  opt_verbose ? "--verbose": "",
                   opt_write_binlog ? "--write-binlog" : "--skip-write-binlog",
                   NULL);
 }

=== modified file 'client/mysqlcheck.c'
--- a/client/mysqlcheck.c	2010-08-27 14:12:44 +0000
+++ b/client/mysqlcheck.c	2010-09-03 16:20:30 +0000
@@ -1,4 +1,5 @@
 /* Copyright (C) 2000 MySQL AB
+   Copyright (C) 2010 Monty Program Ab
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -15,7 +16,7 @@
 
 /* By Jani Tolonen, 2001-04-20, MySQL Development Team */
 
-#define CHECK_VERSION "2.5.0"
+#define CHECK_VERSION "2.6.0"
 
 #include "client_priv.h"
 #include <m_ctype.h>
@@ -416,6 +417,8 @@ static int process_all_databases()
 		    MYF(0), mysql_error(sock));
     return 1;
   }
+  if (verbose)
+    printf("Processing databases\n");
   while ((row = mysql_fetch_row(tableres)))
   {
     if (process_one_db(row[0]))
@@ -429,6 +432,8 @@ static int process_all_databases()
 static int process_databases(char **db_names)
 {
   int result = 0;
+  if (verbose)
+    printf("Processing databases\n");
   for ( ; *db_names ; db_names++)
   {
     if (process_one_db(*db_names))
@@ -624,6 +629,8 @@ static int fix_database_storage_name(con
 
 static int process_one_db(char *database)
 {
+  if (verbose)
+    puts(database);
   if (what_to_do == DO_UPGRADE)
   {
     int rc= 0;
@@ -731,7 +738,7 @@ static void print_result()
 {
   MYSQL_RES *res;
   MYSQL_ROW row;
-  char prev[NAME_LEN*2+2];
+  char prev[(NAME_LEN+9)*2+2];
   uint i;
   my_bool found_error=0;
 
@@ -761,7 +768,15 @@ static void print_result()
       printf("%-50s %s", row[0], row[3]);
     else if (!status && changed)
     {
-      printf("%s\n%-9s: %s", row[0], row[2], row[3]);
+      /*
+        If the error message includes REPAIR TABLE, we assume it means
+        we have to run upgrade on it. In this case we write a nicer message
+        than "Please do "REPAIR TABLE""...
+      */
+      if (!strcmp(row[2],"error") && strinstr(row[3],"REPAIR TABLE") != 0)
+        printf("%-50s %s", row[0], "Needs upgrade");
+      else
+        printf("%s\n%-9s: %s", row[0], row[2], row[3]);
       if (strcmp(row[2],"note"))
 	found_error=1;
     }
@@ -780,7 +795,7 @@ static void print_result()
 static int dbConnect(char *host, char *user, char *passwd)
 {
   DBUG_ENTER("dbConnect");
-  if (verbose)
+  if (verbose > 1)
   {
     fprintf(stderr, "# Connecting to %s...\n", host ? host : "localhost");
   }
@@ -813,7 +828,7 @@ static int dbConnect(char *host, char *u
 
 static void dbDisconnect(char *host)
 {
-  if (verbose)
+  if (verbose > 1)
     fprintf(stderr, "# Disconnecting from %s...\n", host ? host : "localhost");
   mysql_close(sock);
 } /* dbDisconnect */

=== modified file 'mysql-test/r/drop.result'
--- a/mysql-test/r/drop.result	2008-04-03 09:50:43 +0000
+++ b/mysql-test/r/drop.result	2010-09-03 16:20:30 +0000
@@ -115,9 +115,14 @@ create table `#mysql50#abc``def` ( id in
 create table `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa` (a int);
 ERROR 42000: Incorrect table name 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
 create table `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa` (a int);
-create table `#mysql50#aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa` (a int);
-create table `#mysql50#aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa` (a int);
-ERROR 42000: Incorrect table name '#mysql50#aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
+create table `#mysql50#aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1234` (a int);
+create table `#mysql50#aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa12345` (a int);
+ERROR 42000: Incorrect table name '#mysql50#aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa12345'
+show tables;
+Tables_in_mysqltestbug26703
+aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1234
+aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+#mysql50#abc`def
 use test;
 drop database mysqltestbug26703;
 End of 5.1 tests

=== modified file 'mysql-test/r/grant.result'
--- a/mysql-test/r/grant.result	2010-08-27 14:12:44 +0000
+++ b/mysql-test/r/grant.result	2010-09-03 16:20:30 +0000
@@ -1424,7 +1424,7 @@ ERROR 42S02: Table 'db1.../db2/tb2' does
 SELECT * FROM `../db2`.tb2;
 ERROR 42000: SELECT command denied to user 'testbug'@'localhost' for table 'tb2'
 SELECT * FROM `#mysql50#/../db2/tb2`;
-ERROR 42S02: Table 'db1.#mysql50#/../db2/tb2' doesn't exist
+ERROR 42000: Incorrect table name '#mysql50#/../db2/tb2'
 DROP USER 'testbug'@localhost;
 DROP TABLE db2.t1;
 DROP DATABASE db1;

=== modified file 'mysql-test/r/show_check.result'
--- a/mysql-test/r/show_check.result	2010-04-28 12:52:24 +0000
+++ b/mysql-test/r/show_check.result	2010-09-03 16:20:30 +0000
@@ -977,7 +977,7 @@ NULL	test	t1	c	NULL	NO	int	NULL	NULL	int
 ----------------------------------------------------------------
 SHOW TABLES LIKE 't1';
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
-def			TABLE_NAMES	TABLE_NAME	Tables_in_test (t1)	253	192	2	N	1	0	33
+def			TABLE_NAMES	TABLE_NAME	Tables_in_test (t1)	253	219	2	N	1	0	33
 Tables_in_test (t1)
 t1
 ----------------------------------------------------------------

=== modified file 'mysql-test/r/upgrade.result'
--- a/mysql-test/r/upgrade.result	2010-07-08 18:46:26 +0000
+++ b/mysql-test/r/upgrade.result	2010-09-03 16:20:30 +0000
@@ -139,4 +139,12 @@ USE `#mysql50#.`;
 ERROR 42000: Incorrect database name '#mysql50#.'
 USE `#mysql50#../blablabla`;
 ERROR 42000: Incorrect database name '#mysql50#../blablabla'
+show full tables;
+Tables_in_test	Table_type
+#mysql50#ltoriaeinnovacionendesarrolloempres?9120761097220077376?cio_com	BASE TABLE
+rename table `#mysql50#ltoriaeinnovacionendesarrolloempres?9120761097220077376?cio_com` to `ltoriaeinnovacionendesarrolloempres?9120761097220077376?cio_com`;
+show full tables;
+Tables_in_test	Table_type
+ltoriaeinnovacionendesarrolloempres?9120761097220077376?cio_com	BASE TABLE
+drop table `ltoriaeinnovacionendesarrolloempres?9120761097220077376?cio_com`;
 # End of 5.1 tests

=== added file 'mysql-test/std_data/ltoriaeinnovacionendesarrolloempres?9120761097220077376?cio_com.MYD'
Files a/mysql-test/std_data/ltoriaeinnovacionendesarrolloempres?9120761097220077376?cio_com.MYD	1970-01-01 00:00:00 +0000 and b/mysql-test/std_data/ltoriaeinnovacionendesarrolloempres?9120761097220077376?cio_com.MYD	2010-09-03 16:20:30 +0000 differ

=== added file 'mysql-test/std_data/ltoriaeinnovacionendesarrolloempres?9120761097220077376?cio_com.MYI'
Files a/mysql-test/std_data/ltoriaeinnovacionendesarrolloempres?9120761097220077376?cio_com.MYI	1970-01-01 00:00:00 +0000 and b/mysql-test/std_data/ltoriaeinnovacionendesarrolloempres?9120761097220077376?cio_com.MYI	2010-09-03 16:20:30 +0000 differ

=== added file 'mysql-test/std_data/ltoriaeinnovacionendesarrolloempres?9120761097220077376?cio_com.frm'
Files a/mysql-test/std_data/ltoriaeinnovacionendesarrolloempres?9120761097220077376?cio_com.frm	1970-01-01 00:00:00 +0000 and b/mysql-test/std_data/ltoriaeinnovacionendesarrolloempres?9120761097220077376?cio_com.frm	2010-09-03 16:20:30 +0000 differ

=== modified file 'mysql-test/suite/funcs_1/r/is_tables_is.result'
--- a/mysql-test/suite/funcs_1/r/is_tables_is.result	2010-04-28 19:29:45 +0000
+++ b/mysql-test/suite/funcs_1/r/is_tables_is.result	2010-09-03 16:20:30 +0000
@@ -245,674 +245,7 @@ user_comment
 Separator	-----------------------------------------------------
 TABLE_CATALOG	NULL
 TABLE_SCHEMA	information_schema
-TABLE_NAME	INNODB_BUFFER_POOL_PAGES
-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	INNODB_BUFFER_POOL_PAGES_BLOB
-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	INNODB_BUFFER_POOL_PAGES_INDEX
-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	INNODB_CMP
-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	INNODB_CMPMEM
-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	INNODB_CMPMEM_RESET
-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	INNODB_CMP_RESET
-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	INNODB_INDEX_STATS
-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	INNODB_LOCKS
-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	INNODB_LOCK_WAITS
-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	INNODB_RSEG
-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	INNODB_SYS_INDEXES
-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	INNODB_SYS_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	INNODB_TABLE_STATS
-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	INNODB_TRX
-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	KEY_COLUMN_USAGE
-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	PARTITIONS
-TABLE_TYPE	SYSTEM VIEW
-ENGINE	MYISAM_OR_MARIA
-VERSION	10
-ROW_FORMAT	DYNAMIC_OR_PAGE
-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	PBXT_STATISTICS
-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	PLUGINS
-TABLE_TYPE	SYSTEM VIEW
-ENGINE	MYISAM_OR_MARIA
-VERSION	10
-ROW_FORMAT	DYNAMIC_OR_PAGE
-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	PROCESSLIST
-TABLE_TYPE	SYSTEM VIEW
-ENGINE	MYISAM_OR_MARIA
-VERSION	10
-ROW_FORMAT	DYNAMIC_OR_PAGE
-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	REFERENTIAL_CONSTRAINTS
-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	ROUTINES
-TABLE_TYPE	SYSTEM VIEW
-ENGINE	MYISAM_OR_MARIA
-VERSION	10
-ROW_FORMAT	DYNAMIC_OR_PAGE
-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	SCHEMATA
-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	SCHEMA_PRIVILEGES
-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	SESSION_STATUS
-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	SESSION_VARIABLES
-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	STATISTICS
-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	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	TABLE_CONSTRAINTS
-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	TABLE_PRIVILEGES
+TABLE_NAME	KEY_COLUMN_USAGE
 TABLE_TYPE	SYSTEM VIEW
 ENGINE	MEMORY
 VERSION	10
@@ -935,7 +268,7 @@ user_comment
 Separator	-----------------------------------------------------
 TABLE_CATALOG	NULL
 TABLE_SCHEMA	information_schema
-TABLE_NAME	TRIGGERS
+TABLE_NAME	PARTITIONS
 TABLE_TYPE	SYSTEM VIEW
 ENGINE	MYISAM_OR_MARIA
 VERSION	10
@@ -958,30 +291,7 @@ user_comment
 Separator	-----------------------------------------------------
 TABLE_CATALOG	NULL
 TABLE_SCHEMA	information_schema
-TABLE_NAME	USER_PRIVILEGES
-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	VIEWS
+TABLE_NAME	PLUGINS
 TABLE_TYPE	SYSTEM VIEW
 ENGINE	MYISAM_OR_MARIA
 VERSION	10
@@ -1004,97 +314,11 @@ user_comment
 Separator	-----------------------------------------------------
 TABLE_CATALOG	NULL
 TABLE_SCHEMA	information_schema
-TABLE_NAME	XTRADB_ADMIN_COMMAND
-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	XTRADB_ENHANCEMENTS
-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	-----------------------------------------------------
-DROP   USER testuser1 at localhost;
-CREATE USER testuser1 at localhost;
-GRANT SELECT ON test1.* TO testuser1 at localhost;
-# Establish connection testuser1 (user=testuser1)
-SELECT *,
-LEFT( table_comment,
-IF(INSTR(table_comment,'InnoDB free') = 0
-AND INSTR(table_comment,'number_of_replicas') = 0,
-LENGTH(table_comment),
-INSTR(table_comment,'InnoDB free')
-+ INSTR(table_comment,'number_of_replicas') - 1))
-AS "user_comment",
-'-----------------------------------------------------' AS "Separator"
-FROM information_schema.tables
-WHERE table_schema = 'information_schema'
-AND table_name <> 'profiling'
-ORDER BY table_schema,table_name;
-TABLE_CATALOG	NULL
-TABLE_SCHEMA	information_schema
-TABLE_NAME	CHARACTER_SETS
-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	COLLATIONS
+TABLE_NAME	PROCESSLIST
 TABLE_TYPE	SYSTEM VIEW
-ENGINE	MEMORY
+ENGINE	MYISAM_OR_MARIA
 VERSION	10
-ROW_FORMAT	Fixed
+ROW_FORMAT	DYNAMIC_OR_PAGE
 TABLE_ROWS	#TBLR#
 AVG_ROW_LENGTH	#ARL#
 DATA_LENGTH	#DL#
@@ -1113,7 +337,7 @@ user_comment
 Separator	-----------------------------------------------------
 TABLE_CATALOG	NULL
 TABLE_SCHEMA	information_schema
-TABLE_NAME	COLLATION_CHARACTER_SET_APPLICABILITY
+TABLE_NAME	REFERENTIAL_CONSTRAINTS
 TABLE_TYPE	SYSTEM VIEW
 ENGINE	MEMORY
 VERSION	10
@@ -1136,7 +360,7 @@ user_comment
 Separator	-----------------------------------------------------
 TABLE_CATALOG	NULL
 TABLE_SCHEMA	information_schema
-TABLE_NAME	COLUMNS
+TABLE_NAME	ROUTINES
 TABLE_TYPE	SYSTEM VIEW
 ENGINE	MYISAM_OR_MARIA
 VERSION	10
@@ -1159,7 +383,7 @@ user_comment
 Separator	-----------------------------------------------------
 TABLE_CATALOG	NULL
 TABLE_SCHEMA	information_schema
-TABLE_NAME	COLUMN_PRIVILEGES
+TABLE_NAME	SCHEMATA
 TABLE_TYPE	SYSTEM VIEW
 ENGINE	MEMORY
 VERSION	10
@@ -1182,7 +406,7 @@ user_comment
 Separator	-----------------------------------------------------
 TABLE_CATALOG	NULL
 TABLE_SCHEMA	information_schema
-TABLE_NAME	ENGINES
+TABLE_NAME	SCHEMA_PRIVILEGES
 TABLE_TYPE	SYSTEM VIEW
 ENGINE	MEMORY
 VERSION	10
@@ -1205,11 +429,11 @@ user_comment
 Separator	-----------------------------------------------------
 TABLE_CATALOG	NULL
 TABLE_SCHEMA	information_schema
-TABLE_NAME	EVENTS
+TABLE_NAME	SESSION_STATUS
 TABLE_TYPE	SYSTEM VIEW
-ENGINE	MYISAM_OR_MARIA
+ENGINE	MEMORY
 VERSION	10
-ROW_FORMAT	DYNAMIC_OR_PAGE
+ROW_FORMAT	Fixed
 TABLE_ROWS	#TBLR#
 AVG_ROW_LENGTH	#ARL#
 DATA_LENGTH	#DL#
@@ -1228,7 +452,7 @@ user_comment
 Separator	-----------------------------------------------------
 TABLE_CATALOG	NULL
 TABLE_SCHEMA	information_schema
-TABLE_NAME	FILES
+TABLE_NAME	SESSION_VARIABLES
 TABLE_TYPE	SYSTEM VIEW
 ENGINE	MEMORY
 VERSION	10
@@ -1251,7 +475,7 @@ user_comment
 Separator	-----------------------------------------------------
 TABLE_CATALOG	NULL
 TABLE_SCHEMA	information_schema
-TABLE_NAME	GLOBAL_STATUS
+TABLE_NAME	STATISTICS
 TABLE_TYPE	SYSTEM VIEW
 ENGINE	MEMORY
 VERSION	10
@@ -1274,7 +498,7 @@ user_comment
 Separator	-----------------------------------------------------
 TABLE_CATALOG	NULL
 TABLE_SCHEMA	information_schema
-TABLE_NAME	GLOBAL_VARIABLES
+TABLE_NAME	TABLES
 TABLE_TYPE	SYSTEM VIEW
 ENGINE	MEMORY
 VERSION	10
@@ -1297,7 +521,7 @@ user_comment
 Separator	-----------------------------------------------------
 TABLE_CATALOG	NULL
 TABLE_SCHEMA	information_schema
-TABLE_NAME	INNODB_BUFFER_POOL_PAGES
+TABLE_NAME	TABLE_CONSTRAINTS
 TABLE_TYPE	SYSTEM VIEW
 ENGINE	MEMORY
 VERSION	10
@@ -1320,7 +544,7 @@ user_comment
 Separator	-----------------------------------------------------
 TABLE_CATALOG	NULL
 TABLE_SCHEMA	information_schema
-TABLE_NAME	INNODB_BUFFER_POOL_PAGES_BLOB
+TABLE_NAME	TABLE_PRIVILEGES
 TABLE_TYPE	SYSTEM VIEW
 ENGINE	MEMORY
 VERSION	10
@@ -1343,11 +567,11 @@ user_comment
 Separator	-----------------------------------------------------
 TABLE_CATALOG	NULL
 TABLE_SCHEMA	information_schema
-TABLE_NAME	INNODB_BUFFER_POOL_PAGES_INDEX
+TABLE_NAME	TRIGGERS
 TABLE_TYPE	SYSTEM VIEW
-ENGINE	MEMORY
+ENGINE	MYISAM_OR_MARIA
 VERSION	10
-ROW_FORMAT	Fixed
+ROW_FORMAT	DYNAMIC_OR_PAGE
 TABLE_ROWS	#TBLR#
 AVG_ROW_LENGTH	#ARL#
 DATA_LENGTH	#DL#
@@ -1366,7 +590,7 @@ user_comment
 Separator	-----------------------------------------------------
 TABLE_CATALOG	NULL
 TABLE_SCHEMA	information_schema
-TABLE_NAME	INNODB_CMP
+TABLE_NAME	USER_PRIVILEGES
 TABLE_TYPE	SYSTEM VIEW
 ENGINE	MEMORY
 VERSION	10
@@ -1389,11 +613,11 @@ user_comment
 Separator	-----------------------------------------------------
 TABLE_CATALOG	NULL
 TABLE_SCHEMA	information_schema
-TABLE_NAME	INNODB_CMPMEM
+TABLE_NAME	VIEWS
 TABLE_TYPE	SYSTEM VIEW
-ENGINE	MEMORY
+ENGINE	MYISAM_OR_MARIA
 VERSION	10
-ROW_FORMAT	Fixed
+ROW_FORMAT	DYNAMIC_OR_PAGE
 TABLE_ROWS	#TBLR#
 AVG_ROW_LENGTH	#ARL#
 DATA_LENGTH	#DL#
@@ -1410,9 +634,26 @@ CREATE_OPTIONS	#CO#
 TABLE_COMMENT	#TC#
 user_comment	
 Separator	-----------------------------------------------------
+DROP   USER testuser1 at localhost;
+CREATE USER testuser1 at localhost;
+GRANT SELECT ON test1.* TO testuser1 at localhost;
+# Establish connection testuser1 (user=testuser1)
+SELECT *,
+LEFT( table_comment,
+IF(INSTR(table_comment,'InnoDB free') = 0
+AND INSTR(table_comment,'number_of_replicas') = 0,
+LENGTH(table_comment),
+INSTR(table_comment,'InnoDB free')
++ INSTR(table_comment,'number_of_replicas') - 1))
+AS "user_comment",
+'-----------------------------------------------------' AS "Separator"
+FROM information_schema.tables
+WHERE table_schema = 'information_schema'
+AND table_name <> 'profiling'
+ORDER BY table_schema,table_name;
 TABLE_CATALOG	NULL
 TABLE_SCHEMA	information_schema
-TABLE_NAME	INNODB_CMPMEM_RESET
+TABLE_NAME	CHARACTER_SETS
 TABLE_TYPE	SYSTEM VIEW
 ENGINE	MEMORY
 VERSION	10
@@ -1435,7 +676,7 @@ user_comment
 Separator	-----------------------------------------------------
 TABLE_CATALOG	NULL
 TABLE_SCHEMA	information_schema
-TABLE_NAME	INNODB_CMP_RESET
+TABLE_NAME	COLLATIONS
 TABLE_TYPE	SYSTEM VIEW
 ENGINE	MEMORY
 VERSION	10
@@ -1458,7 +699,7 @@ user_comment
 Separator	-----------------------------------------------------
 TABLE_CATALOG	NULL
 TABLE_SCHEMA	information_schema
-TABLE_NAME	INNODB_INDEX_STATS
+TABLE_NAME	COLLATION_CHARACTER_SET_APPLICABILITY
 TABLE_TYPE	SYSTEM VIEW
 ENGINE	MEMORY
 VERSION	10
@@ -1481,11 +722,11 @@ user_comment
 Separator	-----------------------------------------------------
 TABLE_CATALOG	NULL
 TABLE_SCHEMA	information_schema
-TABLE_NAME	INNODB_LOCKS
+TABLE_NAME	COLUMNS
 TABLE_TYPE	SYSTEM VIEW
-ENGINE	MEMORY
+ENGINE	MYISAM_OR_MARIA
 VERSION	10
-ROW_FORMAT	Fixed
+ROW_FORMAT	DYNAMIC_OR_PAGE
 TABLE_ROWS	#TBLR#
 AVG_ROW_LENGTH	#ARL#
 DATA_LENGTH	#DL#
@@ -1504,7 +745,7 @@ user_comment
 Separator	-----------------------------------------------------
 TABLE_CATALOG	NULL
 TABLE_SCHEMA	information_schema
-TABLE_NAME	INNODB_LOCK_WAITS
+TABLE_NAME	COLUMN_PRIVILEGES
 TABLE_TYPE	SYSTEM VIEW
 ENGINE	MEMORY
 VERSION	10
@@ -1527,7 +768,7 @@ user_comment
 Separator	-----------------------------------------------------
 TABLE_CATALOG	NULL
 TABLE_SCHEMA	information_schema
-TABLE_NAME	INNODB_RSEG
+TABLE_NAME	ENGINES
 TABLE_TYPE	SYSTEM VIEW
 ENGINE	MEMORY
 VERSION	10
@@ -1550,11 +791,11 @@ user_comment
 Separator	-----------------------------------------------------
 TABLE_CATALOG	NULL
 TABLE_SCHEMA	information_schema
-TABLE_NAME	INNODB_SYS_INDEXES
+TABLE_NAME	EVENTS
 TABLE_TYPE	SYSTEM VIEW
-ENGINE	MEMORY
+ENGINE	MYISAM_OR_MARIA
 VERSION	10
-ROW_FORMAT	Fixed
+ROW_FORMAT	DYNAMIC_OR_PAGE
 TABLE_ROWS	#TBLR#
 AVG_ROW_LENGTH	#ARL#
 DATA_LENGTH	#DL#
@@ -1573,7 +814,7 @@ user_comment
 Separator	-----------------------------------------------------
 TABLE_CATALOG	NULL
 TABLE_SCHEMA	information_schema
-TABLE_NAME	INNODB_SYS_TABLES
+TABLE_NAME	FILES
 TABLE_TYPE	SYSTEM VIEW
 ENGINE	MEMORY
 VERSION	10
@@ -1596,7 +837,7 @@ user_comment
 Separator	-----------------------------------------------------
 TABLE_CATALOG	NULL
 TABLE_SCHEMA	information_schema
-TABLE_NAME	INNODB_TABLE_STATS
+TABLE_NAME	GLOBAL_STATUS
 TABLE_TYPE	SYSTEM VIEW
 ENGINE	MEMORY
 VERSION	10
@@ -1619,7 +860,7 @@ user_comment
 Separator	-----------------------------------------------------
 TABLE_CATALOG	NULL
 TABLE_SCHEMA	information_schema
-TABLE_NAME	INNODB_TRX
+TABLE_NAME	GLOBAL_VARIABLES
 TABLE_TYPE	SYSTEM VIEW
 ENGINE	MEMORY
 VERSION	10
@@ -1688,29 +929,6 @@ user_comment
 Separator	-----------------------------------------------------
 TABLE_CATALOG	NULL
 TABLE_SCHEMA	information_schema
-TABLE_NAME	PBXT_STATISTICS
-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	PLUGINS
 TABLE_TYPE	SYSTEM VIEW
 ENGINE	MYISAM_OR_MARIA
@@ -2041,52 +1259,6 @@ ROW_FORMAT	DYNAMIC_OR_PAGE
 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	XTRADB_ADMIN_COMMAND
-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	XTRADB_ENHANCEMENTS
-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#

=== modified file 'mysql-test/t/drop.test'
--- a/mysql-test/t/drop.test	2009-05-15 10:15:56 +0000
+++ b/mysql-test/t/drop.test	2010-09-03 16:20:30 +0000
@@ -195,9 +195,10 @@ create table `#mysql50#abc``def` ( id in
 --error ER_WRONG_TABLE_NAME
 create table `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa` (a int);
 create table `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa` (a int);
-create table `#mysql50#aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa` (a int);
+create table `#mysql50#aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1234` (a int);
 --error ER_WRONG_TABLE_NAME
-create table `#mysql50#aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa` (a int);
+create table `#mysql50#aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa12345` (a int);
+show tables;
 use test;
 drop database mysqltestbug26703;
 

=== modified file 'mysql-test/t/grant.test'
--- a/mysql-test/t/grant.test	2010-08-27 14:12:44 +0000
+++ b/mysql-test/t/grant.test	2010-09-03 16:20:30 +0000
@@ -1541,7 +1541,7 @@ connect (con1,localhost,testbug,,db1);
 SELECT * FROM `../db2/tb2`;
 --error ER_TABLEACCESS_DENIED_ERROR
 SELECT * FROM `../db2`.tb2;
---error ER_NO_SUCH_TABLE
+--error ER_WRONG_TABLE_NAME
 SELECT * FROM `#mysql50#/../db2/tb2`;
 connection default;
 disconnect con1;

=== modified file 'mysql-test/t/upgrade.test'
--- a/mysql-test/t/upgrade.test	2010-07-08 18:46:26 +0000
+++ b/mysql-test/t/upgrade.test	2010-09-03 16:20:30 +0000
@@ -169,5 +169,16 @@ USE `#mysql50#.`;
 --error ER_WRONG_DB_NAME
 USE `#mysql50#../blablabla`;
 
+#
+# Test of Bug #56441: mysql_upgrade 5.0->5.1 fails for tables with long names
+#
+copy_file std_data/ltoriaeinnovacionendesarrolloempres?9120761097220077376?cio_com.MYI $MYSQLD_DATADIR/test/ltoriaeinnovacionendesarrolloempres?9120761097220077376?cio_com.MYI;
+copy_file std_data/ltoriaeinnovacionendesarrolloempres?9120761097220077376?cio_com.MYD $MYSQLD_DATADIR/test/ltoriaeinnovacionendesarrolloempres?9120761097220077376?cio_com.MYD;
+copy_file std_data/ltoriaeinnovacionendesarrolloempres?9120761097220077376?cio_com.frm $MYSQLD_DATADIR/test/ltoriaeinnovacionendesarrolloempres?9120761097220077376?cio_com.frm;
+show full tables;
+rename table `#mysql50#ltoriaeinnovacionendesarrolloempres?9120761097220077376?cio_com` to `ltoriaeinnovacionendesarrolloempres?9120761097220077376?cio_com`;
+show full tables;
+drop table `ltoriaeinnovacionendesarrolloempres?9120761097220077376?cio_com`;
+
 --echo # End of 5.1 tests
 

=== modified file 'sql/ha_partition.cc'
--- a/sql/ha_partition.cc	2010-08-27 14:12:44 +0000
+++ b/sql/ha_partition.cc	2010-09-03 16:20:30 +0000
@@ -996,7 +996,7 @@ static bool print_admin_msg(THD* thd, co
   Protocol *protocol= thd->protocol;
   uint length, msg_length;
   char msgbuf[HA_MAX_MSG_BUF];
-  char name[NAME_LEN*2+2];
+  char name[SAFE_NAME_LEN*2+2];
 
   va_start(args, fmt);
   msg_length= my_vsnprintf(msgbuf, sizeof(msgbuf), fmt, args);

=== modified file 'sql/item.cc'
--- a/sql/item.cc	2010-08-27 14:12:44 +0000
+++ b/sql/item.cc	2010-09-03 16:20:30 +0000
@@ -3728,7 +3728,7 @@ static Item** find_field_in_group_list(I
   int         found_match_degree= 0;
   Item_ident *cur_field;
   int         cur_match_degree= 0;
-  char        name_buff[NAME_LEN+1];
+  char        name_buff[SAFE_NAME_LEN+1];
 
   if (find_item->type() == Item::FIELD_ITEM ||
       find_item->type() == Item::REF_ITEM)

=== modified file 'sql/log_event.cc'
--- a/sql/log_event.cc	2010-08-27 14:12:44 +0000
+++ b/sql/log_event.cc	2010-09-03 16:20:30 +0000
@@ -6234,7 +6234,7 @@ void Create_file_log_event::print(FILE*
 #if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
 void Create_file_log_event::pack_info(Protocol *protocol)
 {
-  char buf[NAME_LEN*2 + 30 + 21*2], *pos;
+  char buf[SAFE_NAME_LEN*2 + 30 + 21*2], *pos;
   pos= strmov(buf, "db=");
   memcpy(pos, db, db_len);
   pos= strmov(pos + db_len, ";table=");

=== modified file 'sql/mysql_priv.h'
--- a/sql/mysql_priv.h	2010-08-27 14:12:44 +0000
+++ b/sql/mysql_priv.h	2010-09-03 16:20:30 +0000
@@ -2288,6 +2288,7 @@ const char *get_canonical_filename(handl
 
 #define MYSQL50_TABLE_NAME_PREFIX         "#mysql50#"
 #define MYSQL50_TABLE_NAME_PREFIX_LENGTH  9
+#define SAFE_NAME_LEN (NAME_LEN + MYSQL50_TABLE_NAME_PREFIX_LENGTH)
 
 uint build_table_shadow_filename(char *buff, size_t bufflen, 
                                  ALTER_PARTITION_PARAM_TYPE *lpt);

=== modified file 'sql/rpl_filter.cc'
--- a/sql/rpl_filter.cc	2009-12-03 11:19:05 +0000
+++ b/sql/rpl_filter.cc	2010-09-03 16:20:30 +0000
@@ -91,7 +91,7 @@ Rpl_filter::tables_ok(const char* db, TA
   
   for (; tables; tables= tables->next_global)
   {
-    char hash_key[2*NAME_LEN+2];
+    char hash_key[SAFE_NAME_LEN*2+2];
     char *end;
     uint len;
 
@@ -225,7 +225,7 @@ Rpl_filter::db_ok_with_wild_table(const
 {
   DBUG_ENTER("Rpl_filter::db_ok_with_wild_table");
 
-  char hash_key[NAME_LEN+2];
+  char hash_key[SAFE_NAME_LEN+2];
   char *end;
   int len;
   end= strmov(hash_key, db);

=== modified file 'sql/sp.cc'
--- a/sql/sp.cc	2010-06-11 12:52:06 +0000
+++ b/sql/sp.cc	2010-09-03 16:20:30 +0000
@@ -717,7 +717,7 @@ db_load_routine(THD *thd, int type, sp_n
 {
   LEX *old_lex= thd->lex, newlex;
   String defstr;
-  char saved_cur_db_name_buf[NAME_LEN+1];
+  char saved_cur_db_name_buf[SAFE_NAME_LEN+1];
   LEX_STRING saved_cur_db_name=
     { saved_cur_db_name_buf, sizeof(saved_cur_db_name_buf) };
   bool cur_db_changed;
@@ -1928,7 +1928,7 @@ sp_cache_routines_and_add_tables_aux(THD
             Hence, the overrun happens only if the name is in length > 32 and
             uses multibyte (cyrillic, greek, etc.)
           */
-          char n[NAME_LEN*2+2];
+          char n[SAFE_NAME_LEN*2+2];
 
           /* m_qname.str is not always \0 terminated */
           memcpy(n, name.m_qname.str, name.m_qname.length);

=== modified file 'sql/sp_head.cc'
--- a/sql/sp_head.cc	2010-08-27 14:12:44 +0000
+++ b/sql/sp_head.cc	2010-09-03 16:20:30 +0000
@@ -1085,7 +1085,7 @@ bool
 sp_head::execute(THD *thd)
 {
   DBUG_ENTER("sp_head::execute");
-  char saved_cur_db_name_buf[NAME_LEN+1];
+  char saved_cur_db_name_buf[SAFE_NAME_LEN+1];
   LEX_STRING saved_cur_db_name=
     { saved_cur_db_name_buf, sizeof(saved_cur_db_name_buf) };
   bool cur_db_changed= FALSE;
@@ -3851,7 +3851,7 @@ sp_head::merge_table_list(THD *thd, TABL
   for (; table ; table= table->next_global)
     if (!table->derived && !table->schema_table)
     {
-      char tname[(NAME_LEN + 1) * 3];           // db\0table\0alias\0
+      char tname[(SAFE_NAME_LEN + 1) * 3];           // db\0table\0alias\0
       uint tlen, alen;
 
       tlen= table->db_length;

=== modified file 'sql/sql_acl.cc'
--- a/sql/sql_acl.cc	2010-08-27 14:12:44 +0000
+++ b/sql/sql_acl.cc	2010-09-03 16:20:30 +0000
@@ -313,7 +313,7 @@ static my_bool acl_load(THD *thd, TABLE_
   READ_RECORD read_record_info;
   my_bool return_val= TRUE;
   bool check_no_resolve= specialflag & SPECIAL_NO_RESOLVE;
-  char tmp_name[NAME_LEN+1];
+  char tmp_name[SAFE_NAME_LEN+1];
   int password_length;
   ulong old_sql_mode= thd->variables.sql_mode;
   DBUG_ENTER("acl_load");
@@ -2453,7 +2453,7 @@ static GRANT_NAME *name_hash_search(HASH
                                     const char *user, const char *tname,
                                     bool exact, bool name_tolower)
 {
-  char helping [NAME_LEN*2+USERNAME_LENGTH+3], *name_ptr;
+  char helping [SAFE_NAME_LEN*2+USERNAME_LENGTH+3], *name_ptr;
   uint len;
   GRANT_NAME *grant_name,*found=0;
   HASH_SEARCH_STATE state;
@@ -3431,7 +3431,7 @@ bool mysql_grant(THD *thd, const char *d
 {
   List_iterator <LEX_USER> str_list (list);
   LEX_USER *Str, *tmp_Str;
-  char tmp_db[NAME_LEN+1];
+  char tmp_db[SAFE_NAME_LEN+1];
   bool create_new_users=0;
   TABLE_LIST tables[2];
   bool save_binlog_row_based;
@@ -4316,7 +4316,7 @@ static bool check_grant_db_routine(THD *
 bool check_grant_db(THD *thd,const char *db)
 {
   Security_context *sctx= thd->security_ctx;
-  char helping [NAME_LEN+USERNAME_LENGTH+2];
+  char helping [SAFE_NAME_LEN + USERNAME_LENGTH+2];
   uint len;
   bool error= TRUE;
 

=== modified file 'sql/sql_base.cc'
--- a/sql/sql_base.cc	2010-08-27 14:12:44 +0000
+++ b/sql/sql_base.cc	2010-09-03 16:20:30 +0000
@@ -613,7 +613,7 @@ void release_table_share(TABLE_SHARE *sh
 
 TABLE_SHARE *get_cached_table_share(const char *db, const char *table_name)
 {
-  char key[NAME_LEN*2+2];
+  char key[SAFE_NAME_LEN*2+2];
   TABLE_LIST table_list;
   uint key_length;
   safe_mutex_assert_owner(&LOCK_open);
@@ -6311,7 +6311,7 @@ find_field_in_tables(THD *thd, Item_iden
   const char *table_name= item->table_name;
   const char *name= item->field_name;
   uint length=(uint) strlen(name);
-  char name_buff[NAME_LEN+1];
+  char name_buff[SAFE_NAME_LEN+1];
   TABLE_LIST *cur_table= first_table;
   TABLE_LIST *actual_table;
   bool allow_rowid;
@@ -6468,7 +6468,7 @@ find_field_in_tables(THD *thd, Item_iden
       (report_error == REPORT_ALL_ERRORS ||
        report_error == REPORT_EXCEPT_NON_UNIQUE))
   {
-    char buff[NAME_LEN*2 + 2];
+    char buff[SAFE_NAME_LEN*2 + 2];
     if (db && db[0])
     {
       strxnmov(buff,sizeof(buff)-1,db,".",table_name,NullS);
@@ -7854,7 +7854,7 @@ insert_fields(THD *thd, Name_resolution_
 {
   Field_iterator_table_ref field_iterator;
   bool found;
-  char name_buff[NAME_LEN+1];
+  char name_buff[SAFE_NAME_LEN+1];
   DBUG_ENTER("insert_fields");
   DBUG_PRINT("arena", ("stmt arena: 0x%lx", (ulong)thd->stmt_arena));
 

=== modified file 'sql/sql_connect.cc'
--- a/sql/sql_connect.cc	2010-08-27 14:12:44 +0000
+++ b/sql/sql_connect.cc	2010-09-03 16:20:30 +0000
@@ -851,8 +851,8 @@ static int check_connection(THD *thd)
   char *passwd= strend(user)+1;
   uint user_len= passwd - user - 1;
   char *db= passwd;
-  char db_buff[NAME_LEN + 1];           // buffer to store db in utf8
-  char user_buff[USERNAME_LENGTH + 1];	// buffer to store user in utf8
+  char db_buff[SAFE_NAME_LEN*2 + 1];       // buffer to store db in utf8
+  char user_buff[USERNAME_LENGTH*2 + 1];   // buffer to store user in utf8
   uint dummy_errors;
 
   /*

=== modified file 'sql/sql_parse.cc'
--- a/sql/sql_parse.cc	2010-08-27 14:12:44 +0000
+++ b/sql/sql_parse.cc	2010-09-03 16:20:30 +0000
@@ -1125,7 +1125,7 @@ bool dispatch_command(enum enum_server_c
       Cast *passwd to an unsigned char, so that it doesn't extend the sign
       for *passwd > 127 and become 2**32-127 after casting to uint.
     */
-    char db_buff[NAME_LEN+1];                 // buffer to store db in utf8
+    char db_buff[SAFE_NAME_LEN*2+1];           // buffer to store db in utf8
     char *db= passwd;
     char *save_db;
     /*
@@ -1329,7 +1329,7 @@ bool dispatch_command(enum enum_server_c
     char *fields, *packet_end= packet + packet_length, *wildcard;
     /* Locked closure of all tables */
     TABLE_LIST table_list;
-    char db_buff[NAME_LEN+1];
+    char db_buff[SAFE_NAME_LEN+1];
     uint32 db_length;
     uint dummy_errors, query_length;
 
@@ -1348,7 +1348,7 @@ bool dispatch_command(enum enum_server_c
     db_length= wildcard - packet;
     wildcard++;
     query_length= (uint) (packet_end - wildcard); // Don't count end \0
-    if (db_length > NAME_LEN || query_length > NAME_LEN)
+    if (db_length > SAFE_NAME_LEN || query_length > NAME_LEN)
     {
       my_message(ER_UNKNOWN_COM_ERROR, ER(ER_UNKNOWN_COM_ERROR), MYF(0));
       break;

=== modified file 'sql/sql_prepare.cc'
--- a/sql/sql_prepare.cc	2010-08-27 14:12:44 +0000
+++ b/sql/sql_prepare.cc	2010-09-03 16:20:30 +0000
@@ -3338,7 +3338,7 @@ reexecute:
 bool
 Prepared_statement::reprepare()
 {
-  char saved_cur_db_name_buf[NAME_LEN+1];
+  char saved_cur_db_name_buf[SAFE_NAME_LEN+1];
   LEX_STRING saved_cur_db_name=
     { saved_cur_db_name_buf, sizeof(saved_cur_db_name_buf) };
   LEX_STRING stmt_db_name= { db, db_length };
@@ -3499,7 +3499,7 @@ bool Prepared_statement::execute(String
   Query_arena *old_stmt_arena;
   bool error= TRUE;
 
-  char saved_cur_db_name_buf[NAME_LEN+1];
+  char saved_cur_db_name_buf[SAFE_NAME_LEN+1];
   LEX_STRING saved_cur_db_name=
     { saved_cur_db_name_buf, sizeof(saved_cur_db_name_buf) };
   bool cur_db_changed;

=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc	2010-08-27 14:12:44 +0000
+++ b/sql/sql_select.cc	2010-09-03 16:20:30 +0000
@@ -16707,7 +16707,7 @@ static void select_describe(JOIN *join,
       the UNION to provide precise EXPLAIN information will hardly be
       appreciated :)
     */
-    char table_name_buffer[NAME_LEN];
+    char table_name_buffer[SAFE_NAME_LEN];
     item_list.empty();
     /* id */
     item_list.push_back(new Item_null);
@@ -16780,7 +16780,7 @@ static void select_describe(JOIN *join,
       char buff1[512], buff2[512], buff3[512];
       char keylen_str_buf[64];
       String extra(buff, sizeof(buff),cs);
-      char table_name_buffer[NAME_LEN];
+      char table_name_buffer[SAFE_NAME_LEN];
       String tmp1(buff1,sizeof(buff1),cs);
       String tmp2(buff2,sizeof(buff2),cs);
       String tmp3(buff3,sizeof(buff3),cs);

=== modified file 'sql/sql_show.cc'
--- a/sql/sql_show.cc	2010-08-27 14:12:44 +0000
+++ b/sql/sql_show.cc	2010-09-03 16:20:30 +0000
@@ -493,7 +493,7 @@ find_files(THD *thd, List<LEX_STRING> *f
 
   for (i=0 ; i < (uint) dirp->number_off_files  ; i++)
   {
-    char uname[NAME_LEN + 1];                   /* Unencoded name */
+    char uname[SAFE_NAME_LEN + 1];              /* Unencoded name */
     file=dirp->dir_entry+i;
     if (dir)
     {                                           /* Return databases */
@@ -4254,7 +4254,7 @@ bool store_schema_proc(THD *thd, TABLE *
   MYSQL_TIME time;
   LEX *lex= thd->lex;
   CHARSET_INFO *cs= system_charset_info;
-  char sp_db_buff[NAME_LEN + 1], sp_name_buff[NAME_LEN + 1],
+  char sp_db_buff[SAFE_NAME_LEN + 1], sp_name_buff[SAFE_NAME_LEN + 1],
     definer_buff[USERNAME_LENGTH + HOSTNAME_LENGTH + 2];
   String sp_db(sp_db_buff, sizeof(sp_db_buff), cs);
   String sp_name(sp_name_buff, sizeof(sp_name_buff), cs);
@@ -6589,8 +6589,8 @@ ST_FIELD_INFO table_names_fields_info[]=
 {
   {"TABLE_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 1, 0, SKIP_OPEN_TABLE},
   {"TABLE_SCHEMA",NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE},
-  {"TABLE_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, "Tables_in_",
-   SKIP_OPEN_TABLE},
+  {"TABLE_NAME", NAME_CHAR_LEN + MYSQL50_TABLE_NAME_PREFIX_LENGTH,
+   MYSQL_TYPE_STRING, 0, 0, "Tables_in_", SKIP_OPEN_TABLE},
   {"TABLE_TYPE", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, "Table_type",
    OPEN_FRM_ONLY},
   {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}

=== modified file 'sql/sql_table.cc'
--- a/sql/sql_table.cc	2010-08-27 14:12:44 +0000
+++ b/sql/sql_table.cc	2010-09-03 16:20:30 +0000
@@ -54,6 +54,7 @@ static bool
 mysql_prepare_alter_table(THD *thd, TABLE *table,
                           HA_CREATE_INFO *create_info,
                           Alter_info *alter_info);
+static bool admin_recreate_table(THD *thd, TABLE_LIST *table_list);
 
 #ifndef DBUG_OFF
 
@@ -4172,7 +4173,7 @@ mysql_rename_table(handlerton *base, con
   char from[FN_REFLEN + 1], to[FN_REFLEN + 1],
     lc_from[FN_REFLEN + 1], lc_to[FN_REFLEN + 1];
   char *from_base= from, *to_base= to;
-  char tmp_name[NAME_LEN+1];
+  char tmp_name[SAFE_NAME_LEN+1];
   handler *file;
   int error=0;
   DBUG_ENTER("mysql_rename_table");
@@ -4567,6 +4568,7 @@ static bool mysql_admin_table(THD* thd,
   Protocol *protocol= thd->protocol;
   LEX *lex= thd->lex;
   int result_code;
+  bool need_repair_or_alter= 0;
   DBUG_ENTER("mysql_admin_table");
 
   if (end_active_trans(thd))
@@ -4587,7 +4589,7 @@ static bool mysql_admin_table(THD* thd,
 
   for (table= tables; table; table= table->next_local)
   {
-    char table_name[NAME_LEN*2+2];
+    char table_name[SAFE_NAME_LEN*2+2];
     char* db = table->db;
     bool fatal_error=0;
 
@@ -4795,32 +4797,35 @@ static bool mysql_admin_table(THD* thd,
     if (operator_func == &handler::ha_repair &&
         !(check_opt->sql_flags & TT_USEFRM))
     {
-      if ((table->table->file->check_old_types() == HA_ADMIN_NEEDS_ALTER) ||
-          (table->table->file->ha_check_for_upgrade(check_opt) ==
-           HA_ADMIN_NEEDS_ALTER))
+      handler *file= table->table->file;
+      int check_old_types=   file->check_old_types();
+      int check_for_upgrade= file->ha_check_for_upgrade(check_opt);
+
+      if (check_old_types == HA_ADMIN_NEEDS_ALTER ||
+          check_for_upgrade == HA_ADMIN_NEEDS_ALTER)
       {
-        DBUG_PRINT("admin", ("recreating table"));
-        ha_autocommit_or_rollback(thd, 1);
-        close_thread_tables(thd);
-        tmp_disable_binlog(thd); // binlogging is done by caller if wanted
-        result_code= mysql_recreate_table(thd, table);
-        reenable_binlog(thd);
-        /*
-          mysql_recreate_table() can push OK or ERROR.
-          Clear 'OK' status. If there is an error, keep it:
-          we will store the error message in a result set row 
-          and then clear.
-        */
-        if (thd->main_da.is_ok())
-          thd->main_da.reset_diagnostics_area();
+        result_code= admin_recreate_table(thd, table);
         goto send_result;
       }
+      if (check_old_types || check_for_upgrade)
+      {
+        /* If repair is not implemented for the engine, run ALTER TABLE */
+        need_repair_or_alter= 1;
+      }
     }
 
     DBUG_PRINT("admin", ("calling operator_func '%s'", operator_name));
     result_code = (table->table->file->*operator_func)(thd, check_opt);
     DBUG_PRINT("admin", ("operator_func returned: %d", result_code));
 
+    if (result_code == HA_ADMIN_NOT_IMPLEMENTED && need_repair_or_alter)
+    {
+      /*
+        repair was not implemented and we need to upgrade the table
+        to a new version so we recreate the table with ALTER TABLE
+      */
+      result_code= admin_recreate_table(thd, table);
+    }
 send_result:
 
     lex->cleanup_after_one_table_open();
@@ -4920,23 +4925,13 @@ send_result_message:
                       system_charset_info);
       if (protocol->write())
         goto err;
-      ha_autocommit_or_rollback(thd, 0);
-      close_thread_tables(thd);
       DBUG_PRINT("info", ("HA_ADMIN_TRY_ALTER, trying analyze..."));
       TABLE_LIST *save_next_local= table->next_local,
                  *save_next_global= table->next_global;
       table->next_local= table->next_global= 0;
-      tmp_disable_binlog(thd); // binlogging is done by caller if wanted
-      result_code= mysql_recreate_table(thd, table);
-      reenable_binlog(thd);
-      /*
-        mysql_recreate_table() can push OK or ERROR.
-        Clear 'OK' status. If there is an error, keep it:
-        we will store the error message in a result set row 
-        and then clear.
-      */
-      if (thd->main_da.is_ok())
-        thd->main_da.reset_diagnostics_area();
+
+      result_code= admin_recreate_table(thd, table);
+
       ha_autocommit_or_rollback(thd, 0);
       close_thread_tables(thd);
       if (!result_code) // recreation went ok
@@ -7954,6 +7949,30 @@ err:
 }
 
 
+/* Prepare, run and cleanup for mysql_recreate_table() */
+
+static bool admin_recreate_table(THD *thd, TABLE_LIST *table_list)
+{
+  bool result_code;
+  DBUG_ENTER("admin_recreate_table");
+
+  ha_autocommit_or_rollback(thd, 1);
+  close_thread_tables(thd);
+  tmp_disable_binlog(thd); // binlogging is done by caller if wanted
+  result_code= mysql_recreate_table(thd, table_list);
+  reenable_binlog(thd);
+  /*
+    mysql_recreate_table() can push OK or ERROR.
+    Clear 'OK' status. If there is an error, keep it:
+    we will store the error message in a result set row 
+    and then clear.
+  */
+  if (thd->main_da.is_ok())
+    thd->main_da.reset_diagnostics_area();
+  DBUG_RETURN(result_code);
+}
+
+
 /*
   Recreates tables by calling mysql_alter_table().
 
@@ -8010,7 +8029,7 @@ bool mysql_checksum_table(THD *thd, TABL
   /* Open one table after the other to keep lock time as short as possible. */
   for (table= tables; table; table= table->next_local)
   {
-    char table_name[NAME_LEN*2+2];
+    char table_name[SAFE_NAME_LEN*2+2];
     TABLE *t;
 
     strxmov(table_name, table->db ,".", table->table_name, NullS);

=== modified file 'sql/sql_trigger.cc'
--- a/sql/sql_trigger.cc	2010-08-02 09:01:24 +0000
+++ b/sql/sql_trigger.cc	2010-09-03 16:20:30 +0000
@@ -1391,7 +1391,7 @@ bool Table_triggers_list::check_n_load(T
           To remove this prefix we use check_n_cut_mysql50_prefix().
         */
 
-        char fname[NAME_LEN + 1];
+        char fname[SAFE_NAME_LEN + 1];
         DBUG_ASSERT((!my_strcasecmp(table_alias_charset, lex.query_tables->db, db) ||
                      (check_n_cut_mysql50_prefix(db, fname, sizeof(fname)) &&
                       !my_strcasecmp(table_alias_charset, lex.query_tables->db, fname))) &&
@@ -1917,7 +1917,7 @@ bool Table_triggers_list::change_table_n
     */
     if (my_strcasecmp(table_alias_charset, db, new_db))
     {
-      char dbname[NAME_LEN + 1];
+      char dbname[SAFE_NAME_LEN + 1];
       if (check_n_cut_mysql50_prefix(db, dbname, sizeof(dbname)) && 
           !my_strcasecmp(table_alias_charset, dbname, new_db))
       {

=== modified file 'sql/sql_udf.cc'
--- a/sql/sql_udf.cc	2010-01-25 02:55:05 +0000
+++ b/sql/sql_udf.cc	2010-09-03 16:20:30 +0000
@@ -209,7 +209,7 @@ void udf_init()
     }
     tmp->dlhandle = dl;
     {
-      char buf[NAME_LEN+16], *missing;
+      char buf[SAFE_NAME_LEN+16], *missing;
       if ((missing= init_syms(tmp, buf)))
       {
         sql_print_error(ER(ER_CANT_FIND_DL_ENTRY), missing);
@@ -463,7 +463,7 @@ int mysql_create_function(THD *thd,udf_f
   }
   udf->dlhandle=dl;
   {
-    char buf[NAME_LEN+16], *missing;
+    char buf[SAFE_NAME_LEN+16], *missing;
     if ((missing= init_syms(udf, buf)))
     {
       my_error(ER_CANT_FIND_DL_ENTRY, MYF(0), missing);

=== modified file 'sql/sql_view.cc'
--- a/sql/sql_view.cc	2010-08-02 09:01:24 +0000
+++ b/sql/sql_view.cc	2010-09-03 16:20:30 +0000
@@ -1189,7 +1189,7 @@ bool mysql_make_view(THD *thd, File_pars
   table->view= lex= thd->lex= (LEX*) new(thd->mem_root) st_lex_local;
 
   {
-    char old_db_buf[NAME_LEN+1];
+    char old_db_buf[SAFE_NAME_LEN+1];
     LEX_STRING old_db= { old_db_buf, sizeof(old_db_buf) };
     bool dbchanged;
     Parser_state parser_state;

=== modified file 'sql/table.cc'
--- a/sql/table.cc	2010-08-27 14:12:44 +0000
+++ b/sql/table.cc	2010-09-03 16:20:30 +0000
@@ -2699,15 +2699,15 @@ bool check_db_name(LEX_STRING *org_name)
   uint name_length= org_name->length;
   bool check_for_path_chars;
 
-  if (!name_length || name_length > NAME_LEN)
-    return 1;
-
   if ((check_for_path_chars= check_mysql50_prefix(name)))
   {
     name+= MYSQL50_TABLE_NAME_PREFIX_LENGTH;
     name_length-= MYSQL50_TABLE_NAME_PREFIX_LENGTH;
   }
 
+  if (!name_length || name_length > NAME_LEN)
+    return 1;
+
   if (lower_case_table_names && name != any_db)
     my_casedn_str(files_charset_info, name);
 
@@ -2725,6 +2725,15 @@ bool check_table_name(const char *name,
 {
   uint name_length= 0;  // name length in symbols
   const char *end= name+length;
+
+
+  if (!check_for_path_chars &&
+      (check_for_path_chars= check_mysql50_prefix(name)))
+  {
+    name+= MYSQL50_TABLE_NAME_PREFIX_LENGTH;
+    length-= MYSQL50_TABLE_NAME_PREFIX_LENGTH;
+  }
+
   if (!length || length > NAME_LEN)
     return 1;
 #if defined(USE_MB) && defined(USE_MB_IDENT)



More information about the commits mailing list