2

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

1
  • Can you add your SHOW CREATE TABLE output to the question? Nov 14, 2011 at 14:15

1 Answer 1

2

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
2
  • Everything needed is in your first link. +1 !!! Nov 14, 2011 at 17:47
  • I saw, read and pretty ignore that, before I post this question, thanks for kick +1
    – mKorbel
    Nov 14, 2011 at 19:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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