diff options
author | unknown <bar@mysql.com> | 2005-01-21 16:49:20 +0400 |
---|---|---|
committer | unknown <bar@mysql.com> | 2005-01-21 16:49:20 +0400 |
commit | f813e0dac0d9f31140b699f3903940b50c9481fc (patch) | |
tree | 0eec39b05fc476406d8e0cd1fc4c177c48e65efd | |
parent | 4bfad5aedb45d386a4449f70cf079357c297642c (diff) | |
download | mariadb-git-f813e0dac0d9f31140b699f3903940b50c9481fc.tar.gz |
Bug#7943: Wrong prefix lengths reported on UTF-8 columns
SHOW KEYS FROM t1 now displays number of characters in Sub_part,
not number of bytes, to be compatible with SHOW CREATE TABLE.
-rw-r--r-- | mysql-test/r/ctype_mb.result | 4 | ||||
-rw-r--r-- | sql/sql_show.cc | 3 |
2 files changed, 4 insertions, 3 deletions
diff --git a/mysql-test/r/ctype_mb.result b/mysql-test/r/ctype_mb.result index 5e273b3c800..dbdb9c1343c 100644 --- a/mysql-test/r/ctype_mb.result +++ b/mysql-test/r/ctype_mb.result @@ -33,7 +33,7 @@ t1 CREATE TABLE `t1` ( ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SHOW KEYS FROM t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment -t1 1 key_a 1 a A NULL 9 NULL YES BTREE +t1 1 key_a 1 a A NULL 3 NULL YES BTREE ALTER TABLE t1 CHANGE a a CHAR(4); SHOW CREATE TABLE t1; Table Create Table @@ -53,5 +53,5 @@ t1 CREATE TABLE `t1` ( ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SHOW KEYS FROM t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment -t1 1 key_a 1 a A NULL 9 NULL YES BTREE +t1 1 key_a 1 a A NULL 3 NULL YES BTREE DROP TABLE t1; diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 8929872c466..91cac29f3a3 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -1025,7 +1025,8 @@ mysqld_show_keys(THD *thd, TABLE_LIST *table_list) /* Check if we have a key part that only uses part of the field */ if (!(key_info->flags & HA_FULLTEXT) && (!key_part->field || key_part->length != table->field[key_part->fieldnr-1]->key_length())) - protocol->store_tiny((longlong) key_part->length); + protocol->store_tiny((longlong) key_part->length / + key_part->field->charset()->mbmaxlen); else protocol->store_null(); protocol->store_null(); // No pack_information yet |