Bug #53067 Incorrect formats being generated by "Copy SQL to Clipboard"
Submitted: 22 Apr 2010 14:23 Modified: 23 Apr 2010 15:50
Reporter: Joshua Levin Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Workbench: Modeling Severity:S2 (Serious)
Version:5.2.17 OSS Beta Rev. 5565 OS:Windows (Vista)
Assigned to: CPU Architecture:Any

[22 Apr 2010 14:23] Joshua Levin
Description:
"Copy SQL to Clipboard" gets incomplete syntax:

CREATE  TABLE IF NOT EXISTS `lawcast88rw`.`ISSUESx` (
  `IssueID` INT NOT NULL AUTO_INCREMENT ,
  `PubID` SMALLINT(6)  NULL COMMENT 'Publication' ,
  `IssueDate` DATE NULL ,
  PRIMARY KEY (`IssueID`) ,
  UNIQUE INDEX `IssueID_UNIQUE` (`IssueID` ASC) ,
  INDEX `PubID` () ,
  CONSTRAINT `PubID`
    FOREIGN KEY ()
    REFERENCES `lawcast88rw`.`PUBLICATIONS` ()
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
ENGINE = InnoDB

I corrected this, by adding names, to:

CREATE  TABLE IF NOT EXISTS `lawcast88rw`.`ISSUES` (
  `IssueID` INT NOT NULL AUTO_INCREMENT ,
  `PubID` SMALLINT(6)  NULL COMMENT 'Publication' ,
  `IssueDate` DATE NULL ,
  PRIMARY KEY (`IssueID`) ,
  UNIQUE INDEX `IssueID_UNIQUE` (`IssueID` ASC) ,
  INDEX `PubID` (`PubID` ASC) ,
  CONSTRAINT `PubID`
    FOREIGN KEY (`PubID` )
    REFERENCES `lawcast88rw`.`PUBLICATIONS` (`PubID` )
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
ENGINE = InnoDB

However, when I try to use this to build a table in the target database, I get an error unless I remove the body of the CONSTRAINT stuff, as such:

COMMENT = 'List of Publications'
CREATE  TABLE IF NOT EXISTS `lawcast88rw`.`ISSUES` (
  `IssueID` INT NOT NULL AUTO_INCREMENT ,
  `PubID` SMALLINT(6)  NULL COMMENT 'Publication' ,
  `IssueDate` DATE NULL ,
  PRIMARY KEY (`IssueID`) ,
  UNIQUE INDEX `IssueID_UNIQUE` (`IssueID` ASC) ,
  INDEX `PubID` (`PubID` ASC) ,
  CONSTRAINT `PubID`)
ENGINE = InnoDB

This used to work on the previous Beta version, and now it doesn't.

How to repeat:
See Description, above.

Suggested fix:
You need to have better regression testing.
[22 Apr 2010 15:20] MySQL Verification Team
Could you please try version 5.2.19 and comment the results here. Thanks in advance.
[23 Apr 2010 14:40] Joshua Levin
Initial problem corrected in 5.2.19 OSS Beta Rev. 5680.

Other problems persist, and will be reported separately.

Also, I was informed of the existence of 5.2.19 by e-mail.  One of the first things I did when I was having problems was to do Help --> Check for Updates ..., and I never saw any new updates available.  The "Check for Updates" feature has to be reliable.

I have a feeling that someone is too anxious to release new versions into Beta.  There should be more thorough regression testing before Beta release, to make sure that "improvements" don't shut down existing features that work correctly.  A release that does not pass this regression testing should be an internal "Alpha" release.
[23 Apr 2010 15:50] Valeriy Kravchuk
Initial problem is not repeatable with a recent version, 5.2.19. Other problems mentioned are to be reported separately.