List:Commits« Previous MessageNext Message »
From:Chad MILLER Date:March 12 2008 5:40pm
Subject:bk commit into 5.1 tree (cmiller:1.2561) BUG#26703
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of cmiller.  When cmiller does a push these changes
will be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2008-03-12 12:40:12-04:00, cmiller@stripped +3 -0
  Bug#26703: DROP DATABASE fails if database contains a #mysql50# \
  	table with backticks
  
  (Thanks to Lu Jingdong, though I did not take his patch directly, as
  it contained a significant flaw.)
  
  It wasn't a backtick/parsing problem.  We merely didn't anticipate
  and allocate enough space to handle the optional "#mysql50#" table-
  name prefix. 
  
  Now, allocate that extra space in case we need it when we look up 
  a legacy table to get its file's name.

  mysql-test/r/drop.result@stripped, 2008-03-12 12:40:09-04:00, cmiller@stripped +11
-0
    Verify that databases with old-style files can be removed.

  mysql-test/t/drop.test@stripped, 2008-03-12 12:40:09-04:00, cmiller@stripped +15
-0
    Verify that databases with old-style files can be removed.

  sql/sql_db.cc@stripped, 2008-03-12 12:40:09-04:00, cmiller@stripped +7 -2
    Extend the size of the memory that holds the table's name, so that
    the legacy "mysql50" prefix fits.

diff -Nrup a/mysql-test/r/drop.result b/mysql-test/r/drop.result
--- a/mysql-test/r/drop.result	2008-03-05 14:18:32 -05:00
+++ b/mysql-test/r/drop.result	2008-03-12 12:40:09 -04:00
@@ -91,4 +91,15 @@ create table mysql_test.`#sql-347f_7` (f
 create table mysql_test.`#sql-347f_8` (f1 int);
 drop table mysql_test.`#sql-347f_8`;
 drop database mysql_test;
+create database mysqltestbug26703;
+use mysqltestbug26703;
+create table `#mysql50#abc``def` ( id int );
+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'
+use test;
+drop database mysqltestbug26703;
 End of 5.1 tests
diff -Nrup a/mysql-test/t/drop.test b/mysql-test/t/drop.test
--- a/mysql-test/t/drop.test	2008-03-05 14:18:32 -05:00
+++ b/mysql-test/t/drop.test	2008-03-12 12:40:09 -04:00
@@ -134,4 +134,19 @@ drop table mysql_test.`#sql-347f_8`;
 copy_file $MYSQLTEST_VARDIR/master-data/mysql_test/t1.frm
$MYSQLTEST_VARDIR/master-data/mysql_test/#sql-347f_6.frm;
 drop database mysql_test;
 
+#
+# Bug#26703: DROP DATABASE fails if database contains a #mysql50# table with backticks
+#
+create database mysqltestbug26703;
+use mysqltestbug26703;
+create table `#mysql50#abc``def` ( id int );
+--error ER_WRONG_TABLE_NAME
+create table `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa` (a int);
+create table `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa` (a int);
+create table `#mysql50#aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa` (a int);
+--error ER_WRONG_TABLE_NAME
+create table `#mysql50#aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa` (a int);
+use test;
+drop database mysqltestbug26703;
+
 --echo End of 5.1 tests
diff -Nrup a/sql/sql_db.cc b/sql/sql_db.cc
--- a/sql/sql_db.cc	2008-02-19 07:45:16 -05:00
+++ b/sql/sql_db.cc	2008-03-12 12:40:09 -04:00
@@ -1111,12 +1111,17 @@ static long mysql_rm_known_files(THD *th
       /* Drop the table nicely */
       *extension= 0;			// Remove extension
       TABLE_LIST *table_list=(TABLE_LIST*)
-	thd->calloc(sizeof(*table_list)+ strlen(db)+strlen(file->name)+2);
+                              thd->calloc(sizeof(*table_list) + 
+                                          strlen(db) + 1 +
+                                          MYSQL50_TABLE_NAME_PREFIX_LENGTH + 
+                                          strlen(file->name) + 1);
+
       if (!table_list)
-	goto err;
+        goto err;
       table_list->db= (char*) (table_list+1);
       table_list->table_name= strmov(table_list->db, db) + 1;
       VOID(filename_to_tablename(file->name, table_list->table_name,
+                                 MYSQL50_TABLE_NAME_PREFIX_LENGTH +
                                  strlen(file->name) + 1));
       table_list->alias= table_list->table_name;	// If lower_case_table_names=2
       table_list->internal_tmp_table= is_prefix(file->name, tmp_file_prefix);
Thread
bk commit into 5.1 tree (cmiller:1.2561) BUG#26703Chad MILLER12 Mar 2008