[MDEV-30440] Invalid default value on DEFAULT NULL TIMESTAMP Created: 2023-01-20 Updated: 2023-01-20 Resolved: 2023-01-20 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Data Definition - Create Table |
| Affects Version/s: | 10.5.4 |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Major |
| Reporter: | Florent | Assignee: | Unassigned |
| Resolution: | Not a Bug | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Windows 10 |
||
| Description |
|
On mariadb 10.5.4 it seen not possible to create a TIMESTAMP column with null default value. For exemple : Return : |
| Comments |
| Comment by Alice Sherepa [ 2023-01-20 ] | |||||
|
It works as expected. KB says: "MariaDB also has special behavior if NULL is assigned to column that uses the TIMESTAMP data type. If the column is assigned the NULL value in an INSERT or UPDATE query, then MariaDB will automatically initialize the column's value with the current date and time. This automatic initialization for NULL values can also be explicitly disabled for a column that uses the TIMESTAMP data type by specifying the NULL attribute for the column. In this case, if the column's value is set to NULL, then the column's value will actually be set to NULL." ( https://mariadb.com/kb/en/timestamp/) So - first set NULL attribute to timestamp column - then set the default (NULL or something else if needed, CURRENT_TIMESTAMP e.g.) |