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.