[MDEV-2458] LP:904432 - Wrong result with LEFT JOIN, constant table, semijoin=ON,materialization=ON Created: 2011-12-14 Updated: 2015-02-02 Resolved: 2012-10-04 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major |
| Reporter: | Elena Stepanova | Assignee: | Sergei Petrunia |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | Launchpad | ||
| Attachments: |
|
| Description |
|
The following query SELECT * FROM t1 LEFT JOIN t2 ON ( a = b ) returns one row with NULLs instead of t2 values if it's run with materialization=ON and semijoin=ON (current defaults), and 3 rows with actual values otherwise. The latter is correct. In test data t1 contains 1 row and has to have MyISAM or Aria engine. bzr version-info Not reproducible on 3250. EXPLAIN with semijoin=ON, materialization=ON (wrong result): 1 PRIMARY t1 system NULL NULL NULL NULL 1 100.00 select 4 AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t1` semi join (`test`.`t2`) left join `test`.`t2` on(((`test`.`t2`.`c` = 4) and (`test`.`t2`.`b` = 4))) where (`test`.`t2`.`c` = 4) EXPLAIN ith semijoin=OFF, materialization=ON (correct result): 1 PRIMARY t1 system NULL NULL NULL NULL 1 100.00 select 4 AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t1` left join `test`.`t2` on((`test`.`t2`.`b` = 4)) where <expr_cache><4>(<in_optimizer>(4,4 in ( <materialize> (select `test`.`t2`.`c` from `test`.`t2` ), <primary_index_lookup>(4 in <temporary table> on distinct_key where ((4 = `<subquery2>`.`c`)))))) EXPLAIN with materialization=OFF, semijoin=ON (correct result): 1 PRIMARY t1 system NULL NULL NULL NULL 1 100.00 select 4 AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t1` semi join (`test`.`t2`) left join `test`.`t2` on(((`test`.`t2`.`c` = 4) and (`test`.`t2`.`b` = 4))) where (`test`.`t2`.`c` = 4) Minimal optimizer_switch: materialization=on,semijoin=on (default values) Full optimizer_switch: 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=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,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 Test case: SET optimizer_switch = 'materialization=on,semijoin=on';
SELECT * FROM t1 LEFT JOIN t2 ON ( a = b )
|
| Comments |
| Comment by Elena Stepanova [ 2012-03-18 ] |
|
Re: Wrong result with LEFT JOIN, constant table, semijoin=ON,materialization=ON |
| Comment by Rasmus Johansson (Inactive) [ 2012-03-18 ] |
|
Launchpad bug id: 904432 |