Bug #114501 MySQL Workbench fail to open a exiting table after adding a virtual column
Submitted: 28 Mar 2024 1:38 Modified: 28 Mar 2024 3:35
Reporter: Marlon Wei Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Workbench: SQL Editor Severity:S3 (Non-critical)
Version:8.0.36 OS:Windows (Windows 11 Pro 23H2)
Assigned to: CPU Architecture:x86 (AMD Ryzen 9 5950X 16-Core Processor )

[28 Mar 2024 1:38] Marlon Wei
Description:
After adding a virtual column which refer to a column with json type, MySQL workbench cannot open the table anymore. It showing a DDL error, error msg:
"""
Error Parsing DDL for `xxxxx`.`xxxxx`

There was an error while parsing the DDL retrieved from the sever.
Do lyou want to view the DDL or cancel processing it
"""

After viewing the DDL, it jump to a sql editor tab:
"""
delimiter $$

CREATE TABLE `xxxxxxx_talbe_name` (
  `cik` int NOT NULL,
  `entityType` varchar(30) DEFAULT NULL,
  `sic` varchar(6) DEFAULT NULL,
  `sicDescription` varchar(127) DEFAULT NULL,
  `insiderTransactionForOwnerExists` int DEFAULT NULL,
  `insiderTransactionForIssuerExists` int DEFAULT NULL,
  `name` varchar(127) DEFAULT NULL,
  `tickers` json DEFAULT NULL,
  `exchanges` json DEFAULT NULL,
  `ein` varchar(10) DEFAULT NULL,
  `description` varchar(1024) DEFAULT NULL,
  `website` varchar(1024) DEFAULT NULL,
  `investorWebsite` varchar(1024) DEFAULT NULL,
  `category` varchar(127) DEFAULT NULL,
  `fiscalYearEnd` varchar(10) DEFAULT NULL,
  `stateOfIncorporation` varchar(30) DEFAULT NULL,
  `stateOfIncorporationDescription` varchar(30) DEFAULT NULL,
  `addresses` json DEFAULT NULL,
  `phone` varchar(30) DEFAULT NULL,
  `flags` varchar(10) DEFAULT NULL,
  `formerNames` json DEFAULT NULL,
  `stk_code` varchar(45) GENERATED ALWAYS AS (json_value(`tickers`, _utf8mb4'$[0]' returning char(512))) VIRTUAL,
  PRIMARY KEY (`cik`),
  KEY `ix_edgar_stk_basic_cik` (`cik`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci$$

How to repeat:
1. you can create a table using following sql

delimiter $$

CREATE TABLE `xxxx_schema`.`xxxx_table` (
  `cik` int NOT NULL,
  `entityType` varchar(30) DEFAULT NULL,
  `sic` varchar(6) DEFAULT NULL,
  `sicDescription` varchar(127) DEFAULT NULL,
  `insiderTransactionForOwnerExists` int DEFAULT NULL,
  `insiderTransactionForIssuerExists` int DEFAULT NULL,
  `name` varchar(127) DEFAULT NULL,
  `tickers` json DEFAULT NULL,
  `exchanges` json DEFAULT NULL,
  `ein` varchar(10) DEFAULT NULL,
  `description` varchar(1024) DEFAULT NULL,
  `website` varchar(1024) DEFAULT NULL,
  `investorWebsite` varchar(1024) DEFAULT NULL,
  `category` varchar(127) DEFAULT NULL,
  `fiscalYearEnd` varchar(10) DEFAULT NULL,
  `stateOfIncorporation` varchar(30) DEFAULT NULL,
  `stateOfIncorporationDescription` varchar(30) DEFAULT NULL,
  `addresses` json DEFAULT NULL,
  `phone` varchar(30) DEFAULT NULL,
  `flags` varchar(10) DEFAULT NULL,
  `formerNames` json DEFAULT NULL,
  `stk_code` varchar(45) GENERATED ALWAYS AS (json_value(`tickers`, _utf8mb4'$[0]')) VIRTUAL,
  PRIMARY KEY (`cik`),
  KEY `ix_edgar_stk_basic_cik` (`cik`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci$$
[28 Mar 2024 3:35] MySQL Verification Team
Hello Marlon Wei,

Thank you for the report and feedback.
Verified as described.

regards,
Umesh