Commit b9225bb5 authored by Aleksey Midenkov's avatar Aleksey Midenkov

SQL: outdated select_lex->where fix [#365 bug 5]

Affected tests (forced mode):

main.index_merge_myisam

After optimization versioning AND takes operands from WHERE AND
leaving `select_lex->where` as empty dangling AND.
parent e4b86780
......@@ -367,6 +367,12 @@ order by i;
f
0
0
### Issue #365, bug 5 (dangling AND)
create or replace table t1 (a int);
create or replace table t2 (b int) with system versioning;
select * from t1
where exists (select 1 from t2 where t2.b = t1.a and t2.b = t1.a);
a
drop view v1;
drop table t1, t2;
call innodb_verify_vtq(28);
......
......@@ -188,6 +188,12 @@ select min(i) over (partition by b) as f
from (select i + 0 as i, b from t1) as tt
order by i;
--echo ### Issue #365, bug 5 (dangling AND)
create or replace table t1 (a int);
create or replace table t2 (b int) with system versioning;
select * from t1
where exists (select 1 from t2 where t2.b = t1.a and t2.b = t1.a);
drop view v1;
drop table t1, t2;
......
......@@ -976,6 +976,8 @@ int vers_setup_select(THD *thd, TABLE_LIST *tables, COND **where_expr,
*dst_cond= cond1;
else
thd->change_item_tree(dst_cond, cond1);
slex->where= *dst_cond;
}
} // if (... table->table->versioned())
} // for (table= tables; ...)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment