Commit 73977d11 authored by unknown's avatar unknown

Bug #18483 Cannot create table with FK constraint

- remove error set for auto partitioned tables

parent 6e20d34b
...@@ -748,3 +748,11 @@ f1 f2 f3 ...@@ -748,3 +748,11 @@ f1 f2 f3
111111 aaaaaa 1 111111 aaaaaa 1
222222 bbbbbb 2 222222 bbbbbb 2
drop table t1; drop table t1;
CREATE TABLE t1 (a VARCHAR(255) NOT NULL,
CONSTRAINT pk_a PRIMARY KEY (a))engine=ndb;
CREATE TABLE t2(a VARCHAR(255) NOT NULL,
b VARCHAR(255) NOT NULL,
c VARCHAR(255) NOT NULL,
CONSTRAINT pk_b_c_id PRIMARY KEY (b,c),
CONSTRAINT fk_a FOREIGN KEY(a) REFERENCES t1(a))engine=ndb;
drop table t1, t2;
...@@ -713,3 +713,17 @@ select * from t1 order by f1; ...@@ -713,3 +713,17 @@ select * from t1 order by f1;
select * from t1 order by f2; select * from t1 order by f2;
select * from t1 order by f3; select * from t1 order by f3;
drop table t1; drop table t1;
#
# Bug #18483 Cannot create table with FK constraint
# ndb does not support foreign key constraint, it is silently ignored
# in line with other storage engines
#
CREATE TABLE t1 (a VARCHAR(255) NOT NULL,
CONSTRAINT pk_a PRIMARY KEY (a))engine=ndb;
CREATE TABLE t2(a VARCHAR(255) NOT NULL,
b VARCHAR(255) NOT NULL,
c VARCHAR(255) NOT NULL,
CONSTRAINT pk_b_c_id PRIMARY KEY (b,c),
CONSTRAINT fk_a FOREIGN KEY(a) REFERENCES t1(a))engine=ndb;
drop table t1, t2;
...@@ -3106,7 +3106,8 @@ bool mysql_create_table_internal(THD *thd, ...@@ -3106,7 +3106,8 @@ bool mysql_create_table_internal(THD *thd,
} }
while ((key= key_iterator++)) while ((key= key_iterator++))
{ {
if (key->type == Key::FOREIGN_KEY) if (key->type == Key::FOREIGN_KEY &&
!part_info->is_auto_partitioned)
{ {
my_error(ER_CANNOT_ADD_FOREIGN, MYF(0)); my_error(ER_CANNOT_ADD_FOREIGN, MYF(0));
goto err; goto err;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment