Subject | Re: Re[2]: [firebird-support] accessing data from the trigger & ON DELETE CASCADE |
---|---|
Author | Ivan Prenosil |
Post date | 2004-12-08T13:17:47Z |
> Thanks for the info, this explains everything. Still, this behaviourHere is good explanation:
> seems unnatural to me, wouldn't it be more logical to delete the child
> records before deleting the parent one, i.e. avoiding the inconsistent
> state where we have a child with parent id, with no such parent?
To: firebird-support@yahoogroups.com
From: "Alexander V.Nevsky" <ded@...>
Date: Wed, 20 Aug 2003 08:57:51 -0000
Subject: [firebird-support] Re: On delete cascade and before delete triggers
Calin, no, it is right behaviour. It prevents the next situation,
which will occure if check of details existance will be performed
before master delete:
1. Transaction 1 started delete process
2. Transaction 1 checked existance of details and delete them
3. Transaction 2 inserted new detail for this master record
4. Transaction 1 deleted master and commited
moment of transaction 2 commit is not principial, we have broken
references integrity. Current behaviour (master deleted first)
guarantees that transaction 2 can't insert detail during cascade
delete process.
Best regards, Alexander.