summaryrefslogtreecommitdiff
path: root/sql/item_subselect.h
diff options
context:
space:
mode:
authorunknown <timour@askmonty.org>2012-09-14 11:26:01 +0300
committerunknown <timour@askmonty.org>2012-09-14 11:26:01 +0300
commitb917fb63a638fd117e1e52d3bc29b57a81124fea (patch)
tree86d017a6bd2b296ec536fe4447efb344488715ac /sql/item_subselect.h
parentcaea98a4173ed512522ea06f154ac37bf6b1552b (diff)
downloadmariadb-git-b917fb63a638fd117e1e52d3bc29b57a81124fea.tar.gz
Fix bug lp:1009187, mdev-373, mysql bug#58628
Analysis: The queries in question use the [unique | index]_subquery execution methods. These methods reuse the ref keys constructed by create_ref_for_key(). The way create_ref_for_key() works is that it doesn't store in ref.key_copy[] store_key elements that represent constants. In particular it doesn't store the store_key for NULL constants. The execution of [unique | index]_subquery calls subselect_uniquesubquery_engine::copy_ref_key, which in addition to copy the left IN argument into a index lookup key, is supposed to detect if the left IN argument contains NULLs. Since the store_key for the NULL constant is not copied into the key array, the null is not detected, and execution erroneously proceeds as if it should look for a complete match. Solution: The solution (unlike MySQL) is to reuse already computed information about NULL presence. Item_in_optimizer::val_int already finds out if the left IN operand contains NULLs. The fix propagates this to the execution methods subselect_[unique | index]subquery_engine::exec so it knows if there were NULL values independent of the presence of keys. In addition the patch siplifies copy_ref_key() and the logic that hanldes the case of NULLs in the left IN operand.
Diffstat (limited to 'sql/item_subselect.h')
-rw-r--r--sql/item_subselect.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/sql/item_subselect.h b/sql/item_subselect.h
index 7eb45e74f40..b6b9750b910 100644
--- a/sql/item_subselect.h
+++ b/sql/item_subselect.h
@@ -334,6 +334,7 @@ public:
bool test_limit(st_select_lex_unit *unit);
virtual void print(String *str, enum_query_type query_type);
bool fix_fields(THD *thd, Item **ref);
+ inline bool left_expr_has_null();
friend class Item_ref_null_helper;
friend class Item_is_not_null_test;
@@ -513,7 +514,6 @@ protected:
expression is NULL.
*/
bool empty_result_set;
- bool null_keypart; /* TRUE <=> constructed search tuple has a NULL */
public:
// constructor can assign THD because it will be called after JOIN::prepare