MySQL Forums
Forum List  »  Newbie

Re: Malformed date yet column still gets updated
Posted by: Rick James
Date: January 29, 2015 06:09PM

More details (from changelogs):

----- 2012-08-07 5.6.6 Milestone 9 -- Bugs Fixed -- -----

MySQL was overly agressive in enforcing the NO_ZERO_DATE ( http://dev.mysql.com/doc/refman/5.6/en/sql-mode.html#sqlmode_no_zero_date ) and NO_ZERO_IN_DATE ( http://dev.mysql.com/doc/refman/5.6/en/sql-mode.html#sqlmode_no_zero_in_date ) SQL modes for default values in column definitions for CREATE TABLE ( http://dev.mysql.com/doc/refman/5.6/en/create-table.html ) and ALTER TABLE ( http://dev.mysql.com/doc/refman/5.6/en/alter-table.html ) statements. Previously, default dates that were invalid with those SQL modes enabled produced an error, even when strict mode was not enabled. Now with NO_ZERO_DATE ( http://dev.mysql.com/doc/refman/5.6/en/sql-mode.html#sqlmode_no_zero_date ) or NO_ZERO_IN_DATE ( http://dev.mysql.com/doc/refman/5.6/en/sql-mode.html#sqlmode_no_zero_in_date ) enabled, invalid default dates produce a warning if strict SQL mode is not enabled, and an error if strict mode is enabled. (Bug #34280, Bug #11747847)

----- 2014-03-27 5.6.17 -- Functionality Added or Changed -- Incompatible Change -----

The ERROR_FOR_DIVISION_BY_ZERO ( http://dev.mysql.com/doc/refman/5.6/en/sql-mode.html#sqlmode_error_for_division_by_zero ), NO_ZERO_DATE ( http://dev.mysql.com/doc/refman/5.6/en/sql-mode.html#sqlmode_no_zero_date ), and NO_ZERO_IN_DATE ( http://dev.mysql.com/doc/refman/5.6/en/sql-mode.html#sqlmode_no_zero_in_date ) SQL modes now are deprecated and setting the sql_mode value to include any of them generates a warning. In MySQL 5.7, these modes do nothing. Instead, their effects are included in the effects of strict SQL mode (STRICT_ALL_TABLES ( http://dev.mysql.com/doc/refman/5.6/en/sql-mode.html#sqlmode_strict_all_tables ) or STRICT_TRANS_TABLES ( http://dev.mysql.com/doc/refman/5.6/en/sql-mode.html#sqlmode_strict_trans_tables )). The motivation for the change in MySQL 5.7 is to reduce the number of SQL modes with an effect dependent on strict mode and make them part of strict mode itself.

To make advance preparation for an upgrade to MySQL 5.7, see SQL Mode Changes in MySQL 5.7 ( http://dev.mysql.com/doc/refman/5.7/en/sql-mode.html#sql-mode-changes ). That discussion provides guidelines to assess whether your applications will be affected by the SQL mode changes in MySQL 5.7.

----- 2014-03-31 5.7.4 Milestone 14 -- Functionality Added or Changed -- Incompatible Change -----

The deprecated ERROR_FOR_DIVISION_BY_ZERO ( http://dev.mysql.com/doc/refman/5.7/en/sql-mode.html#sqlmode_error_for_division_by_zero ), NO_ZERO_DATE ( http://dev.mysql.com/doc/refman/5.7/en/sql-mode.html#sqlmode_no_zero_date ), and NO_ZERO_IN_DATE ( http://dev.mysql.com/doc/refman/5.7/en/sql-mode.html#sqlmode_no_zero_in_date ) SQL modes now do nothing. Instead, their previous effects are included in the effects of strict SQL mode (STRICT_ALL_TABLES ( http://dev.mysql.com/doc/refman/5.7/en/sql-mode.html#sqlmode_strict_all_tables ) or STRICT_TRANS_TABLES ( http://dev.mysql.com/doc/refman/5.7/en/sql-mode.html#sqlmode_strict_trans_tables )). In other words, strict mode now means the same thing as the previous meaning of strict mode plus the ERROR_FOR_DIVISION_BY_ZERO ( http://dev.mysql.com/doc/refman/5.7/en/sql-mode.html#sqlmode_error_for_division_by_zero ), NO_ZERO_DATE ( http://dev.mysql.com/doc/refman/5.7/en/sql-mode.html#sqlmode_no_zero_date ), and NO_ZERO_IN_DATE ( http://dev.mysql.com/doc/refman/5.7/en/sql-mode.html#sqlmode_no_zero_in_date ) modes. This change reduces the number of SQL modes with an effect dependent on strict mode and makes them part of strict mode itself.

To prepare for the SQL mode changes in this version of MySQL, it is advisable before upgrading to read SQL Mode Changes in MySQL 5.7 ( http://dev.mysql.com/doc/refman/5.7/en/sql-mode.html#sql-mode-changes ). That discussion provides guidelines to assess whether your applications will be affected by these changes.

The deprecated ERROR_FOR_DIVISION_BY_ZERO ( http://dev.mysql.com/doc/refman/5.7/en/sql-mode.html#sqlmode_error_for_division_by_zero ), NO_ZERO_DATE ( http://dev.mysql.com/doc/refman/5.7/en/sql-mode.html#sqlmode_no_zero_date ), and NO_ZERO_IN_DATE ( http://dev.mysql.com/doc/refman/5.7/en/sql-mode.html#sqlmode_no_zero_in_date ) SQL modes are still recognized so that statements that name them do not produce an error, but will be removed in a future version of MySQL. To make advance preparation for versions of MySQL in which these modes do not exist, applications should be modified to not refer to those mode names.

Options: ReplyQuote


Subject
Written By
Posted
Re: Malformed date yet column still gets updated
January 29, 2015 06:09PM


Sorry, you can't reply to this topic. It has been closed.

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.