Bug #79624 "alter column c1 set default current_stamp" is not working
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.
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.039 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.