Bug #49645 init_slave and multi-byte characters
Submitted: 13 Dec 2009 8:59 Modified: 14 Mar 2010 1:41
Reporter: Sergei Golubchik Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Options Severity:S3 (Non-critical)
Version: OS:Any
Assigned to: CPU Architecture:Any

[13 Dec 2009 8:59] Sergei Golubchik
Description:
init_slave (as well as all other string variables) can store multi-byte characters, but the max_length is calculated incorrectly.

How to repeat:
see sys_vars.rpl_init_slave_func
find this:

SET @@global.init_slave = 'SET @@global.max_connections = @@global.max_connections + 1';
CREATE TEMPORARY TABLE t1 AS SELECT @@global.init_slave AS my_column;
DESCRIBE t1;

modify as

SET NAMES utf8;
SET @@global.init_slave = 'SET @@global.max_connections = @@global.max_connections + 1 -- комментарий';
CREATE TEMPORARY TABLE t1 AS SELECT @@global.init_slave AS my_column;
DESCRIBE t1;
select length(my_column) from t1;

you'll see that the column is defined as VARCHAR(N) where N is the length of
@@init_slave in bytes, not in characters
[13 Dec 2009 9:00] Sergei Golubchik
fixed in WL#4738
[6 Mar 2010 11:07] Bugs System
Pushed into 5.5.3-m3 (revid:alik@sun.com-20100306103849-hha31z2enhh7jwt3) (version source revid:vvaintroub@fedora12-20091225154921-x25a5pyw1pxiwobv) (merge vers: 5.5.99) (pib:16)
[14 Mar 2010 1:41] Paul Dubois
Noted in 5.5.3 changelog.

For string-valued system variables containing multibyte characters,
the byte length was used in contexts where the character length was
more appropriate.