Subject | Re: foreign Key Deletion |
---|---|
Author | mspencewasunavailable |
Post date | 2006-08-18T02:59:31Z |
--- In firebird-support@yahoogroups.com, "Adam" <s3057043@...> wrote:
>if
> --- 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
> > themthe
> > > 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
> foreign key constraint, although it is always advisable tomaster
> 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
> record.D'OH!!! Of course it is<g>. And of course he said that. Long day.
>
> Adam
>