Below is the list of changes that have just been committed into a local
4.1 repository of tomash. When tomash 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-11-17 19:14:09+03:00, kroki@stripped +2 -0
BUG#21635: MYSQL_FIELD struct's member strings seem to misbehave for
expression cols.
The problem was that MYSQL_FIELD::org_name was set for MIN() and MAX()
functions (COUNT() was already fixed). The solution is to reset this
field for all functions.
sql/item_sum.cc@stripped, 2006-11-17 19:14:07+03:00, kroki@stripped +7 -3
For expressions only col_name should be non-empty string.
tests/mysql_client_test.c@stripped, 2006-11-17 19:14:07+03:00, kroki@stripped +50 -0
Add test case for bug#21635: MYSQL_FIELD struct's member strings seem
to misbehave for expression cols.
# 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: kroki
# Host: moonlight.intranet
# Root: /home/tomash/src/mysql_ab/mysql-4.1-bug21635
--- 1.150/sql/item_sum.cc 2006-11-17 19:14:14 +03:00
+++ 1.151/sql/item_sum.cc 2006-11-17 19:14:14 +03:00
@@ -71,9 +71,13 @@ void Item_sum::make_field(Send_field *tm
if (args[0]->type() == Item::FIELD_ITEM && keep_field_type())
{
((Item_field*) args[0])->field->make_field(tmp_field);
- tmp_field->db_name=(char*)"";
- tmp_field->org_table_name=tmp_field->table_name=(char*)"";
- tmp_field->org_col_name=tmp_field->col_name=name;
+ /* For expressions only col_name should be non-empty string. */
+ char *empty_string= (char*)"";
+ tmp_field->db_name= empty_string;
+ tmp_field->org_table_name= empty_string;
+ tmp_field->table_name= empty_string;
+ tmp_field->org_col_name= empty_string;
+ tmp_field->col_name= name;
if (maybe_null)
tmp_field->flags&= ~NOT_NULL_FLAG;
}
--- 1.171/tests/mysql_client_test.c 2006-11-17 19:14:14 +03:00
+++ 1.172/tests/mysql_client_test.c 2006-11-17 19:14:14 +03:00
@@ -11946,6 +11946,55 @@ static void test_bug21726()
/*
+ BUG#21635: MYSQL_FIELD struct's member strings seem to misbehave for
+ expression cols
+
+ Check that for MIN(), MAX(), COUNT() only MYSQL_FIELD::name is set
+ to non-empty string.
+*/
+static void test_bug21635()
+{
+ MYSQL_RES *result;
+ MYSQL_FIELD *field;
+ const char *query;
+ unsigned int field_count, i;
+ int rc;
+
+ DBUG_ENTER("test_bug21635");
+ myheader("test_bug21635");
+
+ rc= mysql_query(mysql, "DROP TABLE IF EXISTS t1");
+ myquery(rc);
+ rc= mysql_query(mysql, "CREATE TABLE t1 (i INT)");
+ myquery(rc);
+ rc= mysql_query(mysql, "INSERT INTO t1 VALUES (1)");
+ myquery(rc);
+
+ query= "SELECT MIN(i), MAX(i), COUNT(i) FROM t1 GROUP BY i";
+ rc= mysql_real_query(mysql, query, strlen(query));
+ myquery(rc);
+
+ result= mysql_use_result(mysql);
+ DIE_UNLESS(result);
+
+ field_count= mysql_field_count(mysql);
+ for (i = 0; i < field_count; ++i)
+ {
+ field= mysql_fetch_field_direct(result, i);
+ DIE_UNLESS(field->db[0] == 0 && field->org_table[0] == 0 &&
+ field->table[0] == 0 && field->org_name[0] == 0 &&
+ field->name[0] != 0);
+ }
+
+ mysql_free_result(result);
+ rc= mysql_query(mysql, "DROP TABLE t1");
+ myquery(rc);
+
+ DBUG_VOID_RETURN;
+}
+
+
+/*
Read and parse arguments and MySQL options from my.cnf
*/
@@ -12172,6 +12221,7 @@ static struct my_tests_st my_tests[]= {
{ "test_bug15613", test_bug15613 },
{ "test_bug20152", test_bug20152 },
{ "test_bug21726", test_bug21726 },
+ { "test_bug21635", test_bug21635 },
{ 0, 0 }
};
| Thread |
|---|
| • bk commit into 4.1 tree (kroki:1.2540) BUG#21635 | kroki | 17 Nov |