summaryrefslogtreecommitdiff
path: root/mysql-test/r/func_str.result
diff options
context:
space:
mode:
authorunknown <evgen@moonbone.local>2006-05-28 22:01:38 +0400
committerunknown <evgen@moonbone.local>2006-05-28 22:01:38 +0400
commit43a94ac2055209be789c605fd6dcb31f82a5eed1 (patch)
tree92cb12e483eb1ba657db44d5d64e5cd5abb98d52 /mysql-test/r/func_str.result
parent5f67ab29a7d0654f2340c08c66d00cde8c45df8c (diff)
downloadmariadb-git-43a94ac2055209be789c605fd6dcb31f82a5eed1.tar.gz
Fixed bug#15351: Wrong collation used for comparison of md5() and sha()
argument can lead to a wrong result. md5() and sha() functions treat their arguments as case sensitive strings. But when they are compared their arguments were compared as a case insensitive strings which leads to two functions with different arguments and thus different results to being identical. This can lead to a wrong decision made in the range optimizer and thus lead to a wrong result set. Item_func_md5::fix_length_and_dec() and Item_func_sha::fix_length_and_dec() functions now set binary collation on their arguments. sql/item_strfunc.cc: Fixed bug#15351: Wrong collation used for comparison of md5() and sha() argument can lead to a wrong result. Item_func_md5::fix_length_and_dec() and Item_func_sha::fix_length_and_dec() functions now set binary collation on their arguments. mysql-test/r/func_str.result: Added test case for the bug#15351: Wrong collation used for comparison of md5() and sha() argument can lead to a wrong result. mysql-test/t/func_str.test: Added test case for the bug#15351: Wrong collation used for comparison of md5() and sha() argument can lead to a wrong result.
Diffstat (limited to 'mysql-test/r/func_str.result')
-rw-r--r--mysql-test/r/func_str.result15
1 files changed, 15 insertions, 0 deletions
diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result
index 0609624af18..24e6bb6f38a 100644
--- a/mysql-test/r/func_str.result
+++ b/mysql-test/r/func_str.result
@@ -1006,4 +1006,19 @@ NULL
select ifnull(load_file("lkjlkj"),"it's null");
ifnull(load_file("lkjlkj"),"it's null")
it's null
+create table t1 (f1 varchar(4), f2 varchar(64), unique key k1 (f1,f2));
+insert into t1 values ( 'test',md5('test')), ('test', sha('test'));
+select * from t1 where f1='test' and (f2= md5("test") or f2= md5("TEST"));
+f1 f2
+test 098f6bcd4621d373cade4e832627b4f6
+select * from t1 where f1='test' and (f2= md5("TEST") or f2= md5("test"));
+f1 f2
+test 098f6bcd4621d373cade4e832627b4f6
+select * from t1 where f1='test' and (f2= sha("test") or f2= sha("TEST"));
+f1 f2
+test a94a8fe5ccb19ba61c4c0873d391e987982fbbd3
+select * from t1 where f1='test' and (f2= sha("TEST") or f2= sha("test"));
+f1 f2
+test a94a8fe5ccb19ba61c4c0873d391e987982fbbd3
+drop table t1;
End of 4.1 tests