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$$