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.


mysql-test/r/init_connect.result:
  Made init_connect.test robust against existing t1.
mysql-test/t/init_connect.test:
  Made init_connect.test robust against existing t1.
sql/sql_select.cc:
  Enlarged group item key_length by a varstring length field.
  Group item fields are implemented as varstrings nowadays.
This commit is contained in:
unknown 2004-12-16 11:41:52 +01:00
parent 7845f99abf
commit 9a2c0bd932
3 changed files with 16 additions and 3 deletions

View file

@ -12,7 +12,7 @@ set GLOBAL init_connect=DEFAULT;
select @a;
@a
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')";
select hex(a) from t1;
hex(a)

View file

@ -19,7 +19,7 @@ connect (con3,localhost,user_1,,);
connection con3;
select @a;
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')";
connect (con4,localhost,user_1,,);
connection con4;

View file

@ -11654,8 +11654,21 @@ calc_group_buffer(JOIN *join,ORDER *group)
key_length+=sizeof(double);
else if ((*group->item)->result_type() == INT_RESULT)
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
key_length+=(*group->item)->max_length;
{
/* This case should never be choosen */
DBUG_ASSERT(0);
current_thd->fatal_error();
}
parts++;
if ((*group->item)->maybe_null)
null_parts++;