Bug #18167 Crash on Union Select
Submitted: 12 Mar 2006 13:50 Modified: 12 Mar 2006 23:05
Reporter: Scott Mankowitz Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S1 (Critical)
Version:4.1.10-nt-log OS:Windows (win 2000)
Assigned to: Hartmut Holzgraefe CPU Architecture:Any

[12 Mar 2006 13:50] Scott Mankowitz
Description:
When I try to run a particular union query, the mysql server shuts down, and must be restarted through windows control panel.

I have a table with two columns: Date and Tag. I want to get a summary list of rows on a week by week basis (GROUP BY WEEK(xxxx)), but I want to get a summary of all records as well as a summary of only those records where the tag is set.

How to repeat:
Create a simple table:

CREATE TABLE `unioncrash` (
  `arrival` datetime default '0000-00-00 00:00:00',
  `tag` int(10) unsigned default '0'
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

You don't need to put any data in it--MySQL will crash with or without if the following query is run:

SELECT date(arrival) as `Week`, 0 as AllPresent, count(*) as OnlyTagged
FROM `unioncrash` where tag=1
GROUP BY week(arrival)
UNION SELECT date(arrival) as `Week`, count(*) as AllPresent, 0 as OnlyTagged
FROM `unioncrash`
GROUP BY week(arrival)
[12 Mar 2006 23:05] Hartmut Holzgraefe
Thank you for your bug report. This issue has already been fixed
in the latest released version of that product, which you can download at 
http://www.mysql.com/downloads/

Additional info:

Could reproduce this in 4.1.10 on linux but not in any newer version.