From 23fefc88010a0f1bbb1ac45bf41224b21fbb19c1 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 20 Sep 2006 01:40:59 +0500 Subject: BUG#10974 - No error message if merge table based on union of innodb, memory Fixed confusing error message from the storage engine when it fails to open underlying table. The error message is issued when a table is _opened_ (not when it is created). myisammrg/myrg_open.c: Set my_errno to HA_ERR_WRONG_MRG_TABLE_DEF if attempt to open underlying table failed. mysql-test/r/merge.result: A test case for bug#10974. mysql-test/r/repair.result: Fixed a test case according to patch for bug#10974. mysql-test/t/merge.test: A test case for bug#10974. sql/share/english/errmsg.txt: Better error message if we fail to open underlying table. sql/table.cc: Report error from handler with print_error instead of frm_error. This fixes confusing error message from the handler. Actually this is backported from 5.0. --- mysql-test/r/merge.result | 13 +++++++++++-- mysql-test/r/repair.result | 2 +- mysql-test/t/merge.test | 18 ++++++++++++++++-- 3 files changed, 28 insertions(+), 5 deletions(-) (limited to 'mysql-test') diff --git a/mysql-test/r/merge.result b/mysql-test/r/merge.result index 038ea43cabc..2d0ca55c74a 100644 --- a/mysql-test/r/merge.result +++ b/mysql-test/r/merge.result @@ -178,9 +178,9 @@ t3 CREATE TABLE `t3` ( ) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t1`,`t2`) create table t4 (a int not null, b char(10), key(a)) engine=MERGE UNION=(t1,t2); select * from t4; -ERROR HY000: Can't open file: 't4.MRG' (errno: 143) +ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exists alter table t4 add column c int; -ERROR HY000: Can't open file: 't4.MRG' (errno: 143) +ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exists create database mysqltest; create table mysqltest.t6 (a int not null primary key auto_increment, message char(20)); create table t5 (a int not null, b char(20), key(a)) engine=MERGE UNION=(test.t1,mysqltest.t6); @@ -766,3 +766,12 @@ Table Op Msg_type Msg_text test.t1 check status OK test.t2 check status OK drop table t1, t2, t3; +CREATE TABLE t1(a INT) ENGINE=MEMORY; +CREATE TABLE t2(a INT) ENGINE=MERGE UNION=(t1); +SELECT * FROM t2; +ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exists +DROP TABLE t1, t2; +CREATE TABLE t2(a INT) ENGINE=MERGE UNION=(t3); +SELECT * FROM t2; +ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exists +DROP TABLE t2; diff --git a/mysql-test/r/repair.result b/mysql-test/r/repair.result index e0849452399..c069824e9f0 100644 --- a/mysql-test/r/repair.result +++ b/mysql-test/r/repair.result @@ -31,7 +31,7 @@ create table t1 engine=myisam SELECT 1,"table 1"; flush tables; repair table t1; Table Op Msg_type Msg_text -test.t1 repair error Can't open file: 't1.MYI' (errno: 130) +test.t1 repair error Got error 130 from storage engine repair table t1 use_frm; Table Op Msg_type Msg_text test.t1 repair warning Number of rows changed from 0 to 1 diff --git a/mysql-test/t/merge.test b/mysql-test/t/merge.test index a723443b395..93eda3aad82 100644 --- a/mysql-test/t/merge.test +++ b/mysql-test/t/merge.test @@ -47,9 +47,9 @@ show create table t3; # The following should give errors create table t4 (a int not null, b char(10), key(a)) engine=MERGE UNION=(t1,t2); ---error 1016 +--error 1168 select * from t4; ---error 1016 +--error 1168 alter table t4 add column c int; # @@ -376,4 +376,18 @@ select * from t3; check table t1, t2; drop table t1, t2, t3; +# +# BUG#10974 - No error message if merge table based on union of innodb, +# memory +# +CREATE TABLE t1(a INT) ENGINE=MEMORY; +CREATE TABLE t2(a INT) ENGINE=MERGE UNION=(t1); +--error 1168 +SELECT * FROM t2; +DROP TABLE t1, t2; +CREATE TABLE t2(a INT) ENGINE=MERGE UNION=(t3); +--error 1168 +SELECT * FROM t2; +DROP TABLE t2; + # End of 4.1 tests -- cgit v1.2.1