summaryrefslogtreecommitdiff
path: root/sql/sql_select.cc
diff options
context:
space:
mode:
authorunknown <gluh@gluh.mysql.r18.ru>2004-08-23 20:17:14 +0400
committerunknown <gluh@gluh.mysql.r18.ru>2004-08-23 20:17:14 +0400
commitd88fc9744dd068d3a3573f5f0cad35fecd056016 (patch)
treea9c256c6840c53b62bd58731b44e7d73655b7689 /sql/sql_select.cc
parent01b9de60ef4ee39bcdfb04b8780dee61f155b6b2 (diff)
downloadmariadb-git-d88fc9744dd068d3a3573f5f0cad35fecd056016.tar.gz
Fix for bug #5134: WHERE x = 'bar' AND x LIKE BINARY 'bar' returns wrong results(for 4.1 tree)
mysql-test/r/binary.result: Fix for bug #5134: WHERE x = 'bar' AND x LIKE BINARY 'bar' returns wrong results mysql-test/t/binary.test: Fix for bug #5134: WHERE x = 'bar' AND x LIKE BINARY 'bar' returns wrong results sql/sql_select.cc: Fix for bug #5134: WHERE x = 'bar' AND x LIKE BINARY 'bar' returns wrong results
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r--sql/sql_select.cc10
1 files changed, 8 insertions, 2 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 70fec408753..ca17f246929 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -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)