Bug #74138 Drop down menu for foreign keys in Form Editor
Submitted: 29 Sep 2014 14:04 Modified: 5 Mar 2018 9:00
Reporter: Tariq Qubti Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Workbench Severity:S4 (Feature request)
Version: OS:Any
Assigned to: CPU Architecture:Any

[29 Sep 2014 14:04] Tariq Qubti
Description:
If possible to add this feature similar to what is present in PHPMyAdmin.
When adding data to a table to the field that is a foreign key to have a drop down menu.
Would help very much.
Thanks,

How to repeat:
Open a table by (Select Rows) and go to the Form Editor, if one field is a foreign key then a drop down instead of a regular text field should appear for that field.
The drop down maybe shows that first two columns of the foreign table.
[5 Feb 2018 9:00] Mike Lischke
Is this stil something you would want? The request is however not really clear to me, since in the form editor you edit data, not meta data. There is no notion of foreign keys in that editor. It would make more sense on the FK page in the table editor (but there we used a slightly different approach, with a second list for columns).
[7 Feb 2018 23:17] Kevin Ernst
Yes! Oh my yes, a thousand times 'yes'.

The requester is asking that, for the fields which are FKs to another table, the allowable entries in the form editor for that field should be restricted exclusively to valid entries from the referenced "foreign" table, and presented in a "drop-down" control.

The form editor already has this behavior for ENUM fields, for example.

One challenge, though, is that the form editor would need to have some notion of what the "display" column should be from the referenced table. phpMyAdmin solves this by storing a "relational display column" (ref: https://stackoverflow.com/a/29228551) for the table in one of its metadata databases.

I think with Workbench, it would be sufficient to show the first several columns in a drop-down, as a "minimum viable" solution.

As a tangible example, imagine a table of recipes, with a FK called 'recipe_type_id' to an 'id' column in a "recipe type" table. In the Workbench form editor, we would like to see a drop-down for the 'recipe_type_id' in the recipes table that shows the first several columns of the other table, e.g.:

╔════╤═══════════╗
║ id │ name      ║
╟────┼───────────╢
║ 1  │ breakfast ║
║ 2  │ lunch     ║
║ 3  │ brunch    ║
║ 4  │ dinner    ║
║ 5  │ dessert   ║
║ 6  │ snack     ║
╚════╧═══════════╝

With phpMyAdmin, having configured 'name' as the "relational display column" for the recipe type table, you would see a drop-down containing entries for "breakfast," "lunch," "brunch," and so on when you create new records in the (parent) "recipe" table. See also: https://docs.phpmyadmin.net/en/latest/relations.html

With a multi-million-record table, I can see how this might be a concern speed-wise, but perhaps Workbench itself can find-as-you-type, and limit the returned records for large tables.
[6 Mar 2018 1: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".
[18 Jul 2018 3:28] Kevin Ernst
This bug was put in a suspended state due to having no feedback, but (so far as I can discern) the requested feedback was provided. If additional clarification is required, I can provide that.

Can someone switch this back to "open"? I don't see an obvious way to do that myself.