title: mysql 5.6.10: before update trigger only works with constant?
body: <p>I am trying to get a trigger to update a row's value with a current timestamp and that same timestamp is being used in the table that is getting inserted on by this trigger. The trigger works with set new.last_update = 'some constant' , but the moment you add a variable or a select all I get is null values in the row. </p>
  
  <pre><code>drop trigger if exists event_update_history;
  delimiter //
  create trigger event_update_history before update on Events 
      for each row
      begin
          declare history_timestamp timestamp;
          set @history_timestamp = timestamp(unix_timestamp());
          if (new.current_state &lt;&gt; old.current_state) then
              insert into Event_History (evt_id, evt_state, time_of_change, userid) values (new.evt_id, new.current_state, history_timestamp, new.last_updated_by);
          end if;
          set new.last_update = history_timestamp; ## THIS IS THE PART THAT IS NOT WORKING but works if you send a constant
      end; //
  delimiter ;
  </code></pre>