Bug #35303 MySQL Administrator: Table Editor Generates Invalid "ADD PRIMARY KEY ()" Syntax
Submitted: 15 Mar 2008 1:34 Modified: 26 May 2009 11:56
Reporter: Ryan Lowe Email Updates:
Status: Unsupported Impact on me:
None 
Category:MySQL Administrator Severity:S3 (Non-critical)
Version:1.2.12 OS:MacOS (10.5.2)
Assigned to: CPU Architecture:Any
Tags: catalogs, mysql administrator, table editor

[15 Mar 2008 1:34] Ryan Lowe
Description:
The table editor generates ADD PRIMARY KEY () statements when there is no primary key to be added.

How to repeat:
1) Select "Catalogs" from the top menu icons.
2) Click on a Schemata on the left-hand side.
3) Double-Click on a table that does not have a primary key.
4) Click (highlighting) any column name.
5) Click the "Primary Key" checkbox in the lower-left so that it is checked.
6) Click the "Primary Key" checkbox in the lower-left so that it is un-checked.
7) Click on the "Apply" button.
8) A dialog box will appear with invalid SQL: "... , ADD PRIMARY KEY ();"
9) Click on "Execute".

The following error message will appear: "Error executing SQL commands to update table.  You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 2 (error 1064)"

Suggested fix:
If there's no primary key that needs to be added, don't append ", ADD PRIMARY KEY ();" to the SQL statement.
[17 Mar 2008 14:46] Sveta Smirnova
Thank you for the report.

Verified as described.

Workaround: close, then reopen edit window.
[26 May 2009 11:56] Susanne Ebrecht
Many thanks for writing a bug report. We are on the way to implement full functionality of MySQL Administrator into MySQL Workbench. Unfortunately you are using an unsupported platform. More informations about supported platforms you will find here:

http://www.mysql.com/support/supportedplatforms/tools.html

More informations about MySQL Workbench you will find here:

http://dev.mysql.com/workbench/