MySQL Forums
Forum List  »  Triggers

Weird Trigger Behavior
Posted by: Adam Toy
Date: December 06, 2013 01:53PM

I have a very strange trigger behavior happening in MySQL. Here's the trigger:

DELIMITER //
CREATE TRIGGER NewLogDB.UpdateSources
AFTER UPDATE ON NewLogDB.ROBOT_RUN FOR EACH ROW
BEGIN
IF NEW.`ENDTIME` <> OLD.`ENDTIME` THEN

    UPDATE CollectionDB.`source` AS T1
    SET T1.lastCapDate = NEW.`ENDTIME`,
    T1.numCaptured = T1.numCaptured + new.EXTRACTEDOBJECTS
    WHERE T1.`robotName` = NEW.`ROBOTNAME`;

END IF;

END;
//

Simple enough, right?

I'm using a 3rd party program that performs updates to a table. Here's the UPDATE query pulled directly from the MySQL logs:

                   2092251 Query   UPDATE ROBOT_RUN SET EXECUTIONTIME = 317, ENDTIME = '2013-12-06 14:19:04', TOTALTIME = 317 WHERE (ID = 12)

This is NOT triggering the query. However, when I logged into the MySQL console and ran this query (again, directly from the logs..):

131206 14:23:36    2093727 Query   UPDATE ROBOT_RUN SET EXECUTIONTIME = 317, ENDTIME = '2011-11-11 11:11:11', TOTALTIME = 317 WHERE (ID = 12)

the trigger magically works! The only difference in the logs is the beginning date/time.

Is there some mechanism of MySQL that doesn't allow triggers to be performed on externally ran queries?

I'm at a loss, any help would be appreciated. Thanks!

Options: ReplyQuote


Subject
Views
Written By
Posted
Weird Trigger Behavior
1947
December 06, 2013 01:53PM


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.