#At file:///home/bar/mysql-bzr/mysql-5.5-bugteam.b57306/ based on revid:vvaintroub@stripped3mkujaucde
3121 Alexander Barkov 2010-11-12
Bug#57306 SHOW PROCESSLIST does not display string literals well.
Problem: Extended characters outside of ASCII range where not displayed
properly in SHOW PROCESSLIST, because thd_info->query was always sent as
system_character_set (utf8). This was wrong, because query buffer
is never converted to utf8 - it is always have client character set.
Fix: sending query buffer using character_set_client of its thread.
modified:
mysql-test/r/show_check.result
mysql-test/t/show_check.test
sql/sql_show.cc
=== modified file 'mysql-test/r/show_check.result'
--- a/mysql-test/r/show_check.result 2010-07-23 08:44:55 +0000
+++ b/mysql-test/r/show_check.result 2010-11-12 14:45:32 +0000
@@ -1514,3 +1514,26 @@ ALTER TABLE t1 CHARACTER SET = utf8;
COMMIT;
DROP TRIGGER t1_bi;
DROP TABLE t1;
+#
+# Bug#57306 SHOW PROCESSLIST does not display string literals well.
+#
+SET NAMES latin1;
+SELECT GET_LOCK('t', 1000);
+GET_LOCK('t', 1000)
+1
+SET NAMES latin1;
+SELECT GET_LOCK('t',1000) AS 'óóóó';;
+SHOW PROCESSLIST;
+Id User Host db Command Time State Info
+### root localhost test Query ### ### SHOW PROCESSLIST
+### root localhost test Query ### ### SELECT GET_LOCK('t',1000) AS 'óóóó'
+SET NAMES utf8;
+SHOW PROCESSLIST;
+Id User Host db Command Time State Info
+### root localhost test Query ### ### SHOW PROCESSLIST
+### root localhost test Query ### ### SELECT GET_LOCK('t',1000) AS 'óóóó'
+SELECT RELEASE_LOCK('t');
+RELEASE_LOCK('t')
+1
+óóóó
+1
=== modified file 'mysql-test/t/show_check.test'
--- a/mysql-test/t/show_check.test 2010-07-27 14:32:42 +0000
+++ b/mysql-test/t/show_check.test 2010-11-12 14:45:32 +0000
@@ -1328,3 +1328,24 @@ disconnect con1;
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc
+--echo #
+--echo # Bug#57306 SHOW PROCESSLIST does not display string literals well.
+--echo #
+
+SET NAMES latin1;
+SELECT GET_LOCK('t', 1000);
+--connect (con1,localhost,root,,)
+--connection con1
+SET NAMES latin1;
+--send SELECT GET_LOCK('t',1000) AS 'óóóó';
+--connection default
+--replace_column 1 ### 6 ### 7 ###
+SHOW PROCESSLIST;
+SET NAMES utf8;
+--replace_column 1 ### 6 ### 7 ###
+SHOW PROCESSLIST;
+SELECT RELEASE_LOCK('t');
+--connection con1
+--reap
+--disconnect con1
+--connection default
=== modified file 'sql/sql_show.cc'
--- a/sql/sql_show.cc 2010-11-02 14:02:16 +0000
+++ b/sql/sql_show.cc 2010-11-12 14:45:32 +0000
@@ -1728,6 +1728,7 @@ public:
uint command;
const char *user,*host,*db,*proc_info,*state_info;
char *query;
+ CHARSET_INFO *character_set_client;
};
#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION
@@ -1833,6 +1834,7 @@ void mysqld_list_processes(THD *thd,cons
}
mysql_mutex_unlock(&tmp->LOCK_thd_data);
thd_info->start_time= tmp->start_time;
+ thd_info->character_set_client= tmp->variables.character_set_client;
thread_infos.append(thd_info);
}
}
@@ -1857,7 +1859,7 @@ void mysqld_list_processes(THD *thd,cons
else
protocol->store_null();
protocol->store(thd_info->state_info, system_charset_info);
- protocol->store(thd_info->query, system_charset_info);
+ protocol->store(thd_info->query, thd_info->character_set_client);
if (protocol->write())
break; /* purecov: inspected */
}
Attachment: [text/bzr-bundle] bzr/bar@mysql.com-20101112144532-6ax1ddvoymf8hhp3.bundle