Hi there,
- I have a table with 3 timestamp columns.
- Non of them have "on update current_timestamp"
- All of them have NULL -> default NULL
When editing any line, the first timestamp column has the function NOW by default.
Why is that?
Hi there,
- I have a table with 3 timestamp columns.
- Non of them have "on update current_timestamp"
- All of them have NULL -> default NULL
When editing any line, the first timestamp column has the function NOW by default.
Why is that?
As described in the MySQL manual for TIMESTAMP columns, you have to specifically set a default value for a TIMESTAMP column (e.g. 'DEFAULT 0'), else it will automatically use the NOW() function as a default value. That's one of the main differences between a TIMESTAMP column and a DATETIME column.
EDIT: Just read over your third bullet point there, and now I'm somewhat confused. If you're positive that you declared the columns with the NULL attribute as well as DEFAULT NULL, then they should in fact be able to hold NULL values.
What if you try to insert a row via the MySQL command line (or just via a normal query within PMA - not using PMA's "Insert" tab) and leave out these columns in the INSERT? Do all three TIMESTAMP columns show NULL values? I'm wondering if this isn't just a "feature" in PMA that isn't quite behaving as it should.
Default 0 it's the solution, no more NOW function
Thanks