mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
Fix for Bug #9246 Condition pushdown and left join, wrong result
This commit is contained in:
@@ -1139,5 +1139,10 @@ explain
|
|||||||
select * from t2 where (attr1 < 2) = (attr2 < 2) order by pk1;
|
select * from t2 where (attr1 < 2) = (attr2 < 2) order by pk1;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Using filesort
|
1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Using filesort
|
||||||
|
explain
|
||||||
|
select * from t3 left join t4 on t4.attr2 = t3.attr2 where t4.attr1 > 1 and t4.attr3 < 5 or t4.attr1 is null order by t4.pk1;
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE t3 ALL NULL NULL NULL NULL 6 Using temporary; Using filesort
|
||||||
|
1 SIMPLE t4 ALL NULL NULL NULL NULL 6 Using where
|
||||||
set engine_condition_pushdown = @old_ecpd;
|
set engine_condition_pushdown = @old_ecpd;
|
||||||
DROP TABLE t1,t2,t3,t4;
|
DROP TABLE t1,t2,t3,t4;
|
||||||
|
@@ -1044,6 +1044,8 @@ explain
|
|||||||
select auto from t1 where string = "aaaa" collate latin1_general_ci order by auto;
|
select auto from t1 where string = "aaaa" collate latin1_general_ci order by auto;
|
||||||
explain
|
explain
|
||||||
select * from t2 where (attr1 < 2) = (attr2 < 2) order by pk1;
|
select * from t2 where (attr1 < 2) = (attr2 < 2) order by pk1;
|
||||||
|
explain
|
||||||
|
select * from t3 left join t4 on t4.attr2 = t3.attr2 where t4.attr1 > 1 and t4.attr3 < 5 or t4.attr1 is null order by t4.pk1;
|
||||||
|
|
||||||
set engine_condition_pushdown = @old_ecpd;
|
set engine_condition_pushdown = @old_ecpd;
|
||||||
DROP TABLE t1,t2,t3,t4;
|
DROP TABLE t1,t2,t3,t4;
|
||||||
|
@@ -5401,10 +5401,12 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
|
|||||||
if (!(tmp= add_found_match_trig_cond(first_inner_tab, tmp, 0)))
|
if (!(tmp= add_found_match_trig_cond(first_inner_tab, tmp, 0)))
|
||||||
DBUG_RETURN(1);
|
DBUG_RETURN(1);
|
||||||
tab->select_cond=sel->cond=tmp;
|
tab->select_cond=sel->cond=tmp;
|
||||||
|
/* Push condition to storage engine if this is enabled
|
||||||
|
and the condition is not guarded */
|
||||||
if (thd->variables.engine_condition_pushdown)
|
if (thd->variables.engine_condition_pushdown)
|
||||||
{
|
{
|
||||||
COND *push_cond=
|
COND *push_cond=
|
||||||
make_cond_for_table(cond,current_map,current_map);
|
make_cond_for_table(tmp,current_map,current_map);
|
||||||
tab->table->file->pushed_cond= NULL;
|
tab->table->file->pushed_cond= NULL;
|
||||||
if (push_cond)
|
if (push_cond)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user