Subject | Re: On delete cascade and before delete triggers |
---|---|
Author | Alexander V.Nevsky |
Post date | 2003-08-20T08:57:51Z |
--- In firebird-support@yahoogroups.com, "Calin Iancu Pirtea"
<pcalin@r...> wrote:
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.
<pcalin@r...> wrote:
> I noticed today that delete cascade triggers are fired "afterdelete"
> while I was convinced that they happen before delete.Calin, no, it is right behaviour. It prevents the next situation,
>
> Is this a bug?
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.