Bug #60652 | Query returns BLOB type but no BLOBs are in the database | ||
---|---|---|---|
Submitted: | 25 Mar 2011 21:09 | Modified: | 2 Jun 2011 18:21 |
Reporter: | Matt Houser | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | Connector / NET | Severity: | S1 (Critical) |
Version: | 6.3.6 | OS: | Any |
Assigned to: | Julio Casal | CPU Architecture: | Any |
Tags: | BLOB, connector, NET |
[25 Mar 2011 21:09]
Matt Houser
[25 Mar 2011 21:10]
Matt Houser
MySql Model
Attachment: EFTest3.mwb (application/octet-stream, text), 11.82 KiB.
[25 Mar 2011 21:10]
Matt Houser
Problem Query
Attachment: Problem.sql (application/octet-stream, text), 5.74 KiB.
[25 Mar 2011 21:10]
Matt Houser
Sample data
Attachment: InsertValues.sql (application/octet-stream, text), 520 bytes.
[26 Mar 2011 7:20]
Valeriy Kravchuk
The return type is the following (in mysql command line client with --column-type-info): Field 24: `C15` Catalog: `def` Database: `` Table: `Project5` Org_table: `` Type: VAR_STRING Collation: binary (63) Length: 1 Max_length: 1 Decimals: 0 Flags: BINARY So, it is a string with binary flag and collation, not BLOB: mysql> create table tblob(c1 blob); Query OK, 0 rows affected (0.13 sec) mysql> select * from tblob; Field 1: `c1` Catalog: `def` Database: `eftest3` Table: `tblob` Org_table: `tblob` Type: BLOB Collation: binary (63) Length: 65535 Max_length: 0 Decimals: 0 Flags: BLOB BINARY
[26 Mar 2011 7:23]
Valeriy Kravchuk
So, in what tool/application do you see this column as BLOB, and why you expect it to be "a bit"?
[27 Mar 2011 2:55]
Matt Houser
Workbench showing C15 as BLOB
Attachment: C15Blob.JPG (image/jpeg, text), 17.20 KiB.
[27 Mar 2011 3:10]
Matt Houser
Image showing expected bit data
Attachment: ShowingExpectedBit.jpg (image/jpeg, text), 54.12 KiB.
[27 Mar 2011 3:22]
Matt Houser
Error shown when performing the problem query using Connector/NET
Attachment: InvalidCastError.JPG (image/jpeg, text), 35.77 KiB.
[27 Mar 2011 3:38]
Matt Houser
Image showing data at time of error using Connector/NET. Datatype is "BLOB".
Attachment: ShowingBlobResult.jpg (image/jpeg, text), 55.47 KiB.
[27 Mar 2011 3:39]
Matt Houser
I have attached some images showing why it should be a bit in the result. 1. One image shows MySql Workbench showing the column as a BLOB. 2. One image shows what columns should be present in the result. As shown, it should be the IsStop column which is a BIT column. 3. One image shows details about the error in Connector/NET when executed via Visual Studio 2010. As seen, it is showing that the return type is a BLOB.
[27 Mar 2011 6:17]
Valeriy Kravchuk
So, it's Workbench... Please, check in Preferences > SQL Editor if "Treat BINARY/VARBINARY as nonbinary character string" checkbox is checked.
[27 Mar 2011 13:46]
Matt Houser
In Workbench preferences, that setting is *unchecked*. However, it's not just Workbench. Connector/NET is treating it exactly the same. Even if Workbench is treating a BINARY or VARBINARY as a BLOB, why is it that anyways? It should be a BIT. Other queries return 0 or 1 for this field.
[20 Apr 2011 13:18]
Bogdan Degtyariov
The query is very long and nearly impossible to understand. It has to be simplified first. Though, when I remove the UNION part declaring `Extent2` C15 is not shown as BLOB anymore. I cannot find a reasonable for that...
[20 Apr 2011 14:34]
Bogdan Degtyariov
Please ignore the previous comment. Bit values are returned as binary values. To display them in printable form, add 0 or use a conversion function such as BIN(). Maybe that is the case here: SELECT * FROM ( (SELECT b'0') UNION ALL (SELECT bit_column from bit_table)) AS `UnionAll2` bit_column gets reduced to binary because it is used in union with b'0'.
[20 Apr 2011 14:59]
Bogdan Degtyariov
Modify the query by editing this line: `Project5`.`C15`+0 as `C15` Other BIT columns in the query (such as IsEnabled) were not combined with constants in UNION and therefore the server returned them with the original metadata. It works like this: "bit_column + 1" tells the server to treat the result as the number "bit_column UNION 1" assumes that all types are reduced to the simplest data type, which is binary. This does not look like a bug to me.
[21 Apr 2011 14:25]
Matt Houser
Please do not close this issue. As mentioned, the sql was generated by mysql connector .Net. If the bug is not in the server, then it must be in the connector and must be fixed there as soon as possible. Please re-open and move to the connector group. Please fix this right away. This works properly using Microsoft SQL, so you must make it work with mysql or I must revert to ms sql.
[27 Apr 2011 7:24]
Bogdan Degtyariov
Matt, Sorry, it was my mistake. I missed your comment that the query is generated by Connector/NET. The bug is marked as 'verified'. Indeed, this is the problem in the NET driver, which will be reported to the developers ASAP. Thanks for your feedback.
[23 May 2011 18:26]
Julio Casal
Please attach your Visual Studio project with the Entity Framework model and a sample execution code that would produce the mentioned query and exception. I need this to figure out if this is a Connector/Net or a server issue. The bug is very simmilar to bug #59824 for which there is a workaround, but need your EF model to verify this. Also, the reported version for this issue is 5.5.8, but I believe that number is for the server version, not the Connector/Net version. Would you confirm in which Connector/Net version and server version you see this issue?
[23 May 2011 19:51]
Matt Houser
Sample application using Connector/NET
Attachment: EFTest3-TestApp.zip (application/x-zip-compressed, text), 90.75 KiB.
[23 May 2011 19:52]
Matt Houser
I have added a sample application using VS2010 and entity frameworks. Run the app and an exception is thrown. The version is actually for the server. I originally posted it as a server problem. The "server guys" says it was a connector issue and they changed the category but did not update the version. The server is using 5.5.8, the connector version is 6.3.6
[2 Jun 2011 18:21]
Julio Casal
Thank you for your bug report. This issue has been committed to our source repository of that product and will be incorporated into the next release. Fixed versions: 6.1.6, 6.2.5, 6.3.7, 6.4.1+. If necessary, you can access the source repository and build the latest available version, including the bug fix. More information about accessing the source trees is available at http://dev.mysql.com/doc/en/installing-source.html