Bug #4606 Views: Index creation returns cryptic error message
Submitted: 18 Jul 2004 23:01 Modified: 25 Aug 2004 8:56
Reporter: Trudy Pelzer Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0.1-alpha-debug OS:Linux (SuSE 8.2)
Assigned to: Oleksandr Byelkin CPU Architecture:Any

[18 Jul 2004 23:01] Trudy Pelzer
Description:
If one creates a view (e.g. vt1) based on a single underlying table (e.g. t1), then tries to create an index on the view, MySQL returns the following cryptic error message:
ERROR 4 (HY000): Error on close of 'UNOPENED' (Errcode: 9)

Normally, views do  not have indexes -- operations on views utilize the indexes of the underlying table(s). So the error message should either say something like: "Indexes not allowed on views", or the message returned should tell the user what the real problem is.

How to repeat:
create table t1 (col1 int,col2 char(22));
create view vt1 as select * from t1;
create index i1 on vt1 (col1);
[19 Jul 2004 19:09] Aleksey Kishkin
tested on slackware 9
[24 Aug 2004 14:39] Oleksandr Byelkin
ChangeSet 
  1.1728 04/08/24 15:37:51 bell@sanja.is.com.ua +5 -0 
  sending right error message where VIEW is not expected (BUG#4606)
[25 Aug 2004 8:56] Oleksandr Byelkin
Thank you for bug report. Bugfix is pushed in our source repository.