From 2ef4c97e9daed004ae4d60ea6e71b31b1f230ad1 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 10 Nov 2004 11:22:39 -0800 Subject: 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. sql/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. mysql-test/t/select.test: Added test cases for bug #6474. mysql-test/r/select.result: Added test cases for bug #6474. --- sql/sql_select.cc | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'sql/sql_select.cc') diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 85feea3d51a..686316d80a6 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -6639,10 +6639,7 @@ static Item *eliminate_item_equal(COND *cond, COND_EQUAL *upper_levels, List 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 -- cgit v1.2.1