=== modified file 'mysql-test/t/errors.test' --- mysql-test/t/errors.test 2007-06-18 13:35:01 +0000 +++ mysql-test/t/errors.test 2009-10-13 14:34:22 +0000 @@ -67,3 +67,39 @@ SHOW ERRORS; INSERT INTO t1 SELECT b FROM t1; DROP TABLE t1; # End of 5.0 tests + +# +# testing the value encoding in the error messages of set_var +# +SET NAMES utf8; +--error ER_WRONG_VALUE_FOR_VAR +SET sql_quote_show_create= _binary x'5452C39C45'; +--error ER_WRONG_VALUE_FOR_VAR +SET sql_quote_show_create= _utf8 x'5452C39C45'; +--error ER_WRONG_VALUE_FOR_VAR +SET sql_quote_show_create=_latin1 x'5452DC45'; +--error ER_WRONG_VALUE_FOR_VAR +SET sql_quote_show_create='TRÃœE'; +--error ER_WRONG_VALUE_FOR_VAR +SET sql_quote_show_create=TRÃœE; + +SET NAMES latin1; +--error ER_WRONG_VALUE_FOR_VAR +SET sql_quote_show_create= _binary x'5452C39C45'; +--error ER_WRONG_VALUE_FOR_VAR +SET sql_quote_show_create= _utf8 x'5452C39C45'; +--error ER_WRONG_VALUE_FOR_VAR +SET sql_quote_show_create=_latin1 x'5452DC45'; +--error ER_WRONG_VALUE_FOR_VAR +SET sql_quote_show_create='TRÜE'; +--error ER_WRONG_VALUE_FOR_VAR +SET sql_quote_show_create=TRÜE; + +SET NAMES binary; +--error ER_WRONG_VALUE_FOR_VAR +SET sql_quote_show_create= _binary x'5452C39C45'; +--error ER_WRONG_VALUE_FOR_VAR +SET sql_quote_show_create= _utf8 x'5452C39C45'; +--error ER_WRONG_VALUE_FOR_VAR +SET sql_quote_show_create=_latin1 x'5452DC45'; + === modified file 'sql/set_var.h' --- sql/set_var.h 2009-06-19 09:29:21 +0000 +++ sql/set_var.h 2009-10-13 14:31:10 +0000 @@ -1306,8 +1306,8 @@ public: { Item_field *item= (Item_field*) value_arg; if (!(value=new Item_string(item->field_name, - (uint) strlen(item->field_name), - item->collation.collation))) + (uint) strlen(item->field_name), + system_charset_info))) value=value_arg; /* Give error message later */ } else