diff options
Diffstat (limited to 'mysql-test/main/join_cache.test')
-rw-r--r-- | mysql-test/main/join_cache.test | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/mysql-test/main/join_cache.test b/mysql-test/main/join_cache.test index f831c442a3e..edee05cb6a5 100644 --- a/mysql-test/main/join_cache.test +++ b/mysql-test/main/join_cache.test @@ -4068,6 +4068,46 @@ select f2 from t2,t1 where f2 = 0; drop table t1, t2; set join_buffer_size=@save_join_buffer_size; + +--echo # +--echo # MDEV-21243: Join buffer: condition is checked in wrong place for range access +--echo # +create table t1(a int primary key); +insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t2 (a int); +insert into t2 select A.a + 10*B.a from t1 A, t1 B; + +create table t3 ( + kp1 int, + kp2 int, + col1 int, + col2 int, + key (kp1, kp2) +); + +insert into t3 +select + A.a, + B.a, + A.a + 100*B.a, + A.a + 100*B.a +from + t2 A, t2 B; +analyze table t3; + +--echo # The following must have "B.col1 + 1 < 33333" attached to table B +--echo # and not to the block-nl-join node: +explain format=json +select * +from t1 a, t3 b +where + b.kp1=a.a and + b.kp1 <= 10 and + b.kp2 <= 10 and + b.col1 +1 < 33333; + +drop table t1,t2,t3; + # The following command must be the last one in the file set @@optimizer_switch=@save_optimizer_switch; |