Bug #45799 please allow viewing merge table structure even if there are errors with usage
Submitted: 27 Jun 2009 10:33
Reporter: Shane Bester (Platinum Quality Contributor) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Merge storage engine Severity:S4 (Feature request)
Version:5.1.37 OS:Any
Assigned to: CPU Architecture:Any

[27 Jun 2009 10:33] Shane Bester
Description:
feature request: it would be useful to be able to see the structure of m1, even though it is unusable due to incorrect definition:

mysql> create table t1(id int)engine=myisam;
Query OK, 0 rows affected (0.01 sec)

mysql> create table m1(id bigint)engine=merge union=(t1);
Query OK, 0 rows affected (0.05 sec)

mysql> show create table m1;
ERROR 1168 (HY000): Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist

rational: you can see a view's structure even if the view is unusable due
to missing tables:

flush tables;
drop table if exists m1,t1;
create table t1(id int)engine=myisam;
create or replace view v1 as select * from t1;
show create view v1;
drop table if exists t1;
show create view v1;

How to repeat:
flush tables;
drop table if exists m1,t1;
create table t1(id int)engine=myisam;
create table m1(id bigint)engine=merge union=(t1);
show create table m1;

Suggested fix:
make the behaviour consistent with faulty view handling.  print the structure, and a warning if the merge table is really faulty.

as a workaround, just recreate the merge table;

drop table m1;
create table m1 like t1;
alter table m1 engine=merge union=(t1);
check table m1;
[14 Sep 2011 6:57] MySQL Verification Team
you can see the merge base tables by opening m1.MRG in a text editor.