MySQL Forums
Forum List  »  Triggers

Re: How to alter a trigger atomicly?
Posted by: Sebastian Kirsche
Date: March 02, 2009 03:12AM

Temporarily renaming the table appears to work. Changes to mytable from other threads will fail.


DELIMITER $$
ALTER TABLE `mytable` RENAME TO `mytable_locked` $$
DROP TRIGGER IF EXISTS `mytable_ait` $$
CREATE TRIGGER `mytable_ait` AFTER INSERT ON `mytable_locked`
FOR EACH ROW
BEGIN
...
END $$
ALTER TABLE `mytable_locked` RENAME TO `mytable` $$
DELIMITER ;

Options: ReplyQuote


Subject
Views
Written By
Posted
15215
March 19, 2007 09:53PM
4660
April 19, 2007 02:56AM
Re: How to alter a trigger atomicly?
3784
March 02, 2009 03:12AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.