mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
select.result, select.test:
Added test cases for bug #6474. sql_select.cc: Fixed bug #6474. A wrong result was returned when a query contained the same equality of the form field=const on different AND levels.
This commit is contained in:
@ -6639,10 +6639,7 @@ static Item *eliminate_item_equal(COND *cond, COND_EQUAL *upper_levels,
|
||||
List<Item> eq_list;
|
||||
Item_func_eq *eq_item= 0;
|
||||
if (((Item *) item_equal)->const_item() && !item_equal->val_int())
|
||||
{
|
||||
cond= new Item_int((char*) "FALSE",0,1);
|
||||
return cond;
|
||||
}
|
||||
return new Item_int((longlong) 0,1);
|
||||
Item *item_const= item_equal->get_const();
|
||||
Item_equal_iterator it(*item_equal);
|
||||
Item *head;
|
||||
@ -6685,9 +6682,14 @@ static Item *eliminate_item_equal(COND *cond, COND_EQUAL *upper_levels,
|
||||
}
|
||||
|
||||
if (!cond && !eq_list.head())
|
||||
{
|
||||
if (!eq_item)
|
||||
return new Item_int((longlong) 1,1);
|
||||
return eq_item;
|
||||
}
|
||||
|
||||
eq_list.push_back(eq_item);
|
||||
if (eq_item)
|
||||
eq_list.push_back(eq_item);
|
||||
if (!cond)
|
||||
cond= new Item_cond_and(eq_list);
|
||||
else
|
||||
|
Reference in New Issue
Block a user