summaryrefslogtreecommitdiff
path: root/sql/opt_subselect.cc
diff options
context:
space:
mode:
authorOleksandr Byelkin <sanja@mariadb.com>2015-04-23 20:08:57 +0200
committerOleksandr Byelkin <sanja@mariadb.com>2015-10-06 13:12:58 +0200
commit54b998173b128bb8362b5dbafbd66c4199776937 (patch)
tree60ab4e9cd8a19d3b04ff0ef336794028bb857ab9 /sql/opt_subselect.cc
parent0ab93fd6f3050cabac5fbb503173c95bb7073cfc (diff)
downloadmariadb-git-54b998173b128bb8362b5dbafbd66c4199776937.tar.gz
MDEV-7846: Server crashes in Item_subselect::fix_fields or fails with Thread stack overrun
Substitute into transformed subselects original left expression and than register its change in case it was substituted.
Diffstat (limited to 'sql/opt_subselect.cc')
-rw-r--r--sql/opt_subselect.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/sql/opt_subselect.cc b/sql/opt_subselect.cc
index 5b1a7f2f22a..1363be002b9 100644
--- a/sql/opt_subselect.cc
+++ b/sql/opt_subselect.cc
@@ -1593,7 +1593,9 @@ static bool convert_subq_to_sj(JOIN *parent_join, Item_in_subselect *subq_pred)
{
nested_join->sj_outer_expr_list.push_back(subq_pred->left_expr);
Item_func_eq *item_eq=
- new Item_func_eq(subq_pred->left_expr, subq_lex->ref_pointer_array[0]);
+ new Item_func_eq(subq_pred->left_expr_orig, subq_lex->ref_pointer_array[0]);
+ if (subq_pred->left_expr_orig != subq_pred->left_expr)
+ thd->change_item_tree(item_eq->arguments(), subq_pred->left_expr);
item_eq->in_equality_no= 0;
sj_nest->sj_on_expr= and_items(sj_nest->sj_on_expr, item_eq);
}