Commit 932c7a31 authored by Georgi Kodinov's avatar Georgi Kodinov

Bug #36995: valgrind error in remove_const during subquery executions

When copying the Item class one must copy its attributes as well.
parent 1a1ffe73
...@@ -1303,4 +1303,16 @@ t1 CREATE TABLE `t1` ( ...@@ -1303,4 +1303,16 @@ t1 CREATE TABLE `t1` (
CONSTRAINT `f2_ref` FOREIGN KEY (`f2`) REFERENCES `t1` (`f1`) CONSTRAINT `f2_ref` FOREIGN KEY (`f2`) REFERENCES `t1` (`f1`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
DROP TABLE t1; DROP TABLE t1;
#
# Bug #36995: valgrind error in remove_const during subquery executions
#
create table t1 (a bit(1) not null,b int) engine=myisam;
create table t2 (c int) engine=innodb;
explain
select b from t1 where a not in (select b from t1,t2 group by a) group by a;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
2 DEPENDENT SUBQUERY t1 system NULL NULL NULL NULL 0 const row not found
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 1
DROP TABLE t1,t2;
End of 5.0 tests End of 5.0 tests
...@@ -1063,4 +1063,14 @@ CREATE TABLE t1 (f1 INTEGER PRIMARY KEY COMMENT 'My ID#', f2 INTEGER DEFAULT NUL ...@@ -1063,4 +1063,14 @@ CREATE TABLE t1 (f1 INTEGER PRIMARY KEY COMMENT 'My ID#', f2 INTEGER DEFAULT NUL
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
DROP TABLE t1; DROP TABLE t1;
--echo #
--echo # Bug #36995: valgrind error in remove_const during subquery executions
--echo #
create table t1 (a bit(1) not null,b int) engine=myisam;
create table t2 (c int) engine=innodb;
explain
select b from t1 where a not in (select b from t1,t2 group by a) group by a;
DROP TABLE t1,t2;
--echo End of 5.0 tests --echo End of 5.0 tests
...@@ -409,6 +409,7 @@ Item::Item(THD *thd, Item *item): ...@@ -409,6 +409,7 @@ Item::Item(THD *thd, Item *item):
name(item->name), name(item->name),
orig_name(item->orig_name), orig_name(item->orig_name),
max_length(item->max_length), max_length(item->max_length),
name_length(item->name_length),
marker(item->marker), marker(item->marker),
decimals(item->decimals), decimals(item->decimals),
maybe_null(item->maybe_null), maybe_null(item->maybe_null),
...@@ -416,7 +417,9 @@ Item::Item(THD *thd, Item *item): ...@@ -416,7 +417,9 @@ Item::Item(THD *thd, Item *item):
unsigned_flag(item->unsigned_flag), unsigned_flag(item->unsigned_flag),
with_sum_func(item->with_sum_func), with_sum_func(item->with_sum_func),
fixed(item->fixed), fixed(item->fixed),
is_autogenerated_name(item->is_autogenerated_name),
collation(item->collation), collation(item->collation),
with_subselect(item->with_subselect),
cmp_context(item->cmp_context) cmp_context(item->cmp_context)
{ {
next= thd->free_list; // Put in free list next= thd->free_list; // Put in free list
......
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