Subject | Re: [firebird-support] problem adding foreign key |
---|---|
Author | Helen Borrie |
Post date | 2005-02-07T05:27:42Z |
At 02:39 AM 7/02/2005 +0000, you wrote:
it's called "PK_CUSTOMERS" too. Constraint identifiers have to be globally
unique (as do index identifiers).
./heLen
>hi. i'm pretty new to firebird and sql so i'm not sure if i'm making aCheck the name of the foreign key constraint in the *other* table. I bet
>stupid mistake...
>
>i have 2 tables, contacts and customers. customers has a pk called ID
>and contacts has a field (with no contraints) called CustomerID.
>
>when i execute the following sql i get an error...
>
>alter table CONTACTS
>add constraint FK_CONTACTS_CUSTOMERS
>foreign key ("CustomerID")
>references CUSTOMERS(ID)
>on delete CASCADE
>on update CASCADE
>
>and the error is...
>
>violation of FOREIGN KEY constraint "PK_CUSTOMERS" on table "CUSTOMERS"
>
>there is another table with a foreign key on Customers.ID. i'm not
>sure if this makes a difference.
>
>running v1.5.2.4731
>
>any ideas?
it's called "PK_CUSTOMERS" too. Constraint identifiers have to be globally
unique (as do index identifiers).
./heLen