1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

MDEV-19790 Wrong result for query with outer join and IS NOT TRUE predicate

in where clause

The classes Item_func_isnottrue and Item_func_isnotfalse inherited the
implementation of the eval_not_null_tables method from the Item_func
class. As a result the not_null_tables_cache was set incorrectly for
the objects of these classes. It led to improper conversion of outer
joins to inner joins when the where clause of the processed query
contained IS NOT TRUE or IS NOT FALSE predicates. The coverted query
in many cases produced a wrong result set.
This commit is contained in:
Igor Babaev
2019-06-17 14:23:10 -07:00
parent 039b8782d4
commit 167da05f55
4 changed files with 98 additions and 3 deletions

View File

@ -1895,7 +1895,7 @@ set @save_join_cache_level= @@join_cache_level;
SET @@join_cache_level = 3;
SELECT t1.b1+'0' , t2.b2 + '0' FROM t1 LEFT JOIN t2 ON b1 = b2;
DROP TABLE t1, t2;
set @join_cache_level= @save_join_cache_level;
set @@join_cache_level= @save_join_cache_level;
--echo #
--echo # MDEV-14779: using left join causes incorrect results with materialization and derived tables
@ -1959,6 +1959,29 @@ ORDER BY tb1.i1;
DROP TABLE t1,t2;
--echo #
--echo # MDEV-19790 : IS NOT TRUE / IS NOT FALSE predicates over
--echo # inner tables of outer joins
--echo #
create table t1 (a int);
create table t2 (b int);
insert into t1 values (3), (7), (1);
insert into t2 values (7), (4), (3);
select * from t1 left join t2 on a=b;
let $q=
select * from t1 left join t2 on a=b where (b > 3) is not true;
eval $q;
eval explain extended $q;
let $q=
select * from t1 left join t2 on a=b where (b > 3) is not false;
eval $q;
eval explain extended $q;
drop table t1,t2;
--echo # end of 5.5 tests
SET optimizer_switch=@save_optimizer_switch;