Bug #83755 Wrong query generated when auto incremental property of an unsigned field is set
Submitted: 9 Nov 2016 15:29 Modified: 10 Nov 2016 11:41
Reporter: Erman Müftüoğlu Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Workbench: SQL Editor Severity:S3 (Non-critical)
Version:6.3.8 OS:Any
Assigned to: CPU Architecture:Any
Tags: Auto Incremental, UNSIGNED, Wrong Query

[9 Nov 2016 15:29] Erman Müftüoğlu
Description:
Wrong query generated when auto incremental property of an unsigned field is set to true

How to repeat:
CREATE TABLE `us_test` (
  `us_test_id` bigint(20) unsigned NOT NULL,
  PRIMARY KEY (`us_test_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_turkish_ci;

Try to change AI (Auto incremental) property of `us_test_id` to true 

MySQL Workbench generates this query

ALTER TABLE `test`.`us_test` 
CHANGE COLUMN `us_test_id` `us_test_id` BIGINT(20) UNSİGNED UNSIGNED NOT NULL AUTO_INCREMENT ;

It had to be

ALTER TABLE `test`.`us_test` 
CHANGE COLUMN `us_test_id` `us_test_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT ;
[9 Nov 2016 16:41] MySQL Verification Team
Correct query

Attachment: AI_alter_table.png (image/png, text), 284.85 KiB.

[9 Nov 2016 16:42] MySQL Verification Team
Thank you for bug report. I couldn't repeat on Windows 10 Pro.
[9 Nov 2016 16:50] Erman Müftüoğlu
Screenshot

Attachment: tmp_mysql_workbench_bug.png (image/png, text), 121.05 KiB.

[9 Nov 2016 16:56] Erman Müftüoğlu
I tested on

Windows 10 Pro
MySQL 5.6.11
MySQL Workbench 6.3.8

After table generated, i tried to alter table with GUI, although field was unsigned, UN field was not checked, i checked this field again and checked AI field also then wrong query generated as seen on screenshot.
[9 Nov 2016 17:46] MySQL Verification Team
I was not able to repeat with most recent 5.6.X server, not sure if related you are using 5.6.11 a bit older version current release is 5.6.34. Are you able to test with today release version?. Thanks.
[9 Nov 2016 21:57] Erman Müftüoğlu
Hi I tested on MySQL 5.7.9. Still same. My Windows language is English but my regional settings is Turkish, i don't know it is related or not.
[9 Nov 2016 23:18] MySQL Verification Team
Thank you for the feedback. Please attach screen-shot for every step you need to do to repeat the issue (since create table). Thanks in advance.
[9 Nov 2016 23:33] Erman Müftüoğlu
Step#1

Attachment: tmp_mysql_workbench_bug_step_1.png (image/png, text), 100.23 KiB.

[9 Nov 2016 23:33] Erman Müftüoğlu
Step #2

Attachment: tmp_mysql_workbench_bug_step_2.png (image/png, text), 106.53 KiB.

[9 Nov 2016 23:33] Erman Müftüoğlu
Step #3

Attachment: tmp_mysql_workbench_bug_step_3.png (image/png, text), 107.12 KiB.

[9 Nov 2016 23:33] Erman Müftüoğlu
Step #4

Attachment: tmp_mysql_workbench_bug_step_4.png (image/png, text), 160.44 KiB.

[9 Nov 2016 23:37] Erman Müftüoğlu
Hi Miguel,I attached screenshots of every step. You may follow clicks as shown as red rectangles.
[10 Nov 2016 11:41] Chiranjeevi Battula
Hello Erman,

Thank you for your feedback.
I could not see any issues with applying Auto increment to alter table in WB 6.3.8 version.
If you can provide more information, feel free to add it to this bug and change the status back to 'Open'.

Thanks,
Chiranjeevi.
[10 Nov 2016 11:42] Chiranjeevi Battula
Screenshot

Attachment: 83755.JPG (image/jpeg, text), 104.17 KiB.