summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <timour@askmonty.org>2011-11-01 18:19:19 +0200
committerunknown <timour@askmonty.org>2011-11-01 18:19:19 +0200
commit64986873252e6c4fff867407d1b2f92abe24ca88 (patch)
tree911bb592a61ae2d80182cd8345268f18dfeaee19 /sql
parent9c5644e6b764667e165fb895c6b9c90601cba06e (diff)
downloadmariadb-git-64986873252e6c4fff867407d1b2f92abe24ca88.tar.gz
Fix bug lp:833702
Analysis: Equality propagation propagated the constant '7' into args[0] of the Item_in_optimizer that stands for the "< ANY" predicate. At the same the min/max subquery rewrite swapped the order of the left and right operands of the "<" predicate, but used Item_in_subselect::left_expr. As a result, when the <ANY predicate is executed early in the execution phase as a contant condition, instead of a constant right (swapped) argument of the < predicate, there was a field (t3.a). This field had no data, since the whole predicate is considered constant, and it is evaluated before any tables are read. Having junk in the field row buffer produced wrong result Solution: Fix create_swap to pick the correct Item_in_optimizer left argument.
Diffstat (limited to 'sql')
-rw-r--r--sql/item_subselect.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc
index 22c62f0a6d7..f390c7ae1be 100644
--- a/sql/item_subselect.cc
+++ b/sql/item_subselect.cc
@@ -1698,7 +1698,7 @@ bool Item_allany_subselect::transform_into_max_min(JOIN *join)
The swap is needed for expressions of type 'f1 < ALL ( SELECT ....)'
where we want to evaluate the sub query even if f1 would be null.
*/
- subs= func->create_swap(left_expr, subs);
+ subs= func->create_swap(*(optimizer->get_cache()), subs);
thd->change_item_tree(place, subs);
if (subs->fix_fields(thd, &subs))
DBUG_RETURN(true);