Commit 6ac77342 authored by Aleksey Midenkov's avatar Aleksey Midenkov

SQL: WHERE cond freed prematurely for PS [#365 bug 10]

Applicable to vanilla version.
Applies to Item_cond_and, etc.: items with allocating copy_andor_structure().

Tests affected (forced mode):

main.subselect_sj
main.subselect_sj_jcl6
parent 3d88a72f
......@@ -302,9 +302,21 @@ a
create or replace table t1 (x int) with system versioning;
select t1.x in (select x from t1) a from t1, (select x from t1) b;
a
### Issue #365, bug 10 (WHERE cond freed prematurely for PS)
create or replace table t1 (x int) with system versioning;
insert into t1 values (1);
create or replace view v1 as select x from t1 where x = 1;
prepare stmt from "
select x from t1 where x in (select x from v1);";
execute stmt;
x
1
execute stmt;
x
1
drop view v1;
drop table t1, t2;
call innodb_verify_vtq(28);
call innodb_verify_vtq(29);
No A B C D
1 1 1 1 1
2 1 1 1 1
......@@ -334,3 +346,4 @@ No A B C D
26 1 1 1 1
27 1 1 1 1
28 1 1 1 1
29 1 1 1 1
......@@ -199,9 +199,18 @@ where exists (select 1 from t2 where t2.b = t1.a and t2.b = t1.a);
create or replace table t1 (x int) with system versioning;
select t1.x in (select x from t1) a from t1, (select x from t1) b;
--echo ### Issue #365, bug 10 (WHERE cond freed prematurely for PS)
create or replace table t1 (x int) with system versioning;
insert into t1 values (1);
create or replace view v1 as select x from t1 where x = 1;
prepare stmt from "
select x from t1 where x in (select x from v1);";
execute stmt;
execute stmt;
drop view v1;
drop table t1, t2;
call innodb_verify_vtq(28);
call innodb_verify_vtq(29);
-- source suite/versioning/common_finish.inc
......@@ -3775,6 +3775,7 @@ void st_select_lex::fix_prepare_information(THD *thd, Item **conds,
DBUG_ENTER("st_select_lex::fix_prepare_information");
if (!thd->stmt_arena->is_conventional() && first_execution)
{
Query_arena_stmt on_stmt_arena(thd);
first_execution= 0;
if (group_list.first)
{
......
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