Subject | Re: FK confusion |
---|---|
Author | Ali Gökçen |
Post date | 2006-07-09T17:39:08Z |
Hi,
"Acc ID" allrady first segment of PK,
so what is the trick of another index on "Acc ID" ?
PK doesnt seen effected to me, only ID should be enough in my mind.
FB says there is no Unique index on "Acc ID" allready required.
your defined index on "Acc ID" is duplicated index, not unique:
Ali
> =============================== A Table =====================ID");
> CREATE TABLE "ACCCHEM" (
> "Acc ID" INTEGER NOT NULL,
> "Date" DATE NOT NULL,
> "ID" INTEGER NOT NULL,
> "Chem ID" INTEGER,
> "Chemical Brand" VARCHAR(40),
> "Complete Name" VARCHAR(40),
> "EPA Registration #" VARCHAR(30),
> ----- removed many fields -----
> CONSTRAINT "PK_ACCCHEM" PRIMARY KEY ("Acc ID", "Date", "ID")
> );
>
> CREATE INDEX "IDX_ACCCHEM_1" ON "ACCCHEM" ("Acc ID");
>
> CREATE INDEX "IDX_ACCCHEM_2" ON "ACCCHEM" ("Chemical Brand","Chem
"Acc ID" allrady first segment of PK,
so what is the trick of another index on "Acc ID" ?
PK doesnt seen effected to me, only ID should be enough in my mind.
>i think you need to review your PK build strategy.
> ============================= Another Table =====================
> CREATE TABLE "Cust" (
> "Cat" SMALLINT NOT NULL,
> "Last Name" VARCHAR(35) NOT NULL,
> "ID" INTEGER NOT NULL,
> "First Name" VARCHAR(15),
> "Street" VARCHAR(30),
> "Town" VARCHAR(15),
> "State" VARCHAR(2),
> "Zip" VARCHAR(10),
> ----- removed many fields -----
> CONSTRAINT "PK_Cust" PRIMARY KEY ("Cat", "Last Name", "ID")
> );
>
> ----- removed a bunch of other index defs -------
>
> CREATE UNIQUE INDEX "IDX_Cust_13" ON "Cust" (ID);
>
>ON
> ===================== Alter Table doesn't work
> ==================================
> ALTER TABLE "ACCCHEM" ADD CONSTRAINT "Cust_ACCCHEM"
> FOREIGN KEY ("Acc ID") REFERENCES "Cust" (ID) ON DELETE CASCADE
> UPDATE CASCADE;metadata
>
> I get this error message:
>
> This operation is not defined for system tables.Unsuccessful
> update.As you can see easly,
> Could not find UNIQUE INDEX with specified columns.
>
> IDX_Cust_13 is there, though. What am I overlooking?
>
>
> Michael D. Spence
> Mockingbird Data Systems, Inc.
>
>
FB says there is no Unique index on "Acc ID" allready required.
your defined index on "Acc ID" is duplicated index, not unique:
> CREATE INDEX "IDX_ACCCHEM_1" ON "ACCCHEM" ("Acc ID");Regards.
Ali