summaryrefslogtreecommitdiff
path: root/mysql-test/t/subselect_sj.test
diff options
context:
space:
mode:
authorSergey Petrunya <psergey@askmonty.org>2013-05-04 20:42:43 +0400
committerSergey Petrunya <psergey@askmonty.org>2013-05-04 20:42:43 +0400
commitddd341b71ae6b9c2dd206df64c662c0a29730ae9 (patch)
tree5ef61cfe0eb665f9bc26bc5abc9fec87d9b3c6bc /mysql-test/t/subselect_sj.test
parent71422d7b143ae92a1a5802f0669d2d3d9483c2e4 (diff)
downloadmariadb-git-ddd341b71ae6b9c2dd206df64c662c0a29730ae9.tar.gz
MDEV-4071: Valgrind warnings 'Invalid read' in subselect_engine::calc_const_tables with ...
- Call tmp_having->update_used_tables() *before* we have call JOIN::cleanup(). Making the call after join::cleanup() is not allowed, because subquery predicate items walk parent join's JOIN_TAB structures. Which can be invalidated by JOIN::cleanup().
Diffstat (limited to 'mysql-test/t/subselect_sj.test')
-rw-r--r--mysql-test/t/subselect_sj.test17
1 files changed, 17 insertions, 0 deletions
diff --git a/mysql-test/t/subselect_sj.test b/mysql-test/t/subselect_sj.test
index 15ca4ce884e..bfdc6335f1d 100644
--- a/mysql-test/t/subselect_sj.test
+++ b/mysql-test/t/subselect_sj.test
@@ -2567,5 +2567,22 @@ drop table t1, t2;
connection default;
disconnect con1;
+--echo #
+--echo # MDEV-4071: Valgrind warnings 'Invalid read' in subselect_engine::calc_const_tables with ...
+--echo #
+CREATE TABLE t1 (b INT, c VARCHAR(1)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (7,'v'),(0,'s');
+
+CREATE TABLE t2 (a INT) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (0),(8);
+
+SELECT c, SUM( DISTINCT b ) AS sm FROM t1
+WHERE ( 5, 108 ) IN ( SELECT MIN(a), MAX(a) FROM t2 )
+GROUP BY b
+HAVING c <> ( SELECT MAX( c ) FROM t1 )
+ORDER BY sm;
+
+DROP TABLE t1,t2;
+
# The following command must be the last one the file
set optimizer_switch=@subselect_sj_tmp;