Bug #11295 Simple query using blob column crashes server
Submitted: 13 Jun 2005 17:32 Modified: 23 Jun 2005 18:13
Reporter: Pete French Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:4.1.12 OS:Windows (Windows & FreeBSD)
Assigned to: Igor Babaev CPU Architecture:Any

[13 Jun 2005 17:32] Pete French
Description:
A simple query using left on a blob column, combined
with a distinct on another column causes the Windows
server to crash. Under BSD th whole server does not crash
but the database connection is dropped.

I can make this run by altering the length trimmen on the
blob and also chhanging the name of the coolumn. But the fact
that it causes things to collapse in such an ugly heap is worrying
as it should work as far as I can make out.

How to repeat:
Create the following two tables:

CREATE TABLE `t1` (
  `trans_id` varchar(48) character set latin1 collate latin1_bin NOT NULL default ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

INSERT INTO `t1` VALUES ('trans1'),('trans2');

CREATE TABLE `t2` (
  `trans_id` varchar(48) character set latin1 collate latin1_bin NOT NULL default '',
  `error_comment` blob NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

INSERT INTO `t2` VALUES ('trans1','a problem');

Now try running the following query from a client:

select
        count(distinct(t1.trans_id)),
        left(error_comment,256) as error_comment
from
        t1 left join
        t2 using (trans_id)
group by error_comment;
[15 Jun 2005 8:25] Vasily Kishkin
Server is really crashed. Thanks for the bug report.
Tested on Win 2000 Sp4, MySQL server 4.1.13
[21 Jun 2005 15:16] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/internals/26252
[21 Jun 2005 15:48] Igor Babaev
The bug was due to the not completely valid patch for the bug #11088 that did not take into account possible null values the grouping blob column.

ChangeSet
  1.2303 05/06/21 04:24:21 igor@rurik.mysql.com +3 -0
  group_by.result, group_by.test:
    Added a test case for bug #11295.
  item_buff.cc:
    Fixed bug #11295.
    This a correction for the patch of bug #11088 that takes into
    account a possible NULL values of the BLOB column.

The fix will appear in 4.1.13 and 5.0.8.
[23 Jun 2005 18:13] Mike Hillyer
Documented in 4.1.13 and 5.0.8 changelogs.