Bug #50947 Workbench Unhandled Exception Column Specified twice
Submitted: 5 Feb 2010 16:01 Modified: 19 Apr 2010 15:07
Reporter: AI Engr Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Workbench: Administration Severity:S2 (Serious)
Version:5.2.15 Beta Revision 5053 OS:MacOS (10.6.2)
Assigned to: Alfredo Kojima CPU Architecture:Any
Tags: column, specified twice, workbench

[5 Feb 2010 16:01] AI Engr
Description:
The Workbench internal SQL script to add a new user is improperly formed. As you can see below, the last 7 columns are repeated twice in the script. Script is spaced for clarity. The exception follows: 

Unhandled exception: Error adding account anewuser@%: Error executing 'INSERT INTO mysql.user (User, Host, Select_priv, Insert_priv, Update_priv, Delete_priv, Create_priv, Drop_priv, Reload_priv, Shutdown_priv, Process_priv, File_priv, Grant_priv, References_priv, Index_priv, Alter_priv, Show_db_priv, Super_priv, Create_tmp_table_priv, Lock_tables_priv, Execute_priv, Repl_slave_priv, Repl_client_priv, Create_view_priv, Show_view_priv, Create_routine_priv, Alter_routine_priv, Create_user_priv, Event_priv, Trigger_priv, 

max_questions, max_updates, max_connections, max_user_connections, ssl_cipher, x509_issuer, x509_subject, 

max_questions, max_updates, max_connections, max_user_connections, ssl_cipher, x509_issuer, x509_subject, 

max_questions, max_updates, max_connections, max_user_connections, ssl_cipher, x509_issuer, x509_subject) 

VALUES ('anewuser', '%', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 0, 0, 0, 0, '', '', '')':
Column 'x509_subject' specified twice

I was able to add one user after installing the Workbench. Then when trying to add other users, I get a window popup stating the above message. Also, it doesn't seems to be adding the password specified in the entry box. 

How to repeat:
MySQL 5.1.43 Community Server
Mac 10.6.2

Install fresh workbench app. Connect to localhost. Try to add new user.

Suggested fix:
Check insert/parsing script for multiple inclusions of query limit params(max_questions, etc).
[5 Feb 2010 16:28] AI Engr
Update:
After more testing, it seems the exception is triggered by adding admin roles to the user when creating a new user. The exception is not generated when adding a user without roles, as long as a role is not clicked. If a role is clicked on, then clicked off, then one tries to save the user, the exception will be raised.

It seems that a user must be created first, then assigned privileges. It makes no difference to me how the user is created, but if the business logic is as stated, the admin roles screen should be disabled/hidden to prevent accidental errors. Or just fix the script generation error. Or both?
[5 Feb 2010 16:43] AI Engr
This can also occur when adding a new user if the Admin Roles tab is click on. The behavior is inconsistent, however.
[6 Feb 2010 11:42] Valeriy Kravchuk
Thank you for the bug report. Verified just as described on Mac OS X 10.5.x. Error happened when I tried to add second new user account.
[14 Apr 2010 16:05] Alfredo Kojima
This has been fixed previously, I can repeat in 5.2.15 but not in .18
[16 Apr 2010 16:54] Johannes Taxacher
fix confirmed in repository
[19 Apr 2010 15:07] Tony Bedford
An entry has been added to the 5.2.19 changelog:

The internal script MySQL Workbench used to add a new user to MySQL Server was incorrect. After MySQL Workbench was started, it was possible to create a new user, but attempts to create additional users resulted in an unhandled exception.
[2 Jan 2011 20:42] Matt Sherwood
I have repeated this bug in version 5.2.31. I cannot add any new users to my database until this gets fixed.
[1 Feb 2011 21:44] Mark Foster
Same problem for me in .31 - any workaround or patches?
[9 Feb 2011 20:32] Peter Berkman
I have this problem with version .31 too.  in addtion, I get the same "unhandled exception" dialog box when I try and change the server configuration (on the configuration tab).