1
(click on this box to dismiss)
Can't create composite foreign key with a different cardinality
I can't create composite foreign key with a different cardinality than the referenced table's primary key, even if there is a unique index:
CREATE TABLE "ITEMS" (
"ID" integer AUTO_INCREMENT PRIMARY KEY,
"ITEM_ID" integer FOREIGN KEY REFERENCES "ITEMS",
UNIQUE ("ITEM_ID", "ID"),
FOREIGN KEY ("ID", "ITEM_ID") REFERENCES "ITEMS"("ITEM_ID", "ID")
);
gives error:
The number of keys of the foreign key 'fk_items_id_item_id' is different from that of the primary key 'pk_items_id'.
1
질문시간 7달 전
viewed 415 times