Commit bdd70d1c authored by ram@gw.mysql.r18.ru's avatar ram@gw.mysql.r18.ru

Added test case for the bug #3155: strange results with index (x, y) ... WHERE...

Added test case for the bug #3155: strange results with index (x, y) ... WHERE x=val_1 AND y>=val_2 ORDER BY pk;
(thankee Monty)
parent 757cff9f
...@@ -611,3 +611,35 @@ a b ...@@ -611,3 +611,35 @@ a b
5 2 5 2
6 2 6 2
drop table t1; drop table t1;
create table t1 (a int not null auto_increment, b int not null, c int not null, d int not null,
key(a,b,d), key(c,b,a));
create table t2 like t1;
insert into t1 values (NULL, 1, 2, 0), (NULL, 2, 1, 1), (NULL, 3, 4, 2), (NULL, 4, 3, 3);
insert into t2 select null, b, c, d from t1;
insert into t1 select null, b, c, d from t2;
insert into t2 select null, b, c, d from t1;
insert into t1 select null, b, c, d from t2;
insert into t2 select null, b, c, d from t1;
insert into t1 select null, b, c, d from t2;
insert into t2 select null, b, c, d from t1;
insert into t1 select null, b, c, d from t2;
insert into t2 select null, b, c, d from t1;
insert into t1 select null, b, c, d from t2;
optimize table t1;
Table Op Msg_type Msg_text
test.t1 optimize status OK
set @row=10;
insert into t1 select 1, b, c + (@row:=@row - 1) * 10, d - @row from t2 limit 10;
select * from t1 where a=1 and b in (1) order by c, b, a;
a b c d
1 1 2 0
1 1 12 -1
1 1 52 -5
1 1 92 -9
select * from t1 where a=1 and b in (1);
a b c d
1 1 92 -9
1 1 52 -5
1 1 12 -1
1 1 2 0
drop table t1, t2;
...@@ -393,3 +393,28 @@ select * from t1 where b=1 or b is null order by a; ...@@ -393,3 +393,28 @@ select * from t1 where b=1 or b is null order by a;
explain select * from t1 where b=2 or b is null order by a; explain select * from t1 where b=2 or b is null order by a;
select * from t1 where b=2 or b is null order by a; select * from t1 where b=2 or b is null order by a;
drop table t1; drop table t1;
#
# Bug #3155
#
create table t1 (a int not null auto_increment, b int not null, c int not null, d int not null,
key(a,b,d), key(c,b,a));
create table t2 like t1;
insert into t1 values (NULL, 1, 2, 0), (NULL, 2, 1, 1), (NULL, 3, 4, 2), (NULL, 4, 3, 3);
insert into t2 select null, b, c, d from t1;
insert into t1 select null, b, c, d from t2;
insert into t2 select null, b, c, d from t1;
insert into t1 select null, b, c, d from t2;
insert into t2 select null, b, c, d from t1;
insert into t1 select null, b, c, d from t2;
insert into t2 select null, b, c, d from t1;
insert into t1 select null, b, c, d from t2;
insert into t2 select null, b, c, d from t1;
insert into t1 select null, b, c, d from t2;
optimize table t1;
set @row=10;
insert into t1 select 1, b, c + (@row:=@row - 1) * 10, d - @row from t2 limit 10;
select * from t1 where a=1 and b in (1) order by c, b, a;
select * from t1 where a=1 and b in (1);
drop table t1, t2;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment