1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-27 18:02:13 +03:00

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.
This commit is contained in:
unknown
2010-07-30 07:16:58 +03:00
parent 76e2be8e81
commit 02c040dd5c
3 changed files with 209 additions and 9 deletions

View File

@ -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)