Bug #79624 "alter column c1 set default current_stamp" is not working
Submitted: 14 Dec 2015 2:52 Modified: 25 Jun 2018 11:15
Reporter: Su Dylan Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: DML Severity:S3 (Non-critical)
Version:5.5/5.6/5.7/8.0 OS:Any
Assigned to: CPU Architecture:Any

[14 Dec 2015 2:52] Su Dylan
Description:
Output:
=======
mysql> drop table if exists test;
Query OK, 0 rows affected (0.01 sec)

mysql> create table test(c1 int primary key, c2 timestamp );
Query OK, 0 rows affected (0.01 sec)

mysql> alter table test alter column c2 set default current_timestamp;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'current_timestamp' at line 1
mysql> alter table test alter column c2 set default now();
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'now()' at line 1
mysql> alter table test alter column c2 set default '2015-01-01 01:01:01';
Query OK, 0 rows affected (0.00 sec)
Records: 0  Duplicates: 0  Warnings: 0

mysql>
mysql>
mysql> select version();
+-----------+
| version() |
+-----------+
| 5.7.8-rc  |
+-----------+
1 row in set (0.00 sec)

Problem:
========
When I want to set a timestamp column default to current_stamp, it raises syntax error.

How to repeat:

drop table if exists test;
create table test(c1 int primary key, c2 timestamp ); 
alter table test alter column c2 set default current_timestamp;
alter table test alter column c2 set default now();
alter table test alter column c2 set default '2015-01-01 01:01:01';

Suggested fix:
When I want to set a timestamp column default to current_stamp, it succeeds.
[25 Jun 2018 11:15] MySQL Verification Team
Thank you for the bug report.