Bug #53976 | ALTER TABLE RENAME is allowed on views (not documented, broken) | ||
---|---|---|---|
Submitted: | 25 May 2010 15:54 | Modified: | 7 Jul 2010 19:20 |
Reporter: | Konstantin Osipov (OCA) | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: DDL | Severity: | S3 (Non-critical) |
Version: | 5.0, 5.1, 5.6.99 | OS: | Any |
Assigned to: | CPU Architecture: | Any |
[25 May 2010 15:54]
Konstantin Osipov
[25 May 2010 20:27]
Konstantin Osipov
Additional history on RENAME and ALTER TABLE RENAME for views, provided by Peter Gulutzan: Regardless of views about ALTER TABLE ... RENAME, RENAME TABLE view_name is there because of a deliberate decision (from Monty), and would be okay in DB2. WL#946 "Views" says ... " However, these are some exceptions: HANDLER <View_name> is legal. LOAD DATA ... INTO TABLE <View_name> is legal. LOCK TABLES <View_name> is legal. RENAME TABLE <View_name> is legal. REPLACE ... <View_name> is legal. TRUNCATE TABLE <View_name> is legal. I couldn't see what extra functionality such statements give users. But they're not impossible or inconceivable. And Monty believes they should be legal. " With DB2 (r). For ALTER TABLE t, t "must not be a view". For RENAME [TABLE] t, "The RENAME statement renames a table, view, or index." http://publib.boulder.ibm.com/infocenter/iseries/v5r3/index.jsp?topic=/db2/rbafzmstrena.ht... With standard SQL. ALTER TABLE <view name> is illegal, RENAME doesn't exist. With Oracle. I tried ALTER TABLE view_name RENAME to view_name_2, and got an error message.
[26 May 2010 9:51]
Sveta Smirnova
Thank you for the report. Verified as described. Though this fact was documented in 5.0.30 change log ("ALTER TABLE was not able to rename a view. (Bug#14959)")
[27 May 2010 16:06]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/109404 3026 Dmitry Lenev 2010-05-27 Tentative 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.
[28 May 2010 5:25]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/109445 3029 Dmitry Lenev 2010-05-28 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.
[28 May 2010 5:27]
Dmitry Lenev
Patch removing support of ALTER TABLE RENAME for views has been queued into mysql-trunk-runtime tree.
[30 May 2010 7:48]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/109552 3031 Dmitry Lenev 2010-05-30 Follow-up for patch that addresses bug #53976 "ALTER TABLE RENAME is allowed on views (not documented, broken)". Adjusted test cases in funcs_1 suite after removing support of ALTER TABLE RENAME for views.
[22 Jun 2010 13:08]
Bugs System
Pushed into 5.5.5-m3 (revid:alik@sun.com-20100622130139-u05awgya93zvbsop) (version source revid:marko.makela@oracle.com-20100603095032-v5ptkkzt1bhz0m1d) (merge vers: 5.1.48) (pib:16)
[22 Jun 2010 13:10]
Bugs System
Pushed into mysql-next-mr (revid:alik@sun.com-20100622130623-r7yhm89fz9n5t9nb) (version source revid:alik@sun.com-20100622130528-187gd949sa9b6pa6) (pib:16)
[7 Jul 2010 19:20]
Paul DuBois
Noted in 5.5.5 changelog. ALTER TABLE for views is not legal but did not produce an error. (If you need to rename a view, use RENAME TABLE.)