MySQL UPDATE TIMESTAMP on row UPDATE, even when all other row data remains the same?

走远了吗. 提交于 2020-02-29 07:11:07

问题


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.


回答1:


You have said ON UPDATE.

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



来源:https://stackoverflow.com/questions/6620366/mysql-update-timestamp-on-row-update-even-when-all-other-row-data-remains-the-s

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!