diff options
author | unknown <sanja@askmonty.org> | 2010-07-30 07:16:58 +0300 |
---|---|---|
committer | unknown <sanja@askmonty.org> | 2010-07-30 07:16:58 +0300 |
commit | 02c040dd5c26cbc97ae30776638463c36d96a938 (patch) | |
tree | 4040d337486a7cfe035923277374ce41b03f8601 /sql/sql_expression_cache.cc | |
parent | 76e2be8e81f88889176fbe6f1983ccc8644ac7f2 (diff) | |
download | mariadb-git-02c040dd5c26cbc97ae30776638463c36d96a938.tar.gz |
Fix for luanchpad bug#609043
Removed indirect reference in equalities for cache index lookup.
We should use a direct reference because some optimization of the
query may optimize out a condition predicate and if the outer reference
is the only element of the condition predicate the indirect reference
becomes NULL.
We can resolve correctly the indirect reference in
Expression_cache_tmptable::make_equalities because it is called before
optimization of the cached subquery.
mysql-test/r/subquery_cache.result:
The test suite for the bug added.
mysql-test/t/subquery_cache.test:
The test suite for the bug added.
sql/sql_expression_cache.cc:
Removed indirect reference in equalities for cache index lookup.
Diffstat (limited to 'sql/sql_expression_cache.cc')
-rw-r--r-- | sql/sql_expression_cache.cc | 10 |
1 files changed, 1 insertions, 9 deletions
diff --git a/sql/sql_expression_cache.cc b/sql/sql_expression_cache.cc index 70c36b141b6..924abb24480 100644 --- a/sql/sql_expression_cache.cc +++ b/sql/sql_expression_cache.cc @@ -41,7 +41,6 @@ bool Expression_cache_tmptable::make_equalities() List<Item> args; List_iterator_fast<Item*> li(*list); Item **ref; - Name_resolution_context *cn= NULL; DBUG_ENTER("Expression_cache_tmptable::make_equalities"); for (uint i= 1 /* skip result filed */; (ref= li++); i++) @@ -58,14 +57,7 @@ bool Expression_cache_tmptable::make_equalities() fld->type() == MYSQL_TYPE_NEWDECIMAL || fld->type() == MYSQL_TYPE_DECIMAL) { - if (!cn) - { - // dummy resolution context - cn= new Name_resolution_context(); - cn->init(); - } - args.push_front(new Item_func_eq(new Item_ref(cn, ref, "", "", FALSE), - new Item_field(fld))); + args.push_front(new Item_func_eq(*ref, new Item_field(fld))); } } if (args.elements == 1) |