Bug #7095 | Compress/Uncompress function support Blob type | ||
---|---|---|---|
Submitted: | 8 Dec 2004 5:45 | Modified: | 14 Sep 2005 9:54 |
Reporter: | TAT LIM CHIN | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server | Severity: | S3 (Non-critical) |
Version: | 4.1.15-BK | OS: | Linux (Linux) |
Assigned to: | Jim Winstead | CPU Architecture: | Any |
[8 Dec 2004 5:45]
TAT LIM CHIN
[31 Aug 2005 10:22]
Valeriy Kravchuk
Test file. Shows incorrect data type VAR_STRING (253) istead of BLOB (252)
Attachment: 7095.c (text/x-csrc), 1.29 KiB.
[31 Aug 2005 10:31]
Valeriy Kravchuk
See the attached test case. The table used is the following: mysql> desc ImageFile; +-----------+---------------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +-----------+---------------------+------+-----+---------+----------------+ | ID | bigint(20) unsigned | | PRI | NULL | auto_increment | | IMAGEDATA | mediumblob | YES | | NULL | | +-----------+---------------------+------+-----+---------+----------------+ 2 rows in set (0.00 sec) According to the manual (http://dev.mysql.com/doc/mysql/en/string-functions.html): "(Use of CHAR or VARCHAR to store compressed strings is not recommended. It is better to use a BLOB column instead.)" We used it in just such a way, and, as original reporter described, will get the result as string, not as a blob, thus making it impossible to use the results of uncomression as blobs directly. The result of Uncompress(BLOB) should be of a BLOB type really.
[31 Aug 2005 10:33]
Valeriy Kravchuk
The results of test: [openxs@Fedora 4.1]$ ./7095 Client info: 4.1.15 Server info: 4.1.15 type=8 length=20 decimals=0 type=253 length=8192 decimals=31
[14 Sep 2005 9:54]
Sergei Golubchik
VAR_STRING is correct for the result of the string function. What matters is the character set. The result of the UNCOMPRESS() has 'binary' character set and BINARY flag set. It means the result is binary data, not a text.