Loading mysql-test/r/information_schema.result +7 −0 Original line number Diff line number Diff line Loading @@ -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; mysql-test/t/information_schema.test +8 −0 Original line number Diff line number Diff line Loading @@ -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; sql/sql_show.cc +3 −1 Original line number Diff line number Diff line Loading @@ -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 : Loading Loading
mysql-test/r/information_schema.result +7 −0 Original line number Diff line number Diff line Loading @@ -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;
mysql-test/t/information_schema.test +8 −0 Original line number Diff line number Diff line Loading @@ -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;
sql/sql_show.cc +3 −1 Original line number Diff line number Diff line Loading @@ -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 : Loading