Bug #61696 One more space after TINYINT(1) values generated with BOOL
Submitted: 29 Jun 2011 17:28 Modified: 17 Nov 2011 16:27
Reporter: Waldson Moura Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Workbench: Modeling Severity:S3 (Non-critical)
Version:5.2.34 OS:MacOS
Assigned to: CPU Architecture:Any
Tags: foward generate, Tinyint

[29 Jun 2011 17:28] Waldson Moura
Description:
When I use the option Export -> Forward Engineer SQL CREATE Script, all the fields as TINYINT(1) generates one more space after them, but only with BOOL type, for example:
  `description` TEXT NULL ,
  `active` TINYINT(1)  NOT NULL DEFAULT 1 ,
  `orderby` INT(11) UNSIGNED NULL ,
  `system_default` TINYINT(1)  NULL DEFAULT 0 ,

With my tests I verified that it happens when I use BOOL type, if I put as TINYINT(1) or TINYINT(any length) it does not happen!

I know that MySQL doesn't have the BOOL type and uses TINYINT(1) by default, but with my modelings I always use BOOL for a better representation and it works fine! So, that's the problem, just one more space after it when convert BOOL as TINYINT(1)  .

How to repeat:
1. Create a table with one field as BOOL and another with TINYINT(1)
2. Export -> Foward Engineer SQL CREATE Script

Suggested fix:
Just remove the space after TINYINT(1) when it's generated by BOOL type.
[29 Jun 2011 17:41] Valeriy Kravchuk
Thank you for the bug report. Verified just as described. This is how what Workbench generates:

CREATE  TABLE IF NOT EXISTS `mydb`.`table1` (
  `id` INT NOT NULL ,
  `c1` INT NULL DEFAULT 1 ,
  `c2` TINYINT(1)  NULL DEFAULT 1 ,
  `c3` TINYINT(1) NULL DEFAULT 1 ,
  `c4` VARCHAR(45) NULL ,
  PRIMARY KEY (`id`) )
ENGINE = InnoDB;

Column c2 above is BOOLEAN in the model, and extra space (' ') is added after (1) and before NULL.
[17 Nov 2011 16:27] Philip Olson
Fixed as of 5.2.36:

+        <guimenu>File</guimenu>, <guimenu>Export</guimenu>,
+        <guimenu>Forward Engineer SQL CREATE Script</guimenu> would
+        append an extra space to <literal>TINYINT(1)</literal> after
+        converting it from <literal>BOOL</literal>.