Bug #51869 Foreign Key
Submitted: 9 Mar 2010 14:01 Modified: 12 May 2010 10:08
Reporter: Gabriel Feippe Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Workbench: Modeling Severity:S3 (Non-critical)
Version:5.2.16 OS:Microsoft Windows (XP ver 2002 SP3)
Assigned to: CPU Architecture:Any

[9 Mar 2010 14:01] Gabriel Feippe
Description:
Exception = System.Runtime.InteropServices.SEHException
Message = Un componente externo produjo una excepción.
FullText = System.Runtime.InteropServices.SEHException: Un componente externo produjo una excepción.
   en bec.FKConstraintColumnsListBE.get_column_is_fk(FKConstraintColumnsListBE* , NodeId* )
   en MySQL.Grt.Db.FKConstraintColumnsListBE.get_column_is_fk(NodeId node)
   en MySQL.GUI.Workbench.Plugins.DbMysqlTableFkColumnListModel.columnEnabledFkNodeControl_CheckStateChanged(Object sender, TreePathEventArgs e)
   en System.EventHandler`1.Invoke(Object sender, TEventArgs e)
   en Aga.Controls.Tree.NodeControls.NodeCheckBox.OnCheckStateChanged(TreePathEventArgs args)
   en Aga.Controls.Tree.NodeControls.NodeCheckBox.OnCheckStateChanged(TreeNodeAdv node)
   en Aga.Controls.Tree.NodeControls.NodeCheckBox.SetCheckState(TreeNodeAdv node, CheckState value)
   en Aga.Controls.Tree.NodeControls.NodeCheckBox.MouseDown(TreeNodeAdvMouseEventArgs args)
   en Aga.Controls.Tree.TreeViewAdv.OnMouseDown(MouseEventArgs e)
   en System.Windows.Forms.Control.WmMouseDown(Message& m, MouseButtons button, Int32 clicks)
   en System.Windows.Forms.Control.WndProc(Message& m)
   en System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   en System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   en System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

How to repeat:
I put NN columna, over it i try to put a Foreign Key.
[9 Mar 2010 14:34] Valeriy Kravchuk
What exact version of MySQL Workbench, 5.x.y, do you use?
[9 Mar 2010 14:55] Gabriel Feippe
5.2.16 OSS Beta
[9 Mar 2010 14:57] Valeriy Kravchuk
What exact operating system do you use? What data types are used for that foreign key column and primary key column it refers to?
[9 Mar 2010 15:47] Gabriel Feippe
Operation System:
Windows XP version 2002 Service Pack 3

Data Types:
The first table: INT NN
The second table: INT PK NN AI

I create FK for another tables and it work great, it's only in "one" table.
The table is:
-----------------------------------------------------------------------
estados
-----------------------------------------------------------------------
Column Name   Datatype       PK NN UQ BIN UN ZF AI  Default  Comments
-----------------------------------------------------------------------
id            INT            PK NN              AI
nombre        VARCHAR(45)       NN UQ
descripcion   VARCHAR(250)
abierto       INT               NN                  0        yes
reasignar     INT               NN                  0        yes
propietario   INT               NN                  0        yes
-----------------------------------------------------------------------

MySQL Workbench:
5.2.16 OSS beta
revision 5249
[10 Mar 2010 6:50] Susanne Ebrecht
Do I understand this right?

CREATE tab1 (i INT NOT NULL);

CREATE tab2 (i INT NOT NULL auto_increment,
PRIMARY KEY(i),
FOREIGN KEY(i) REFERENCES tab2(i));

This isn't valid ...
[10 Mar 2010 11:37] Gabriel Feippe
I did it:

CREATE tab1 (i INT NOT NULL auto_increment,
PRIMARY KEY (i));

CREATE tab2 (y INT NOT NULL,
FOREIGN KEY(y) REFERENCES tab1(i));

anyway now does't display the error.
Thanks.
[12 Apr 2010 10:08] Valeriy Kravchuk
Where you tried to add foreign key, in SQL Editor tab or in ERR Model tab?
[12 May 2010 23:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".