Subject RE: [firebird-support] Multi-column Foreign key
Author Leyne, Sean
> Let's create two unites from one lot:
>
> INSERT INTO UNITES (CODE, LOT, SITE, DESCRIPTION) VALUES ('A1', 'L1', 'S1',
> 'abc'); INSERT INTO UNITES (CODE, LOT, SITE, DESCRIPTION) VALUES ('A2',
> 'L1', 'S1', 'bcd');
>
> I expected that the following instruction will not be exectued:
> INSERT INTO LOCATION (ID, UCODE, ULOT, USITE, ZONE, WAREHOUSE)
> VALUES (1, 'A3', NULL, NULL, NULL, NULL); because there is no A3 entry in
> unites table, but it IS! Firebird allows to add record with value which doesn't
> exist in master table.

I believe that your schema for the LOCATION table is incorrect.

UCODE, ULOT and USITE should be described as NOT NULL, since a Location must relate to a UNITES (which has CODE, LOT and SITE described as NOT NULL), no?


Sean