diff options
author | unknown <ramil/ram@mysql.com/myoffice.izhnet.ru> | 2006-10-19 12:52:37 +0500 |
---|---|---|
committer | unknown <ramil/ram@mysql.com/myoffice.izhnet.ru> | 2006-10-19 12:52:37 +0500 |
commit | da7af481cda9d0fb836f010d421ce00830b69f56 (patch) | |
tree | 46f10dec22a47aca4f01060db36cdfc4d2465f82 /mysql-test | |
parent | 9a506df0c2f831ed91a6ca4dea9f44982f28f2f7 (diff) | |
download | mariadb-git-da7af481cda9d0fb836f010d421ce00830b69f56.tar.gz |
Fix for bug #20732: Partial index and long sjis search with '>' fails sometimes
We miss some records sometimes using RANGE method if we have
partial key segments.
Example:
Create table t1(a char(2), key(a(1)));
insert into t1 values ('a'), ('xx');
select a from t1 where a > 'x';
We call index_read() passing 'x' key and HA_READ_AFTER_KEY flag
in the handler::read_range_first() wich is wrong because we have
a partial key segment for the field and might miss records like 'xx'.
Fix: don't use open segments in such a case.
mysql-test/r/range.result:
Fix for bug #20732: Partial index and long sjis search with '>' fails sometimes
- test result.
mysql-test/t/range.test:
Fix for bug #20732: Partial index and long sjis search with '>' fails sometimes
- test case.
sql/opt_range.cc:
Fix for bug #20732: Partial index and long sjis search with '>' fails sometimes
- check if we have a partial key segment for a Item_func::GT_FUNC;
if so, don't set NEAR_MIN flag in order to use HA_READ_KEY_OR_NEXT
instead of HA_READ_AFTER_KEY.
sql/opt_range.h:
Fix for bug #20732: Partial index and long sjis search with '>' fails sometimes
- key segment 'flag' slot added.
sql/sql_select.cc:
Fix for bug #20732: Partial index and long sjis search with '>' fails sometimes
- test (HA_PART_KEY_SEG | HA_NULL_PART) as we split it in the sql/table.cc
sql/table.cc:
Fix for bug #20732: Partial index and long sjis search with '>' fails sometimes
- set HA_NULL_PART flag instead of HA_PART_KEY_SEG in order not to mix them.
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/r/range.result | 10 | ||||
-rw-r--r-- | mysql-test/t/range.test | 12 |
2 files changed, 21 insertions, 1 deletions
diff --git a/mysql-test/r/range.result b/mysql-test/r/range.result index b436519d967..f25d94f8066 100644 --- a/mysql-test/r/range.result +++ b/mysql-test/r/range.result @@ -649,3 +649,13 @@ OR ((pk4 =1) AND (((pk1 IN ( 7, 2, 1 ))) OR (pk1 =522)) AND ((pk2 IN ( 0, 2635)) pk1 pk2 pk3 pk4 filler 2621 2635 1000015 0 filler drop table t1, t2; +create table t1(a char(2), key(a(1))); +insert into t1 values ('x'), ('xx'); +explain select a from t1 where a > 'x'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range a a 2 NULL 2 Using where +select a from t1 where a > 'x'; +a +xx +drop table t1; +End of 4.1 tests diff --git a/mysql-test/t/range.test b/mysql-test/t/range.test index 9280911df2c..245178d7d4a 100644 --- a/mysql-test/t/range.test +++ b/mysql-test/t/range.test @@ -510,4 +510,14 @@ OR ((pk4 =1) AND (((pk1 IN ( 7, 2, 1 ))) OR (pk1 =522)) AND ((pk2 IN ( 0, 2635)) ) AND (pk3 >=1000000); drop table t1, t2; -# End of 4.1 tests +# +# Bug #20732: Partial index and long sjis search with '>' fails sometimes +# + +create table t1(a char(2), key(a(1))); +insert into t1 values ('x'), ('xx'); +explain select a from t1 where a > 'x'; +select a from t1 where a > 'x'; +drop table t1; + +--echo End of 4.1 tests |