1
0
mirror of https://github.com/MariaDB/server.git synced 2026-01-06 05:22:24 +03:00

MDEV-435: Expensive subqueries may be evaluated during optimization in merge_key_fields

Fix by Sergey Petrunia.

This patch only prevents the evaluation of expensive subqueries during optimization.
The crash reported in this bug has been fixed by some other patch.
The fix is to call value->is_null() only when  !value->is_expensive(), because is_null()
may trigger evaluation of the Item, which in turn triggers subquery evaluation if the
Item is a subquery.
This commit is contained in:
unknown
2012-10-12 16:44:54 +03:00
parent fc941f8a21
commit e47cdfdfb6
7 changed files with 133 additions and 3 deletions

View File

@@ -3876,8 +3876,10 @@ merge_key_fields(KEY_FIELD *start,KEY_FIELD *new_fields,KEY_FIELD *end,
new_fields->null_rejecting);
}
else if (old->eq_func && new_fields->eq_func &&
((old->val->const_item() && old->val->is_null()) ||
new_fields->val->is_null()))
((old->val->const_item() && !old->val->is_expensive() &&
old->val->is_null()) ||
(!new_fields->val->is_expensive() &&
new_fields->val->is_null())))
{
/* field = expression OR field IS NULL */
old->level= and_level;
@@ -3891,7 +3893,8 @@ merge_key_fields(KEY_FIELD *start,KEY_FIELD *new_fields,KEY_FIELD *end,
Remember the NOT NULL value unless the value does not depend
on other tables.
*/
if (!old->val->used_tables() && old->val->is_null())
if (!old->val->used_tables() && !old->val->is_expensive() &&
old->val->is_null())
old->val= new_fields->val;
}
else