Below is the list of changes that have just been committed into a local
5.0 repository of kgeorge. When kgeorge 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, 2006-07-19 11:04:55+03:00, gkodinov@stripped +4 -0
Bug#16712: group_concat returns odd srting insead of intended result
when calculating GROUP_CONCAT all blob fields are transformed
to varchar when making the temp table.
However a varchar has at max 2 bytes for length.
This fix makes the conversion only for blobs whose max length
is below that limit.
Otherwise blob field is created by make_string_field() call.
mysql-test/r/func_gconcat.result@stripped, 2006-07-19 11:04:45+03:00, gkodinov@stripped +13 -0
Bug#16712: group_concat returns odd srting insead of intended result
* testsuite for the bug
mysql-test/t/func_gconcat.test@stripped, 2006-07-19 11:04:46+03:00, gkodinov@stripped +14 -0
Bug#16712: group_concat returns odd srting insead of intended result
* testsuite for the bug
sql/item_sum.cc@stripped, 2006-07-19 11:04:46+03:00, gkodinov@stripped +3 -1
Bug#16712: group_concat returns odd srting insead of intended result
* force blob->varchar conversion for small enough blobs only
sql/sql_select.cc@stripped, 2006-07-19 11:04:47+03:00, gkodinov@stripped +4 -2
Bug#16712: group_concat returns odd srting insead of intended result
* force blob->varchar conversion for small enough blobs only
# 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: gkodinov
# Host: macbook.gmz
# Root: /Users/kgeorge/mysql/work/B16712-5.0-opt
--- 1.176/sql/item_sum.cc 2006-07-19 11:05:11 +03:00
+++ 1.177/sql/item_sum.cc 2006-07-19 11:05:11 +03:00
@@ -377,7 +377,9 @@
case INT_RESULT:
return new Field_longlong(max_length,maybe_null,name,table,unsigned_flag);
case STRING_RESULT:
- if (max_length/collation.collation->mbmaxlen > 255 && convert_blob_length)
+ if (max_length/collation.collation->mbmaxlen > 255 &&
+ max_length/collation.collation->mbmaxlen < UINT_MAX16 &&
+ convert_blob_length)
return new Field_varstring(convert_blob_length, maybe_null,
name, table,
collation.collation);
--- 1.428/sql/sql_select.cc 2006-07-19 11:05:11 +03:00
+++ 1.429/sql/sql_select.cc 2006-07-19 11:05:11 +03:00
@@ -8011,7 +8011,8 @@
{
Field *new_field;
- if (convert_blob_length && (org_field->flags & BLOB_FLAG))
+ if (convert_blob_length && convert_blob_length < UINT_MAX16 &&
+ (org_field->flags & BLOB_FLAG))
new_field= new Field_varstring(convert_blob_length,
org_field->maybe_null(),
org_field->field_name, table,
@@ -8088,7 +8089,8 @@
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 &&
- convert_blob_length)
+ item->max_length/item->collation.collation->mbmaxlen < UINT_MAX16
+ && convert_blob_length)
new_field= new Field_varstring(convert_blob_length, maybe_null,
item->name, table,
item->collation.collation);
--- 1.58/mysql-test/r/func_gconcat.result 2006-07-19 11:05:11 +03:00
+++ 1.59/mysql-test/r/func_gconcat.result 2006-07-19 11:05:11 +03:00
@@ -641,3 +641,16 @@
charset(group_concat(c1 order by c2))
latin1
drop table t1;
+CREATE TABLE t1 (a INT(10), b LONGTEXT, PRIMARY KEY (a));
+SET GROUP_CONCAT_MAX_LEN = 20000000;
+INSERT INTO t1 VALUES (1,REPEAT(CONCAT('A',CAST(CHAR(0) AS BINARY),'B'), 40000));
+INSERT INTO t1 SELECT a + 1, b FROM t1;
+SELECT a, CHAR_LENGTH(b) FROM t1;
+a CHAR_LENGTH(b)
+1 120000
+2 120000
+SELECT CHAR_LENGTH( GROUP_CONCAT(b) ) FROM t1;
+CHAR_LENGTH( GROUP_CONCAT(b) )
+240001
+SET GROUP_CONCAT_MAX_LEN = 1024;
+DROP TABLE t1;
--- 1.44/mysql-test/t/func_gconcat.test 2006-07-19 11:05:11 +03:00
+++ 1.45/mysql-test/t/func_gconcat.test 2006-07-19 11:05:11 +03:00
@@ -433,3 +433,17 @@
select charset(group_concat(c1 order by c2)) from t1;
drop table t1;
+#
+# Bug #16712: group_concat returns odd string instead of intended result
+#
+CREATE TABLE t1 (a INT(10), b LONGTEXT, PRIMARY KEY (a));
+
+SET GROUP_CONCAT_MAX_LEN = 20000000;
+
+INSERT INTO t1 VALUES (1,REPEAT(CONCAT('A',CAST(CHAR(0) AS BINARY),'B'), 40000));
+INSERT INTO t1 SELECT a + 1, b FROM t1;
+
+SELECT a, CHAR_LENGTH(b) FROM t1;
+SELECT CHAR_LENGTH( GROUP_CONCAT(b) ) FROM t1;
+SET GROUP_CONCAT_MAX_LEN = 1024;
+DROP TABLE t1;
| Thread |
|---|
| • bk commit into 5.0 tree (gkodinov:1.2207) BUG#16712 | kgeorge | 19 Jul |