From a9dab6da62e90fa8238a4ff89d7292d7bafa8935 Mon Sep 17 00:00:00 2001 From: Sergey Petrunya Date: Thu, 9 Aug 2012 20:38:09 +0400 Subject: [PATCH] MWL#182: Explain running statements: address review feedback - Add a testcase showing that queries specified in a charset that's different from the charset used for warnings, are converted. --- mysql-test/r/show_explain.result | 24 ++++++++++++++++++++++++ mysql-test/t/show_explain.test | 28 ++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) diff --git a/mysql-test/r/show_explain.result b/mysql-test/r/show_explain.result index c751e4f913f..b5eda0b30c8 100644 --- a/mysql-test/r/show_explain.result +++ b/mysql-test/r/show_explain.result @@ -1045,5 +1045,29 @@ id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE 2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using filesort DROP TABLE t1,t2; +# +# Check if queries in non-default charsets work. +# +set names cp1251; +select charset('ãû'); +charset('ãû') +cp1251 +select hex('ãû'); +hex('ãû') +E3FB +set @show_explain_probe_select_id=1; +set debug_dbug='d,show_explain_probe_join_exec_start'; +select * from t0 where length('ãû') = a; +set names utf8; +show explain for $thr2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t0 ALL NULL NULL NULL NULL 10 Using where +Warnings: +Note 1003 select * from t0 where length('гы') = a +set names default; +a +2 +set debug_dbug=''; +set names default; # End drop table t0; diff --git a/mysql-test/t/show_explain.test b/mysql-test/t/show_explain.test index 4bfee830986..8bfeae7e7e5 100644 --- a/mysql-test/t/show_explain.test +++ b/mysql-test/t/show_explain.test @@ -1077,5 +1077,33 @@ WHERE ( 8, 89 ) IN ( SELECT b, SUM( DISTINCT b ) FROM t2 GROUP BY b ); DROP TABLE t1,t2; +--echo # +--echo # Check if queries in non-default charsets work. +--echo # + +set names cp1251; +# The below are two Russian letters with codes E3FB in cp1251 encoding. +select charset('ãû'); +select hex('ãû'); + +set @show_explain_probe_select_id=1; +set debug_dbug='d,show_explain_probe_join_exec_start'; + +send +select * from t0 where length('ãû') = a; + +connection default; +set names utf8; +--source include/wait_condition.inc +evalp show explain for $thr2; +set names default; + +connection con1; +# The constant should be two letters, the last looking like 'bl' +reap; + +set debug_dbug=''; +set names default; + --echo # End drop table t0;