#At file:///home/alik/MySQL/bzr/00/bug27480/mysql-trunk-bug27480/ based on revid:alexander.nozdrin@stripped
3528 Alexander Nozdrin 2011-02-15
Follow-up patch for Bug#27480.
Report error if 'table' field is NULL in merge-child-table_list.
modified:
mysql-test/r/merge.result
mysql-test/t/merge.test
storage/myisammrg/ha_myisammrg.cc
=== modified file 'mysql-test/r/merge.result'
--- a/mysql-test/r/merge.result 2011-01-17 16:27:07 +0000
+++ b/mysql-test/r/merge.result 2011-02-15 18:21:37 +0000
@@ -3750,4 +3750,19 @@ checksum table m1;
Table Checksum
test.m1 3459908756
drop tables t1, m1;
+DROP TABLE IF EXISTS t1;
+DROP TABLE IF EXISTS m1;
+DROP TRIGGER IF EXISTS trg1;
+DROP TABLE IF EXISTS q1;
+DROP TABLE IF EXISTS q2;
+CREATE TABLE t1(a INT);
+CREATE TABLE m1(a INT) ENGINE = MERGE UNION (q1, q2);
+CREATE TRIGGER trg1 BEFORE DELETE ON t1
+FOR EACH ROW
+INSERT INTO m1 VALUES (1);
+DELETE FROM t1;
+ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
+DROP TRIGGER trg1;
+DROP TABLE t1;
+DROP TABLE m1;
End of 6.0 tests
=== modified file 'mysql-test/t/merge.test'
--- a/mysql-test/t/merge.test 2011-01-17 16:27:07 +0000
+++ b/mysql-test/t/merge.test 2011-02-15 18:21:37 +0000
@@ -2851,6 +2851,30 @@ repair table m1;
checksum table m1;
drop tables t1, m1;
+# Check effect of Bug#27480-preliminary patch:
+# a merge-table with non-existing children, opened from a prelocked list.
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+DROP TABLE IF EXISTS m1;
+DROP TRIGGER IF EXISTS trg1;
+DROP TABLE IF EXISTS q1;
+DROP TABLE IF EXISTS q2;
+--enable_warnings
+
+CREATE TABLE t1(a INT);
+CREATE TABLE m1(a INT) ENGINE = MERGE UNION (q1, q2);
+
+CREATE TRIGGER trg1 BEFORE DELETE ON t1
+FOR EACH ROW
+ INSERT INTO m1 VALUES (1);
+
+--error ER_WRONG_MRG_TABLE
+DELETE FROM t1;
+
+DROP TRIGGER trg1;
+DROP TABLE t1;
+DROP TABLE m1;
--echo End of 6.0 tests
=== modified file 'storage/myisammrg/ha_myisammrg.cc'
--- a/storage/myisammrg/ha_myisammrg.cc 2011-01-17 16:27:07 +0000
+++ b/storage/myisammrg/ha_myisammrg.cc 2011-02-15 18:21:37 +0000
@@ -626,6 +626,13 @@ extern "C" MI_INFO *myisammrg_attach_chi
goto end;
}
child= child_l->table;
+
+ if (!child)
+ {
+ DBUG_PRINT("myrg", ("Child table does not exist"));
+ my_errno= HA_ERR_WRONG_MRG_TABLE_DEF;
+ goto end;
+ }
/* Prepare for next child. */
param->next();
Attachment: [text/bzr-bundle] bzr/alexander.nozdrin@oracle.com-20110215182137-9mzw9f7mhqc4el2x.bundle
| Thread |
|---|
| • bzr commit into mysql-trunk branch (alexander.nozdrin:3528) Bug#27480 | Alexander Nozdrin | 15 Feb |