summaryrefslogtreecommitdiff
path: root/mysql-test/t/view.test
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2012-04-06 15:08:09 -0700
committerIgor Babaev <igor@askmonty.org>2012-04-06 15:08:09 -0700
commit4ca9b8eb3af0fbfabd493bf72a0cc0e57f51d935 (patch)
tree151af947a63d7e9c9f906e5eebcf6979723fb4e2 /mysql-test/t/view.test
parent2149a42928f961112e65944e4b0d7639416e6f50 (diff)
downloadmariadb-git-4ca9b8eb3af0fbfabd493bf72a0cc0e57f51d935.tar.gz
Fixed bug #915222.
This bug happened because the function find_field_in_view formed autogenerated names of view columns without a possibility to roll them back. In some situation it could cause memory misuses reported by valgrind or even crashes.
Diffstat (limited to 'mysql-test/t/view.test')
-rw-r--r--mysql-test/t/view.test29
1 files changed, 29 insertions, 0 deletions
diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test
index 2a9bfd89f3b..4820e0ac173 100644
--- a/mysql-test/t/view.test
+++ b/mysql-test/t/view.test
@@ -4365,6 +4365,35 @@ SELECT * FROM t1 RIGHT JOIN v2 ON ( v2.a = t1.a ) WHERE v2.b IN ( SELECT b FROM
DROP VIEW v2;
DROP TABLE t1, t2, t3;
+--echo #
+--echo # BUG#915222: Valgrind complains or crashes with INSERT SELECT
+--echo # within a trigger that uses a view
+--echo #
+
+CREATE TABLE t1 (a char(1));
+
+CREATE TABLE t2 (d int, e char(1));
+
+INSERT INTO t2 VALUES (13,'z');
+
+CREATE TRIGGER tr AFTER UPDATE ON t2
+ FOR EACH ROW
+ REPLACE INTO t3
+ SELECT f, a AS alias FROM t3, v;
+
+CREATE TABLE t3 (f int, g char(8));
+
+CREATE VIEW v AS SELECT a, e FROM t2, t1;
+
+UPDATE t2 SET d=7;
+UPDATE t2 SET d=7;
+UPDATE t2 SET d=7;
+UPDATE t2 SET d=7;
+
+DROP TRIGGER tr;
+DROP VIEW v;
+DROP TABLE t1,t2,t3;
+
--echo # -----------------------------------------------------------------
--echo # -- End of 5.3 tests.
--echo # -----------------------------------------------------------------