Bug #5604 SQL syntax to drop primary key is wrong.
Submitted: 16 Sep 2004 2:15 Modified: 3 Nov 2004 19:51
Reporter: Shuichi Tamagawa Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Query Browser Severity:S3 (Non-critical)
Version:1.0.12-GA OS:Windows (Win XP / SP2)
Assigned to: Michael G. Zinner CPU Architecture:Any

[16 Sep 2004 2:15] Shuichi Tamagawa
Description:
When trying to drop primary key from the MySQL Table Editor, it fails because of SQL syntax error.

How to repeat:
execute 'create table test(a int primary key);'
In the Query Browser right on the table you created and select 'Edit Table'.
In the Table editor click on the 'key mark' in the Column Name field.
Click 'Apply Changes'.
Click 'Execute' in the 'Confirm Edit Table' dialog.
--> it returns Error No.1064

Suggested fix:
ALTER TABLE `test`.`test` DROP PRIMARY KEY, ADD PRIMARY KEY();

should be

ALTER TABLE `test`.`test` DROP PRIMARY KEY;
[3 Nov 2004 13:08] Michael G. Zinner
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at
    http://www.mysql.com/doc/en/Installing_source_tree.html
[3 Nov 2004 19:28] Shuichi Tamagawa
Hi Michael,

It seems that this is not fixed yet in 1.1.0-gammna.

Now the SQL to drop primary key is like...

ALTER TABLE `test`.`t1` DROP PRIMARY KEY
, ADD PRIMARY KEY()
, DROP INDEX `PRIMARY`;

It should simply be

ALTER TABLE `test`.`t1` DROP PRIMARY KEY;
[3 Nov 2004 19:51] Michael G. Zinner
I know, this is fixed in the upcoming releases MA 1.0.15 and QB 1.1.1