From: Date: February 24 2006 3:17pm Subject: bk commit into 5.0 tree (evgen:1.2066) BUG#14169 List-Archive: http://lists.mysql.com/commits/3110 X-Bug: 14169 Message-Id: <20060224141725.200E222DA93@moonbone.moonbone.local> Below is the list of changes that have just been committed into a local 5.0 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.2066 06/02/24 17:17:17 evgen@stripped +2 -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. tests/mysql_client_test.c 1.176 06/02/24 17:16:18 evgen@stripped +35 -0 Added test case for bug#14169: type of group_concat() result changed to blob if tmp_table was used sql/item_sum.h 1.98 06/02/24 17:14:42 evgen@stripped +7 -0 Fixed bug#14169: type of group_concat() result changed to blob if tmp_table was used The Item_func_group_concat::field_type() now returns FIELD_TYPE_BLOB if the result is longer than 512 chars. # 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-5.0-mysql --- 1.97/sql/item_sum.h 2005-12-12 09:20:48 +03:00 +++ 1.98/sql/item_sum.h 2006-02-24 17:14:42 +03:00 @@ -1116,6 +1116,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_VARCHAR; + } void clear(); bool add(); void reset_field() { DBUG_ASSERT(0); } // not used --- 1.175/tests/mysql_client_test.c 2006-02-15 22:16:27 +03:00 +++ 1.176/tests/mysql_client_test.c 2006-02-24 17:16:18 +03:00 @@ -14841,6 +14841,40 @@ } /* + Bug#14169: type of group_concat() result changed to blob if tmp_table was used +*/ +static void test_bug14169() +{ + MYSQL_STMT *stmt; + const char *stmt_text; + MYSQL_RES *res; + MYSQL_FIELD *field; + int rc; + + myheader("test_bug14169"); + + rc= mysql_query(mysql, "drop table if exists t1"); + myquery(rc); + rc= mysql_query(mysql, "set global group_concat_max_len=1024"); + myquery(rc); + rc= mysql_query(mysql, "create table t1 (f1 int unsigned, f2 varchar(255))"); + myquery(rc); + rc= mysql_query(mysql, "insert into t1 values (1,repeat('a',255))," + "(2,repeat('b',255))"); + myquery(rc); + stmt= mysql_stmt_init(mysql); + stmt_text= "select f2,group_concat(f1) from t1 group by f2"; + rc= mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text)); + myquery(rc); + res= mysql_stmt_result_metadata(stmt); + field= mysql_fetch_fields(res); + if (!opt_silent) + printf("GROUP_CONCAT() result type %i", field[1].type); + DIE_UNLESS(field[1].type == MYSQL_TYPE_BLOB); + + rc= mysql_query(mysql, "drop table t1"); + myquery(rc); +}/* Read and parse arguments and MySQL options from my.cnf */ @@ -15105,6 +15139,7 @@ { "test_bug16143", test_bug16143 }, { "test_bug16144", test_bug16144 }, { "test_bug15613", test_bug15613 }, + { "test_bug14169", test_bug14169 }, { 0, 0 } };