List:Commits« Previous MessageNext Message »
From:Sergey Glukhov Date:February 27 2009 1:39pm
Subject:bzr commit into mysql-5.1-bugteam branch (Sergey.Glukhov:2828)
Bug#41030
View as plain text  
#At file:///home/gluh/MySQL/mysql-5.1-bug-41030/ based on revid:kgeorge@stripped

 2828 Sergey Glukhov	2009-02-27
      Bug#41030 Wrong meta data (incorrect fieldlen)
      set user variable max length on
      fix_length_and_dec() stage
      using real value length.
     @ mysql-test/r/variables.result
        test result
     @ mysql-test/t/variables.test
        test case
     @ sql/item_func.cc
        set user variable max length
        on fix_length_and_dec()
        using real value length.

    modified:
      mysql-test/r/variables.result
      mysql-test/t/variables.test
      sql/item_func.cc
=== modified file 'mysql-test/r/variables.result'
--- a/mysql-test/r/variables.result	2009-01-30 13:44:49 +0000
+++ b/mysql-test/r/variables.result	2009-02-27 13:39:47 +0000
@@ -1341,3 +1341,8 @@ SET @@session.thread_stack= 7;
 ERROR HY000: Variable 'thread_stack' is a read only variable
 SET @@global.thread_stack= 7;
 ERROR HY000: Variable 'thread_stack' is a read only variable
+select @@storage_engine;
+Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
+def					@@storage_engine	253	6	6	N	1	31	8
+@@storage_engine
+MyISAM

=== modified file 'mysql-test/t/variables.test'
--- a/mysql-test/t/variables.test	2009-02-02 22:56:45 +0000
+++ b/mysql-test/t/variables.test	2009-02-27 13:39:47 +0000
@@ -1079,3 +1079,10 @@ SET @@session.thread_stack= 7;
 --error ER_INCORRECT_GLOBAL_LOCAL_VAR
 SET @@global.thread_stack= 7;
 #
+
+#
+# Bug#41030 Wrong meta data (incorrect fieldlen)
+#
+--enable_metadata
+select @@storage_engine;
+--disable_metadata

=== modified file 'sql/item_func.cc'
--- a/sql/item_func.cc	2009-02-12 10:10:07 +0000
+++ b/sql/item_func.cc	2009-02-27 13:39:47 +0000
@@ -4837,7 +4837,10 @@ bool Item_func_get_system_var::is_writte
 
 void Item_func_get_system_var::fix_length_and_dec()
 {
+  char *cptr;
+  int well_formed_error;
   maybe_null=0;
+  max_length= 0;
 
   if (var->check_type(var_type))
   {
@@ -4867,8 +4870,14 @@ void Item_func_get_system_var::fix_lengt
       break;
     case SHOW_CHAR:
     case SHOW_CHAR_PTR:
+      pthread_mutex_lock(&LOCK_global_system_variables);
+      cptr= var->show_type() == SHOW_CHAR_PTR ? 
+        *(char**) var->value_ptr(current_thd, var_type, &component) :
+        (char*) var->value_ptr(current_thd, var_type, &component);
+      if (cptr)
+        max_length= strlen(cptr) * system_charset_info->mbmaxlen;
+      pthread_mutex_unlock(&LOCK_global_system_variables);
       collation.set(system_charset_info, DERIVATION_SYSCONST);
-      max_length= MAX_BLOB_WIDTH;
       decimals=NOT_FIXED_DEC;
       break;
     case SHOW_BOOL:


Attachment: [text/bzr-bundle] bzr/sergey.glukhov@sun.com-20090227133947-c88794c1hxwqs3qn.bundle
Thread
bzr commit into mysql-5.1-bugteam branch (Sergey.Glukhov:2828)Bug#41030Sergey Glukhov27 Feb