Commit d920097a authored by unknown's avatar unknown
Browse files

Fix for bug#14271 I_S: columns has no size for (var)binary columns

  set character_octet_length, character_maximum_length for
  binary and varbinary field types


mysql-test/r/information_schema.result:
  Fix for bug#14271 I_S: columns has no size for (var)binary columns
    test case
mysql-test/t/information_schema.test:
  Fix for bug#14271 I_S: columns has no size for (var)binary columns
    test case
parent c7a440d1
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -1067,3 +1067,10 @@ show indexes from t1;
Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment
t1	1	f1	1	f1	A	NULL	NULL	NULL	YES	BTREE	
drop table t1;
create table t1(f1 binary(32), f2 varbinary(64));
select character_maximum_length, character_octet_length
from information_schema.columns where table_name='t1';
character_maximum_length	character_octet_length
32	32
64	64
drop table t1;
+8 −0
Original line number Diff line number Diff line
@@ -759,3 +759,11 @@ show columns from t1;
describe t1;
show indexes from t1;
drop table t1;

#
# Bug#14271 I_S: columns has no size for (var)binary columns
#
create table t1(f1 binary(32), f2 varbinary(64));
select character_maximum_length, character_octet_length
from information_schema.columns where table_name='t1';
drop table t1;
+3 −1
Original line number Diff line number Diff line
@@ -2616,7 +2616,9 @@ static int get_schema_column_record(THD *thd, struct st_table_list *tables,
    table->field[6]->store((const char*) pos,
                           strlen((const char*) pos), cs);
    is_blob= (field->type() == FIELD_TYPE_BLOB);
    if (field->has_charset() || is_blob)
    if (field->has_charset() || is_blob ||
        field->real_type() == MYSQL_TYPE_VARCHAR ||  // For varbinary type
        field->real_type() == MYSQL_TYPE_STRING)     // For binary type
    {
      longlong char_max_len= is_blob ? 
        (longlong) field->max_length() / field->charset()->mbminlen :