Bug #38948 When defining foreign keys manually list of tables is non-alphabetical
Submitted: 21 Aug 2008 20:37 Modified: 22 Aug 2008 3:35
Reporter: Alex Saavedra Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Workbench Severity:S3 (Non-critical)
Version:5.0.24 OS:Windows
Assigned to: CPU Architecture:Any

[21 Aug 2008 20:37] Alex Saavedra
Description:
If you define manually a relationship, the column "Referenced Table" lists existing tables apparently using the chronological order of creation of tables. Instead, this list should sort tables alphabetically.

With databases containing a large number of tables it's very difficult to find the referenced table you're looking for.

How to repeat:
1. create tables t1, t3, t2 (in this order)
    CREATE  TABLE IF NOT EXISTS `mydb`.`t1` (
      `id` INT NOT NULL AUTO_INCREMENT ,
      PRIMARY KEY (`id`) )
    ENGINE = InnoDB;
    
    CREATE  TABLE IF NOT EXISTS `mydb`.`t3` (
      `id` INT NOT NULL AUTO_INCREMENT ,
      `t1_id` INT NULL ,
      PRIMARY KEY (`id`) )
    ENGINE = InnoDB;
    
    CREATE  TABLE IF NOT EXISTS `mydb`.`t2` (
      `id` INT NOT NULL AUTO_INCREMENT ,
      `t1_id` INT NULL ,
      PRIMARY KEY (`id`) )
    ENGINE = InnoDB;

2. right-click on t2 and select "Edit Table..."
3. go to "Foreign Keys" tab
4. create manually a new foreign key named "fk_t2_t1"
5. when you enter the "Referenced Table" column, you'll see that tables are sorted in the order of creation, instead of alphabetically:

  mydb.t1
  mydb.t3
  mydb.t2
[22 Aug 2008 3:35] Valeriy Kravchuk
Please do not submit the same bug more than once. An existing bug report, Bug #38944, already describes this very problem. Even if you feel that your issue is somewhat different, the resolution is likely to be the same. Because of this, we hope you add your comments to the original bug instead.

Thank you for your interest in MySQL.