summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorunknown <sanja@askmonty.org>2010-11-23 20:43:34 +0200
committerunknown <sanja@askmonty.org>2010-11-23 20:43:34 +0200
commit34c8930c09e7d944d9aea5182b0c6b98290bf350 (patch)
treec945fcc9eda88c491d7f4eccf7efb29ecc9eb3a5 /mysql-test
parent7840965db9460e2117c163f3db83aaa247c65203 (diff)
downloadmariadb-git-34c8930c09e7d944d9aea5182b0c6b98290bf350.tar.gz
Fix of LP BUG#675248.
Registration of pointer change if we assign it to other pointer which should be identical after statement execution (PS/SP). mysql-test/r/subselect.result: Test suite. mysql-test/t/subselect.test: Test suite. sql/sql_class.cc: The procedure of the pointer registration. sql/sql_class.h: The procedure of the pointer registration. sql/sql_lex.cc: Registration of pointer change if we assign it to other pointer which should be identical after statement execution (PS/SP).
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/subselect.result19
-rw-r--r--mysql-test/t/subselect.test24
2 files changed, 43 insertions, 0 deletions
diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result
index cbb6149a148..7d594d4be1c 100644
--- a/mysql-test/r/subselect.result
+++ b/mysql-test/r/subselect.result
@@ -4730,4 +4730,23 @@ ORDER BY (SELECT * FROM t1 WHERE MATCH(a) AGAINST ('+abc' IN BOOLEAN MODE));
SELECT * FROM t2 UNION SELECT * FROM t2
ORDER BY (SELECT * FROM t1 WHERE MATCH(a) AGAINST ('+abc' IN BOOLEAN MODE));
DROP TABLE t1,t2;
+# LP BUG#675248 - select->prep_where references on freed memory
+CREATE TABLE t1 (a int, b int);
+insert into t1 values (1,1),(0,0);
+CREATE TABLE t2 (c int);
+insert into t2 values (1),(2);
+prepare stmt1 from "select sum(a),(select sum(c) from t2 where table1.b) as sub
+from t1 as table1 group by sub";
+execute stmt1;
+sum(a) sub
+0 NULL
+1 3
+deallocate prepare stmt1;
+prepare stmt1 from "select sum(a),(select sum(c) from t2 having table1.b) as sub
+from t1 as table1";
+execute stmt1;
+sum(a) sub
+1 3
+deallocate prepare stmt1;
+drop table t1,t2;
End of 5.1 tests
diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test
index 89be351312d..bd333d5a649 100644
--- a/mysql-test/t/subselect.test
+++ b/mysql-test/t/subselect.test
@@ -3735,4 +3735,28 @@ SELECT * FROM t2 UNION SELECT * FROM t2
DROP TABLE t1,t2;
--enable_result_log
+--echo # LP BUG#675248 - select->prep_where references on freed memory
+
+CREATE TABLE t1 (a int, b int);
+insert into t1 values (1,1),(0,0);
+
+CREATE TABLE t2 (c int);
+insert into t2 values (1),(2);
+
+prepare stmt1 from "select sum(a),(select sum(c) from t2 where table1.b) as sub
+from t1 as table1 group by sub";
+
+execute stmt1;
+
+deallocate prepare stmt1;
+
+prepare stmt1 from "select sum(a),(select sum(c) from t2 having table1.b) as sub
+from t1 as table1";
+
+execute stmt1;
+
+deallocate prepare stmt1;
+
+drop table t1,t2;
+
--echo End of 5.1 tests