List:Commits« Previous MessageNext Message »
From:Mattias Jonsson Date:October 5 2010 10:50am
Subject:bzr push into mysql-trunk-bugfixing branch (mattias.jonsson:3283 to 3285)
View as plain text  
 3285 Mattias Jonsson	2010-10-05
      Pre-push fix

    modified:
      mysql-test/r/not_partition.result
 3284 Mattias Jonsson	2010-10-05 [merge]
      merge

    modified:
      mysql-test/r/partition_exchange.result
      mysql-test/t/partition_exchange.test
      sql/share/errmsg-utf8.txt
      sql/sql_partition_admin.cc
 3283 Alexander Nozdrin	2010-10-02 [merge]
      Auto-merge from mysql-trunk.

=== modified file 'mysql-test/r/not_partition.result'
--- a/mysql-test/r/not_partition.result	2010-08-16 12:53:30 +0000
+++ b/mysql-test/r/not_partition.result	2010-10-05 10:17:45 +0000
@@ -3,7 +3,7 @@ FLUSH TABLES;
 SELECT * FROM t1;
 ERROR 42000: Unknown storage engine 'partition'
 TRUNCATE TABLE t1;
-ERROR 42000: Unknown storage engine 'partition'
+ERROR 42S02: Table 'test.t1' doesn't exist
 ANALYZE TABLE t1;
 Table	Op	Msg_type	Msg_text
 test.t1	analyze	Error	Unknown storage engine 'partition'

=== modified file 'mysql-test/r/partition_exchange.result'
--- a/mysql-test/r/partition_exchange.result	2010-08-04 11:53:45 +0000
+++ b/mysql-test/r/partition_exchange.result	2010-08-25 14:00:02 +0000
@@ -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	2010-08-04 11:53:45 +0000
+++ b/mysql-test/t/partition_exchange.test	2010-08-25 14:00:02 +0000
@@ -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	2010-07-29 14:15:38 +0000
+++ b/sql/share/errmsg-utf8.txt	2010-08-25 14:00:02 +0000
@@ -6387,3 +6387,6 @@ ER_TABLES_DIFFERENT_METADATA
 ER_ROW_DOES_NOT_MATCH_PARTITION
   eng "Found row that does not match the partition"
   swe "Hittade rad som inte passar i partitionen"
+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	2010-08-16 15:07:53 +0000
+++ b/sql/sql_partition_admin.cc	2010-08-25 14:00:02 +0000
@@ -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/mattias.jonsson@oracle.com-20101005101745-8des9p1p4xa4zf2p.bundle
Thread
bzr push into mysql-trunk-bugfixing branch (mattias.jonsson:3283 to 3285) Mattias Jonsson5 Oct