Bug #11974 | TEXT column with binary collation appears to be a BLOB | ||
---|---|---|---|
Submitted: | 15 Jul 2005 18:18 | Modified: | 28 Jul 2005 16:57 |
Reporter: | Dean Ellis | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server | Severity: | S4 (Feature request) |
Version: | 4.1.13 BK | OS: | Windows (Windows/Linux) |
Assigned to: | Alexander Barkov | CPU Architecture: | Any |
[15 Jul 2005 18:18]
Dean Ellis
[15 Jul 2005 20:10]
MySQL Verification Team
On Windows: C:\temp>bug11974 Server version: 4.1.13-nt Name: a FIELD_TYPE: 252 BLOB_FLAG: 1 BINARY_FLAG 0 Name: b FIELD_TYPE: 252 BLOB_FLAG: 1 BINARY_FLAG 1 Name: c FIELD_TYPE: 252 BLOB_FLAG: 1 BINARY_FLAG 1 On Linux; miguel@hegel:~/dbs/4.1$ ./bug11974 Server version: 4.1.13-debug-log Name: a FIELD_TYPE: 252 BLOB_FLAG: 1 BINARY_FLAG 0 Name: b FIELD_TYPE: 252 BLOB_FLAG: 1 BINARY_FLAG 1 Name: c FIELD_TYPE: 252 BLOB_FLAG: 1 BINARY_FLAG 1
[23 Aug 2005 10:43]
Sergei Golubchik
They are not completely the same, collation of the blob is 'binary', while collation of the text column is not.
[28 Jun 2007 11:37]
Andrea Valassi
I understood from the manual that it is now possible to distinguish TEXT BINARY and BLOB via the charsetnr variable: "To distinguish between binary and non-binary data for string data types, check whether the charsetnr value is 63. If so, the character set is binary, which indicates binary rather than non-binary data. This is how to distinguish between BINARY and CHAR, VARBINARY and VARCHAR, and BLOB and TEXT." (http://dev.mysql.com/doc/refman/5.0/en/c-api-datatypes.html). I tried this in a similar case to the one reported in this bug, and it seems to work. Is this the recommended solution? Cheers, Andrea
[29 Jun 2007 5:59]
Alexander Barkov
Yes, this is a recommended solution. For example, Java and ODBC connectors use this approach.
[29 Jun 2007 17:04]
Mark Matthews
Yes, that's what Connector/J and Connector/ODBC do, but only because we don't expose a concrete type for TEXT like we should, and it causes all kinds of interesting corner cases related to the output of functions and temporary tables. The real answer is to have a _real_ type in the protocol for TEXT types.