Bug #3242 binary blackhole
Submitted: 19 Mar 2004 5:41 Modified: 25 Mar 2004 11:25
Reporter: Wei He Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:3.23.58 OS:Linux (RHEL-3AS)
Assigned to: CPU Architecture:Any

[19 Mar 2004 5:41] Wei He
Description:
Numeric fields seem to be binary always. This breaks the multi-byte functionalities since mbstrings are sometimes impossible to get away from
the binary blackhole.

How to repeat:
SELECT LEFT('¹ýÈ¥µÄÒ»Äê', 2)

correctly returns two MB chars when default-character-set=gbk. But

SELECT LEFT('¹ýÈ¥µÄÒ»Äê', id + 1) FROM anytable WHERE id=1

returns only the first char cause id is treated as binary and so sticky the
binary effect is and makes the query actually like:

SELECT LEFT('¹ýÈ¥µÄÒ»Äê', BINARY 2)

Suggested fix:
Do like what the manual says, treat numeric fields non-binary.
And I suggest, even more, non-binariable.

I am the contributor of MySQL's gbk charset and some MB functionalities.
But I didn't use MB functions too much. This seems to be a problem 
that has been existing for a long time. IIRC, a constant like '2' had been treated as binary once in the history.
[25 Mar 2004 11:25] MySQL Verification Team
3.23 gets only crashing bug fixes right now.

The above worked just fine for me in 4.1.2:

mysql> set character set gbk;
Query OK, 0 rows affected (0.00 sec)

mysql> set collation_server=gbk_chinese_ci;
Query OK, 0 rows affected (0.00 sec)

mysql> SELECT LEFT('^(1)y\'E`??A\"O`?A\"e^', broj + 1) FROM nazivi WHERE broj=1;
+------------------------------------------+
| LEFT('^(1)y\'E`??A\"O`?A\"e^', broj + 1) |
+------------------------------------------+
| ^(                                       |
+------------------------------------------+
1 row in set (0.00 sec)