Bug #31040 Subqueries: query with two semi-join subqueries causes assertion failure
Submitted: 15 Sep 2007 15:39 Modified: 25 Feb 2008 18:11
Reporter: Sergey Petrunya Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:5.2-opt OS:Any
Assigned to: Igor Babaev CPU Architecture:Any
Tags: semi-join, subquery

[15 Sep 2007 15:39] Sergey Petrunya
Description:
A query with two subqueries will cause assertion failure if both of the subqueries are using semi-join strategy.

How to repeat:
1. Load the tables (will attach files)
2. Run this query:

SELECT Name 
FROM Country 
WHERE 
  Country.Code IN (SELECT City.Country FROM City WHERE Population > 5000000) AND
  Country.Code IN (SELECT Country FROM CountryLanguage 
                   WHERE Language='English' AND Percentage > 10 AND
                         Country.Population > 100000);
                         

3. See the server to crash because of assertion failure in Item_in_subselect::val_int().
[15 Sep 2007 21:19] 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/34318

ChangeSet@1.2600, 2007-09-15 14:26:53-07:00, igor@olga.mysql.com +3 -0
  Fixed bug #31040. This bug occurred for queries whose WHERE/ON conditions
  contained several predicates with IN subqueries that were flattened.
[15 Sep 2007 21:28] 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/34319

ChangeSet@1.2600, 2007-09-15 14:36:00-07:00, igor@olga.mysql.com +3 -0
  Fixed bug #31040. This bug occurred for queries whose WHERE/ON conditions
  contained several predicates with IN subqueries that were flattened.
[25 Feb 2008 18:11] Paul DuBois
Noted in 5.1.24, 6.0.5 changelogs.

An assertion failure occurred for queries containing two subqueries
if both subqueries were evaluated using a semi-join strategy.
[16 Apr 2008 12:51] Paul DuBois
Correction. Noted in 6.0.5 changelog only.