Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

In MySQL InnDB engine I created TableColumn with data type TIMESTAMP and put there as default value CURRENT_TIMESTAMP, but this value are always changed to CURRENT_TIMESTAMP when I update that by using JDBC or MySQL Administrator GUI,

my questions are

1) is this feature by default and I have to remove CURRENT_TIMESTAMP from Table settings and update this column standard way(s)

2) is there some option / setting that allows me to switch on/off this feature

Sql engine is MySQL 5.1.29-rc community

share|improve this question
    
Can you add your SHOW CREATE TABLE output to the question? –  Derek Downey Nov 14 '11 at 14:15
add comment

1 Answer 1

up vote 2 down vote accepted

According to the manual, a TIMESTAMP can be auto-initialized, auto-updated, both, or neither. The apparent caveat is this:

With neither DEFAULT nor ON UPDATE clauses, it is the same as DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP.

So, if you don't explicitly give the column a default/on update clause, it will do both. If you don't want to default or auto-update, give the default a '0':

ts TIMESTAMP DEFAULT 0
share|improve this answer
    
Everything needed is in your first link. +1 !!! –  RolandoMySQLDBA Nov 14 '11 at 17:47
    
I saw, read and pretty ignore that, before I post this question, thanks for kick +1 –  mKorbel Nov 14 '11 at 19:49
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.