|
SET @x=_utf8'ß';
|
SELECT IF (0,@x:=10,@x), CHARSET(@x), @x;
|
+------------------+-------------+------+
|
| IF (0,@x:=10,@x) | CHARSET(@x) | @x |
|
+------------------+-------------+------+
|
| ß | latin1 | ß |
|
+------------------+-------------+------+
|
Notice, the variable @x changed its character set from utf8 to latin1 and therefore returns a wrong value.
The problem happens because Item_func_set_user_val::fix_length_and_dec(), performed for @x:=10, changes the character set of @x from utf8 to latin1.
But the assignment of @x to 10 does not actually happen, because of the 0 in the first argument of IF.
So the underlying code erroneously changes the variable character set separately from the value, which looks wrong.
|