Bug #76009 | Pubtime is set as current if other columns are modified | ||
---|---|---|---|
Submitted: | 23 Feb 2015 16:00 | Modified: | 8 Apr 2015 15:21 |
Reporter: | Wei Huang | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | Connector / NET | Severity: | S2 (Serious) |
Version: | 6.9.5 | OS: | Windows |
Assigned to: | Gabriela Martinez Sanchez | CPU Architecture: | Any |
[23 Feb 2015 16:00]
Wei Huang
[5 Mar 2015 21:41]
Gabriela Martinez Sanchez
Hi Wei, This behavior is defined at the server level. You can check the documentation about how this automatic initialization is handled here: http://dev.mysql.com/doc/refman/5.6/en/timestamp-initialization.html Please check it out and let us know if there is any problem with the automatic initialization. Looking forward to your answer.
[6 Apr 2015 1:00]
Bugs System
No feedback was provided for this bug for over a month, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to "Open".
[6 Apr 2015 7:43]
Wei Huang
I'm sorry that I didn't recieve the email alert for this bug. So I reply to you so late. I've read your feedback and the web page URL you provided. However, I don't mean the "Automatic Initialization and Updating for TIMESTAMP and DATETIME" problem. I think it is a problem about default value of a column, a NULL TIMESTAMP problem. But in my case, there is updating the row and try not to affect the TIMESTAMP column. If I want to update only the title column without affecting the pubtime column, I can't use only one update function. Is it somewhat strange? And there is no similar problem in JDBC.
[7 Apr 2015 0:48]
Gabriela Martinez Sanchez
hi Wei, The pubtime is defined in your table like an auto-updated column. So the behavior is that the value of this column is going to be updated automatically every time the value of any other column in the row is changed from its current value. If you want to prevent an auto-updated column from updating when other columns change, explicitly set it to its current value. As I understood that is what you would have to do if you do not want that the value changes in the same update operation when you are updating the Title column. Looking forward to your answer.
[8 Apr 2015 15:21]
Wei Huang
Yeap, you're right. I used SQL Server before, hence it takes me some time to notic this problem (DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP). Thank you.