diff -ur mysql-5.1.48.stock/sql/item_cmpfunc.cc mysql-5.1.48-bigint/sql/item_cmpfunc.cc --- mysql-5.1.48.stock/sql/item_cmpfunc.cc 2010-06-03 23:50:02.000000000 +0800 +++ mysql-5.1.48-bigint/sql/item_cmpfunc.cc 2011-11-29 18:52:51.000000000 +0800 @@ -506,7 +506,8 @@ !(field_item->is_datetime() && args[1]->result_type() == STRING_RESULT)) { - if (convert_constant_item(thd, field_item, &args[1])) + if ( (!(field_item->field->type() == MYSQL_TYPE_LONGLONG && args[1]->real_item()->type() == DECIMAL_ITEM)) + && convert_constant_item(thd, field_item, &args[1])) { cmp.set_cmp_func(this, tmp_arg, tmp_arg+1, INT_RESULT); // Works for all types. @@ -522,7 +523,8 @@ !(field_item->is_datetime() && args[0]->result_type() == STRING_RESULT)) { - if (convert_constant_item(thd, field_item, &args[0])) + if ( (!(field_item->field->type() == MYSQL_TYPE_LONGLONG && args[0]->real_item()->type() == DECIMAL_ITEM)) + && convert_constant_item(thd, field_item, &args[0])) { cmp.set_cmp_func(this, tmp_arg, tmp_arg+1, INT_RESULT); // Works for all types.