diff options
author | Sergey Petrunya <psergey@askmonty.org> | 2012-07-18 22:36:20 +0400 |
---|---|---|
committer | Sergey Petrunya <psergey@askmonty.org> | 2012-07-18 22:36:20 +0400 |
commit | 33e961c1abbf7d401a6f3ae5c04ff312b433ca3a (patch) | |
tree | dd03578718b29dbb8436f93de4396e936d9f5aef | |
parent | 82f821ee8f7d8b55674115f64e344299ef28bfe5 (diff) | |
parent | 1b84c0cfee4db6f0a6c97459a47444ed1f0d6ce1 (diff) | |
download | mariadb-git-33e961c1abbf7d401a6f3ae5c04ff312b433ca3a.tar.gz |
Merge bug#1007622 from 5.3 to 5.5
-rw-r--r-- | mysql-test/r/view.result | 13 | ||||
-rw-r--r-- | mysql-test/t/view.test | 13 | ||||
-rw-r--r-- | sql/table.cc | 9 |
3 files changed, 34 insertions, 1 deletions
diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result index 008f8f41ada..b50f6b81206 100644 --- a/mysql-test/r/view.result +++ b/mysql-test/r/view.result @@ -4674,6 +4674,19 @@ INSERT INTO t2 VALUES (1); DROP TRIGGER tr; DROP VIEW v1; DROP TABLE t1,t2,t3; +# +# LP bug#1007622 Server crashes in handler::increment_statistics on +# inserting into a view over a view +# +CREATE TABLE t1 (a INT); +CREATE ALGORITHM=MERGE VIEW v1 AS SELECT a1.* FROM t1 AS a1, t1 AS a2; +CREATE ALGORITHM=MERGE VIEW v2 AS SELECT * FROM v1; +INSERT INTO v2 (a) VALUES (1) ; +select * from t1; +a +1 +drop view v2,v1; +drop table t1; # ----------------------------------------------------------------- # -- End of 5.3 tests. # ----------------------------------------------------------------- diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test index 0585073a6f5..17026e45724 100644 --- a/mysql-test/t/view.test +++ b/mysql-test/t/view.test @@ -4613,6 +4613,19 @@ DROP TRIGGER tr; DROP VIEW v1; DROP TABLE t1,t2,t3; +--echo # +--echo # LP bug#1007622 Server crashes in handler::increment_statistics on +--echo # inserting into a view over a view +--echo # + +CREATE TABLE t1 (a INT); +CREATE ALGORITHM=MERGE VIEW v1 AS SELECT a1.* FROM t1 AS a1, t1 AS a2; +CREATE ALGORITHM=MERGE VIEW v2 AS SELECT * FROM v1; +INSERT INTO v2 (a) VALUES (1) ; +select * from t1; +drop view v2,v1; +drop table t1; + --echo # ----------------------------------------------------------------- --echo # -- End of 5.3 tests. --echo # ----------------------------------------------------------------- diff --git a/sql/table.cc b/sql/table.cc index 2a11098caed..b8161093e9a 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -4544,7 +4544,14 @@ bool TABLE_LIST::check_single_table(TABLE_LIST **table_arg, tbl; tbl= tbl->next_local) { - if (tbl->table) + /* + Merged view has also temporary table attached (in 5.2 if it has table + then it was real table), so we have filter such temporary tables out + by checking that it is not merged view + */ + if (tbl->table && + !(tbl->is_view() && + tbl->is_merged_derived())) { if (tbl->table->map & map) { |