mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Fixed bug #49600.
The problem could be demonstrated with an outer join of two single-row tables where the values of the join attributes were null. Any query with such a join could return a wrong result set if the where condition of the query was not empty. For queries with empty where conditions the result sets were correct. This was the consequence of two bugs in the code: - Item_equal objects for on conditions of outer joins were not built if the processed query had no where condition - the check for null values in the code that evaluated constant Item_equal objects was incorrect. Fixed both above problems. Added a test case for the bug and adjusted results for some other test cases.
This commit is contained in:
@ -1397,4 +1397,18 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
Warnings:
|
||||
Note 1003 select straight_join `test`.`jt1`.`f1` AS `f1` from `test`.`t1` `jt6` left join (`test`.`t1` `jt3` join `test`.`t1` `jt4` left join `test`.`t1` `jt5` on(1) left join `test`.`t1` `jt2` on(1)) on((`test`.`jt6`.`f1` and 1)) left join `test`.`t1` `jt1` on(1) where 1
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Bug#49600: outer join of two single-row tables with joining attributes
|
||||
# evaluated to nulls
|
||||
create table t1 (a int, b int);
|
||||
create table t2 (a int, b int);
|
||||
insert into t1 values (1, NULL);
|
||||
insert into t2 values (2, NULL);
|
||||
select * from t1 left join t2 on t1.b=t2.b;
|
||||
a b a b
|
||||
1 NULL NULL NULL
|
||||
select * from t1 left join t2 on t1.b=t2.b where 1=1;
|
||||
a b a b
|
||||
1 NULL NULL NULL
|
||||
drop table t1,t2;
|
||||
End of 5.1 tests
|
||||
|
Reference in New Issue
Block a user