diff options
author | Mattias Jonsson <mattias.jonsson@sun.com> | 2010-03-04 12:29:22 +0100 |
---|---|---|
committer | Mattias Jonsson <mattias.jonsson@sun.com> | 2010-03-04 12:29:22 +0100 |
commit | 6e7539de29b2225c742a87b1866b631e15ab9b5f (patch) | |
tree | 1b49c655aae5fd5a6139935c87c87fdbe7c031dc /mysql-test/t/partition_innodb.test | |
parent | 2e9045c8fdf2cf07eb2b1b5655ee40bd43a02f77 (diff) | |
download | mariadb-git-6e7539de29b2225c742a87b1866b631e15ab9b5f.tar.gz |
Bug#50104: Partitioned table with just 1 partion works with fk
There was no check for foreign keys when altering partitioned
tables.
Added check for FK when altering partitioned tables.
Diffstat (limited to 'mysql-test/t/partition_innodb.test')
-rw-r--r-- | mysql-test/t/partition_innodb.test | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/mysql-test/t/partition_innodb.test b/mysql-test/t/partition_innodb.test index b7fe4477a13..8e92adc5868 100644 --- a/mysql-test/t/partition_innodb.test +++ b/mysql-test/t/partition_innodb.test @@ -2,11 +2,38 @@ --source include/have_innodb.inc --disable_warnings -drop table if exists t1; +drop table if exists t1, t2; --enable_warnings let $MYSQLD_DATADIR= `SELECT @@datadir`; +--echo # +--echo # Bug#50104: Partitioned table with just 1 partion works with fk +--echo # +CREATE TABLE t2 ( + id INT, + PRIMARY KEY (id) +) ENGINE=InnoDB ; + +CREATE TABLE t1 ( + id INT NOT NULL AUTO_INCREMENT, + parent_id INT DEFAULT NULL, + PRIMARY KEY (id), + KEY parent_id (parent_id) +) ENGINE=InnoDB; + +ALTER TABLE t1 PARTITION BY HASH (id) PARTITIONS 1; + +--error ER_FOREIGN_KEY_ON_PARTITIONED +ALTER TABLE t1 ADD CONSTRAINT test_ibfk_1 FOREIGN KEY (parent_id) REFERENCES t2 (id); + +ALTER TABLE t1 PARTITION BY HASH (id) PARTITIONS 2; + +--error ER_FOREIGN_KEY_ON_PARTITIONED +ALTER TABLE t1 ADD CONSTRAINT test_ibfk_1 FOREIGN KEY (parent_id) REFERENCES t2 (id); + +DROP TABLE t1, t2; + # # Bug#47029: Crash when reorganize partition with subpartition # |