Bug #27228 unable to delete a column which is set as primary key using table editor
Submitted: 16 Mar 2007 21:17 Modified: 28 Oct 2009 9:40
Reporter: Manisha Siddhu Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Workbench Severity:S3 (Non-critical)
Version:1.2.10 OS:Windows (windows xp)
Assigned to: CPU Architecture:Any
Tags: CHECKED

[16 Mar 2007 21:17] Manisha Siddhu
Description:
when I try to delete a column such as id and id is set as primary key using table editor, table editor generates following query:

ALTER TABLE `db_user16`.`mytable1` DROP COLUMN `id`,
 DROP PRIMARY KEY,
 ADD PRIMARY KEY  USING BTREE();

and when I select apply changes, above query fails.

However If I just time following in query area 
ALTER TABLE `db_user16`.`mytable1` DROP COLUMN `id`

and I execute above query, I am able to delete id.

How to repeat:
select a table which has a primary key. open a table editor by press F2. then try select a column that is a primary key.
right click on a column and select delete column
press ok when window pops up
press apply changes.
it is going to display error message
mysql error number 1064: error in sql query syntax

Suggested fix:
ALTER TABLE `db_user16`.`mytable1` DROP COLUMN `id`,
 DROP PRIMARY KEY,
 ADD PRIMARY KEY  USING BTREE();

to

ALTER TABLE `db_user16`.`mytable1` DROP COLUMN `id`

basically it should treat column set as a primary key as a regular column.
[17 Mar 2007 0:13] MySQL Verification Team
Thank you for the bug report.
[15 Oct 2009 8:43] Susanne Ebrecht
I am pretty sure this issue don't occur in Workbench 5.2 but I will test it.
[28 Oct 2009 9:40] Susanne Ebrecht
Thank you for your bug report. This issue has been already fixed in our source repository of Workbench 5.2 and will be incorporated into the next release.

You can download MySQL Workbench 5.2 here:
http://dev.mysql.com/downloads/