summaryrefslogtreecommitdiff
path: root/mysql-test/r/view.result
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/r/view.result
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/r/view.result')
-rw-r--r--mysql-test/r/view.result17
1 files changed, 17 insertions, 0 deletions
diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result
index 7e9739173df..cb53bf462f5 100644
--- a/mysql-test/r/view.result
+++ b/mysql-test/r/view.result
@@ -3959,3 +3959,20 @@ DROP TABLE t1;
# -----------------------------------------------------------------
# -- End of 5.1 tests.
# -----------------------------------------------------------------
+#
+# Bug #47335 assert in get_table_share
+#
+DROP TABLE IF EXISTS t1;
+DROP VIEW IF EXISTS v1;
+CREATE TEMPORARY TABLE t1 (id INT);
+ALTER VIEW t1 AS SELECT 1 AS f1;
+ERROR 42S02: Table 'test.t1' doesn't exist
+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;
+f1
+2
+DROP VIEW v1;