===== mysql-test/r/merge.result 1.74 vs edited ===== --- 1.74/mysql-test/r/merge.result 2008-03-15 22:28:17 +04:00 +++ edited/mysql-test/r/merge.result 2008-05-04 15:36:57 +05:00 @@ -830,7 +830,7 @@ DROP TABLE t1, t2; CREATE TABLE t2(a INT) ENGINE=MERGE UNION=(t3); SELECT * FROM t2; -ERROR 42S02: Table 'test.t3' doesn't exist +ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist DROP TABLE t2; CREATE TABLE t1(a INT, b TEXT); CREATE TABLE tm1(a TEXT, b INT) ENGINE=MERGE UNION=(t1); @@ -895,17 +895,19 @@ drop table t1; CREATE TABLE tm1(a INT) ENGINE=MERGE UNION=(t1, t2); SELECT * FROM tm1; -ERROR 42S02: Table 'test.t1' doesn't exist +ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist CHECK TABLE tm1; Table Op Msg_type Msg_text test.tm1 check Error Table 'test.t1' doesn't exist +test.tm1 check Error Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist test.tm1 check error Corrupt CREATE TABLE t1(a INT); SELECT * FROM tm1; -ERROR 42S02: Table 'test.t2' doesn't exist +ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist CHECK TABLE tm1; Table Op Msg_type Msg_text test.tm1 check Error Table 'test.t2' doesn't exist +test.tm1 check Error Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist test.tm1 check error Corrupt CREATE TABLE t2(a BLOB); SELECT * FROM tm1; @@ -1199,7 +1201,7 @@ 3 RENAME TABLE t2 TO t5; SELECT * FROM t3 ORDER BY c1; -ERROR 42S02: Table 'test.t2' doesn't exist +ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist RENAME TABLE t5 TO t2; SELECT * FROM t3 ORDER BY c1; c1 @@ -1233,7 +1235,7 @@ # 4. Alter table rename. ALTER TABLE t2 RENAME TO t5; SELECT * FROM t3 ORDER BY c1; -ERROR 42S02: Table 'test.t2' doesn't exist +ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist ALTER TABLE t5 RENAME TO t2; SELECT * FROM t3 ORDER BY c1; c1 @@ -1317,7 +1319,7 @@ INSERT INTO t1 VALUES (1); DROP TABLE t1; SELECT * FROM t2; -ERROR 42S02: Table 'test.t1' doesn't exist +ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist SELECT * FROM t1; ERROR 42S02: Table 'test.t1' doesn't exist UNLOCK TABLES; @@ -2006,3 +2008,10 @@ FLUSH TABLES m1, t1; UNLOCK TABLES; DROP TABLE t1, m1; +CREATE TABLE tm1 (c1 INT) ENGINE=MRG_MYISAM UNION=(t1) INSERT_METHOD=FIRST; +SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE +TABLE_SCHEMA = 'test' and TABLE_NAME='tm1'; +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME TABLE_TYPE ENGINE VERSION ROW_FORMAT TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE AUTO_INCREMENT CREATE_TIME UPDATE_TIME CHECK_TIME TABLE_COLLATION CHECKSUM CREATE_OPTIONS TABLE_COMMENT +NULL test tm1 BASE TABLE NULL NULL NULL # # # # # # # # # # NULL # # Unable to open underlying table which is differently defined or of non-MyISAM ty +DROP TABLE tm1; +End of 5.1 tests ===== mysql-test/t/merge.test 1.63 vs edited ===== --- 1.63/mysql-test/t/merge.test 2008-03-15 22:28:17 +04:00 +++ edited/mysql-test/t/merge.test 2008-05-04 15:43:43 +05:00 @@ -456,7 +456,7 @@ SELECT * FROM t2; DROP TABLE t1, t2; CREATE TABLE t2(a INT) ENGINE=MERGE UNION=(t3); ---error ER_NO_SUCH_TABLE +--error 1168 SELECT * FROM t2; DROP TABLE t2; @@ -548,11 +548,11 @@ # CREATE TABLE fails # CREATE TABLE tm1(a INT) ENGINE=MERGE UNION=(t1, t2); ---error ER_NO_SUCH_TABLE +--error 1168 SELECT * FROM tm1; CHECK TABLE tm1; CREATE TABLE t1(a INT); ---error ER_NO_SUCH_TABLE +--error 1168 SELECT * FROM tm1; CHECK TABLE tm1; CREATE TABLE t2(a BLOB); @@ -878,7 +878,7 @@ --echo # 2. Normal rename. SELECT * FROM t3 ORDER BY c1; RENAME TABLE t2 TO t5; ---error ER_NO_SUCH_TABLE +--error 1168 SELECT * FROM t3 ORDER BY c1; RENAME TABLE t5 TO t2; SELECT * FROM t3 ORDER BY c1; @@ -896,7 +896,7 @@ --echo # --echo # 4. Alter table rename. ALTER TABLE t2 RENAME TO t5; ---error ER_NO_SUCH_TABLE +--error 1168 SELECT * FROM t3 ORDER BY c1; ALTER TABLE t5 RENAME TO t2; SELECT * FROM t3 ORDER BY c1; @@ -956,7 +956,7 @@ LOCK TABLES t1 WRITE, t2 WRITE; INSERT INTO t1 VALUES (1); DROP TABLE t1; ---error ER_NO_SUCH_TABLE +--error 1168 SELECT * FROM t2; --error ER_NO_SUCH_TABLE SELECT * FROM t1; @@ -1393,4 +1393,17 @@ FLUSH TABLES m1, t1; UNLOCK TABLES; DROP TABLE t1, m1; + +# +# Bug#35068 - Assertion fails when reading from i_s.tables +# and there is incorrect merge table +# +CREATE TABLE tm1 (c1 INT) ENGINE=MRG_MYISAM UNION=(t1) INSERT_METHOD=FIRST; +--replace_column 8 # 9 # 10 # 11 # 12 # 13 # 14 # 15 # 16 # 17 # 19 # 20 # +SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE +TABLE_SCHEMA = 'test' and TABLE_NAME='tm1'; + +DROP TABLE tm1; + +--echo End of 5.1 tests ===== sql/sql_base.cc 1.441 vs edited ===== --- 1.441/sql/sql_base.cc 2008-03-27 15:54:43 +04:00 +++ edited/sql/sql_base.cc 2008-05-04 15:33:25 +05:00 @@ -527,12 +527,20 @@ "no such table" errors. @todo Rework the alternative ways to deal with ER_NO_SUCH TABLE. */ - if (thd->is_error() && table_list->belong_to_view) + if (thd->is_error()) { - TABLE_LIST *view= table_list->belong_to_view; - thd->clear_error(); - my_error(ER_VIEW_INVALID, MYF(0), - view->view_db.str, view->view_name.str); + if (table_list->parent_l) + { + thd->clear_error(); + my_error(ER_WRONG_MRG_TABLE, MYF(0)); + } + else if (table_list->belong_to_view) + { + TABLE_LIST *view= table_list->belong_to_view; + thd->clear_error(); + my_error(ER_VIEW_INVALID, MYF(0), + view->view_db.str, view->view_name.str); + } } DBUG_RETURN(0); }