Bug #70739 Use same fsp for CURRENT_TIMESTAMP as for column by default
Submitted: 27 Oct 2013 9:52 Modified: 7 Jan 2021 8:06
Reporter: Daniël van Eeden (OCA) Email Updates:
Status: Open Impact on me:
None 
Category:MySQL Server: DDL Severity:S4 (Feature request)
Version:5.6, 5.7, 8.0 OS:Any
Assigned to: CPU Architecture:Any
Tags: DEFAULT, fsp, timestamp

[27 Oct 2013 9:52] Daniël van Eeden
Description:
A column with a fsp only works if the default value uses the same fsp, so why shouldn't that be the default then?

How to repeat:
mysql> CREATE TABLE t1 (ts TIMESTAMP(6) DEFAULT CURRENT_TIMESTAMP);
ERROR 1067 (42000): Invalid default value for 'ts'

mysql> CREATE TABLE t1 (ts TIMESTAMP DEFAULT CURRENT_TIMESTAMP(6));
ERROR 1067 (42000): Invalid default value for 'ts'

mysql> CREATE TABLE t1 (ts TIMESTAMP(6) DEFAULT CURRENT_TIMESTAMP(6));
Query OK, 0 rows affected (0.02 sec)

Suggested fix:
If a fsp is supplied for a column then the same fsp should also be used for the default value for the column.
[21 Aug 2017 9:48] Daniël van Eeden
update versions
[21 Aug 2017 9:49] Daniël van Eeden
Related:
Bug #71982 	TIMESTAMP(6) DEFAULT CURRENT_TIMESTAMP --> invalid
[7 Jan 2021 8:06] Daniël van Eeden
This is still valid. Could this be verified?