Reputation: 61422
I have a BEFORE DELETE
trigger which inserts rows into another table using SPI_exec
.
Do these INSERT
queries run in the same transaction as the one in which the original delete is executing? Hence, will the delete and all inserts roll back or commit together?
If not, how can I make that happen?
Upvotes: 3
Views: 798
Reputation: 19471
Yes, everything in triggers is in the same transaction as the triggering event.
Not directly related to the question, but normally you want to put side-effects in the AFTER
trigger, rather than the BEFORE
trigger.
Upvotes: 4