Bug #83195 views' result grids are not editable
Submitted: 28 Sep 2016 23:20 Modified: 29 Sep 2016 3:41
Reporter: Paul Weiss Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Workbench Severity:S3 (Non-critical)
Version:6.3.7 CE build 1199 (64 bit) OS:Windows (Windows 10 Home)
Assigned to: CPU Architecture:Any
Tags: result grid, UPDATE, Views

[28 Sep 2016 23:20] Paul Weiss
Description:
Views that meet the criteria for updatability still show as Read Only in the Result Grid. They can be edited via SQL code.

How to repeat:
CREATE TABLE t1 (id INT(10) PRIMARY KEY AUTO_INCREMENT, title VARCHAR(100));

SELECT * FROM t1;
#result grid is editable
    
CREATE VIEW t1_view AS SELECT * FROM t1;
SELECT * FROM t1_view;
#result grid is read only

no change when data is inserted:
INSERT INTO t1 VALUES (1, "row 1"), (2, "row 2");
SELECT * FROM t1;
#result grid is editable
SELECT * FROM t1_view;
#result grid is read only

note that the view can be updated by SQL code directly:
INSERT INTO t1_view VALUES (3, "row 3"), (4, "row 4");
SELECT * FROM t1;
#4 rows
SELECT * FROM t1_view;
#4 rows

Suggested fix:
Allow views that meet the criteria for updatability to be edited in their Result Grids.
[29 Sep 2016 1:28] MySQL Verification Team
Thank you for the bug report. This is expected behavior according explained here:

https://dev.mysql.com/doc/workbench/en/workbench-faq.html#faq-workbench-read-only

Why do my query results sometimes say Read Only but other times I can edit data in the results grid?

Data in the query results grid is only editable when the query results includes a primary key. For example, "SELECT type FROM food" will be read-only if "type" is not a primary key, but "SELECT id, type FROM food" will be editable when "id" is a primary key. Typically, "SELECT *" syntax is used in Workbench which often includes query results with a primary key.

For additional information, hover over the "Read Only" icon to reveal a tooltip that explains why your result set is in read-only mode.
[29 Sep 2016 3:41] Paul Weiss
The query results _do_ include the primary key of the base table.