1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-27 18:02:13 +03:00

Bug #44290: explain crashes for subquery with distinct in

SQL_SELECT::test_quick_select

The crash was caused by an incomplete cleanup of JOIN_TAB::select
during the filesort of rows for GROUP BY clause inside a subquery.
Queries where a quick index access is replaced with filesort was
was affected. For example:

  SELECT 1 FROM
    (SELECT COUNT(DISTINCT c1) FROM t1
       WHERE c2 IN (1, 1) AND c3 = 2 GROUP BY c2) x

Quick index access related data in the SQL_SELECT::test_quick_select
function was inconsistent after an incomplete cleanup.
This function has been completed to prevent crashes in the
SQL_SELECT::test_quick_select function.
This commit is contained in:
Gleb Shchepa
2009-05-13 12:51:39 +05:00
parent 230f3f5208
commit fbb96b339a
3 changed files with 39 additions and 0 deletions

View File

@ -13471,6 +13471,7 @@ create_sort_index(THD *thd, JOIN *join, ORDER *order,
{
select->cleanup(); // filesort did select
tab->select= 0;
table->quick_keys.clear_all(); // as far as we cleanup select->quick
}
tab->select_cond=0;
tab->last_inner= 0;