If no, is there any way to cancel the UPDATE from out of the trigger?
+1
A:
EDIT: If a BEFORE trigger fails then the UPDATE is canceled.
My previous stupid answer was referring to AFTER triggers. here it is just in case anybody still needs it: In case of AFTER trigger then the UPDATE is not canceled if a trigger fails. For "canceling" an UPDATE one has to use transactions and then ROLLBACK the transaction in case of error or commit the transaction in case of success. more info about transactions in MySQL can be found at: http://dev.mysql.com/doc/refman/5.0/en/commit.html
Saggi Malachi
2009-08-08 17:04:33
Is that really true, the BEFORE trigger is fired *after* the update?
DR
2009-08-08 17:21:25
wow, I'm sorry. For some reason I thought you mean the UPDATE happens BEFORE the trigger so my mind processed it as if it's an AFTER trigger. my bad. if a BEFORE trigger fails then the UPDATE is canceled.
Saggi Malachi
2009-08-08 18:51:21