Bug #34504 Forward Engineer and TRADITIONAL SQL Mode

Submitted: 12 Feb 2008 22:24 Modified: 29 Mar 2012 3:23
Reporter: Sergey Romanov Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Workbench Severity:S4 (Feature request)
Version:5.0.13 SE Beta OS:Windows (XP SP2)
Assigned to: CPU Architecture:Any
Tags: forward engineer, sql mode

[12 Feb 2008 22:24] Sergey Romanov
Description:
After export with File > Export > Forward Engineer SQL CREATE Script I can see 
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL';
in SQL file. But this mode create problems in some case. For example when you have '0000-00-00' as default value for date fields. In documentation you can see that TRADITIONAL is equivalent to STRICT_TRANS_TABLES, STRICT_ALL_TABLES, NO_ZERO_IN_DATE, NO_ZERO_DATE, ERROR_FOR_DIVISION_BY_ZERO, NO_AUTO_CREATE_USER. As result you have error when try to execute SQL from file.

How to repeat:
SQL:

SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL';

CREATE  TABLE IF NOT EXISTS `test` (
  `create_date` DATE NOT NULL DEFAULT '0000-00-00'
);

SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;

Result:

#1067 - Invalid default value for 'create_date' 

Suggested fix:
Export should be more smart.
[13 Feb 2008 5:54] Valeriy Kravchuk
Thank you for a bug report.
[25 Feb 2008 10:52] Vladimir Kolesnikov
The TRADITIONAL mode is used my intention, so it's not a bug. But we recognize that it would be a good feature to allow users optionally choose a less strict operation mode (at their own risk). So I'm changing this to feature request.
[5 Aug 2009 13:41] Ricardo Cescon
the defualt SQL_MODE='TRADITIONAL' is a problem for me too, for which version is it's planned to allow users optionally choose a less strict operation mode?
[8 May 2011 2:22] Alfredo Kojima
Marked Bug #61082 a duplicate
[29 Mar 2012 3:23] Alfredo Kojima
duplicate of bug #54173

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.043 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
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.