summaryrefslogtreecommitdiff
path: root/mysql-test/t/view.test
diff options
context:
space:
mode:
authoranozdrin/alik@quad. <>2008-02-21 12:17:32 +0300
committeranozdrin/alik@quad. <>2008-02-21 12:17:32 +0300
commitf5cb5fdc4fce3b6469655ee2ecc828606d41f7c2 (patch)
tree82ae7d29a938e72530c3afa2b0a9fde8b5830b91 /mysql-test/t/view.test
parent4b821c0cbd7bf87b1ac6de6a84207e9fd0383e62 (diff)
downloadmariadb-git-f5cb5fdc4fce3b6469655ee2ecc828606d41f7c2.tar.gz
Fix for Bug#34337: Server crash when Altering a view using
a table name. The problem was that fill_defined_view_parts() did not return an error if a table is going to be altered. That happened if the table was already in the table cache. In that case, open_table() returned non-NULL value (valid TABLE-instance from the cache). The fix is to ensure that an error is thrown even if the table is in the cache. (This is a backport of the original patch for 5.1)
Diffstat (limited to 'mysql-test/t/view.test')
-rw-r--r--mysql-test/t/view.test36
1 files changed, 35 insertions, 1 deletions
diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test
index 340a34db5a1..5a87128f69e 100644
--- a/mysql-test/t/view.test
+++ b/mysql-test/t/view.test
@@ -3470,5 +3470,39 @@ insert into v1 values(1);
set @@sql_mode=@old_mode;
drop view v1;
drop table t1;
---echo End of 5.0 tests.
+###########################################################################
+
+--echo # -----------------------------------------------------------------
+--echo # -- Bug#34337: Server crash when Altering a view using a table name.
+--echo # -----------------------------------------------------------------
+--echo
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+--echo
+
+CREATE TABLE t1(c1 INT);
+
+--echo
+
+SELECT * FROM t1;
+
+--error ER_WRONG_OBJECT
+ALTER ALGORITHM=TEMPTABLE SQL SECURITY INVOKER VIEW t1 (c2) AS SELECT (1);
+
+--echo
+
+DROP TABLE t1;
+
+--echo
+--echo # -- End of test case for Bug#34337.
+--echo
+
+###########################################################################
+
+--echo # -----------------------------------------------------------------
+--echo # -- End of 5.0 tests.
+--echo # -----------------------------------------------------------------