diff options
author | Sergei Petrunia <psergey@askmonty.org> | 2021-04-13 20:32:16 +0300 |
---|---|---|
committer | Sergei Petrunia <psergey@askmonty.org> | 2021-04-16 17:15:22 +0300 |
commit | ab5dc625458c2fd63489292117d4420610a79a9d (patch) | |
tree | 379d6e689769c77c3a979fdfdf20a58a79329f08 /sql | |
parent | a3871cd2832dec43ca4ad6592646f58a7acf6630 (diff) | |
download | mariadb-git-ab5dc625458c2fd63489292117d4420610a79a9d.tar.gz |
MDEV-25407: EXISTS subquery with correlation in ON expression crashesbb-10.2-mdev25407
Make Item_subselect::walk() walk the ON expressions, too.
Diffstat (limited to 'sql')
-rw-r--r-- | sql/item_subselect.cc | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc index 4b8f118ca43..ed8e5e900a2 100644 --- a/sql/item_subselect.cc +++ b/sql/item_subselect.cc @@ -664,6 +664,31 @@ bool Item_subselect::is_expensive() } +static +int walk_items_for_table_list(Item_processor processor, + bool walk_subquery, void *argument, + List<TABLE_LIST>& join_list) +{ + List_iterator<TABLE_LIST> li(join_list); + int res; + while (TABLE_LIST *table= li++) + { + if (table->on_expr) + { + if ((res= table->on_expr->walk(processor, walk_subquery, argument))) + return res; + } + if (table->nested_join) + { + if ((res= walk_items_for_table_list(processor, walk_subquery, argument, + table->nested_join->join_list))) + return res; + } + } + return 0; +} + + bool Item_subselect::walk(Item_processor processor, bool walk_subquery, void *argument) { @@ -695,7 +720,10 @@ bool Item_subselect::walk(Item_processor processor, bool walk_subquery, if (lex->having && (lex->having)->walk(processor, walk_subquery, argument)) return 1; - /* TODO: why does this walk WHERE/HAVING but not ON expressions of outer joins? */ + + if (walk_items_for_table_list(processor, walk_subquery, argument, + *lex->join_list)) + return 1; while ((item=li++)) { |