From 4ca9b8eb3af0fbfabd493bf72a0cc0e57f51d935 Mon Sep 17 00:00:00 2001 From: Igor Babaev Date: Fri, 6 Apr 2012 15:08:09 -0700 Subject: 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. --- mysql-test/t/view.test | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'mysql-test/t/view.test') 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 # ----------------------------------------------------------------- -- cgit v1.2.1 From b95ae56b9f47cc19d3498d4be3142b2449a04600 Mon Sep 17 00:00:00 2001 From: Igor Babaev Date: Sat, 7 Apr 2012 02:29:04 -0700 Subject: Fixed LP bug #972973. When the function free_tmp_table deletes the handler object for a temporary table the field TABLE::file for this table should be set to NULL. Otherwise an assertion failure may occur. --- mysql-test/t/view.test | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'mysql-test/t/view.test') diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test index 4820e0ac173..93e0cce8a5d 100644 --- a/mysql-test/t/view.test +++ b/mysql-test/t/view.test @@ -4394,6 +4394,32 @@ DROP TRIGGER tr; DROP VIEW v; DROP TABLE t1,t2,t3; +--echo # +--echo # BUG#972943: Assertion failure with INSERT SELECT within a trigger +--echo # that uses derived table and materialized view +--echo # + +CREATE TABLE t1 (a int, b int); +INSERT INTO t1 VALUES (1,0), (2,8); + +CREATE ALGORITHM=TEMPTABLE VIEW v1 + AS SELECT * FROM t1; + +CREATE TABLE t2 (c int); +CREATE TABLE t3 (d int, e int); + +CREATE TRIGGER tr BEFORE INSERT ON t2 FOR EACH ROW + INSERT INTO t3 + SELECT t1.* + FROM (SELECT * FROM t1 WHERE b IN (SELECT b FROM v1)) AS alias1, t1 + WHERE t1.a = 3 OR t1.a > 5; + +INSERT INTO t2 VALUES (1); + +DROP TRIGGER tr; +DROP VIEW v1; +DROP TABLE t1,t2,t3; + --echo # ----------------------------------------------------------------- --echo # -- End of 5.3 tests. --echo # ----------------------------------------------------------------- -- cgit v1.2.1