Commit f57c7d8b authored by ramil@mysql.com's avatar ramil@mysql.com

Fix for bug #9571: Primary key creation causes server crash.

parent 81977103
......@@ -377,3 +377,6 @@ hex(concat(a)) hex(concat(b))
07 0FFE
01 01FF
drop table t1;
create table t1(a int, b bit not null);
alter table t1 add primary key (a);
drop table t1;
......@@ -112,3 +112,11 @@ insert into t1 values (7,(1<<12)-2), (0x01,0x01ff);
select hex(a),hex(b) from t1;
select hex(concat(a)),hex(concat(b)) from t1;
drop table t1;
#
# Bug #9571: problem with primary key creation
#
create table t1(a int, b bit not null);
alter table t1 add primary key (a);
drop table t1;
......@@ -679,15 +679,14 @@ static bool make_empty_rec(THD *thd, File file,enum db_type table_type,
null_count++;
}
bfill(buff,(null_length=(null_fields+7)/8),255);
null_pos=buff;
null_pos= buff + null_count / 8;
List_iterator<create_field> it(create_fields);
thd->count_cuted_fields= CHECK_FIELD_WARN; // To find wrong default values
while ((field=it++))
{
Field *regfield=make_field((char*) buff+field->offset,field->length,
field->flags & NOT_NULL_FLAG ? 0:
null_pos+null_count/8,
null_pos,
null_count & 7,
field->pack_flag,
field->sql_type,
......
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