Below is the list of changes that have just been committed into a local
5.1 repository of istruewing. When istruewing does a push these changes
will be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet@stripped, 2008-03-18 19:37:57+01:00, istruewing@stripped +5 -0
Bug#35068 - Assertion fails when reading from i_s.tables
and there is incorrect merge table
SELECT * on INFORMATION_SCHEMA.TABLES crashed the server when
a MERGE table included a non-existent MyISAM table.
The MERGE table adds its children to the table list so that
open_tables() opens them too. If a child cannot be opened,
open_tables() returns with the open MERGE table and opened
MyISAM tables as far as they could be opened. However, the
returned error message was ER_NO_SUCH_TABLE.
get_all_tables() from information schema assumes that it opens
one table at a time. If it cannot be opened, and the error is
ER_NO_SUCH_TABLE, it assumes that no table needs to be closed.
Fixed error handling for MERGE tables in open_tables(). If
open_tables() failes due to an open error of a child, it converts
the error to ER_ADMIN_WRONG_MRG_TABLE. This does also improve
the diagnosis in other cases.
mysql-test/r/merge.result@stripped, 2008-03-18 19:37:54+01:00, istruewing@stripped +29
-21
Bug#35068 - Assertion fails when reading from i_s.tables
and there is incorrect merge table
Fixed test results.
Added test result.
mysql-test/r/merge_innodb.result@stripped, 2008-03-18 19:37:54+01:00, istruewing@stripped
+5 -5
Bug#35068 - Assertion fails when reading from i_s.tables
and there is incorrect merge table
Fixed test results.
mysql-test/t/merge.test@stripped, 2008-03-18 19:37:54+01:00, istruewing@stripped +30 -21
Bug#35068 - Assertion fails when reading from i_s.tables
and there is incorrect merge table
Fixed tests.
Added test.
mysql-test/t/merge_innodb.test@stripped, 2008-03-18 19:37:54+01:00, istruewing@stripped
+5 -5
Bug#35068 - Assertion fails when reading from i_s.tables
and there is incorrect merge table
Fixed tests.
sql/sql_base.cc@stripped, 2008-03-18 19:37:54+01:00, istruewing@stripped +15 -4
Bug#35068 - Assertion fails when reading from i_s.tables
and there is incorrect merge table
Fixed error handling for MERGE tables in open_tables().
diff -Nrup a/mysql-test/r/merge.result b/mysql-test/r/merge.result
--- a/mysql-test/r/merge.result 2008-03-14 21:24:06 +01:00
+++ b/mysql-test/r/merge.result 2008-03-18 19:37:54 +01:00
@@ -178,12 +178,12 @@ 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: Unable to open underlying table which is differently defined or of
non-MyISAM type or doesn't exist
+ERROR HY000: Table 't2' is differently defined or of non-MyISAM type or doesn't exist
alter table t4 add column c int;
-ERROR HY000: Unable to open underlying table which is differently defined or of
non-MyISAM type or doesn't exist
+ERROR HY000: Table 't2' is differently defined or of non-MyISAM type or doesn't exist
flush tables;
select * from t4;
-ERROR HY000: Unable to open underlying table which is differently defined or of
non-MyISAM type or doesn't exist
+ERROR HY000: Table 't2' is differently defined or of non-MyISAM type or doesn't exist
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);
@@ -584,7 +584,7 @@ insert into t1 values (1);
insert into t2 values (2);
create temporary table t3 (a int not null) ENGINE=MERGE UNION=(t1,t2);
select * from t3;
-ERROR HY000: Unable to open underlying table which is differently defined or of
non-MyISAM type or doesn't exist
+ERROR HY000: Table 't2' is differently defined or of non-MyISAM type or doesn't exist
create temporary table t4 (a int not null);
create temporary table t5 (a int not null);
insert into t4 values (1);
@@ -601,7 +601,7 @@ insert into t1 values (1);
insert into t2 values (2);
create table t3 (a int not null) ENGINE=MERGE UNION=(t1,t2);
select * from t3;
-ERROR HY000: Unable to open underlying table which is differently defined or of
non-MyISAM type or doesn't exist
+ERROR HY000: Table 't2' is differently defined or of non-MyISAM type or doesn't exist
drop table t3, t2, t1;
create table t1 (a int not null);
create temporary table t2 (a int not null);
@@ -609,11 +609,11 @@ insert into t1 values (1);
insert into t2 values (2);
create table t3 (a int not null) ENGINE=MERGE UNION=(t1,t2);
select * from t3;
-ERROR HY000: Unable to open underlying table which is differently defined or of
non-MyISAM type or doesn't exist
+ERROR HY000: Table 't2' is differently defined or of non-MyISAM type or doesn't exist
drop table t3;
create temporary table t3 (a int not null) ENGINE=MERGE UNION=(t1,t2);
select * from t3;
-ERROR HY000: Unable to open underlying table which is differently defined or of
non-MyISAM type or doesn't exist
+ERROR HY000: Table 't2' is differently defined or of non-MyISAM type or doesn't exist
drop table t3, t2, t1;
# CREATE...SELECT is not implemented for MERGE tables.
CREATE TEMPORARY TABLE t1 (c1 INT NOT NULL);
@@ -821,36 +821,36 @@ CREATE TABLE t1(a INT);
INSERT INTO t1 VALUES(2),(1);
CREATE TABLE t2(a INT, KEY(a)) ENGINE=MERGE UNION=(t1);
SELECT * FROM t2 WHERE a=2;
-ERROR HY000: Unable to open underlying table which is differently defined or of
non-MyISAM type or doesn't exist
+ERROR HY000: Table 't1' is differently defined or of non-MyISAM type or doesn't exist
DROP TABLE t1, t2;
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 exist
+ERROR HY000: Table 't1' is differently defined or of non-MyISAM type or doesn't exist
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: Table 't3' 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);
SELECT * FROM tm1;
-ERROR HY000: Unable to open underlying table which is differently defined or of
non-MyISAM type or doesn't exist
+ERROR HY000: Table 't1' is differently defined or of non-MyISAM type or doesn't exist
DROP TABLE t1, tm1;
CREATE TABLE t1(a SMALLINT, b SMALLINT);
CREATE TABLE tm1(a INT) ENGINE=MERGE UNION=(t1);
SELECT * FROM tm1;
-ERROR HY000: Unable to open underlying table which is differently defined or of
non-MyISAM type or doesn't exist
+ERROR HY000: Table 't1' is differently defined or of non-MyISAM type or doesn't exist
DROP TABLE t1, tm1;
CREATE TABLE t1(a SMALLINT, b SMALLINT, KEY(a, b));
CREATE TABLE tm1(a SMALLINT, b SMALLINT, KEY(a)) ENGINE=MERGE UNION=(t1);
SELECT * FROM tm1;
-ERROR HY000: Unable to open underlying table which is differently defined or of
non-MyISAM type or doesn't exist
+ERROR HY000: Table 't1' is differently defined or of non-MyISAM type or doesn't exist
DROP TABLE t1, tm1;
CREATE TABLE t1(a SMALLINT, b SMALLINT, KEY(b));
CREATE TABLE tm1(a SMALLINT, b SMALLINT, KEY(a)) ENGINE=MERGE UNION=(t1);
SELECT * FROM tm1;
-ERROR HY000: Unable to open underlying table which is differently defined or of
non-MyISAM type or doesn't exist
+ERROR HY000: Table 't1' is differently defined or of non-MyISAM type or doesn't exist
DROP TABLE t1, tm1;
CREATE TABLE t1(c1 VARCHAR(1));
CREATE TABLE m1 LIKE t1;
@@ -895,25 +895,28 @@ 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: Table 't1' 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 Table 't1' 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: Table 't2' 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 Table 't2' 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;
-ERROR HY000: Unable to open underlying table which is differently defined or of
non-MyISAM type or doesn't exist
+ERROR HY000: Table 't2' 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' is differently defined or of non-MyISAM type or
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 Table 't2' is differently defined or of non-MyISAM type or doesn't
exist
test.tm1 check error Corrupt
ALTER TABLE t2 MODIFY a INT;
SELECT * FROM tm1;
@@ -1199,7 +1202,7 @@ c1
3
RENAME TABLE t2 TO t5;
SELECT * FROM t3 ORDER BY c1;
-ERROR 42S02: Table 'test.t2' doesn't exist
+ERROR HY000: Table 't2' 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 +1236,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: Table 't2' 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 +1320,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: Table 't1' 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;
@@ -1972,7 +1975,7 @@ c1 c2
ALTER TABLE t1 ENGINE= MEMORY;
INSERT INTO t1 VALUES (0, 0);
SELECT * FROM t3;
-ERROR HY000: Unable to open underlying table which is differently defined or of
non-MyISAM type or doesn't exist
+ERROR HY000: Table 't2' is differently defined or of non-MyISAM type or doesn't exist
DROP TABLE t1, t2, t3;
CREATE TABLE t1 (c1 INT, KEY(c1));
CREATE TABLE t2 (c1 INT, KEY(c1)) ENGINE=MRG_MYISAM UNION=(t1)
@@ -2006,3 +2009,8 @@ test.t1 optimize status OK
FLUSH TABLES m1, t1;
UNLOCK TABLES;
DROP TABLE t1, m1;
+CREATE TABLE m1 (c1 INT) ENGINE=MRG_MYISAM UNION=(t1) INSERT_METHOD=FIRST;
+SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'test';
+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 m1 BASE TABLE NULL NULL NULL # # # # # # # # # # NULL # # Table 't1' is
differently defined or of non-MyISAM type or doesn't exist
+DROP TABLE m1;
diff -Nrup a/mysql-test/r/merge_innodb.result b/mysql-test/r/merge_innodb.result
--- a/mysql-test/r/merge_innodb.result 2007-11-30 15:16:30 +01:00
+++ b/mysql-test/r/merge_innodb.result 2008-03-18 19:37:54 +01:00
@@ -10,7 +10,7 @@ INSERT_METHOD=LAST;
CREATE TABLE t5 (c1 varchar(100)) ENGINE=MRG_MYISAM UNION=(t1,t3)
INSERT_METHOD=LAST;
SELECT * FROM t5;
-ERROR HY000: Unable to open underlying table which is differently defined or of
non-MyISAM type or doesn't exist
+ERROR HY000: Table 't3' is differently defined or of non-MyISAM type or doesn't exist
SELECT * FROM t4;
c1
Ann
@@ -19,14 +19,14 @@ Bob
Brian
ALTER TABLE t2 ENGINE=InnoDB;
SELECT * FROM t4;
-ERROR HY000: Unable to open underlying table which is differently defined or of
non-MyISAM type or doesn't exist
+ERROR HY000: Table 't2' is differently defined or of non-MyISAM type or doesn't exist
DELETE FROM t2 LIMIT 1;
SELECT * FROM t4;
-ERROR HY000: Unable to open underlying table which is differently defined or of
non-MyISAM type or doesn't exist
+ERROR HY000: Table 't2' is differently defined or of non-MyISAM type or doesn't exist
INSERT INTO t4 VALUES ('Beware');
-ERROR HY000: Unable to open underlying table which is differently defined or of
non-MyISAM type or doesn't exist
+ERROR HY000: Table 't2' is differently defined or of non-MyISAM type or doesn't exist
SELECT * FROM t4;
-ERROR HY000: Unable to open underlying table which is differently defined or of
non-MyISAM type or doesn't exist
+ERROR HY000: Table 't2' is differently defined or of non-MyISAM type or doesn't exist
SELECT * FROM t2;
c1
Brian
diff -Nrup a/mysql-test/t/merge.test b/mysql-test/t/merge.test
--- a/mysql-test/t/merge.test 2008-03-14 16:57:59 +01:00
+++ b/mysql-test/t/merge.test 2008-03-18 19:37:54 +01:00
@@ -47,12 +47,12 @@ 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 1168
+--error ER_ADMIN_WRONG_MRG_TABLE
select * from t4;
---error 1168
+--error ER_ADMIN_WRONG_MRG_TABLE
alter table t4 add column c int;
flush tables;
---error 1168
+--error ER_ADMIN_WRONG_MRG_TABLE
select * from t4;
#
@@ -221,7 +221,7 @@ create table t2 (a int not null);
insert into t1 values (1);
insert into t2 values (2);
create temporary table t3 (a int not null) ENGINE=MERGE UNION=(t1,t2);
---error ER_WRONG_MRG_TABLE
+--error ER_ADMIN_WRONG_MRG_TABLE
select * from t3;
create temporary table t4 (a int not null);
create temporary table t5 (a int not null);
@@ -240,7 +240,7 @@ create temporary table t2 (a int not nul
insert into t1 values (1);
insert into t2 values (2);
create table t3 (a int not null) ENGINE=MERGE UNION=(t1,t2);
---error ER_WRONG_MRG_TABLE
+--error ER_ADMIN_WRONG_MRG_TABLE
select * from t3;
drop table t3, t2, t1;
# Forbid children mismatch in temporary:
@@ -249,11 +249,11 @@ create temporary table t2 (a int not nul
insert into t1 values (1);
insert into t2 values (2);
create table t3 (a int not null) ENGINE=MERGE UNION=(t1,t2);
---error ER_WRONG_MRG_TABLE
+--error ER_ADMIN_WRONG_MRG_TABLE
select * from t3;
drop table t3;
create temporary table t3 (a int not null) ENGINE=MERGE UNION=(t1,t2);
---error ER_WRONG_MRG_TABLE
+--error ER_ADMIN_WRONG_MRG_TABLE
select * from t3;
drop table t3, t2, t1;
--echo # CREATE...SELECT is not implemented for MERGE tables.
@@ -442,7 +442,7 @@ drop table t1, t2, t3;
CREATE TABLE t1(a INT);
INSERT INTO t1 VALUES(2),(1);
CREATE TABLE t2(a INT, KEY(a)) ENGINE=MERGE UNION=(t1);
---error 1168
+--error ER_ADMIN_WRONG_MRG_TABLE
SELECT * FROM t2 WHERE a=2;
DROP TABLE t1, t2;
@@ -452,11 +452,11 @@ DROP TABLE t1, t2;
#
CREATE TABLE t1(a INT) ENGINE=MEMORY;
CREATE TABLE t2(a INT) ENGINE=MERGE UNION=(t1);
---error 1168
+--error ER_ADMIN_WRONG_MRG_TABLE
SELECT * FROM t2;
DROP TABLE t1, t2;
CREATE TABLE t2(a INT) ENGINE=MERGE UNION=(t3);
---error ER_NO_SUCH_TABLE
+--error ER_ADMIN_WRONG_MRG_TABLE
SELECT * FROM t2;
DROP TABLE t2;
@@ -465,25 +465,25 @@ DROP TABLE t2;
#
CREATE TABLE t1(a INT, b TEXT);
CREATE TABLE tm1(a TEXT, b INT) ENGINE=MERGE UNION=(t1);
---error 1168
+--error ER_ADMIN_WRONG_MRG_TABLE
SELECT * FROM tm1;
DROP TABLE t1, tm1;
CREATE TABLE t1(a SMALLINT, b SMALLINT);
CREATE TABLE tm1(a INT) ENGINE=MERGE UNION=(t1);
---error 1168
+--error ER_ADMIN_WRONG_MRG_TABLE
SELECT * FROM tm1;
DROP TABLE t1, tm1;
CREATE TABLE t1(a SMALLINT, b SMALLINT, KEY(a, b));
CREATE TABLE tm1(a SMALLINT, b SMALLINT, KEY(a)) ENGINE=MERGE UNION=(t1);
---error 1168
+--error ER_ADMIN_WRONG_MRG_TABLE
SELECT * FROM tm1;
DROP TABLE t1, tm1;
CREATE TABLE t1(a SMALLINT, b SMALLINT, KEY(b));
CREATE TABLE tm1(a SMALLINT, b SMALLINT, KEY(a)) ENGINE=MERGE UNION=(t1);
---error 1168
+--error ER_ADMIN_WRONG_MRG_TABLE
SELECT * FROM tm1;
DROP TABLE t1, tm1;
@@ -548,15 +548,15 @@ drop table t1;
# CREATE TABLE fails
#
CREATE TABLE tm1(a INT) ENGINE=MERGE UNION=(t1, t2);
---error ER_NO_SUCH_TABLE
+--error ER_ADMIN_WRONG_MRG_TABLE
SELECT * FROM tm1;
CHECK TABLE tm1;
CREATE TABLE t1(a INT);
---error ER_NO_SUCH_TABLE
+--error ER_ADMIN_WRONG_MRG_TABLE
SELECT * FROM tm1;
CHECK TABLE tm1;
CREATE TABLE t2(a BLOB);
---error 1168
+--error ER_ADMIN_WRONG_MRG_TABLE
SELECT * FROM tm1;
CHECK TABLE tm1;
ALTER TABLE t2 MODIFY a INT;
@@ -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 ER_ADMIN_WRONG_MRG_TABLE
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 ER_ADMIN_WRONG_MRG_TABLE
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 ER_ADMIN_WRONG_MRG_TABLE
SELECT * FROM t2;
--error ER_NO_SUCH_TABLE
SELECT * FROM t1;
@@ -1354,7 +1354,7 @@ SELECT * FROM t3;
ALTER TABLE t1 ENGINE= MEMORY;
INSERT INTO t1 VALUES (0, 0);
# Before fixing, this succeeded, but (0, 0) was missing.
---error 1168
+--error ER_ADMIN_WRONG_MRG_TABLE
SELECT * FROM t3;
DROP TABLE t1, t2, t3;
@@ -1393,4 +1393,13 @@ OPTIMIZE TABLE t1;
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 m1 (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';
+DROP TABLE m1;
diff -Nrup a/mysql-test/t/merge_innodb.test b/mysql-test/t/merge_innodb.test
--- a/mysql-test/t/merge_innodb.test 2007-11-30 15:16:30 +01:00
+++ b/mysql-test/t/merge_innodb.test 2008-03-18 19:37:54 +01:00
@@ -22,18 +22,18 @@ CREATE TABLE t4 (c1 varchar(100)) ENGINE
INSERT_METHOD=LAST;
CREATE TABLE t5 (c1 varchar(100)) ENGINE=MRG_MYISAM UNION=(t1,t3)
INSERT_METHOD=LAST;
---error ER_WRONG_MRG_TABLE
+--error ER_ADMIN_WRONG_MRG_TABLE
SELECT * FROM t5;
SELECT * FROM t4;
ALTER TABLE t2 ENGINE=InnoDB;
---error ER_WRONG_MRG_TABLE
+--error ER_ADMIN_WRONG_MRG_TABLE
SELECT * FROM t4;
DELETE FROM t2 LIMIT 1;
---error ER_WRONG_MRG_TABLE
+--error ER_ADMIN_WRONG_MRG_TABLE
SELECT * FROM t4;
---error ER_WRONG_MRG_TABLE
+--error ER_ADMIN_WRONG_MRG_TABLE
INSERT INTO t4 VALUES ('Beware');
---error ER_WRONG_MRG_TABLE
+--error ER_ADMIN_WRONG_MRG_TABLE
SELECT * FROM t4;
SELECT * FROM t2;
SELECT * FROM t1;
diff -Nrup a/sql/sql_base.cc b/sql/sql_base.cc
--- a/sql/sql_base.cc 2008-03-12 09:13:21 +01:00
+++ b/sql/sql_base.cc 2008-03-18 19:37:54 +01:00
@@ -4660,13 +4660,24 @@ process_view_routines:
if (result && tables)
{
/*
- Some functions determine success as (tables->table != NULL).
- tables->table is in thd->open_tables. It won't go lost. If the
- error happens on a MERGE child, clear the parents TABLE reference.
+ Some functions (e.g. mysql_admin_table()) determine success as
+ (tables->table != NULL). tables->table is in thd->open_tables. It
+ won't go lost.
+ */
+ tables->table= NULL;
+ /*
+ If the error happened on a MERGE child, clear the parents TABLE
+ reference. Also change the error message. If it was
+ ER_NO_SUCH_TABLE, get_all_tables() (Information Schema) would
+ assume that no table was opened and thus forget to close the merge
+ table.
*/
if (tables->parent_l)
+ {
tables->parent_l->table= NULL;
- tables->table= NULL;
+ thd->clear_error();
+ my_error(ER_ADMIN_WRONG_MRG_TABLE, MYF(0), tables->table_name);
+ }
}
DBUG_PRINT("tcache", ("returning: %d", result));
DBUG_RETURN(result);