List:Commits« Previous MessageNext Message »
From:Mattias Jonsson Date:October 5 2010 10:50am
Subject:bzr push into mysql-next-mr-bugfixing branch (mattias.jonsson:3314 to 3316)
View as plain text  
 3316 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
 3315 Mattias Jonsson	2010-10-05 [merge]
      merge

    modified:
      mysql-test/r/not_partition.result
      sql/sql_partition_admin.h
 3314 Tor Didriksen	2010-10-04 [merge]
      Automerge from next-mr-opt-team

    modified:
      mysql-test/r/join_cache_jcl2.result
      mysql-test/r/join_cache_jcl3.result
      mysql-test/r/join_cache_jcl4.result
      mysql-test/r/order_by_icp_mrr.result
      mysql-test/r/select_all_jcl6.result
      mysql-test/r/select_icp_mrr.result
      mysql-test/r/select_icp_mrr_jcl6.result
      mysql-test/r/select_none_jcl6.result
      mysql-test/r/subquery_all_jcl6.result
      mysql-test/r/subquery_nomat_nosj.result
      mysql-test/r/subquery_nomat_nosj_jcl6.result
      mysql-test/r/subquery_none_jcl6.result
      sql/sql_select.cc
      sql/sql_select.h
=== 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:31:55 +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'
@@ -50,7 +50,7 @@ ERROR HY000: The 'partitioning' feature 
 ALTER TABLE t1 PARTITION BY KEY(joined) PARTITIONS 2;
 ERROR HY000: The 'partitioning' feature is disabled; you need MySQL built with '--with-plugin-partition' to have it working
 drop table t1;
-ERROR 42S02: Unknown table 't1'
+ERROR 42S02: Unknown table 'test.t1'
 CREATE TABLE t1 (
 firstname VARCHAR(25) NOT NULL,
 lastname VARCHAR(25) NOT NULL,
@@ -67,7 +67,7 @@ PARTITION p4 VALUES LESS THAN MAXVALUE
 );
 ERROR HY000: The 'partitioning' feature is disabled; you need MySQL built with '--with-plugin-partition' to have it working
 drop table t1;
-ERROR 42S02: Unknown table 't1'
+ERROR 42S02: Unknown table 'test.t1'
 CREATE TABLE t1 (id INT, purchased DATE)
 PARTITION BY RANGE( YEAR(purchased) )
 SUBPARTITION BY HASH( TO_DAYS(purchased) )
@@ -78,7 +78,7 @@ PARTITION p2 VALUES LESS THAN MAXVALUE
 );
 ERROR HY000: The 'partitioning' feature is disabled; you need MySQL built with '--with-plugin-partition' to have it working
 drop table t1;
-ERROR 42S02: Unknown table 't1'
+ERROR 42S02: Unknown table 'test.t1'
 create table t1 (a varchar(10) charset latin1 collate latin1_bin);
 insert into t1 values (''),(' '),('a'),('a '),('a  ');
 explain partitions select * from t1 where a='a ' OR a='a';

=== 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-09-17 11:32:06 +0000
+++ b/sql/share/errmsg-utf8.txt	2010-10-05 10:31:55 +0000
@@ -6387,6 +6387,9 @@ 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'"
 ER_WARN_INDEX_NOT_APPLICABLE
   eng "Cannot use %-.64s access on index '%-.64s' due to type or collation conversion on field '%-.64s'"
 

=== modified file 'sql/sql_partition_admin.cc'
--- a/sql/sql_partition_admin.cc	2010-08-24 10:52:32 +0000
+++ b/sql/sql_partition_admin.cc	2010-10-05 10:31:55 +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);
 }
 

=== modified file 'sql/sql_partition_admin.h'
--- a/sql/sql_partition_admin.h	2010-08-24 10:52:32 +0000
+++ b/sql/sql_partition_admin.h	2010-10-05 08:55:57 +0000
@@ -31,6 +31,12 @@ public:
   ~Sql_cmd_partition_unsupported()
   {}
 
+  /* Override SQLCOM_*, since it is an ALTER command */
+  virtual enum_sql_command sql_command_code() const
+  {
+    return SQLCOM_ALTER_TABLE;
+  }
+
   bool execute(THD *thd);
 };
 
@@ -150,6 +156,7 @@ public:
 
   bool execute(THD *thd);
 
+  /* Override SQLCOM_ANALYZE, since it is an ALTER command */
   virtual enum_sql_command sql_command_code() const
   {
     return SQLCOM_ALTER_TABLE;
@@ -175,6 +182,7 @@ public:
 
   bool execute(THD *thd);
 
+  /* Override SQLCOM_CHECK, since it is an ALTER command */
   virtual enum_sql_command sql_command_code() const
   {
     return SQLCOM_ALTER_TABLE;
@@ -200,6 +208,7 @@ public:
 
   bool execute(THD *thd);
 
+  /* Override SQLCOM_OPTIMIZE, since it is an ALTER command */
   virtual enum_sql_command sql_command_code() const
   {
     return SQLCOM_ALTER_TABLE;
@@ -225,6 +234,7 @@ public:
 
   bool execute(THD *thd);
 
+  /* Override SQLCOM_REPAIR, since it is an ALTER command */
   virtual enum_sql_command sql_command_code() const
   {
     return SQLCOM_ALTER_TABLE;
@@ -249,6 +259,7 @@ public:
 
   bool execute(THD *thd);
 
+  /* Override SQLCOM_TRUNCATE, since it is an ALTER command */
   virtual enum_sql_command sql_command_code() const
   {
     return SQLCOM_ALTER_TABLE;


Attachment: [text/bzr-bundle] bzr/mattias.jonsson@oracle.com-20101005103155-z2nn0a2yiws0y4y0.bundle
Thread
bzr push into mysql-next-mr-bugfixing branch (mattias.jonsson:3314 to 3316) Mattias Jonsson5 Oct