Subject Re: foreign Key Deletion
Author Adam
--- In firebird-support@yahoogroups.com, "mspencewasunavailable"
<firebird@...> wrote:
>
> --- In firebird-support@yahoogroups.com, "Maurizio P."
> <mauriz_po@> wrote:
> >
> > hi ,
> > i searched hours , but i could not find any help so
> > i try to ask here (my first time) for an help :
> >
> > i thought that normally it would not be possible to
> > delete a row which is a foreign key in another table ,
> >
> > the example :
> >
> > tableBanks
> > -idBAnk(PK)
> > -desBAnk
> >
> > tableCustomers
> > -idCustomer(PK)
> > -desCustomer
> > -idBank (FK)
> > ..ecc
> >
> > in this situation i can delete every tableCustomer row , even if
> them
> > exists as FK in the second table ,
> > is it the normal behave ? how can i prevent it ?
>
>
> I'm guessing you didn't tell it not to allow the delete, by
> using "ON DELETE NO ACTION" when you defined the foreign key.

NO ACTION is the default behaviour if no behaviour is defined in the
foreign key constraint, although it is always advisable to
deliberately state it if that is what you want in case the default
behaviour ever changes.

In any case, his problem is that he is deleting the child record,
where foreign key constraints only deal with deletion of the master
record.

Adam