Bug #29013 Signal 11, MySQL server 5.0.41 crashed: has to do with the (NULL)
Submitted: 11 Jun 2007 7:03 Modified: 11 Jun 2007 10:29
Reporter: alex peeters Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server Severity:S1 (Critical)
Version:5.0.41 OS:Any
Assigned to: CPU Architecture:Any
Tags: 5.0.41, crash, null, server, sygnal 11

[11 Jun 2007 7:03] alex peeters
Description:
Don' work:
----------
select host_name from nagios_hosts where category not in (select category_name from ncpl_categories where category_filetype='6')
order by category desc;

Works:
------
select host_name from nagios_hosts where category not in (select category_name from ncpl_categories where category_filetype='6') 
order by category asc;

select host_name from nagios_hosts 
where category is not null and category not in (select category_name from ncpl_categories where category_filetype='6');

Attention:
----------

When you change the order by catefory from desc to asc it works for:

insert into `nagios_hosts` (`server_name`,`category`,`host_name`) values ('SERVERNAME 1',NULL,'HOSTNAME 1');
insert into `nagios_hosts` (`server_name`,`category`,`host_name`) values ('SERVERNAME 2','CAT 2','HOSTNAME 2');

When you change the order by catefory from asc to dec it works for:
insert into `nagios_hosts` (`server_name`,`category`,`host_name`) values ('SERVERNAME 2','CAT 2','HOSTNAME 2');
insert into `nagios_hosts` (`server_name`,`category`,`host_name`) values ('SERVERNAME 1',NULL,'HOSTNAME 1');

This means that there is a difference depending 

How to repeat:
/*
SQLyog Pro - MySQL GUI v5.15
Host - 5.0.41-log : Database - yves
*********************************************************************
Server version : 5.0.41-log
*/

SET NAMES utf8;

SET SQL_MODE='';

create database if not exists `yves`;

USE `yves`;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO';

/*Table structure for table `nagios_hosts` */

DROP TABLE IF EXISTS `nagios_hosts`;

CREATE TABLE `nagios_hosts` (
  `server_name` varchar(255) NOT NULL default '',
  `category` varchar(64) default NULL,
  `host_name` varchar(64) NOT NULL default '',
  PRIMARY KEY  (`server_name`,`host_name`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

/*Data for the table `nagios_hosts` */

insert into `nagios_hosts` (`server_name`,`category`,`host_name`) values ('SERVERNAME 1',NULL,'HOSTNAME 1');
insert into `nagios_hosts` (`server_name`,`category`,`host_name`) values ('SERVERNAME 2','CAT 2','HOSTNAME 2');

/*Table structure for table `ncpl_categories` */

DROP TABLE IF EXISTS `ncpl_categories`;

CREATE TABLE `ncpl_categories` (
  `category_filetype` varchar(11) NOT NULL default '0',
  `category_name` varchar(64) NOT NULL default '',
  PRIMARY KEY  (`category_filetype`,`category_name`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

/*Data for the table `ncpl_categories` */

insert into `ncpl_categories` (`category_filetype`,`category_name`) values ('6','CAT 1');
insert into `ncpl_categories` (`category_filetype`,`category_name`) values ('6','CAT 2');

SET SQL_MODE=@OLD_SQL_MODE;

Works:
------
select host_name from nagios_hosts where category not in (select category_name from ncpl_categories where category_filetype='6') 
order by category asc;

select host_name from nagios_hosts 
where category is not null and category not in (select category_name from ncpl_categories where category_filetype='6');

Don' work:
----------
select host_name from nagios_hosts where category not in (select category_name from ncpl_categories where category_filetype='6')
order by category desc;
[11 Jun 2007 7:08] alex peeters
> This means that there is a difference depending ...

This means that there is a difference depending the order you insert the records into thae database!!!
[11 Jun 2007 10:29] Sveta Smirnova
Thank you for the report.

I can not repeat it using current development sources, although bug is repeatable with 5.0.41. Please wait next release.
[22 Jun 2007 15:58] MySQL Verification Team
was probably a duplicate of bug #28375