1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +03:00

MDEV-16726 Assertion `tab->type == JT_REF || tab->type == JT_EQ_REF' failed

Due to a legacy bug in the code of make_join_statistics() detecting
so-called constant tables could miss some of them in rare queries
that used RIGHT JOIN. As a result these queries had execution plans
different from the execution plans of the equivalent queries with
LEFT JOIN.
Besides starting from 10.2 this could trigger an assertion failure.
This commit is contained in:
Igor Babaev
2018-07-19 15:31:30 -07:00
parent 8c45eb3ea5
commit 9cea4ccf12
5 changed files with 151 additions and 3 deletions

View File

@ -3456,8 +3456,8 @@ make_join_statistics(JOIN *join, List<TABLE_LIST> &tables_list,
int ref_changed;
do
{
more_const_tables_found:
ref_changed = 0;
more_const_tables_found:
found_ref=0;
/*
@ -3622,7 +3622,7 @@ make_join_statistics(JOIN *join, List<TABLE_LIST> &tables_list,
}
}
}
} while (join->const_table_map & found_ref && ref_changed);
} while (ref_changed);
join->sort_by_table= get_sort_by_table(join->order, join->group_list,
join->select_lex->leaf_tables,