diff options
-rw-r--r-- | mysql-test/r/explain.result | 9 | ||||
-rw-r--r-- | mysql-test/t/explain.test | 11 | ||||
-rw-r--r-- | sql/sql_select.cc | 6 |
3 files changed, 23 insertions, 3 deletions
diff --git a/mysql-test/r/explain.result b/mysql-test/r/explain.result index 02e1ace71e1..d66dec741bd 100644 --- a/mysql-test/r/explain.result +++ b/mysql-test/r/explain.result @@ -44,3 +44,12 @@ explain select count(*) from t1; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away drop table t1; +set names koi8r; +create table таб (кол0 int, кол1 int, key инд0 (кол0), key инд01 (кол0,кол1)); +insert into таб (кол0) values (1); +insert into таб (кол0) values (2); +explain select кол0 from таб where кол0=1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE таб ref инд0,инд01 инд0 5 const 1 Using where; Using index +drop table таб; +set names latin1; diff --git a/mysql-test/t/explain.test b/mysql-test/t/explain.test index ff1803368b9..050939e5ad2 100644 --- a/mysql-test/t/explain.test +++ b/mysql-test/t/explain.test @@ -30,3 +30,14 @@ explain select count(*) from t1; insert into t1 values(1); explain select count(*) from t1; drop table t1; + +# +# Bug #3403 Wrong encoding in EXPLAIN SELECT output +# +set names koi8r; +create table таб (кол0 int, кол1 int, key инд0 (кол0), key инд01 (кол0,кол1)); +insert into таб (кол0) values (1); +insert into таб (кол0) values (2); +explain select кол0 from таб where кол0=1; +drop table таб; +set names latin1; diff --git a/sql/sql_select.cc b/sql/sql_select.cc index f9cd5bcbf86..47ecc57cf16 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -9123,7 +9123,7 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order, THD *thd=join->thd; select_result *result=join->result; Item *item_null= new Item_null(); - CHARSET_INFO *cs= &my_charset_latin1; + CHARSET_INFO *cs= system_charset_info; DBUG_ENTER("select_describe"); DBUG_PRINT("info", ("Select 0x%lx, type %s, message %s", (ulong)join->select_lex, join->select_lex->type, @@ -9190,7 +9190,7 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order, { if (tmp1.length()) tmp1.append(','); - tmp1.append(table->key_info[j].name); + tmp1.append(table->key_info[j].name, 0, system_charset_info); } } } @@ -9209,7 +9209,7 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order, { if (tmp2.length()) tmp2.append(','); - tmp2.append((*ref)->name()); + tmp2.append((*ref)->name(), 0, system_charset_info); } item_list.push_back(new Item_string(tmp2.ptr(),tmp2.length(),cs)); } |