summaryrefslogtreecommitdiff
path: root/sql/opt_range.cc
diff options
context:
space:
mode:
authorbar@mysql.com <>2004-11-03 15:22:33 +0400
committerbar@mysql.com <>2004-11-03 15:22:33 +0400
commit45451568bfabaaf42d5f55c05c57a716ceb42798 (patch)
treec5bf40ee83d4e86e49280ff78cf080946ca52bee /sql/opt_range.cc
parent4650f0acab425e08b5f3f7f7bee9612f81387b6e (diff)
downloadmariadb-git-45451568bfabaaf42d5f55c05c57a716ceb42798.tar.gz
opt_range.cc, range.result, range.test:
Bug #6045: Binary Comparison regression in MySQL 4.1 Binary searches didn't use a case insensitive index, now they do.
Diffstat (limited to 'sql/opt_range.cc')
-rw-r--r--sql/opt_range.cc15
1 files changed, 12 insertions, 3 deletions
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index 541acc69ec7..c9528af7d98 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -1013,13 +1013,22 @@ get_mm_leaf(PARAM *param, COND *conf_func, Field *field, KEY_PART *key_part,
}
/*
- We can't use an index when comparing strings of
- different collations
+ 1. Usually we can't use an index if the column collation
+ differ from the operation collation.
+
+ 2. However, we can reuse a case insensitive index for
+ the binary searches:
+
+ WHERE latin1_swedish_ci_column = 'a' COLLATE lati1_bin;
+
+ WHERE latin1_swedish_ci_colimn = BINARY 'a '
+
*/
if (field->result_type() == STRING_RESULT &&
value->result_type() == STRING_RESULT &&
key_part->image_type == Field::itRAW &&
- ((Field_str*)field)->charset() != conf_func->compare_collation())
+ ((Field_str*)field)->charset() != conf_func->compare_collation() &&
+ !(conf_func->compare_collation()->state & MY_CS_BINSORT))
DBUG_RETURN(0);
if (type == Item_func::LIKE_FUNC)