#At file:///usr/local/devel/bzrroot/server/mysql-trunk-innodb/ based on revid:vasil.dimov@stripped
3258 Vasil Dimov 2010-10-19 [merge]
Merge mysql-trunk-bugfixing -> mysql-trunk-innodb
modified:
mysql-test/r/partition_exchange.result
mysql-test/t/partition_exchange.test
sql/share/errmsg-utf8.txt
sql/sql_partition_admin.cc
=== modified file 'mysql-test/r/partition_exchange.result'
--- a/mysql-test/r/partition_exchange.result revid:vasil.dimov@stripped
+++ b/mysql-test/r/partition_exchange.result revid:vasil.dimov@stripped
@@ -1,3 +1,16 @@
+DROP TABLE IF EXISTS t1, t2, t3, t, tp, tsp, tmp;
+CREATE TABLE t1 (s1 INT PRIMARY KEY) engine=innodb;
+CREATE TABLE t2 (s1 INT, FOREIGN KEY (s1) REFERENCES t1 (s1)) engine=innodb;
+INSERT INTO t1 VALUES (1),(2),(3);
+INSERT INTO t2 VALUES (1),(2),(3);
+CREATE TABLE t3 (s1 INT PRIMARY KEY)
+engine=innodb
+PARTITION BY LIST (s1)
+(PARTITION p1 VALUES IN (1,2,3));
+ALTER TABLE t3 EXCHANGE PARTITION p1 WITH TABLE t1;
+ERROR HY000: Table to exchange with partition have foreign key references: 't1'
+DROP TABLE t2, t1, t3;
+# Tests for WL#4445
CREATE TABLE t (a INT,
b VARCHAR(55),
PRIMARY KEY (a))
=== modified file 'mysql-test/t/partition_exchange.test'
--- a/mysql-test/t/partition_exchange.test revid:vasil.dimov@stripped
+++ b/mysql-test/t/partition_exchange.test revid:vasil.dimov@stripped
@@ -1,5 +1,29 @@
--source include/have_innodb.inc
--source include/have_partition.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1, t2, t3, t, tp, tsp, tmp;
+--enable_warnings
+
+CREATE TABLE t1 (s1 INT PRIMARY KEY) engine=innodb;
+
+CREATE TABLE t2 (s1 INT, FOREIGN KEY (s1) REFERENCES t1 (s1)) engine=innodb;
+
+INSERT INTO t1 VALUES (1),(2),(3);
+
+INSERT INTO t2 VALUES (1),(2),(3);
+
+CREATE TABLE t3 (s1 INT PRIMARY KEY)
+ engine=innodb
+ PARTITION BY LIST (s1)
+ (PARTITION p1 VALUES IN (1,2,3));
+
+--error ER_PARTITION_EXCHANGE_FOREIGN_KEY
+ALTER TABLE t3 EXCHANGE PARTITION p1 WITH TABLE t1;
+
+DROP TABLE t2, t1, t3;
+
+--echo # Tests for WL#4445
CREATE TABLE t (a INT,
b VARCHAR(55),
PRIMARY KEY (a))
=== modified file 'sql/share/errmsg-utf8.txt'
--- a/sql/share/errmsg-utf8.txt revid:vasil.dimov@stripped
+++ b/sql/share/errmsg-utf8.txt revid:vasil.dimov@stripped
@@ -6433,3 +6433,6 @@ ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE_MI
ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE_MAX
eng "The requested value for the heartbeat period exceeds the value of `slave_net_timeout' seconds. A sensible value for the period should be less than the timeout."
+ER_PARTITION_EXCHANGE_FOREIGN_KEY
+ eng "Table to exchange with partition have foreign key references: '%-.64s'"
+ swe "Tabellen att byta ut mot partition har foreign key referenser: '%-.64s'"
=== modified file 'sql/sql_partition_admin.cc'
--- a/sql/sql_partition_admin.cc revid:vasil.dimov@stripped
+++ b/sql/sql_partition_admin.cc revid:vasil.dimov@stripped
@@ -145,6 +145,14 @@ static bool check_exchange_partition(TAB
table->s->table_name.str);
DBUG_RETURN(TRUE);
}
+
+ /* The table cannot have foreign keys constraints or be referenced */
+ if(!table->file->can_switch_engines())
+ {
+ my_error(ER_PARTITION_EXCHANGE_FOREIGN_KEY, MYF(0),
+ table->s->table_name.str);
+ DBUG_RETURN(TRUE);
+ }
DBUG_RETURN(FALSE);
}
Attachment: [text/bzr-bundle] bzr/vasil.dimov@oracle.com-20101019115943-7aukv9ylajbzaxtp.bundle
| Thread |
|---|
| • bzr commit into mysql-trunk-innodb branch (vasil.dimov:3258) | vasil.dimov | 19 Oct |