diff options
author | unknown <istruewing@stella.local> | 2007-12-11 23:57:57 +0100 |
---|---|---|
committer | unknown <istruewing@stella.local> | 2007-12-11 23:57:57 +0100 |
commit | 223e57dec3d634e447094dc9125fe719d3794b1d (patch) | |
tree | ae9b9524f1a4d88f37a9ca36977d3587dc3dd027 | |
parent | 961e5d3dc79f6d0c49d956080b67680109ad602a (diff) | |
parent | 499b57fc572b20a01e35af3876364ce190151cb9 (diff) | |
download | mariadb-git-223e57dec3d634e447094dc9125fe719d3794b1d.tar.gz |
Merge stella.local:/home2/mydev/mysql-5.1-ateam
into stella.local:/home2/mydev/mysql-5.1-axmrg
sql/sql_table.cc:
Auto merged
-rw-r--r-- | mysql-test/r/partition_innodb.result | 12 | ||||
-rw-r--r-- | mysql-test/t/partition_innodb.test | 15 | ||||
-rw-r--r-- | sql/sql_table.cc | 3 |
3 files changed, 29 insertions, 1 deletions
diff --git a/mysql-test/r/partition_innodb.result b/mysql-test/r/partition_innodb.result index f80e0001ea8..5cbe34c94ca 100644 --- a/mysql-test/r/partition_innodb.result +++ b/mysql-test/r/partition_innodb.result @@ -1,3 +1,15 @@ +# Bug#32948 +CREATE TABLE t1 (c1 INT, PRIMARY KEY (c1)) ENGINE=INNODB; +CREATE TABLE t2 (c1 INT, PRIMARY KEY (c1), +FOREIGN KEY (c1) REFERENCES t1 (c1) +ON DELETE CASCADE) +ENGINE=INNODB; +ALTER TABLE t1 PARTITION BY HASH(c1) PARTITIONS 5; +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails +ALTER TABLE t1 ENGINE=MyISAM; +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails +DROP TABLE t2; +DROP TABLE t1; create table t1 (a int) engine=innodb partition by hash(a) ; show table status like 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment diff --git a/mysql-test/t/partition_innodb.test b/mysql-test/t/partition_innodb.test index 6b73d0b2c5e..58010f85ecf 100644 --- a/mysql-test/t/partition_innodb.test +++ b/mysql-test/t/partition_innodb.test @@ -1,6 +1,21 @@ --source include/have_partition.inc --source include/have_innodb.inc +# Bug#32948 - FKs allowed to reference partitioned table +# +-- echo # Bug#32948 +CREATE TABLE t1 (c1 INT, PRIMARY KEY (c1)) ENGINE=INNODB; +CREATE TABLE t2 (c1 INT, PRIMARY KEY (c1), + FOREIGN KEY (c1) REFERENCES t1 (c1) + ON DELETE CASCADE) +ENGINE=INNODB; +--error ER_ROW_IS_REFERENCED +ALTER TABLE t1 PARTITION BY HASH(c1) PARTITIONS 5; +--error ER_ROW_IS_REFERENCED +ALTER TABLE t1 ENGINE=MyISAM; +DROP TABLE t2; +DROP TABLE t1; + # # Bug #14673: Wrong InnoDB default row format # diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 166a2800ea8..a43344e902b 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -5979,7 +5979,8 @@ view_err: goto err; new_db_type= create_info->db_type; - if (new_db_type != old_db_type && + if ((new_db_type != old_db_type || + alter_info->flags & ALTER_PARTITION) && !table->file->can_switch_engines()) { my_error(ER_ROW_IS_REFERENCED, MYF(0)); |