Bug #86379 Cannot create new Unique Index
Submitted: 18 May 2017 23:56 Modified: 4 Aug 2017 0:08
Reporter: Knight Yoshi Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Workbench Severity:S3 (Non-critical)
Version:6.3.9 OS:MacOS (macOS 10.12.x Sierra x86_64)
Assigned to: CPU Architecture:Any
Tags: WBBugReporter

[18 May 2017 23:56] Knight Yoshi
Description:
When trying to add a unique index to a new field in an existing table MySQL Workbench throws an error saying it already exists. This happens when I use both the interface for adding fields/indexes and when I try to manually execute the SQL statement.

How to repeat:
Open a connection to a DB
In the left pane click the icon to edit a table via the UI
Add a new field and set it to be UNIQUE
Click Apply
[19 May 2017 0:03] Knight Yoshi
This may actually be a MySQL error, not a WB error. I just tried executing the same SQL statement in phpMyAdmin and got a duplicate entry error.

I checked the INNODB_SYS_INDEXES table and no results were returned with the index I'm trying to create.
[19 May 2017 1:13] MySQL Verification Team
Thank you for the bug report. Then what is the sql statement?. Thanks.
[20 Jun 2017 1:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
[20 Jun 2017 1:03] Knight Yoshi
I didn't see the reply to this.

SQL Statement:
ALTER TABLE `gaiatools_yii`.`user` 
ADD UNIQUE INDEX `userslug_UNIQUE` (`userslug` ASC)

Error 1062: Duplicate entry '' for key 'userslug_UNIQUE'
SQL Statement:
ALTER TABLE `gaiatools_yii`.`user` 
ADD UNIQUE INDEX `userslug_UNIQUE` (`userslug` ASC)

Ultimately I had to drop and recreate the table to add the UNIQUE index.
[4 Aug 2017 0:08] MySQL Verification Team
I wasn't able to repeat with WB 5.3.9 on MAC OS 10;12;6 against local server 5.7.18.