Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
5.5(EOL), 10.0(EOL), 10.1(EOL)
-
Linux
Description
MariaDB has wonderful feature which allows easy create copy of any table.
create table `new_name` select * from `old_table` |
But I found that this is not worked if `old_table` contain default value for timestamp field.
CREATE TABLE `table1` ( |
`f1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP |
) ENGINE=InnoDB DEFAULT CHARSET=utf8; |
0 row(s) affected
|
CREATE TABLE `table2` ( |
`f2` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP |
) ENGINE=InnoDB DEFAULT CHARSET=utf8 |
0 row(s) affected
|
create table `table1copy` select * from `table1` limit 0; |
Error Code: 1067
|
Invalid default value for 'f1'
|
create table `table2copy` select * from `table2` limit 0; |
0 row(s) affected
|
show create table table2copy |
CREATE TABLE `table2copy` (
|
`f2` timestamp NULL DEFAULT NULL
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8
|