Bug #59050 | Unable to synchronize table from model containing datetime column | ||
---|---|---|---|
Submitted: | 20 Dec 2010 9:21 | Modified: | 21 Dec 2010 13:05 |
Reporter: | Michael Kakuschky | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Workbench: Modeling | Severity: | S2 (Serious) |
Version: | 5.2.31a | OS: | Windows (WIndows 7 x64) |
Assigned to: | CPU Architecture: | Any | |
Tags: | database, datetime, model, synchronize, workbench |
[20 Dec 2010 9:21]
Michael Kakuschky
[20 Dec 2010 9:39]
Michael Kakuschky
I did some more tests. If I connect via the Windows command line from the windows machine where the workbench is running it works. It works also like above described If I log in via SSH to the database server and start a mysql console directly on the machine But it' does not work if I try to synchronize the database with the the model via the Synchronize Database Dialog or running the the statement from the Workbench SQLQuery Tab. So it looks that it depends from the Workbench and not from the machine where the command is executed.
[20 Dec 2010 9:41]
Michael Kakuschky
just edit the Synopsis
[20 Dec 2010 16:12]
Peter Laursen
Tiis is an SQL_MODE issue. Simple test case: SET SQL_MODE = 'no_zero_date,strict_all_tables'; CREATE TABLE `test`.`dttest`(`id` INT NOT NULL AUTO_INCREMENT,`dt` DATETIME, PRIMARY KEY (`id`)); ALTER TABLE `test`.`dttest` ADD COLUMN `txt` CHAR(5) NULL AFTER `dt`; -- also -- Incorrect datetime value: '0000-00-00 00:00:00' for column 'dt' at row 1 SET SQL_MODE = ''; ALTER TABLE `test`.`dttest` ADD COLUMN `txt` CHAR(5) NULL AFTER `dt`; -- success. So WB must use some strict mode for its connection similar to my first example here. Why it does I cannot tell. I think this is a server bug. The error does not make sense as long as there are no rows with a date value of 0000-00-00. I will open a separate issue for this.
[20 Dec 2010 16:18]
Peter Laursen
Posted: http://bugs.mysql.com/bug.php?id=59062
[20 Dec 2010 17:54]
Michael Kakuschky
o.k. there was one entry with a date equals 0 and after setting the value to a valid date it works. So maybe it's not a bug. But is there a way to set the SQL_MODE within the Workbench?
[20 Dec 2010 19:39]
Peter Laursen
I closed my report. Seems that I did a mistake (overlooked a row). But this error will only occur in no_zero_date+strict_***_tables sql_mode (with no_zero_date alone it will return a warning - not an error).
[21 Dec 2010 12:23]
Valeriy Kravchuk
Check SQL Editor tab in Preferences if you want to set default SQL mode to something specific.
[21 Dec 2010 13:05]
Michael Kakuschky
I checked the SQLEditor preferences tab. The hint of the SQL_MODE textbox says enter a whitespace to reset the SQL_MODE. I tried this and after that adding columns works with columns containing a 0(zero) date. I removed the whitespace from the SQL_MODE textbox and restarted the workbench to check if the insert fails again. But it didn't. Seems that the reset did some permanent changes somewhere in the configuration of the Workbench.