MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Sergey Glukhov Date:October 9 2008 8:55am
Subject:bzr commit into mysql-5.1 branch (Sergey.Glukhov:2771) Bug#35068
View as plain text  
#At file:///home/gluh/MySQL/mysql-5.1-bugteam/

 2771 Sergey Glukhov	2008-10-09
      Bug#35068 Assertion fails when reading from i_s.tables and there is incorrect merge table
      Hide "Table doesn't exist" errors if the table belongs to a merge table.
modified:
  mysql-test/r/merge.result
  mysql-test/t/merge.test
  sql/sql_base.cc

per-file messages:
  mysql-test/r/merge.result
    result fix
  mysql-test/t/merge.test
    test case
  sql/sql_base.cc
    Hide "Table doesn't exist" errors if the table belongs to a merge table.
=== modified file 'mysql-test/r/merge.result'
--- a/mysql-test/r/merge.result	2008-04-25 21:45:58 +0000
+++ b/mysql-test/r/merge.result	2008-10-09 08:55:16 +0000
@@ -830,7 +830,7 @@ ERROR HY000: Unable to open underlying t
 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 t2;
 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 @@ c1
 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 @@ UNLOCK TABLES;
 # 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 @@ LOCK TABLES t1 WRITE, t2 WRITE;
 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,6 +2008,13 @@ test.t1	optimize	status	OK
 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
 CREATE TABLE t1(C1 INT, C2 INT, KEY C1(C1), KEY C2(C2)) ENGINE=MYISAM;
 CREATE TABLE t2(C1 INT, C2 INT, KEY C1(C1), KEY C2(C2)) ENGINE=MYISAM;
 CREATE TABLE t3(C1 INT, C2 INT, KEY C1(C1), KEY C2(C2)) ENGINE=MYISAM;

=== modified file 'mysql-test/t/merge.test'
--- a/mysql-test/t/merge.test	2008-06-03 11:25:41 +0000
+++ b/mysql-test/t/merge.test	2008-10-09 08:55:16 +0000
@@ -456,7 +456,7 @@ CREATE TABLE t2(a INT) ENGINE=MERGE UNIO
 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 @@ drop table t1;
 #             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 @@ DROP TABLE t4;
 --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 @@ UNLOCK TABLES;
 --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 @@ CREATE TABLE t2 (c1 INT, INDEX(c1)) ENGI
 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;
@@ -1395,6 +1395,19 @@ 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
+
+#
 # Bug#36006 - Optimizer does table scan for select count(*)
 #
 CREATE TABLE t1(C1 INT, C2 INT, KEY C1(C1), KEY C2(C2)) ENGINE=MYISAM;

=== modified file 'sql/sql_base.cc'
--- a/sql/sql_base.cc	2008-10-03 11:16:58 +0000
+++ b/sql/sql_base.cc	2008-10-09 08:55:16 +0000
@@ -489,12 +489,20 @@ static TABLE_SHARE
       "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);
   }

Thread
bzr commit into mysql-5.1 branch (Sergey.Glukhov:2771) Bug#35068Sergey Glukhov9 Oct