Bug #28036 Server crash when subselect on a union ordering on a field that does not exist.
Submitted: 23 Apr 2007 19:16 Modified: 23 Apr 2007 20:53
Reporter: Peter Edwards Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: General Severity:S3 (Non-critical)
Version:5.0.27, 5.0.33, 5.0.37, 5.2.3-falcon-alpha-community-nt OS:Any
Assigned to: CPU Architecture:Any
Tags: crash, order, subselect, UNION

[23 Apr 2007 19:16] Peter Edwards
Description:
This query:

select * from ( 
(select 'A') 
union 
(select 'A') 
order by fieldthatdoesnotexist) as temp; 

crashes MySQL server versions: 5.0.27, 5.0.33, 5.0.37

on Windows and Linux.

Thanks,
Peter (Stig) Edwards

How to repeat:
Run this query:

select * from ( 
(select 'A') 
union 
(select 'A') 
order by fieldthatdoesnotexist) as temp; 

Suggested fix:
No suggested fix to stop the crash, but if you don't try and order by a field that does not exist then you don't get the crash.
[23 Apr 2007 20:20] Sveta Smirnova
Thank you for your bug report. This issue has been committed to our source repository of that product and will be incorporated into the next release.

If necessary, you can access the source repository and build the latest available version, including the bug fix. More information about accessing the source trees is available at

    http://dev.mysql.com/doc/en/installing-source.html
[23 Apr 2007 20:53] Peter Edwards
Just thought I'd point out this also crashes 5.2.3-falcon-alpha-community-nt:

(I'm under the impression that this windows binary is built from the same source as the Unix/Linux source TAR)

Server version: 5.2.3-falcon-alpha-community-nt MySQL Community Server (GPL)

mysql> select * from (
    -> (select 'A')
    -> union
    -> (select 'A')
    -> order by fieldthatdoesnotexist) as temp;
ERROR 2013 (HY000): Lost connection to MySQL server during query

When you say "this issue has been committed to our source
repository" do you mean a fix for the issue or a note that the issue
exists?  Just curious.  Many thanks, Peter (Stig) Edwards.
[23 Apr 2007 21:19] MySQL Verification Team
That means that the fix was commited in the source tree and you can
build the fixed binary from source or wait for the next release.