MySQL Forums
Forum List  »  Triggers

Override CURRENT_TIMESTAMP in trigger?
Posted by: James B
Date: May 21, 2012 12:45PM

I have a table with a column 'lastupdate' defined as a TIMESTAMP with default = CURRENT_TIMESTAMP. This worked great until I set up a BEFORE UPDATE trigger in which I DON'T want the lastupdate to be set. (The use case is that I want to basically cancel the update by setting all of the "new" values to the "old" ones.) I figured,

set new.lastupdate=old.lastupdate

would do the trick, but it doesn't work (the column is still updated with the current timestamp - but the other values don't change, so I now the trigger is firing correctly). Is there a way to do this?

Thank you for any insight,

Options: ReplyQuote

Written By
Override CURRENT_TIMESTAMP in trigger?
May 21, 2012 12:45PM

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.