0

I have a table with a timestamp.

The timestamp is set to "ON UPDATE CURRENT_TIMESTAMP."

When I run an update on a row with data that is the same as the data already in that row, I still want the TIMESTAMP to update. It does not. Why does it not? If the data is different it updates just fine.

I realize I can force an update with TIMESTAMP = now(), but I am trying to understand what MySQL is doing.

T. Brian Jones
  • 13,002
  • 25
  • 78
  • 117

1 Answers1

6

You have said ON UPDATE.

There is no update happening if all the row's values are the same.

alex
  • 479,566
  • 201
  • 878
  • 984
  • so mysql attempts the update and checks to see if the data has changed, then doesn't execute an update because the data is the same? seems like it should throw an error or warning or something, no? What is mysql actually doing behind the scenes? – T. Brian Jones Jul 08 '11 at 05:46
  • @T.BrianJones: You could check the affected rows. I'm not 100% sure what is going on behind the scenes sorry. – alex Jul 08 '11 at 06:12