List:Commits« Previous MessageNext Message »
From:eugene Date:April 12 2006 9:05pm
Subject:bk commit into 4.1 tree (evgen:1.2505) BUG#14169
View as plain text  
Below is the list of changes that have just been committed into a local
4.1 repository of evgen. When evgen 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
  1.2505 06/04/12 23:05:38 evgen@stripped +6 -0
  Fixed bug#14169: type of group_concat() result changed to blob if tmp_table was 
  used
  
  In a simple queries a result of the GROUP_CONCAT() function was always of 
  varchar type.
  But if length of GROUP_CONCAT() result is greater than 512 chars and temporary
  table is used during select then the result is converted to blob, due to
  policy to not to store fields longer than 512 chars in tmp table as varchar
  fields.
  
  In order to provide consistent behaviour, result of GROUP_CONCAT() now
  will always be converted to blob if it is longer than 512 chars.
  Item_func_group_concat::field_type() is modified accordingly.

  sql/item_func.cc
    1.259 06/04/12 23:02:02 evgen@stripped +1 -1
    Fixed bug#14169: type of group_concat() result changed to blob if tmp_table was used
    In the Item_func::tmp_table_field() function the unnamed constant 255 is changed to
the CONVERT_IF_BIGGER_TO_BLOB constant.
    The Item_func::tmp_table_field() function now measures the result length in chars
rather than bytes when converting string result to a blob.

  sql/item_sum.h
    1.83 06/04/12 23:00:06 evgen@stripped +7 -0
    Fixed bug#14169: type of group_concat() result changed to blob if tmp_table was used
    To the Item_func_group_concat calls added the member function field_type() which
returns the BLOB or VAR_STRING type based on the items length.

  sql/sql_select.cc
    1.451 06/04/12 22:54:11 evgen@stripped +4 -2
    Fixed bug#14169: type of group_concat() result changed to blob if tmp_table was used
    The unnamed constant 255 in the create_tmp_field() and create_tmp_field_from_item()
functions now defined as the CONVERT_IF_BIGGER_TO_BLOB constant.
    The create_tmp_field() function now converts the Item_sum string result to a blob
field based on its char length.

  sql/unireg.h
    1.35 06/04/12 22:47:53 evgen@stripped +1 -0
    Added the CONVERT_IF_BIGGER_TO_BLOB constant

  mysql-test/r/func_gconcat.result
    1.44 06/04/12 22:46:59 evgen@stripped +16 -0
    Added test case for bug#14169: type of group_concat() result changed to blob if
tmp_table was used

  mysql-test/t/func_gconcat.test
    1.35 06/04/12 22:46:32 evgen@stripped +10 -0
    Added test case for bug#14169: type of group_concat() result changed to blob if
tmp_table was used

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	evgen
# Host:	moonbone.local
# Root:	/work/14169-bug-4.1-mysql

--- 1.258/sql/item_func.cc	2006-04-11 12:51:22 +04:00
+++ 1.259/sql/item_func.cc	2006-04-12 23:02:02 +04:00
@@ -307,7 +307,7 @@
     res= new Field_double(max_length, maybe_null, name, t_arg, decimals);
     break;
   case STRING_RESULT:
-    if (max_length > 255)
+    if (max_length/collation.collation->mbmaxlen > CONVERT_IF_BIGGER_TO_BLOB)
       res= new Field_blob(max_length, maybe_null, name, t_arg, collation.collation);
     else
       res= new Field_string(max_length, maybe_null, name, t_arg, collation.collation);

--- 1.82/sql/item_sum.h	2006-03-29 23:28:47 +04:00
+++ 1.83/sql/item_sum.h	2006-04-12 23:00:06 +04:00
@@ -729,6 +729,13 @@
   enum Sumfunctype sum_func () const {return GROUP_CONCAT_FUNC;}
   const char *func_name() const { return "group_concat"; }
   virtual Item_result result_type () const { return STRING_RESULT; }
+  enum_field_types field_type() const
+  {
+    if (max_length/collation.collation->mbmaxlen > CONVERT_IF_BIGGER_TO_BLOB)
+      return FIELD_TYPE_BLOB;
+    else
+      return MYSQL_TYPE_VAR_STRING;
+  }
   void clear();
   bool add();
   void reset_field();

--- 1.450/sql/sql_select.cc	2006-03-29 23:17:40 +04:00
+++ 1.451/sql/sql_select.cc	2006-04-12 22:54:11 +04:00
@@ -4925,7 +4925,8 @@
     if ((type= item->field_type()) == MYSQL_TYPE_DATETIME ||
         type == MYSQL_TYPE_TIME || type == MYSQL_TYPE_DATE)
       new_field= item->tmp_table_field_from_field_type(table);
-    else if (item->max_length/item->collation.collation->mbmaxlen > 255)
+    else if (item->max_length/item->collation.collation->mbmaxlen >
+             CONVERT_IF_BIGGER_TO_BLOB)
     {
       if (convert_blob_length)
         new_field= new Field_varstring(convert_blob_length, maybe_null,
@@ -5028,7 +5029,8 @@
 	return new Field_longlong(item_sum->max_length,maybe_null,
 				  item->name,table,item->unsigned_flag);
       case STRING_RESULT:
-	if (item_sum->max_length > 255)
+	if (item_sum->max_length/item_sum->collation.collation->mbmaxlen >
+            CONVERT_IF_BIGGER_TO_BLOB)
         {
           if (convert_blob_length)
             return new Field_varstring(convert_blob_length, maybe_null,

--- 1.34/sql/unireg.h	2005-02-07 19:13:54 +03:00
+++ 1.35/sql/unireg.h	2006-04-12 22:47:53 +04:00
@@ -60,6 +60,7 @@
 
 #define MAX_MBWIDTH		3		/* Max multibyte sequence */
 #define MAX_FIELD_CHARLENGTH	255
+#define CONVERT_IF_BIGGER_TO_BLOB 255
 /* Max column width +1 */
 #define MAX_FIELD_WIDTH		(MAX_FIELD_CHARLENGTH*MAX_MBWIDTH+1)
 

--- 1.43/mysql-test/r/func_gconcat.result	2006-03-29 23:15:07 +04:00
+++ 1.44/mysql-test/r/func_gconcat.result	2006-04-12 22:46:59 +04:00
@@ -604,3 +604,19 @@
 1
 3
 drop table t1;
+create table t1 (f1 int unsigned, f2 varchar(255));
+insert into t1 values (1,repeat('a',255)),(2,repeat('b',255));
+select f2,group_concat(f1) from t1 group by f2;
+Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max
length	Is_null	Flags	Decimals	Charsetnr
+def	test	t1	t1	f2	f2	253	255	255	Y	0	0	8
+def					group_concat(f1)	252	400	1	Y	128	0	63
+f2	group_concat(f1)
+aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa	1
+bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb	2
+select f2,group_concat(f1) from t1 group by f2 order by 2;
+Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max
length	Is_null	Flags	Decimals	Charsetnr
+def	test	t1	t1	f2	f2	253	255	255	Y	0	0	8
+def				group_concat(f1)	group_concat(f1)	252	400	1	Y	144	0	63
+f2	group_concat(f1)
+aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa	1
+bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb	2

--- 1.34/mysql-test/t/func_gconcat.test	2006-03-29 23:14:58 +04:00
+++ 1.35/mysql-test/t/func_gconcat.test	2006-04-12 22:46:32 +04:00
@@ -390,4 +390,14 @@
 select f1, group_concat(f1+1) from t1 group by f1 with rollup;
 select count(distinct (f1+1)) from t1 group by f1 with rollup;
 drop table t1;
+
+#
+# Bug#14169 type of group_concat() result changed to blob if tmp_table was used
+#
+create table t1 (f1 int unsigned, f2 varchar(255));
+insert into t1 values (1,repeat('a',255)),(2,repeat('b',255));
+--enable_metadata
+select f2,group_concat(f1) from t1 group by f2;
+select f2,group_concat(f1) from t1 group by f2 order by 2;
+--disable_metadata
 # End of 4.1 tests
Thread
bk commit into 4.1 tree (evgen:1.2505) BUG#14169eugene12 Apr