summaryrefslogtreecommitdiff
path: root/sql/item_subselect.cc
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2015-12-09 10:00:49 +0100
committerSergei Golubchik <serg@mariadb.org>2015-12-09 10:00:49 +0100
commitabf9d35213ba482a3927651ddb98baa47aeb34fd (patch)
tree567bee47df18c21d5fbc09bbb4fee4e8f26df4d9 /sql/item_subselect.cc
parent50a796dcba2abe5f25c1e4cd8a69d7ea43343a8d (diff)
parent40ae1b9b618fbbc3b494a896a9d074b74e414337 (diff)
downloadmariadb-git-abf9d35213ba482a3927651ddb98baa47aeb34fd.tar.gz
Merge branch 'mysql/5.5' into 5.5
Diffstat (limited to 'sql/item_subselect.cc')
-rw-r--r--sql/item_subselect.cc28
1 files changed, 26 insertions, 2 deletions
diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc
index 1107945ae99..3020faf29d3 100644
--- a/sql/item_subselect.cc
+++ b/sql/item_subselect.cc
@@ -1,5 +1,5 @@
-/* Copyright (c) 2002, 2012, Oracle and/or its affiliates.
- Copyright (c) 2010, 2012, Monty Program Ab
+/* Copyright (c) 2002, 2015, Oracle and/or its affiliates.
+ Copyright (c) 2010, 2015, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -1748,6 +1748,27 @@ Item_in_subselect::single_value_transformer(JOIN *join)
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.
+
+ @todo
+ Why do we use real_item()/substitutional_item() instead of the plain
+ left_expr?
+ Because left_expr might be a rollbackable item, and we fail to properly
+ rollback all copies of left_expr at end of execution, so we want to
+ avoid creating copies of left_expr as much as possible, so we use
+ real_item() instead.
+ Doing a proper rollback is difficult: the change was registered for the
+ original item which was the left argument of IN. Then this item was
+ copied to left_expr, which is copied below to substitution->args[0]. To
+ do a proper rollback, we would have to restore the content
+ of both copies as well as the original item. There might be more copies,
+ if AND items have been constructed.
+ The same applies to the right expression.
+ However, using real_item()/substitutional_item() brings its own
+ problems: for example, we lose information that the item is an outer
+ reference; the item can thus wrongly be considered for a Keyuse (causing
+ bug#17766653).
+ When WL#6570 removes the "rolling back" system, all
+ real_item()/substitutional_item() in this file should be removed.
*/
substitution= func->create(left_expr, where_item);
have_to_be_excluded= 1;
@@ -2034,6 +2055,9 @@ Item_in_subselect::create_single_in_to_exists_cond(JOIN *join,
}
else
{
+ /*
+ Grep for "WL#6570" to see the relevant comment about real_item.
+ */
Item *item= (Item*) select_lex->item_list.head()->real_item();
if (select_lex->table_list.elements)