Details
-
Type:
Bug
-
Status: Closed
-
Priority:
Critical
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: None
-
Labels:
Description
The following query:
SELECT * FROM ( SELECT t2.* FROM t1 , t2 ) AS alias1 WHERE b IS NULL;
returns rows for which b IS NOT NULL
MariaDB [test]> explain SELECT * FROM ( SELECT t2.* FROM t1 , t2 ) AS alias1 WHERE b IS NULL ;
------------------------------------------------------------------------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
------------------------------------------------------------------------------------------+
| 1 | SIMPLE | t1 | ALL | NULL | NULL | NULL | NULL | 2 | Using where |
| 1 | SIMPLE | t2 | ALL | NULL | NULL | NULL | NULL | 2 | Using join buffer (flat, BNL join) |
------------------------------------------------------------------------------------------+
minimal optimizer switch:derived_merge=on
full optimizer_switch:
index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=on,semijoin=off,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on
bzr version-info
revision-id: <email address hidden>
date: 2011-08-09 18:34:26 +0300
build-date: 2011-08-10 13:04:33 +0300
revno: 3148
branch-nick: maria-5.3
test case:
CREATE TABLE t1 (a int) ;
INSERT INTO t1 VALUES (1),(1);
CREATE TABLE t2 (b int) ;
INSERT INTO t2 VALUES (NULL),(6);
SET SESSION optimizer_switch='derived_merge=on';
SELECT * FROM ( SELECT t2.* FROM t1 , t2 ) AS alias1 WHERE b IS NULL;
Gliffy Diagrams
Attachments
Activity
- All
- Comments
- Work Log
- History
- Activity
- Transitions
Re: Wrong result / WHERE not observed with derived_merge and inner join in maria-5.3
The same problem can be reproduced with a view:
MariaDB [test]> create view v2 as select * from t1,t2;
Query OK, 0 rows affected (0.01 sec)
MariaDB [test]> select * from v2;
-----
-----+-----
-----+-----
-----+4 rows in set (0.00 sec)
MariaDB [test]> select * from v2 where b is null;
-----
-----+-----
-----+-----
-----+4 rows in set (0.00 sec)