Commit 02819411 authored by unknown's avatar unknown
Browse files

Bug#5081: UCS2 fields are filled with '0x2020' after extending field length

parent f9b8ffc2
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -470,3 +470,13 @@ select s1 from t1 where s1 > 'a' order by s1;
s1
b
c
drop table t1;
create table t1(a char(1)) default charset = ucs2;
insert into t1 values ('a'),('b'),('c');
alter table t1 modify a char(5);
select a, hex(a) from t1;
a	hex(a)
a	0061
b	0062
c	0063
drop table t1;
+11 −0
Original line number Diff line number Diff line
@@ -303,4 +303,15 @@ DROP TABLE t1;
create table t1 (s1 char character set `ucs2` collate `ucs2_czech_ci`);
insert into t1 values ('0'),('1'),('2'),('a'),('b'),('c');
select s1 from t1 where s1 > 'a' order by s1;
drop table t1;

#
# Bug #5081 : UCS2 fields are filled with '0x2020'
# after extending field length
#
create table t1(a char(1)) default charset = ucs2;
insert into t1 values ('a'),('b'),('c');
alter table t1 modify a char(5);
select a, hex(a) from t1;
drop table t1;
+3 −1
Original line number Diff line number Diff line
@@ -340,8 +340,10 @@ static void do_cut_string(Copy_field *copy)

static void do_expand_string(Copy_field *copy)
{
  CHARSET_INFO *cs= copy->from_field->charset();
  memcpy(copy->to_ptr,copy->from_ptr,copy->from_length);
  bfill(copy->to_ptr+copy->from_length,copy->to_length-copy->from_length,' ');
  cs->cset->fill(cs, copy->to_ptr+copy->from_length,
                     copy->to_length-copy->from_length, ' ');
}

static void do_varstring(Copy_field *copy)