diff options
author | Sergey Glukhov <sergey.glukhov@oracle.com> | 2013-05-07 13:14:01 +0400 |
---|---|---|
committer | Sergey Glukhov <sergey.glukhov@oracle.com> | 2013-05-07 13:14:01 +0400 |
commit | 1414a0ed7f99b63aad5d5ad7026b6609121f5db1 (patch) | |
tree | 778a71bfcd8283d8b8e7387c804dec58607eae58 /sql/item_subselect.cc | |
parent | 627e7334ec8b9528a4e1f93916cefe7980eabdac (diff) | |
parent | a250331593873e1a737dd572ad91fdbde66718e7 (diff) | |
download | mariadb-git-1414a0ed7f99b63aad5d5ad7026b6609121f5db1.tar.gz |
5.1 -> 5.5 merge
Diffstat (limited to 'sql/item_subselect.cc')
-rw-r--r-- | sql/item_subselect.cc | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc index dd6257db30a..ecf1efeaa9d 100644 --- a/sql/item_subselect.cc +++ b/sql/item_subselect.cc @@ -1065,8 +1065,15 @@ Item_in_subselect::single_value_transformer(JOIN *join, if (upper_item) upper_item->set_sub_test(item); } - /* fix fields is already called for left expression */ - substitution= func->create(left_expr, subs); + /* + fix fields is already called for left expression. + Note that real_item() should be used instead of + original left expression because left_expr can be + runtime created Ref item which is deleted at the end + of the statement. Thus one of 'substitution' arguments + can be broken in case of PS. + */ + substitution= func->create(left_expr->real_item(), subs); DBUG_RETURN(RES_OK); } @@ -1261,8 +1268,16 @@ Item_in_subselect::single_value_transformer(JOIN *join, // select and is not outer anymore. item->walk(&Item::remove_dependence_processor, 0, (uchar *) select_lex->outer_select()); - item= func->create(left_expr, item); - // fix_field of item will be done in time of substituting + item= func->create(left_expr->real_item(), item); + /* + fix_field of substitution item will be done in time of + substituting. + Note that real_item() should be used instead of + original left expression because left_expr can be + runtime created Ref item which is deleted at the end + of the statement. Thus one of 'substitution' arguments + can be broken in case of PS. + */ substitution= item; have_to_be_excluded= 1; if (thd->lex->describe) |