Bug #4821 Can't drop database after ALTER VIEW
Submitted: 30 Jul 2004 8:58 Modified: 26 Aug 2004 10:51
Reporter: Georg Richter Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:5.0.1 OS:
Assigned to: Oleksandr Byelkin CPU Architecture:Any

[30 Jul 2004 8:58] Georg Richter
Description:
When altering a view via ALTER VIEW it isn't possible to drop the database anymore. 

How to repeat:
mysql> create database test; 
Query OK, 1 row affected (0.00 sec) 
 
mysql> use test; 
Database changed 
 
mysql> create table t1 (a int, b int); 
Query OK, 0 rows affected (0.11 sec) 
 
mysql> create view v1 as select a from t1; 
Query OK, 0 rows affected (0.00 sec) 
 
mysql> alter view v1 as select b from t1; 
Query OK, 0 rows affected (0.00 sec) 
 
mysql> drop database test; 
ERROR 6 (HY000): Error on delete of './test/v1.MYI' (Errcode: 2)
[6 Aug 2004 3:32] MySQL Verification Team
With the latest BK 5.0 the error is different:

mysql> create database test1;
Query OK, 1 row affected (0.01 sec)

mysql> use test1;
Database changed
mysql> create table t1 (a int, b int);
Query OK, 0 rows affected (0.00 sec)

mysql> create view v1 as select a from t1;
Query OK, 0 rows affected (0.01 sec)

mysql> alter view v1 as select b from t1;
Query OK, 0 rows affected (0.01 sec)

mysql> drop database test1;
ERROR 1010 (HY000): Error dropping database (can't rmdir './test1/', errno: 17)

and take a look inside the database directory (there is a directory). I noticed this
behavior on Windows with others versions and not related to the views.

[miguel@light miguel]$ ls /home/miguel/dbs/5.0/var/test1 -la
total 12
drwx------  3 miguel miguel 4096 Aug  5 22:25 .
drwx------  5 miguel miguel 4096 Aug  5 22:23 ..
drwx------  2 miguel miguel 4096 Aug  5 22:25 arc
[25 Aug 2004 14:03] Oleksandr Byelkin
ChangeSet 
  1.1731 04/08/25 14:57:57 bell@sanja.is.com.ua +4 -0 
  removing archive of .frm-s added (BUG#4821)
[26 Aug 2004 10:51] Oleksandr Byelkin
Thank you for bugreport! Bugfix is pushed intounour source repository.