Bug #26444 uncompress(BLOB)
Submitted: 16 Feb 2007 12:11 Modified: 28 Aug 2007 20:01
Reporter: Ruben Hernandez Email Updates:
Status: Won't fix Impact on me:
Category:Connector / NET Severity:S3 (Non-critical)
Version:5 OS:Windows (Windows)
Assigned to: CPU Architecture:Any
Tags: BLOB, connector.net, uncompress

[16 Feb 2007 12:11] Ruben Hernandez
select uncompress(BLOB) from data_files where id = 1

I am unable to use the datareader.getbytes() function since the uncompress data is returned as a string.

How to repeat:
command.commandtext= "select uncompress(BLOB) from data_files where id = 1"
datareader = command.executereader

if datareader.read() then
dim bytes() as byte

end if

Suggested fix:
Allow the getbytes function to read strings.
[16 Feb 2007 15:33] Valeriy Kravchuk
Thank you for a problem report. What exact version of Connector/Net do you use (5.0.x)?

It really looks like a connector bug, as at server level everything works as expected:

openxs@suse:~/dbs/5.0> bin/mysql -uroot -T test
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.0.36 Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> create table tblob(c1 int, c2 blob);
Query OK, 0 rows affected (0.01 sec)

mysql> insert into tblob values(1, compress('abcd'));
Query OK, 1 row affected (0.01 sec)

mysql> select uncompress(c2) from tblob;
Field   1:  `uncompress(c2)`
Catalog:    `def`
Database:   ``
Table:      ``
Org_table:  ``
Type:       VAR_STRING
Collation:  binary (63)
Length:     8192
Max_length: 4
Decimals:   31
Flags:      BINARY

| uncompress(c2) |
| abcd           |
1 row in set (0.00 sec)

mysql> create table tblob2 as select uncompress(c2) c1 from tblob;
Query OK, 1 row affected (0.01 sec)
Records: 1  Duplicates: 0  Warnings: 0

mysql> show create table tblob2\G
*************************** 1. row ***************************
       Table: tblob2
Create Table: CREATE TABLE `tblob2` (
  `c1` longblob
1 row in set (0.00 sec)
[17 Mar 2007 0:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
[27 Aug 2007 14:53] Jaroslav Kaas
I have same problem. "select uncompress(BLOB)" returns string instead of byte[].

In connector.net 5.0.6 everything was OK (returned value was byte[]), but after upgrade to latest returned value is string.

I had to rewrite all queries to something like "select * from (select uncompress(BLOB)) tmpalias".

I'm using MySqlCommand.ExecuteScalar to retrieve uncompressed blobs, error with returned string exists in queries passed as string as well as stored procedures.
[28 Aug 2007 20:01] Reggie Burnett
This is something that we will not be fixing in the 5.0 release.  This is fixed in the 5.1 releases. In fact, in 5.1 there is a connection string option to select which behavior you like.

We originally fixed this in 5.0 (in 5.0.5 and 5.0.6) however we got feedback from several users that it broke their apps and that we should not have made the change in a GA product.  That's why we moved the change from 5.0 to 5.1.

I'm sorry for the inconvenience.  We try to fix bugs in such a way that it breaks as few existing apps as possible.