Bug #33124 | Error 1067 adding column to table with 2 not null TIMESTAMPs when NO_ZERO_DATE | ||
---|---|---|---|
Submitted: | 10 Dec 2007 21:12 | Modified: | 1 Feb 2013 21:12 |
Reporter: | Gordon Shannon | Email Updates: | |
Status: | Duplicate | Impact on me: | |
Category: | MySQL Server: DDL | Severity: | S3 (Non-critical) |
Version: | 5.0.27-log | OS: | Linux |
Assigned to: | CPU Architecture: | Any | |
Tags: | strict, timestamp |
[10 Dec 2007 21:12]
Gordon Shannon
[10 Dec 2007 22:05]
MySQL Verification Team
Thank you for the bug report. 5.1 not presents this behavior: set global sql_mode='STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE'; drop table if exists gs02; create table gs02 ( id int not null auto_increment, ts1 timestamp not null, ts2 timestamp not null, primary key (id)); insert into gs02 (ts1, ts2) values (null, 20071030000000); alter table gs02 add vc varchar(10); Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 4 Server version: 5.0.54-debug Source distribution Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> set global sql_mode='STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE'; Query OK, 0 rows affected (0.00 sec) mysql> drop table if exists gs02; Query OK, 0 rows affected (0.00 sec) mysql> create table gs02 ( -> id int not null auto_increment, -> ts1 timestamp not null, -> ts2 timestamp not null, -> primary key (id)); Query OK, 0 rows affected (0.00 sec) mysql> insert into gs02 (ts1, ts2) values (null, 20071030000000); Query OK, 1 row affected (0.00 sec) mysql> alter table gs02 add vc varchar(10); ERROR 1067 (42000): Invalid default value for 'ts2' [miguel@amanhecer dbs]$ 5.1/bin/mysql -uroot db4 Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 3 Server version: 5.1.23-rc-debug Source distribution Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> set global sql_mode='STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE'; Query OK, 0 rows affected (0.00 sec) mysql> drop table if exists gs02; Query OK, 0 rows affected, 1 warning (0.00 sec) mysql> create table gs02 ( -> id int not null auto_increment, -> ts1 timestamp not null, -> ts2 timestamp not null, -> primary key (id)); Query OK, 0 rows affected (0.01 sec) mysql> insert into gs02 (ts1, ts2) values (null, 20071030000000); Query OK, 1 row affected (0.00 sec) mysql> alter table gs02 add vc varchar(10); Query OK, 1 row affected (0.01 sec) Records: 1 Duplicates: 0 Warnings: 0
[1 Feb 2013 21:12]
Dmitry Lenev
Hello! This issue has the same reason (the fact that we add implicit defaults for TIMESTAMP columns) and is fixed by the same patch as bug#55131 "cannot define timestamp column without an implicit DEFAULT". The latter was fixed in 5.6.6 version of server. I am closing this bug as a duplicate of the latter bug.