Commit d920097a authored by unknown's avatar unknown

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
...@@ -1067,3 +1067,10 @@ show indexes from t1; ...@@ -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 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 t1 1 f1 1 f1 A NULL NULL NULL YES BTREE
drop table t1; 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;
...@@ -759,3 +759,11 @@ show columns from t1; ...@@ -759,3 +759,11 @@ show columns from t1;
describe t1; describe t1;
show indexes from t1; show indexes from t1;
drop table 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;
...@@ -2616,7 +2616,9 @@ static int get_schema_column_record(THD *thd, struct st_table_list *tables, ...@@ -2616,7 +2616,9 @@ static int get_schema_column_record(THD *thd, struct st_table_list *tables,
table->field[6]->store((const char*) pos, table->field[6]->store((const char*) pos,
strlen((const char*) pos), cs); strlen((const char*) pos), cs);
is_blob= (field->type() == FIELD_TYPE_BLOB); 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 char_max_len= is_blob ?
(longlong) field->max_length() / field->charset()->mbminlen : (longlong) field->max_length() / field->charset()->mbminlen :
......
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