Details
-
Bug
-
Status: Closed (View Workflow)
-
Minor
-
Resolution: Not a Bug
-
10.6.12
-
None
-
Ubuntu 22.04
Description
I have a table which has an 'updated' timestamp column which on update will update the timestamp, and another timestamp column which may or may not get updated but has no default/on update attributes. I noticed that the other timestamp column was returning the same value as the updated column so looked into it a bit further.
It seems DEFAULT and ON UPDATE is being set on the first TIMESTAMP column when not defined in the table definition, it seems to be reset for the second column though.
CREATE TABLE test ( a TIMESTAMP ); |
DESCRIBE test;
|
| a | timestamp | NO | | current_timestamp() | on update current_timestamp() | |
|
CREATE TABLE test2 ( a TIMESTAMP DEFAULT CURRENT_TIMESTAMP ); |
DESCRIBE test2;
|
| a | timestamp | NO | | current_timestamp() | | |
|
CREATE TABLE test3 ( a TIMESTAMP DEFAULT CURRENT_TIMESTAMP, b TIMESTAMP ); |
DESCRIBE test3;
|
| a | timestamp | NO | | current_timestamp() | | |
| b | timestamp | NO | | 0000-00-00 00:00:00 | | |
|
CREATE TABLE test4 ( a TIMESTAMP, b TIMESTAMP ); |
DESCRIBE test4;
|
| a | timestamp | NO | | current_timestamp() | on update current_timestamp() | |
| b | timestamp | NO | | 0000-00-00 00:00:00 | | |