summaryrefslogtreecommitdiff
path: root/sql/opt_range.cc
diff options
context:
space:
mode:
authorunknown <bar@mysql.com>2004-11-03 15:22:33 +0400
committerunknown <bar@mysql.com>2004-11-03 15:22:33 +0400
commit0afed4c3eb914788528087405022878a2ef5bc95 (patch)
treec5bf40ee83d4e86e49280ff78cf080946ca52bee /sql/opt_range.cc
parent78c4faa297539c95c33c69d00dfb5e129c2afcca (diff)
downloadmariadb-git-0afed4c3eb914788528087405022878a2ef5bc95.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. mysql-test/t/range.test: Bug #6045: Binary Comparison regression in MySQL 4.1 Binary searches didn't use a case insensitive index, now they do. mysql-test/r/range.result: Bug #6045: Binary Comparison regression in MySQL 4.1 Binary searches didn't use a case insensitive index, now they do. sql/opt_range.cc: 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)