Skip to content

Commit df20d6e

Browse files
committed
test: cover short NOT IN prefix index range
1 parent 8131014 commit df20d6e

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

pkg/util/ranger/ranger_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1046,6 +1046,11 @@ func TestPrefixIndexRangeScan(t *testing.T) {
10461046
testKit.MustQuery("select * from t use index (idx_a) where a > 'aa'").Check(testkit.Rows("aaa bbb"))
10471047
testKit.MustQuery("select * from t use index (idx_ab) where a = 'aaa' and b > 'bb' and b < 'cc'").Check(testkit.Rows("aaa bbb"))
10481048
testKit.MustQuery("select * from t use index (idx_a) where a > 'a' order by a").Check(testkit.Rows("aa bb", "aaa bbb"))
1049+
testKit.MustExec("insert into t values ('bb', 'x'), ('bba', 'y'), ('bbb', 'z')")
1050+
// The lower side after a short NOT IN value must include the boundary prefix.
1051+
// Otherwise PrefixNext("bb") can skip values such as "bba" and "bbb".
1052+
testKit.MustQuery("select a, b from t use index (idx_a) where a not in ('bb') order by a").Check(
1053+
testkit.Rows("aa bb", "aaa bbb", "bba y", "bbb z"))
10491054

10501055
testKit.MustExec("drop table if exists issue68152")
10511056
testKit.MustExec("create table issue68152(c0 text not null, c1 double not null, c2 char(1) not null default 'x', primary key (c2, c1, c0(128)), index prefix_idx(c0(1))) engine=InnoDB default charset=utf8mb4 collate=utf8mb4_bin")

0 commit comments

Comments
 (0)