Bug #43058 Constraints still reference schema name even when omit schema qualifiers checked
Submitted: 20 Feb 2009 14:21 Modified: 28 Aug 2009 9:02
Reporter: James Gordon Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Workbench Severity:S2 (Serious)
Version:5.0.30 OS:Any
Assigned to: Assigned Account CPU Architecture:Any
Tags: CHECKED

[20 Feb 2009 14:21] James Gordon
Description:
After call 38223 there is a new option in 5.0.30 to omit schema identifiers in created script. This helps my scripts as it doesn't prefix the schema objects with a schema name. e.g. table table1 isn't prefixed with 'bp' to make 'bp'.table1.

The problem lies in that when it creates constraints it still does prefix with the schema name.

-- -----------------------------------------------------
-- Table `Programmes`
-- -----------------------------------------------------
CREATE  TABLE IF NOT EXISTS `Programmes` (
  `idProgrammes` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
  `idSectionMembershipTypes` INT UNSIGNED NOT NULL ,
  `idSeasons` INT UNSIGNED NOT NULL ,
  `ProgrammeTitle` VARCHAR(45) NOT NULL ,
  `StartDate` DATE NOT NULL ,
  `EndDate` DATE NOT NULL ,
  `Costs` FLOAT NOT NULL ,
  PRIMARY KEY (`idProgrammes`) ,
  INDEX `PRG_SEA_FK` (`idSeasons` ASC) ,
  INDEX `PRG_SMT_FK` (`idSectionMembershipTypes` ASC) ,
  CONSTRAINT `PRG_SEA`
    FOREIGN KEY (`idSeasons` )
    REFERENCES `bp`.`Seasons` (`idSeasons` ),
  CONSTRAINT `PRG_SMT`
    FOREIGN KEY (`idSectionMembershipTypes` )
    REFERENCES `bp`.`SectionMembershipTypes` (`idSectionMembershipTypes` ))
PACK_KEYS = 0
ROW_FORMAT = DEFAULT;

How to repeat:
Forward engineer to sql script
Check "omit schemata quilifiers from output"

The schema name is not prefixed to the create table but is still prefixed on the references syntax.

Suggested fix:
Remove any prefixes from outputed statement.
Not sure how you would handle cross schema references?
[26 Feb 2009 16:24] MySQL Verification Team
Thank you for the bug report.

 CONSTRAINT `kf`
    FOREIGN KEY (`col2` )
    REFERENCES `mydb`.`table1` (`idtable1` )
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
ENGINE = InnoDB;
[1 Mar 2009 2:18] MySQL Verification Team
See related bug: http://bugs.mysql.com/bug.php?id=43276.
[24 Mar 2009 16:08] Benjamin Hill
This bug exists in 5.1.9 build 5142
[2 Apr 2009 19:48] Alfredo Kojima
This is a duplicate of bug #42328