From a81da06f5764c97d9cd20c0c4091b58bc5cd8e95 Mon Sep 17 00:00:00 2001 From: Dmitry Lenev Date: Fri, 28 May 2010 09:25:11 +0400 Subject: Patch that addresses bug #53976 "ALTER TABLE RENAME is allowed on views (not documented, broken)". Remove support of ALTER TABLE RENAME for views as: a) this feature was not documented, c) does not add any compatibility with other databases, b) its implementation doesn't follow metadata locking protocol by accessing .FRM without holding any metadata lock, c) its implementation complicates ALTER TABLE's code by introducing yet another separate branch to it. After this patch one can rename a view by using the documented way - RENAME TABLE statement. mysql-test/r/rename.result: Adjusted existing test case for bug #14959 "ALTER TABLE isn't able to rename a view" after fixing bug #53976: "ALTER TABLE RENAME is allowed on views (not documented, broken)". mysql-test/r/view.result: Adjusted test case after removing support for renaming of views through ALTER TABLE ... RENAME. mysql-test/t/rename.test: Adjusted existing test case for bug #14959 "ALTER TABLE isn't able to rename a view" after fixing bug #53976: "ALTER TABLE RENAME is allowed on views (not documented, broken)". mysql-test/t/view.test: Adjusted test case after removing support for renaming of views through ALTER TABLE ... RENAME. sql/sql_table.cc: Removed support for ALTER TABLE ... RENAME for views. This feature was not properly documented and its implementation was not following metadata locking protocol. --- mysql-test/t/rename.test | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'mysql-test/t/rename.test') diff --git a/mysql-test/t/rename.test b/mysql-test/t/rename.test index 5aa1a51a90f..bb90cbafd74 100644 --- a/mysql-test/t/rename.test +++ b/mysql-test/t/rename.test @@ -79,17 +79,15 @@ connection default; --echo End of 4.1 tests -# -# Bug#14959: ALTER TABLE isn't able to rename a view -# +--echo # +--echo # Bug#14959: "ALTER TABLE isn't able to rename a view" +--echo # Bug#53976: "ALTER TABLE RENAME is allowed on views +--echo # (not documented, broken)" +--echo # create table t1(f1 int); create view v1 as select * from t1; +--error ER_WRONG_OBJECT alter table v1 rename to v2; ---error ER_NO_SUCH_TABLE -alter table v1 rename to v2; -rename table v2 to v1; ---error ER_TABLE_EXISTS_ERROR -rename table v2 to v1; drop view v1; drop table t1; -- cgit v1.2.1