Bug #77474 | Clarification in documentation for Timestamp initilization | ||
---|---|---|---|
Submitted: | 24 Jun 2015 16:06 | Modified: | 13 Jul 2015 16:07 |
Reporter: | Mike W | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: Documentation | Severity: | S3 (Non-critical) |
Version: | 5.6 | OS: | Any |
Assigned to: | CPU Architecture: | Any |
[24 Jun 2015 16:06]
Mike W
[24 Jun 2015 21:55]
MySQL Verification Team
Thank you for the bug report. C:\dbs>c:\dbs\5.6\bin\mysql -uroot --port=3560 -p --prompt="mysql 5.6 > " Enter password: ****** Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1 Server version: 5.6.26 Source distribution PULL 2015/06/05 Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql 5.6 > CREATE DATABASE LX; Query OK, 1 row affected (0.01 sec) mysql 5.6 > USE LX Database changed mysql 5.6 > show variables like 'explicit%'; +---------------------------------+-------+ | Variable_name | Value | +---------------------------------+-------+ | explicit_defaults_for_timestamp | OFF | +---------------------------------+-------+ 1 row in set (0.00 sec) mysql 5.6 > set sql_mode='NO_ZERO_DATE'; Query OK, 0 rows affected, 1 warning (0.00 sec) mysql 5.6 > SHOW WARNINGS; +---------+------+-----------------------------------------------------------------------+ | Level | Code | Message | +---------+------+-----------------------------------------------------------------------+ | Warning | 1681 | 'NO_ZERO_DATE' is deprecated and will be removed in a future release. | +---------+------+-----------------------------------------------------------------------+ 1 row in set (0.00 sec) mysql 5.6 > create table t1 ( t1 timestamp default 0, d1 datetime default 0 ); Query OK, 0 rows affected, 2 warnings (0.20 sec) mysql 5.6 > SHOW WARNINGS; +---------+------+---------------------------------------------+ | Level | Code | Message | +---------+------+---------------------------------------------+ | Warning | 1264 | Out of range value for column 't1' at row 1 | | Warning | 1264 | Out of range value for column 'd1' at row 1 | +---------+------+---------------------------------------------+ 2 rows in set (0.00 sec) mysql 5.6 > show create table t1\G *************************** 1. row *************************** Table: t1 Create Table: CREATE TABLE `t1` ( `t1` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `d1` datetime DEFAULT '0000-00-00 00:00:00' ) ENGINE=InnoDB DEFAULT CHARSET=latin1 1 row in set (0.00 sec) mysql 5.6 > insert into t1 values(); Query OK, 1 row affected, 1 warning (0.05 sec) mysql 5.6 > SHOW WARNINGS; +---------+------+---------------------------------------------+ | Level | Code | Message | +---------+------+---------------------------------------------+ | Warning | 1264 | Out of range value for column 'd1' at row 1 | +---------+------+---------------------------------------------+ 1 row in set (0.00 sec) mysql 5.6 > set sql_mode='NO_ZERO_DATE,STRICT_ALL_TABLES'; Query OK, 0 rows affected, 1 warning (0.00 sec) mysql 5.6 > insert into t1 values(); ERROR 1292 (22007): Incorrect datetime value: '0000-00-00 00:00:00' for column 'd1' at row 1 mysql 5.6 >
[13 Jul 2015 16:07]
Paul DuBois
Thank you for your bug report. This issue has been addressed in the documentation. The updated documentation will appear on our website shortly. Will update to refer to the SQL mode docs for more details: The following examples use DEFAULT 0, a default that can produce warnings or errors depending on whether strict SQL mode or the NO_ZERO_DATE SQL mode is enabled. Be aware that the TRADITIONAL SQL mode includes strict mode and NO_ZERO_DATE. See http://dev.mysql.com/doc/refman/5.6/en/sql-mode.html.