I am setting up a master master replication and trying to do some tests by setting up a before update trigger.
I am getting an error when I run the code below
CREATE TRIGGER update_blogs
BEFORE UPDATE ON blogs
FOR EACH ROW
BEGIN
IF (NEW.updated_replication < OLD.updated_replication) THEN
SET NEW= OLD ;
END IF;
END$$
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 6
What I am trying to do is only allow the row to be updated if the new row has a greater updated_replication(timestamp)
value.
I am using mysql.
Can any one please tell me where I am wrong. How can I debug such errors? Is this any kind of syntax error?