diff options
author | igor@olga.mysql.com <> | 2008-01-26 21:45:35 -0800 |
---|---|---|
committer | igor@olga.mysql.com <> | 2008-01-26 21:45:35 -0800 |
commit | 5e14047e233e62bca79511e3d69ece6ccaa946a3 (patch) | |
tree | 94c5ece68aa9b869b84b682bfdbe69161ed61ddc /mysql-test/t/range.test | |
parent | 6619db580d6b8f4dadd831062be04131e92d8d89 (diff) | |
download | mariadb-git-5e14047e233e62bca79511e3d69ece6ccaa946a3.tar.gz |
Fixed bug #33833.
Two disjuncts containing equalities of the form key=const1 and key=const2 can
be merged into one if const1 is equal to const2. To check it the common
collation of the constants were used rather than the collation of the field key.
For example when the default collation of the constants was cases insensitive
while the collation of the field was case sensitive, then two or-ed equality
predicates key='b' and key='B' incorrectly were merged into one f='b'. As a
result ref access was used instead of range access and wrong result sets were
returned in many cases.
Fixed the problem by comparing constant in the or-ed predicate with collation of
the key field.
Diffstat (limited to 'mysql-test/t/range.test')
-rw-r--r-- | mysql-test/t/range.test | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/mysql-test/t/range.test b/mysql-test/t/range.test index 87ba3510326..1352b366508 100644 --- a/mysql-test/t/range.test +++ b/mysql-test/t/range.test @@ -955,4 +955,21 @@ explain select * from t1 where dateval >= '2007-01-01 00:00:00' and dateval <= ' drop table t1; +# +# Bug #33833: different or-ed predicates were erroneously merged into one that +# resulted in ref access instead of range access and a wrong result set +# + +CREATE TABLE t1 ( + a varchar(32), index (a) +) DEFAULT CHARSET=latin1 COLLATE=latin1_bin; + +INSERT INTO t1 VALUES + ('B'), ('A'), ('A'), ('C'), ('B'), ('A'), ('A'); + +SELECT a FROM t1 WHERE a='b' OR a='B'; +EXPLAIN SELECT a FROM t1 WHERE a='b' OR a='B'; + +DROP TABLE t1; + # End of 5.0 tests |