Bug #32557 order by updatexml causes assertion in filesort
Submitted: 21 Nov 2007 6:24 Modified: 28 Nov 2007 11:16
Reporter: Shane Bester (Platinum Quality Contributor) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: XML functions Severity:S1 (Critical)
Version:5.1 bk OS:Any
Assigned to: Ramil Kalimullin CPU Architecture:Any
Tags: assertion, updatexml

[21 Nov 2007 6:24] Shane Bester
Description:
This looks similar to bug #31160 and bug #31160 .  Those two testcases don't crash anymore, so I'm opening a new bug for this one.

Version: '5.1.23-rc-debug'  socket: ''  port: 3307  Source distribution
Assertion failed: 0, file .\filesort.cc, line 740

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.

mysqld.exe!_NMSG_WRITE
mysqld.exe!abort
mysqld.exe!_wassert
mysqld.exe!make_sortkey
mysqld.exe!find_all_keys
mysqld.exe!filesort
mysqld.exe!create_sort_index
mysqld.exe!JOIN::exec
mysqld.exe!mysql_select
mysqld.exe!handle_select
mysqld.exe!execute_sqlcom_select
mysqld.exe!mysql_execute_command
mysqld.exe!mysql_parse
mysqld.exe!dispatch_command
mysqld.exe!do_command
mysqld.exe!handle_one_connection
mysqld.exe!pthread_start
mysqld.exe!_callthreadstart
mysqld.exe!_threadstart

How to repeat:
#on debug build of mysqld run this:

drop table if exists `t1`;
create table `t1` (`a` int not null)engine=myisam;
insert ignore into `t1` values (0),(0);
select 1 from `t1` order by (updatexml(`a`,'1','1'));
[21 Nov 2007 12:00] 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/commits/38204

ChangeSet@1.2628, 2007-11-21 16:00:09+04:00, ramil@mysql.com +3 -0
  Fix for bug #32557: order by updatexml causes assertion in filesort
  
  Problem: even if an Item_xml_str_func successor returns NULL, it doesn't have 
  a corresponding property (maybe_null) set, that leads to a failed assertion.
  
  Fix: set nullability property of Item_xml_str_func.
[21 Nov 2007 12:09] Alexander Barkov
Ok to push.
[28 Nov 2007 10:23] Bugs System
Pushed into 6.0.4-alpha
[28 Nov 2007 10:25] Bugs System
Pushed into 5.1.23-rc
[28 Nov 2007 11:16] Jon Stephens
Documented bugfix in 5.1.23 and 6.0.4 changelogs as follows:

        ORDER BY UpdateXML(...) caused the server to
        crash in queries where UpdateXML() returned
        NULL.