1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

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.
This commit is contained in:
Mattias Jonsson
2010-03-04 12:29:22 +01:00
parent 2e9045c8fd
commit 6e7539de29
3 changed files with 55 additions and 2 deletions

View File

@ -1,4 +1,24 @@
drop table if exists t1;
drop table if exists t1, t2;
#
# Bug#50104: Partitioned table with just 1 partion works with fk
#
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;
ALTER TABLE t1 ADD CONSTRAINT test_ibfk_1 FOREIGN KEY (parent_id) REFERENCES t2 (id);
ERROR HY000: Foreign key clause is not yet supported in conjunction with partitioning
ALTER TABLE t1 PARTITION BY HASH (id) PARTITIONS 2;
ALTER TABLE t1 ADD CONSTRAINT test_ibfk_1 FOREIGN KEY (parent_id) REFERENCES t2 (id);
ERROR HY000: Foreign key clause is not yet supported in conjunction with partitioning
DROP TABLE t1, t2;
create table t1 (a int not null,
b datetime not null,
primary key (a,b))