Details
-
Bug
-
Status: Open (View Workflow)
-
Major
-
Resolution: Unresolved
-
10.5, 10.6, 10.11, 11.4
Description
MDEV-20729 a.k.a. MDEV-6420 was not fixed completely. It seems that single-column FOREIGN KEY constraints can be created without specifying the column names twice, but multiple column names have to be specified explicitly:
--source include/have_innodb.inc
|
CREATE TABLE t1 (a INT PRIMARY KEY, b INT UNIQUE) engine=InnoDB; |
CREATE TABLE t2 (a INT PRIMARY KEY, b INT UNIQUE REFERENCES t1) ENGINE=InnoDB; |
--error ER_CANT_CREATE_TABLE,ER_FK_NO_INDEX_PARENT
|
#SET STATEMENT foreign_key_checks=0 |
ALTER TABLE t2 ADD FOREIGN KEY (a,b) REFERENCES t1; |
ALTER TABLE t2 ADD FOREIGN KEY (a,b) REFERENCES t1(a,b); |
I would expect the multi-column constraint to be allowed without having to use redundant syntax.
This came up during a discussion around MDEV-35854, which is cleaning up some code after MDEV-20480.
Attachments
Issue Links
- relates to
-
MDEV-6420 REFERENCES syntax in CREATE TABLE
-
- Closed
-
-
MDEV-20480 Obsolete internal parser for FK in InnoDB
-
- Closed
-
-
MDEV-20729 Fix REFERENCES constraint in column definition
-
- Closed
-
Activity
Field | Original Value | New Value |
---|---|---|
Link |
This issue relates to |
Link |
This issue relates to |