Details
-
Bug
-
Status: Closed (View Workflow)
-
Resolution: Fixed
-
None
-
None
-
None
Description
The following degenerate query:
SELECT * FROM t1 RIGHT JOIN v2 ON t1.a = v2.a WHERE ( v2.b AND v2.b = v2.b );
has the following EXPLAIN:
| 1 | SIMPLE | NULL | NULL | NULL | NULL | NULL | NULL | NULL | Impossible WHERE noticed after reading const tables |
even though using a base table instead of a view returns the following result:
| a | a | b |
-----------------
| NULL | dfcjsisnfe | 9 |
and has the following explain:
| 1 | SIMPLE | t1 | system | NULL | NULL | NULL | NULL | 0 | const row not found |
| 1 | SIMPLE | t2 | system | NULL | NULL | NULL | NULL | 1 | Â |
The issue has also been observed with the following slightly less degenerate query:
SELECT MAX( DISTINCT alias2 . `pk` ) AS field1 FROM C AS alias1 RIGHT JOIN view_DD AS alias2 ON alias1 . `col_varchar_10_utf8_key` = alias2 . `col_varchar_10_utf8_key` WHERE ( alias2 . `pk` NOT BETWEEN 1 AND ( 1 + 6 ) AND alias2 . `pk` = alias2 . `pk` ) ;
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=off,derived_merge=off,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=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=on
bzr version-info
revision-id: <email address hidden>
date: 2011-09-06 20:59:29 +0400
build-date: 2011-09-07 16:19:16 +0300
revno: 3178
branch-nick: maria-5.3
Repeatable with maria-5.3. Not repeatable with maria-5.2, mysql-5.5
test case:
CREATE TABLE t1 ( a int) ;
CREATE TABLE t2 ( a varchar(32), b int NOT NULL ) ;
INSERT INTO t2 VALUES ('dfcjsisnfe',9)
CREATE OR REPLACE VIEW v2 AS SELECT * FROM t2;
SELECT * FROM t1 RIGHT JOIN v2 ON t1.a = v2.a WHERE v2.b AND v2.b = v2.b;
SELECT * FROM t1 RIGHT JOIN t2 ON t1.a = t2.a WHERE t2.b AND t2.b = t2.b;