1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

Fix for bug #5134: WHERE x = 'bar' AND x LIKE BINARY 'bar' returns wrong results(for 4.1 tree)

This commit is contained in:
gluh@gluh.mysql.r18.ru
2004-08-23 20:17:14 +04:00
parent 0983295859
commit 7b17daf21e
3 changed files with 39 additions and 2 deletions

View File

@ -4186,7 +4186,10 @@ change_cond_ref_to_const(I_List<COND_CMP> *save_list,Item *and_father,
Item *right_item= func->arguments()[1];
Item_func::Functype functype= func->functype();
if (right_item->eq(field,0) && left_item != value)
if (right_item->eq(field,0) && left_item != value &&
(left_item->result_type() != STRING_RESULT ||
value->result_type() != STRING_RESULT ||
left_item->collation.collation == value->collation.collation))
{
Item *tmp=value->new_item();
if (tmp)
@ -4204,7 +4207,10 @@ change_cond_ref_to_const(I_List<COND_CMP> *save_list,Item *and_father,
func->set_cmp_func();
}
}
else if (left_item->eq(field,0) && right_item != value)
else if (left_item->eq(field,0) && right_item != value &&
(right_item->result_type() != STRING_RESULT ||
value->result_type() != STRING_RESULT ||
right_item->collation.collation == value->collation.collation))
{
Item *tmp=value->new_item();
if (tmp)