From d920097af497870f2fca84f059a89a59b77b6e85 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 19 Dec 2005 16:21:02 +0400 Subject: [PATCH] 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 --- mysql-test/r/information_schema.result | 7 +++++++ mysql-test/t/information_schema.test | 8 ++++++++ sql/sql_show.cc | 4 +++- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result index 5e34c41dfb2..e8d343ad711 100644 --- a/mysql-test/r/information_schema.result +++ b/mysql-test/r/information_schema.result @@ -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; diff --git a/mysql-test/t/information_schema.test b/mysql-test/t/information_schema.test index b982047cec7..b05798b781f 100644 --- a/mysql-test/t/information_schema.test +++ b/mysql-test/t/information_schema.test @@ -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; diff --git a/sql/sql_show.cc b/sql/sql_show.cc index dc6c141bef7..1b31e8f7dc3 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -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 :