Subject SQL spec. and order of delete operations
Author lacakus
I walk throught SQL spec. and I hit one question, which I asked in
this forum some time ago.

If I understand correctly SQL spec. when I run :

DELETE FROM T WHERE <search condition>

Then :
1. <search condition> is evaluated for each row of T

2. rows meet search condition are marked for deletion
(here I do not understand what does mean "marked". I assume,
that "marked" row is still "visible" at least to current transaction?)

3. BEFORE TRIGGER on T

4. referential constraint are processed
(here I assume, that if some table (T2) references T with on delete
cascade, then corresponding rows from T2 are deleted at this moment?
So if T2 has "after delete trigger", trigger is executed before step
5, is not ? If yes, then this trigger should see actualy deleted row
from T (as it is only marked for deletion, not deleted), does not ?)

5. each row that is marked for deletion from T is deleted from T

6. AFTER TRIGGER on T

7. checking of any integrity constraints

Hm, in Firebird in step 4 in after delete trigger on T2 actualy
deleted row from T is already gone.

Pls, comments?
-Laco.