[thelist] How to turn off mysqld 3.23's automatic DATE updatefeature?

Hassan Schroeder hassan at webtuitive.com
Thu Apr 28 14:43:09 CDT 2005


Jonathan Dillon wrote:

> Yes, I'm talking about TimeStamps (sorry, pre-coffee).
> 
> The default behavior pre-mysql 4.1 (after which it seems we get a lot more
> control over how it does this) is to update the first timestamp column in a
> table if it's not explicitly updated with a value or the value is NULL.
> 
> This behavior is totally screwing up a ported db I'm working on, and I want
> to disable it.  The documentation on Timestamps (the pre-4.1 bits) on the
> mysql.com site says NOTHING about how to do this,

Probably because you can't :-)

But you can get around it by explicitly assigning a value to the
field when you update the row, e.g

   UPDATE myTable SET tsCol = tsCol, foo = 'bar' WHERE...

On the other hand, if you don't want TIMESTAMP behavior from a
TIMESTAMP column, maybe you should just change it to a DATETIME :-)

FWIW,
-- 
Hassan Schroeder ----------------------------- hassan at webtuitive.com
Webtuitive Design ===  (+1) 408-938-0567   === http://webtuitive.com

                           dream.  code.




More information about the thelist mailing list