Bug #60824 Trying to create trigger on table within database
Submitted: 10 Apr 2011 13:16 Modified: 12 Apr 2011 1:39
Reporter: Terry Kennedy Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Workbench: SQL Editor Severity:S1 (Critical)
Version:5.2.33 OS:Linux
Assigned to: CPU Architecture:Any

[10 Apr 2011 13:16] Terry Kennedy
Description:
I am trying to run a simple trigger on a database and keep getting the error "External component has thrown an exception".

Here is the trigger:

DELIMITER $$  
CREATE TRIGGER before_employee_update   
BEFORE UPDATE ON employees  
FOR EACH ROW BEGIN 
INSERT INTO employees_audit  
SET action = 'update',  
employeeNumber = OLD.employeeNumber,  
lastname = OLD.lastname,  
changedon = NOW(); END$$  
DELIMITER ;

How to repeat:
Try running the Trigger on a database with the following two tables:

CREATE TABLE `employees` (  
`employeeNumber` int(11) NOT NULL,  
`lastName` varchar(50) NOT NULL,  
`firstName` varchar(50) NOT NULL,  
`extension` varchar(10) NOT NULL,  
`email` varchar(100) NOT NULL,  
`officeCode` varchar(10) NOT NULL,  
`reportsTo` int(11) default NULL,  
`jobTitle` varchar(50) NOT NULL,  
PRIMARY KEY  (`employeeNumber`)  
) 

CREATE TABLE employees_audit (   
id int(11) NOT NULL AUTO_INCREMENT,   
employeeNumber int(11) NOT NULL,   
lastname varchar(50) NOT NULL,   
changedon datetime DEFAULT NULL,   
action varchar(50) DEFAULT NULL,   
PRIMARY KEY (id)   
)
[10 Apr 2011 13:21] Valeriy Kravchuk
What version of Workbench, 5.2.x. do you use? Can you send a screenshot of the error message?
[10 Apr 2011 14:27] Terry Kennedy
Attached is the screenshot of the error.  I am using Workbench 5.2.33 Revision 7508
[10 Apr 2011 14:28] Terry Kennedy
Workbench Error Screenshot

Attachment: sql_scr_shot.png (image/x-png, text), 218.51 KiB.

[10 Apr 2011 14:38] Valeriy Kravchuk
When you'll see this error again, please, right click somewhere in the error dialog box with no text and use Copy stack trace to clipboard context menu item. Send stack trace to this report.
[10 Apr 2011 16:49] Terry Kennedy
Here is the Stack Trace:

Exception = System.Runtime.InteropServices.SEHException
Message = External component has thrown an exception.
FullText = System.Runtime.InteropServices.SEHException (0x80004005): External component has thrown an exception.
   at Db_sql_editor.exec_sql(Db_sql_editor* , basic_string<char\,std::char_traits<char>\,std::allocator<char> >* , shared_ptr<Sql_editor>* , Boolean , Boolean , Boolean )
   at MySQL.GUI.Workbench.Db_sql_editor.exec_sql(String sql, Boolean active_editor, Boolean wrap_with_non_std_delimiter)
   at MySQL.GUI.Workbench.DbSqlEditor.DoExecuteSqlScript(Boolean currentStatementOnly)
   at MySQL.GUI.Workbench.DbSqlEditor.ExecuteCurrentSqlStatement()
   at MySQL.Grt.RunWrappedDelegate0<void\,void\,MySQL::Grt::DelegateSlot0<void\,void>::ManagedDelegate>.native_callback()
   at sigc.pointer_functor0<void>.()(pointer_functor0<void>* )
   at sigc.adaptor_functor<sigc::pointer_functor0<void> >.()(adaptor_functor<sigc::pointer_functor0<void> >* )
   at sigc.internal.slot_call0<sigc::pointer_functor0<void>,void>.call_it(slot_rep* rep)
   at mforms.ToolBarItem.callback(ToolBarItem* )
   at MySQL.Forms.ToolBarItemImpl.OnItemActivation(Object sender, EventArgs e)
   at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
   at System.Windows.Forms.ToolStripButton.OnClick(EventArgs e)
   at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
   at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
   at System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
   at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
   at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at System.Windows.Forms.ToolStrip.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
[10 Apr 2011 22:14] MySQL Verification Team
I couldn't repeat on Vista 64-bit. Which Linux OS are you using?. Thanks in advance.
[11 Apr 2011 13:20] Terry Kennedy
My Hosting Provider says they are using CENT OS.  I am running the workbench on Windows 7 Home Premium 64-bit
[12 Apr 2011 1:31] Alfredo Kojima
Hi

What's the name of the database connection being used?
[12 Apr 2011 1:33] Alfredo Kojima
I see from the screenshot that your connection name as a / in it. This bug is caused by that, please replace that char with something else (such as a dash - ) and it should work. This is a duplicate of bug #60700
[12 Apr 2011 1:35] Terry Kennedy
208.43.81.118/localhost
[12 Apr 2011 1:39] Terry Kennedy
Thank you very much!  That did the trick!