Bug #5158 Views: Alter table returns cryptic error message
Submitted: 23 Aug 2004 1:39 Modified: 24 Aug 2004 22:18
Reporter: Peter Gulutzan Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0.2-alpha-debug OS:Linux (SuSE 8.2)
Assigned to: Assigned Account CPU Architecture:Any

[23 Aug 2004 1:39] Peter Gulutzan
Description:
If one creates a view based on a single underlying table, 
then tries to use "ALTER TABLE" on the view, there's an 
error. But MySQL returns the following cryptic error message: 
ERROR 4 (HY000): Error on close of 'UNOPENED' (Errcode: 9) 
It should be: 
You can't say ALTER TABLE for a view 
See also BUG#4606. 

How to repeat:
mysql> create table t (col1 int); 
Query OK, 0 rows affected (0.33 sec) 
 
mysql> create view v as select * from t; 
Query OK, 0 rows affected (0.00 sec) 
 
mysql> alter table v modify col1 smallint; 
ERROR 4 (HY000): Error on close of 'UNOPENED' (Errcode: 9)
[24 Aug 2004 22:18] Oleksandr Byelkin
Thank you for bug report, but this bug has the same cause with BUG#4606 
Now it is fixed: 
+ create table t (col1 int); 
+ create view v as select * from t; 
+ alter table v modify col1 smallint; 
+ ERROR HY000: 'test.v' is not BASIC TABLE