Bug #6842 doc shouldn't suggest storing text in BLOB because the result is undefined
Submitted: 26 Nov 2004 11:19 Modified: 31 Jan 2005 19:13
Reporter: Hontvari Jozsef Levente Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Documentation Severity:S3 (Non-critical)
Version:4.1 OS:
Assigned to: Paul DuBois CPU Architecture:Any

[26 Nov 2004 11:19] Hontvari Jozsef Levente
Description:
This documentation suggests that you can store texts in BLOB fields even in 4.1 and up, especially if you want case-sensitive comparison. But this is completely wrong (although it may work for ASCII only text in practice). The problem is that BLOB has no charset. So you don't really want to retrieve the value of a  BLOB field as text, because the result is undefined.

A related documentation omission: on the other hand you can use the undocumented "TEXT BINARY" type in CREATE TABLE, which indeed creates a case-sensitive text field which uses the default table charset. (I wrote "undocumented", because on  the CREATE TABLE page VARCHAR BINARY was part of the syntax but TEXT BINARY was not)

How to repeat:
Read  http://dev.mysql.com/doc/mysql/en/BLOB.html, especially:

"BLOB columns are treated as binary strings, whereas TEXT columns are treated according to their character set. For BLOB columns, sorting and comparison is case sensitive."

Suggested fix:
From 4.1 you should stress that BLOBs have nothing to do with character strings, and you shouldn't use the misleading "binary string" and "case sensitive" terms in this context (i.e. BLOB), because both of them suggest character data, not binary data.
[31 Jan 2005 19:13] Paul DuBois
Thank you for your bug report. This issue has been addressed in the
documentation. The updated documentation will appear on our website
shortly, and will be included in the next release of the relevant
product(s).

Additional info:

The section didn't suggest storing text in BLOB columns.
However, I've revised the wording to point out that binary
strings are byte strings and have no character set, and
mentioned the BINARY attribute for TEXT.

Thanks for the report.