summaryrefslogtreecommitdiff
path: root/mysql-test/t/view.test
diff options
context:
space:
mode:
authorJon Olav Hauglid <jon.hauglid@sun.com>2009-12-10 13:02:37 +0100
committerJon Olav Hauglid <jon.hauglid@sun.com>2009-12-10 13:02:37 +0100
commit3173cf335b1cca8bc2265e060c4e983c038bbd0e (patch)
treec7882ec1d412110aa5f5f278c9d7d39720d0a95e /mysql-test/t/view.test
parent9e17ef84ccf4e00648eb7aab9d98dd4eab3b6e5a (diff)
downloadmariadb-git-3173cf335b1cca8bc2265e060c4e983c038bbd0e.tar.gz
Backport of revno: 2617.68.43
Bug #47335 assert in get_table_share The assert would happen if ALTER VIEW was used to alter a view (existing or non-existing) and a temporary table with the same name already existed. The assert is triggered if the current statement does not have a MDL lock on the view to be altered. This would happen because open_table() would open the temporary table instead and MDL locks are not taken for temporary tables (since they are local to one connection). The patch changes open_type for CREATE/ALTER VIEW to OT_BASE_ONLY. This prevents open_table() from trying to open a temporary table with the same name should one exist. Now the view will be altered if it exists or ER_NO_SUCH_TABLE will be reported if it does not. Test case added to view.test
Diffstat (limited to 'mysql-test/t/view.test')
-rw-r--r--mysql-test/t/view.test21
1 files changed, 21 insertions, 0 deletions
diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test
index c3ff58880c9..13a557dda60 100644
--- a/mysql-test/t/view.test
+++ b/mysql-test/t/view.test
@@ -3906,3 +3906,24 @@ DROP TABLE t1;
--echo # -----------------------------------------------------------------
--echo # -- End of 5.1 tests.
--echo # -----------------------------------------------------------------
+
+--echo #
+--echo # Bug #47335 assert in get_table_share
+--echo #
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+DROP VIEW IF EXISTS v1;
+--enable_warnings
+
+CREATE TEMPORARY TABLE t1 (id INT);
+--error ER_NO_SUCH_TABLE
+ALTER VIEW t1 AS SELECT 1 AS f1;
+DROP TABLE t1;
+
+CREATE VIEW v1 AS SELECT 1 AS f1;
+CREATE TEMPORARY TABLE v1 (id INT);
+ALTER VIEW v1 AS SELECT 2 AS f1;
+DROP TABLE v1;
+SELECT * FROM v1;
+DROP VIEW v1;