Bug #74515 Workbench: Can select table to reference that doesn't exist yet
Submitted: 22 Oct 2014 21:29 Modified: 23 Oct 2014 13:20
Reporter: Craig Macdonald Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Workbench Severity:S3 (Non-critical)
Version:6.2, 6.1 OS:Any
Assigned to: CPU Architecture:Any

[22 Oct 2014 21:29] Craig Macdonald
Description:
When creating the table for an entity with a self-referencing relationship, I find that users (students) create the columns, and then go directly to create the foreign keys before applying the columns. 

The table that is being created appears in the drop down for "Foreign Keys", but selecting it gives the error message:
{{{
Error getting DDL for object
Table 'schemaname.tablename' doesn't exist
}}}

I think that this is confusing - the table is in the list, it can be selected, but then there is an error message. Should it be possible to select a table that doesn't yet exist. Perhaps it should be greyed out instead?

How to repeat:
Create Table... to enter the Table editor.

Give the table a name, e.g. "table1". Create two columns:
 - col1: a primary key, INT
 - col2: not a primary key, INT

Do not click apply.

Switch to the Foreign Keys tab. 
Try to make a new foreign key, so that col2 is a FK referencing col1.

See error message above.

Suggested fix:
One of:
(a) Don't allow foreign keys to be created until the table is actually created (i.e. the user must click Apply on the Columns tab before proceeding to the Foreign Keys tab of the Table Editor).

(b) Don't show the table itself (potentially more confusing).
[23 Oct 2014 11:10] Miguel Solorzano
Thank you for the bug report. Are you using 6.2.3 version?. Thanks.
[23 Oct 2014 12:09] Craig Macdonald
Yes. I verified on 6.2.3 and 6.1.7.

Craig
[23 Oct 2014 12:55] Miguel Solorzano
Thank you for the feedback. Please provide screen-shoots after the step "Do not click apply."?. Mainly when you select the referenced table. Thanks in advance.
[23 Oct 2014 13:09] Craig Macdonald
screenshot 1

Attachment: 74515_screen1.png (image/png, text), 399.94 KiB.

[23 Oct 2014 13:09] Craig Macdonald
screenshot 2

Attachment: 74515_screen2.png (image/png, text), 338.18 KiB.

[23 Oct 2014 13:09] Craig Macdonald
screenshot 3, as requested

Attachment: 74515_screen3.png (image/png, text), 396.71 KiB.

[23 Oct 2014 13:17] Craig Macdonald
Hi Miguel, I hope the screenshots make clear the sequence of steps. Craig
[23 Oct 2014 13:20] Miguel Solorzano
Thank you for the feedback.