Subject | RE: [firebird-support] FK's and NULL |
---|---|
Author | Daniel Jimenez |
Post date | 2004-10-28T04:35:39Z |
> Of course. Foreign keys by nature are never meant to beI have created a scrip based on what I am trying to run. This script is
> unique, except when enforcing a 1:1 relationship.
>
>
> >As I am getting no errors from FB when I do this, as well as
> having unique
> >constraints for the FK fields. I have also defined
> FK_Constraints so that on
> >delete and update the result is cascade.
>
> Well, that's one action rule, whereas ON DELETE | UPDATE SET
> NULL is a
> (mutually exclusive) other. If you are using the CASCADE
> rules, then the
> SET NULL rules don't apply, obviously...
>
> ./hb
>
generating the same error.
I would really appreciate if you could point out the possible errors in
this script:
CREATE DOMAIN D_NON_NULL AS
SMALLINT
NOT NULL
CHECK (VALUE IS NOT NULL AND VALUE > 0);
CREATE DOMAIN D_NULL AS
SMALLINT
DEFAULT NULL
CHECK (VALUE IS NULL OR VALUE > 0);
CREATE TABLE CWMONITORS
(
CW_ID D_NON_NULL,
CW_VW_ID D_NULL ,
CONSTRAINT PK_CWMONITORS PRIMARY KEY (CW_ID)
);
CREATE TABLE VWMONITORS
(
VW_ID D_NON_NULL ,
CONSTRAINT PK_VWMONITORS PRIMARY KEY (VW_ID)
);
ALTER TABLE CWMONITORS ADD CONSTRAINT U_CWMONITORS UNIQUE
(CW_VW_ID);
ALTER TABLE CWMONITORS ADD CONSTRAINT FK_CWMONITORS
FOREIGN KEY (CW_VW_ID) REFERENCES VWMONITORS
(VW_ID)
ON DELETE CASCADE
ON UPDATE CASCADE;
Before I forget, the error is:
ISC ERROR CODE:335544351
ISC ERROR MESSAGE:
unsuccessful metadata update
object VWMONITORS is in use
Thanks
danieL
____________________________
Comvision Pty. Ltd.
www.comvision.net.au