Bug #96222 MySQL Workbench doesn't display the comment on a generated column
Submitted: 16 Jul 2019 12:29 Modified: 16 Jul 2019 12:49
Reporter: Georgi Sotirov Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Workbench Severity:S3 (Non-critical)
Version:8.0.16 OS:Windows (1903 (10.0.18362.175))
Assigned to: CPU Architecture:x86

[16 Jul 2019 12:29] Georgi Sotirov
Description:
I just noticed that MySQL Workbench doesn't display the comment for generated columns. It's a valid syntax for MySQL 5.7 according to the manual (see https://dev.mysql.com/doc/refman/5.7/en/create-table-generated-columns.html ). This concerns altering tables from the Navigator. You could design and create a table with generated column with comment, but then when you open it for altering the comment of the generated column is not displayed.

How to repeat:
1. Create a test table as follows:

CREATE TABLE test (
  id INT NOT NULL AUTO_INCREMENT,
  a INT NOT NULL,
  b INT NOT NULL,
  sum_ab INT GENERATED ALWAYS AS (a+b) VIRTUAL COMMENT 'Sum of a and b',
  PRIMARY KEY (id)
)
ENGINE = InnoDB;

2. Open the table in Workbench with right mouse click and chose "Alter table...".
3. Notice the comment is not displayed although it's in the metadata as confirmed by the following query:

SELECT column_name, ordinal_position, data_type, column_comment
  FROM INFORMATION_SCHEMA.`columns`
 WHERE table_name = 'test';

+-------------+------------------+-----------+----------------+
| column_name | ordinal_position | data_type | column_comment |
+-------------+------------------+-----------+----------------+
| id          |                1 | int       |                |
| a           |                2 | int       |                |
| b           |                3 | int       |                |
| sum_ab      |                4 | int       | Sum of a and b |
+-------------+------------------+-----------+----------------+
4 rows in set (0,00 sec)

Suggested fix:
MySQL Workbench should properly display comments on generated columns.
[16 Jul 2019 12:38] Georgi Sotirov
Screenshot of the problem

Attachment: wb_gen_col_no_cmnt.png (image/png, text), 42.02 KiB.

[16 Jul 2019 12:46] MySQL Verification Team
Hello Georgi Sotirov,

Thank you for the report and feedback.
Observed that when WB 8.0.16 is connected to an instance running 5.7 then column's "comment" is not shown but when it is connected to an instance running 8.0 then it works i.e column's comment is displayed.

Thanks,
Umesh
[16 Jul 2019 12:49] Georgi Sotirov
Yes, I was just about to add this comment :-)
[16 Jul 2019 12:51] MySQL Verification Team
Screenshot

Attachment: 96222.png (image/png, text), 15.43 KiB.