on 2011 Mar 24 6:56 AM
If you neglect situations like system crashes, or power failure, is it possible in the system, that under any circumstances an after insert trigger is not fired? If so, what circumstances would lead to such an effect?
(I know that LOAD TABLE, TRUNCATE, and WRITETEXT will not fire triggers)
Request clarification before answering.
Well, I'm not sure whether you ask about a trigger that should fire, and does not in a particular situation, or ask more generally.
In addition to Thomas's answer, there are a few more situations I'm aware of:
EDIT: Sorry, I should have read your question better - so, w.r.t. AFTER INSERT triggers, only point one could be a reason.
As to the reliability of triggers, I do rely on them. To quote from the CREATE TRIGGER page:
If an error occurs while a trigger is executing, the operation that fired the trigger fails. INSERT, UPDATE, and DELETE are atomic operations. When they fail, all effects of the statement (including the effects of triggers and any procedures called by triggers) revert to their preoperative state. See Atomic compound statements.
As such, as far as triggers are not explicitely prevented (s.a.), they should work in an atomic way.
That being said, I would only use triggers for tasks that cannot be handled by other features like
As Breck wrote in his well-knwon book: '"Avoid writing triggers." - " - if possible"*, I would add:)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Not a answer to your question but I know that an AFTER UPDATE Trigger is not fired when content of the fields in the row is not changed.
A statement like
update <TABLE>
set <FIELD> = <FIELD>
will not force the execution of an after update trigger.
HTH
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
50 | |
9 | |
8 | |
6 | |
5 | |
5 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.