List:Commits« Previous MessageNext Message »
From:Georgi Kodinov Date:June 23 2010 2:45pm
Subject:bzr commit into mysql-5.1-bugteam branch (Georgi.Kodinov:3438) Bug#53095
View as plain text  
#At file:///home/kgeorge/mysql/work/B53095-5.1-bugteam/ based on revid:sergey.glukhov@stripped

 3438 Georgi Kodinov	2010-06-23
      Bug #53095: SELECT column_name FROM INFORMATION_SCHEMA.STATISTICS 
      returns nothing
            
      When looking for table or database names inside INFORMATION_SCHEMA
      we must convert the table and column names to lowercase (just as it's
      done in the rest of the server) when lowercase_table_names is non-zero.
      This will allow us to find the same tables that we would find if there
      is no condition.
      
      Fixed by converting to lower case when extracting the database and 
      table name conditions.
      Test case added in a separate file because of the command line option.

    added:
      mysql-test/r/bug53095.result
      mysql-test/t/bug53095-master.opt
      mysql-test/t/bug53095.test
    modified:
      sql/sql_show.cc
=== added file 'mysql-test/r/bug53095.result'
--- a/mysql-test/r/bug53095.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/bug53095.result	2010-06-23 14:44:46 +0000
@@ -0,0 +1,12 @@
+CREATE TABLE `ttt` (
+`f1` char(3) NOT NULL,
+PRIMARY KEY (`f1`)
+) ENGINE=myisam DEFAULT CHARSET=latin1;
+SELECT count(COLUMN_NAME) FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME =
+'TTT';
+count(COLUMN_NAME)
+1
+SELECT count(*) FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME = 'TTT';
+count(*)
+1
+DROP TABLE `ttt`;

=== added file 'mysql-test/t/bug53095-master.opt'
--- a/mysql-test/t/bug53095-master.opt	1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/bug53095-master.opt	2010-06-23 14:44:46 +0000
@@ -0,0 +1 @@
+--lower_case_table_names=1

=== added file 'mysql-test/t/bug53095.test'
--- a/mysql-test/t/bug53095.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/bug53095.test	2010-06-23 14:44:46 +0000
@@ -0,0 +1,10 @@
+CREATE TABLE `ttt` (
+  `f1` char(3) NOT NULL,
+  PRIMARY KEY (`f1`)
+) ENGINE=myisam DEFAULT CHARSET=latin1;
+
+SELECT count(COLUMN_NAME) FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME =
+'TTT';
+SELECT count(*) FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME = 'TTT';
+
+DROP TABLE `ttt`;

=== modified file 'sql/sql_show.cc'
--- a/sql/sql_show.cc	2010-06-10 20:45:22 +0000
+++ b/sql/sql_show.cc	2010-06-23 14:44:46 +0000
@@ -3292,6 +3292,8 @@ int get_all_tables(THD *thd, TABLE_LIST 
   Security_context *sctx= thd->security_ctx;
 #endif
   uint table_open_method;
+  char d_name_buff[MAX_ALIAS_NAME], t_name_buff[MAX_ALIAS_NAME];
+
   DBUG_ENTER("get_all_tables");
 
   lex->view_prepare_mode= TRUE;
@@ -3322,6 +3324,26 @@ int get_all_tables(THD *thd, TABLE_LIST 
     error= 0;
     goto err;
   }
+
+  if (lower_case_table_names)
+  {
+    if (lookup_field_vals.db_value.str && lookup_field_vals.db_value.str[0])
+    {
+      strmake(d_name_buff, lookup_field_vals.db_value.str, 
+              sizeof(d_name_buff) - 1);
+      my_casedn_str(system_charset_info, d_name_buff);
+      lookup_field_vals.db_value.str= d_name_buff;
+    }
+    if (lookup_field_vals.table_value.str && 
+        lookup_field_vals.table_value.str[0])
+    {
+      strmake(t_name_buff, lookup_field_vals.table_value.str, 
+              sizeof(t_name_buff) - 1);
+      my_casedn_str(system_charset_info, t_name_buff);
+      lookup_field_vals.table_value.str= t_name_buff;
+    }
+  }
+
   DBUG_PRINT("INDEX VALUES",("db_name='%s', table_name='%s'",
                              STR_OR_NIL(lookup_field_vals.db_value.str),
                              STR_OR_NIL(lookup_field_vals.table_value.str)));


Attachment: [text/bzr-bundle] bzr/georgi.kodinov@oracle.com-20100623144446-oo9gagbmz2nr67gw.bundle
Thread
bzr commit into mysql-5.1-bugteam branch (Georgi.Kodinov:3438) Bug#53095Georgi Kodinov23 Jun