diff options
author | Igor Babaev <igor@askmonty.org> | 2019-03-14 17:41:35 -0700 |
---|---|---|
committer | Igor Babaev <igor@askmonty.org> | 2019-03-14 17:41:35 -0700 |
commit | 0dd12b4f2a72245a0fb491685c172a7b0e48cbc5 (patch) | |
tree | 09809f3b930995e8001a8b8c32f8e0170a0e4716 /sql/opt_subselect.cc | |
parent | 8024f8c6b86b204c3475e562587640cf2b141683 (diff) | |
download | mariadb-git-0dd12b4f2a72245a0fb491685c172a7b0e48cbc5.tar.gz |
MDEV-18896 Crash in convert_join_subqueries_to_semijoins
If an IN-subquery is used in a table-less select the current code
should never consider it as candidate for semi-join optimizations.
Yet the function check_and_do_in_subquery_rewrites() improperly
checked the property "to be a table-less select". As a result
such select in IN subquery was used in INSERT .. SELECT then
the IN subquery by mistake was registered as a semi-join subquery
and convert_subq_to_sj() was called for it. However the code of
this function does not assume that the parent select of the subquery
could be a table-less select.
Diffstat (limited to 'sql/opt_subselect.cc')
-rw-r--r-- | sql/opt_subselect.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sql/opt_subselect.cc b/sql/opt_subselect.cc index f472cf16710..f82d55f8309 100644 --- a/sql/opt_subselect.cc +++ b/sql/opt_subselect.cc @@ -675,7 +675,7 @@ int check_and_do_in_subquery_rewrites(JOIN *join) select_lex->outer_select()->join && // 6 parent_unit->first_select()->leaf_tables.elements && // 7 !in_subs->has_strategy() && // 8 - select_lex->outer_select()->leaf_tables.elements && // 9 + select_lex->outer_select()->table_list.first && // 9 !((join->select_options | // 10 select_lex->outer_select()->join->select_options) // 10 & SELECT_STRAIGHT_JOIN)) // 10 |