Commit 05d5360e authored by ingo@mysql.com's avatar ingo@mysql.com

Enlarged group item key_length by a varstring length field.

Group item fields are implemented as varstrings nowadays.
Made init_connect.test robust against existing t1.
parent 7216594f
...@@ -12,7 +12,7 @@ set GLOBAL init_connect=DEFAULT; ...@@ -12,7 +12,7 @@ set GLOBAL init_connect=DEFAULT;
select @a; select @a;
@a @a
NULL NULL
set global init_connect="create table t1(a char(10));\ set global init_connect="drop table if exists t1; create table t1(a char(10));\
insert into t1 values ('\0');insert into t1 values('abc')"; insert into t1 values ('\0');insert into t1 values('abc')";
select hex(a) from t1; select hex(a) from t1;
hex(a) hex(a)
......
...@@ -19,7 +19,7 @@ connect (con3,localhost,user_1,,); ...@@ -19,7 +19,7 @@ connect (con3,localhost,user_1,,);
connection con3; connection con3;
select @a; select @a;
connection con0; connection con0;
set global init_connect="create table t1(a char(10));\ set global init_connect="drop table if exists t1; create table t1(a char(10));\
insert into t1 values ('\0');insert into t1 values('abc')"; insert into t1 values ('\0');insert into t1 values('abc')";
connect (con4,localhost,user_1,,); connect (con4,localhost,user_1,,);
connection con4; connection con4;
......
...@@ -11654,8 +11654,21 @@ calc_group_buffer(JOIN *join,ORDER *group) ...@@ -11654,8 +11654,21 @@ calc_group_buffer(JOIN *join,ORDER *group)
key_length+=sizeof(double); key_length+=sizeof(double);
else if ((*group->item)->result_type() == INT_RESULT) else if ((*group->item)->result_type() == INT_RESULT)
key_length+=sizeof(longlong); key_length+=sizeof(longlong);
else if ((*group->item)->result_type() == STRING_RESULT)
{
/*
Group strings are taken as varstrings and require an length field.
A field is not yet created by create_tmp_field()
and the sizes should match up.
*/
key_length+= (*group->item)->max_length + HA_KEY_BLOB_LENGTH;
}
else else
key_length+=(*group->item)->max_length; {
/* This case should never be choosen */
DBUG_ASSERT(0);
current_thd->fatal_error();
}
parts++; parts++;
if ((*group->item)->maybe_null) if ((*group->item)->maybe_null)
null_parts++; null_parts++;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment