Subject | Primary key not set to unique |
---|---|
Author | csswa |
Post date | 2002-02-01T01:42:32Z |
I was surprised to discover that a primary key created from a domain
was not created automatically as unique.
The domain used:
CREATE DOMAIN "DOM_KEY" AS NUMERIC(18, 0)
check (value > 0) NOT NULL;
The metadata for the table (note, F_PK field DDL entered as 'f_pk
dom_key primary key'):
CREATE TABLE "T_CUSTOMERS"
(
"F_PK" "DOM_KEY",
"F_CODE" "DOM_CODE",
"F_NAME" "DOM_STRING1" NOT NULL,
"F_ADDRESS" NUMERIC(18, 0),
"F_COMMENTS" "DOM_MEMO",
"F_RECGENSTAMP" "DOM_RECGENSTAMP",
PRIMARY KEY ("F_PK"),
UNIQUE ("F_CODE")
);
Despite being a primary key, I can enter duplicate F_PK values into
this table. Do I need to manually define a primary key as unique in
this situation? That doesn't seem right...
Regards,
Andrew Ferguson
-FBrc2, ibconsole, NT4sp6, AMDduron850, 512ram
was not created automatically as unique.
The domain used:
CREATE DOMAIN "DOM_KEY" AS NUMERIC(18, 0)
check (value > 0) NOT NULL;
The metadata for the table (note, F_PK field DDL entered as 'f_pk
dom_key primary key'):
CREATE TABLE "T_CUSTOMERS"
(
"F_PK" "DOM_KEY",
"F_CODE" "DOM_CODE",
"F_NAME" "DOM_STRING1" NOT NULL,
"F_ADDRESS" NUMERIC(18, 0),
"F_COMMENTS" "DOM_MEMO",
"F_RECGENSTAMP" "DOM_RECGENSTAMP",
PRIMARY KEY ("F_PK"),
UNIQUE ("F_CODE")
);
Despite being a primary key, I can enter duplicate F_PK values into
this table. Do I need to manually define a primary key as unique in
this situation? That doesn't seem right...
Regards,
Andrew Ferguson
-FBrc2, ibconsole, NT4sp6, AMDduron850, 512ram