Open Source RDBMS - Seamless, Scalable, Stable and Free

English | Login |Register


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'.

링크 댓글 쓰기 (0)
질문시간 2년 전
ovidiuv
55
22 답변들
0

Currently, foreign keys can only reference primary keys in CUBRID.

링크 댓글 쓰기 (0)
답변시간 2년 전
dba
558




You are either using a very old browser or a browser that is not supported.
In order to browse cubrid.org you need to have one of the following browsers:



Internet Explorer: Mozilla Firefox: Google Chrome: