Subject | Order of execution cascade operations |
---|---|
Author | lacakus |
Post date | 2007-06-04T06:14:19Z |
Hi,
I have table1 and table2, which references table1 with foreign key
constraint with "on delete cascade".
On table2 is defined "after delete" trigger ...
When I delete row from table1 which happens ?
A:
1. row (master) from table1 is deleted
2. corresponding rows (detail) are deleted from table2
3. trigger on table2 is fired for every deleted row of table2
-or-
B:
1. corresponding rows (detail) are deleted from table2
2. trigger on table2 is fired for every deleted row of table2
3. row (master) from table1 is deleted
If A is true, then I cannot reference "just deleted" row from
table1, ... true ?
(command as : select col1 from table1 where pk1=OLD.fk2 into :var;
Thanks
-Laco.
I have table1 and table2, which references table1 with foreign key
constraint with "on delete cascade".
On table2 is defined "after delete" trigger ...
When I delete row from table1 which happens ?
A:
1. row (master) from table1 is deleted
2. corresponding rows (detail) are deleted from table2
3. trigger on table2 is fired for every deleted row of table2
-or-
B:
1. corresponding rows (detail) are deleted from table2
2. trigger on table2 is fired for every deleted row of table2
3. row (master) from table1 is deleted
If A is true, then I cannot reference "just deleted" row from
table1, ... true ?
(command as : select col1 from table1 where pk1=OLD.fk2 into :var;
Thanks
-Laco.