joomla / framework.joomla.org

Application powering the internet home of the Joomla! Framework
https://framework.joomla.org
GNU General Public License v2.0
37 stars 28 forks source link

[RFC] Adopt stricter MySQL sql_mode? #18

Closed andrepereiradasilva closed 7 years ago

andrepereiradasilva commented 7 years ago

in Joomla 4.0 we used a strict sql mode https://github.com/joomla/joomla-cms/pull/12494/files

This was reverted when joomla 4.0 was updated to use the framework database package.

As we know MySql is becoming stricter as the other database systems (postgresql, Mssql) already are.

Example:

In MySQL 5.7.4, the ERROR_FOR_DIVISION_BY_ZERO, NO_ZERO_DATE, and NO_ZERO_IN_DATE SQL modes were changed so that they did nothing when named explicitly. Instead, their effects were included in the effects of strict SQL mode (STRICT_ALL_TABLES or STRICT_TRANS_TABLES). The intent was to reduce the number of SQL modes with an effect dependent on strict mode and make them part of strict mode itself.

However, the change to make strict mode more strict by including ERROR_FOR_DIVISION_BY_ZERO, NO_ZERO_DATE, and NO_ZERO_IN_DATE caused some problems. For example, in MySQL 5.6 with strict mode but not NO_ZERO_DATE enabled, TIMESTAMP columns can be defined with DEFAULT '0000-00-00 00:00:00'. In MySQL 5.7.4 with the same mode settings, strict mode includes the effect of NO_ZERO_DATE and TIMESTAMP columns cannot be defined with DEFAULT '0000-00-00 00:00:00'. This causes replication of CREATE TABLE statements from 5.6 to 5.7.4 to fail if they contain such TIMESTAMP columns.

The long term plan is still to have the three affected modes be included in strict SQL mode and to remove them as explicit modes in a future MySQL release. But to restore compatibility in MySQL 5.7 with MySQL 5.6 strict mode and to provide additional time for affected applications to be modified, the following changes have been made: [...]

See https://dev.mysql.com/doc/relnotes/mysql/5.7/en/news-5-7-8.html#mysqld-5-7-8-sql-mode

Also see discussion in https://github.com/joomla/joomla-cms/issues/16788

andrepereiradasilva commented 7 years ago

wrong place