List:Commits« Previous MessageNext Message »
From:mhansson Date:May 22 2007 9:54am
Subject:bk commit into 5.1 tree (mhansson:1.2531)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of mhansson. When mhansson 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, 2007-05-22 09:54:04+02:00, mhansson@stripped +4 -0
  Merge dl145s.mysql.com:/users/mhansson/mysql/push/bug23856/my51-bug23856
  into  dl145s.mysql.com:/users/mhansson/mysql/push/bug23856/mysql-5.1o-pushee
  MERGE: 1.2514.6.1

  mysql-test/r/func_gconcat.result@stripped, 2007-05-22 09:54:01+02:00,
mhansson@stripped +26 -26
    Bug#23856: Manually merged test case.
    MERGE: 1.68.1.1

  mysql-test/t/func_gconcat.test@stripped, 2007-05-22 09:54:01+02:00,
mhansson@stripped +12 -14
    Bug#23856: Manually merged test case.
    MERGE: 1.57.1.1

  sql/item_sum.cc@stripped, 2007-05-22 09:46:13+02:00, mhansson@stripped +0 -0
    Auto merged
    MERGE: 1.218.1.1

  sql/sql_select.cc@stripped, 2007-05-22 09:46:14+02:00, mhansson@stripped +0 -0
    Auto merged
    MERGE: 1.520.1.1

# 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:	mhansson
# Host:	dl145s.mysql.com
# Root:	/users/mhansson/mysql/push/bug23856/mysql-5.1o-pushee/RESYNC

--- 1.219/sql/item_sum.cc	2007-05-18 16:55:02 +02:00
+++ 1.220/sql/item_sum.cc	2007-05-22 09:46:13 +02:00
@@ -431,7 +431,7 @@ Field *Item_sum::create_tmp_field(bool g
     break;
   case STRING_RESULT:
     if (max_length/collation.collation->mbmaxlen <= 255 ||
-        convert_blob_length >=UINT_MAX16 ||
+        convert_blob_length > Field_varstring::MAX_SIZE ||
         !convert_blob_length)
       return make_string_field(table);
     field= new Field_varstring(convert_blob_length, maybe_null,
@@ -3290,14 +3290,20 @@ bool Item_func_group_concat::setup(THD *
   tmp_table_param->force_copy_fields= force_copy_fields;
   DBUG_ASSERT(table == 0);
   /*
+    Currently we have to force conversion of BLOB values to VARCHAR's
+    if we are to store them in TREE objects used for ORDER BY and
+    DISTINCT. This leads to truncation if the BLOB's size exceeds
+    Field_varstring::MAX_SIZE.
+  */
+  if (arg_count_order > 0 || distinct)
+    set_if_smaller(tmp_table_param->convert_blob_length, 
+                   Field_varstring::MAX_SIZE);
+  /*
     We have to create a temporary table to get descriptions of fields
     (types, sizes and so on).
 
     Note that in the table, we first have the ORDER BY fields, then the
     field list.
-
-    We need to set set_sum_field in true for storing value of blob in buffer
-    of a record instead of a pointer of one.
   */
   if (!(table= create_tmp_table(thd, tmp_table_param, all_fields,
                                 (ORDER*) 0, 0, TRUE,

--- 1.521/sql/sql_select.cc	2007-05-18 16:55:03 +02:00
+++ 1.522/sql/sql_select.cc	2007-05-22 09:46:14 +02:00
@@ -8997,7 +8997,7 @@ Field *create_tmp_field_from_field(THD *
     Make sure that the blob fits into a Field_varstring which has 
     2-byte lenght. 
   */
-  if (convert_blob_length && convert_blob_length < UINT_MAX16 &&
+  if (convert_blob_length && convert_blob_length <= Field_varstring::MAX_SIZE
&&
       (org_field->flags & BLOB_FLAG))
     new_field= new Field_varstring(convert_blob_length,
                                    org_field->maybe_null(),
@@ -9090,7 +9090,8 @@ static Field *create_tmp_field_from_item
       2-byte lenght. 
     */
     else if (item->max_length/item->collation.collation->mbmaxlen > 255
&&
-             convert_blob_length < UINT_MAX16 && convert_blob_length)
+             convert_blob_length <= Field_varstring::MAX_SIZE && 
+             convert_blob_length)
       new_field= new Field_varstring(convert_blob_length, maybe_null,
                                      item->name, table->s,
                                      item->collation.collation);

--- 1.69/mysql-test/r/func_gconcat.result	2007-05-18 16:55:01 +02:00
+++ 1.70/mysql-test/r/func_gconcat.result	2007-05-22 09:54:01 +02:00
@@ -769,4 +769,51 @@ Warnings:
 Warning	1260	1 line(s) were cut by GROUP_CONCAT()
 SET group_concat_max_len = DEFAULT;
 DROP TABLE t1;
+SET group_concat_max_len= 65535;
+CREATE TABLE t1( a TEXT, b INTEGER );
+INSERT INTO t1 VALUES ( 'a', 0 ), ( 'b', 1 );
+SELECT GROUP_CONCAT( a ORDER BY b ) FROM t1;
+GROUP_CONCAT( a ORDER BY b )
+a,b
+SELECT GROUP_CONCAT(DISTINCT a ORDER BY b) FROM t1;
+GROUP_CONCAT(DISTINCT a ORDER BY b)
+a,b
+SELECT GROUP_CONCAT(DISTINCT a) FROM t1;
+GROUP_CONCAT(DISTINCT a)
+a,b
+SET group_concat_max_len= 10;
+SELECT GROUP_CONCAT(a ORDER BY b) FROM t1;
+GROUP_CONCAT(a ORDER BY b)
+a,b
+SELECT GROUP_CONCAT(DISTINCT a ORDER BY b) FROM t1;
+GROUP_CONCAT(DISTINCT a ORDER BY b)
+a,b
+SELECT GROUP_CONCAT(DISTINCT a) FROM t1;
+GROUP_CONCAT(DISTINCT a)
+a,b
+SET group_concat_max_len= 65535;
+CREATE TABLE t2( a TEXT );
+INSERT INTO t2 VALUES( REPEAT( 'a', 5000 ) );
+INSERT INTO t2 VALUES( REPEAT( 'b', 5000 ) );
+INSERT INTO t2 VALUES( REPEAT( 'a', 5000 ) );
+SELECT LENGTH( GROUP_CONCAT( DISTINCT a ) ) FROM t2;
+LENGTH( GROUP_CONCAT( DISTINCT a ) )
+10001
+CREATE TABLE t3( a TEXT, b INT  );
+INSERT INTO t3 VALUES( REPEAT( 'a', 65534 ), 1 );
+INSERT INTO t3 VALUES( REPEAT( 'a', 65535 ), 2 );
+INSERT INTO t3 VALUES( REPEAT( 'a', 65536 ), 3 );
+Warnings:
+Warning	1265	Data truncated for column 'a' at row 1
+SELECT LENGTH( GROUP_CONCAT( a ) ) FROM t3 WHERE b = 1;
+LENGTH( GROUP_CONCAT( a ) )
+65534
+SELECT LENGTH( GROUP_CONCAT( a ) ) FROM t3 WHERE b = 2;
+LENGTH( GROUP_CONCAT( a ) )
+65535
+SELECT LENGTH( GROUP_CONCAT( a ) ) FROM t3 WHERE b = 3;
+LENGTH( GROUP_CONCAT( a ) )
+65535
+SET group_concat_max_len= DEFAULT;
+DROP TABLE t1, t2, t3;
 End of 5.0 tests

--- 1.58/mysql-test/t/func_gconcat.test	2007-05-18 16:55:02 +02:00
+++ 1.59/mysql-test/t/func_gconcat.test	2007-05-22 09:54:01 +02:00
@@ -520,5 +520,35 @@ SELECT GROUP_CONCAT( a ORDER BY b ) FROM
 SELECT GROUP_CONCAT( DISTINCT a ORDER BY b ) FROM t1; 
 SET group_concat_max_len = DEFAULT;
 DROP TABLE t1;
+# Bug #23856:GROUP_CONCAT and ORDER BY: junk from previous rows for query on I_S
+#
+SET group_concat_max_len= 65535;
+CREATE TABLE t1( a TEXT, b INTEGER );
+INSERT INTO t1 VALUES ( 'a', 0 ), ( 'b', 1 );
+SELECT GROUP_CONCAT( a ORDER BY b ) FROM t1;
+SELECT GROUP_CONCAT(DISTINCT a ORDER BY b) FROM t1;
+SELECT GROUP_CONCAT(DISTINCT a) FROM t1;
+SET group_concat_max_len= 10;
+SELECT GROUP_CONCAT(a ORDER BY b) FROM t1;
+SELECT GROUP_CONCAT(DISTINCT a ORDER BY b) FROM t1;
+SELECT GROUP_CONCAT(DISTINCT a) FROM t1;
+
+SET group_concat_max_len= 65535;
+CREATE TABLE t2( a TEXT );
+INSERT INTO t2 VALUES( REPEAT( 'a', 5000 ) );
+INSERT INTO t2 VALUES( REPEAT( 'b', 5000 ) );
+INSERT INTO t2 VALUES( REPEAT( 'a', 5000 ) );
+SELECT LENGTH( GROUP_CONCAT( DISTINCT a ) ) FROM t2;
+
+CREATE TABLE t3( a TEXT, b INT  );
+INSERT INTO t3 VALUES( REPEAT( 'a', 65534 ), 1 );
+INSERT INTO t3 VALUES( REPEAT( 'a', 65535 ), 2 );
+INSERT INTO t3 VALUES( REPEAT( 'a', 65536 ), 3 );
+SELECT LENGTH( GROUP_CONCAT( a ) ) FROM t3 WHERE b = 1;
+SELECT LENGTH( GROUP_CONCAT( a ) ) FROM t3 WHERE b = 2;
+SELECT LENGTH( GROUP_CONCAT( a ) ) FROM t3 WHERE b = 3;
+
+SET group_concat_max_len= DEFAULT;
+DROP TABLE t1, t2, t3;
 
 --echo End of 5.0 tests
Thread
bk commit into 5.1 tree (mhansson:1.2531)mhansson22 May