Bug #96788 Error importing sql script with generated columns
Submitted: 7 Sep 2019 21:04 Modified: 8 Sep 2019 19:35
Reporter: Renato Batista Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Workbench Severity:S3 (Non-critical)
Version:8.0.17 OS:MacOS (macOS 10.14.x Mojave x86_64)
Assigned to: CPU Architecture:Any
Tags: WBBugReporter

[7 Sep 2019 21:04] Renato Batista
Description:
After model a database using workbench, with generated columns in some tables, when you export mysql forward engineer sql create script everything seems right.
But then, if you try to import the same file in workbench using import - reverse engineer mysql create script, every table containing generated columns won't be imported and import log will show:
"GENERATED" is not valid at this position, expecting : ')'
 
----

18:38:21 [INF][      Workbench]: Starting up Workbench
18:38:21 [INF][   WBContext UI]: Initializing workbench context UI with these values:
	base dir: /Applications/MySQLWorkbench.app/Contents/Resources
	plugin path: /Applications/MySQLWorkbench.app/Contents/PlugIns
	struct path: /Applications/MySQLWorkbench.app/Contents/Resources/grt
	module path: /Applications/MySQLWorkbench.app/Contents/PlugIns:/Applications/MySQLWorkbench.app/Contents/Resources/plugins
	library path: /Applications/MySQLWorkbench.app/Contents/Resources/libraries
	user data dir: /Users/renato/Library/Application Support/MySQL/Workbench
	open at start: 
	open type: 
	run at startup: 
	run type: 
	Force SW rendering: No
	Force OpenGL: No
	quit when done: No
18:38:21 [INF][      WBContext]: WbContext::init
18:38:21 [INF][            WBA]: Looking for extension modules for WBA...
18:38:21 [INF][            WBA]: 0 extension modules found
18:38:22 [WRN][            grt]: /Users/renato/Library/Application Support/MySQL/Workbench/connections.xml:26: link 'CB308059-E084-497A-8ED6-369FD3B438EF' <object GrtObject> key=owner could not be resolved
18:38:22 [INF][      WBContext]: System info:
 	MySQL Workbench Community (GPL) for Mac OS X version 8.0.17 CE build 14960816 (64 bit)
	Configuration Directory: /Users/renato/Library/Application Support/MySQL/Workbench
	Data Directory: /Applications/MySQLWorkbench.app/Contents/Resources
	Cairo Version: 1.10.2
	OS: macOS 10.14.x Mojave x86_64
	CPU: 4x Intel(R) Core(TM) i7-5557U CPU @ 3.10GHz - 16.00GiB RAM
No video adapter info available

18:38:22 [WRN][         mforms]: Resource file not found: wb_tile_sakila_light@2x.png
18:38:22 [WRN][         mforms]: Resource file not found: wb_tile_manage_light@2x.png
18:38:22 [WRN][         mforms]: Resource file not found: wb_tile_folder@2x.png
18:38:22 [WRN][         mforms]: Resource file not found: wb_tile_network_light@2x.png
18:38:22 [WRN][         mforms]: Resource file not found: wb_tile_plus_light@2x.png
18:38:22 [WRN][         mforms]: Resource file not found: wb_tile_user_light@2x.png
18:38:22 [WRN][         mforms]: Resource file not found: wb_tile_plus_light@2x.png
18:38:22 [WRN][         mforms]: Resource file not found: wb_doc_sql@2x.png
18:38:22 [WRN][         mforms]: Resource file not found: wb_tile_number_light@2x.png
18:38:22 [WRN][         mforms]: Resource file not found: wb_close@2x.png
18:38:22 [WRN][         mforms]: Resource file not found: wb_tile_open_light@2x.png
18:38:22 [WRN][         mforms]: Resource file not found: wb_tile_more_light@2x.png
18:38:22 [WRN][         mforms]: Resource file not found: wb_tile_sakila_light@2x.png
18:38:22 [WRN][         mforms]: Resource file not found: wb_tile_manage_light@2x.png
18:38:22 [WRN][         mforms]: Resource file not found: wb_tile_folder@2x.png
18:38:22 [WRN][         mforms]: Resource file not found: wb_tile_network_light@2x.png
18:38:22 [WRN][         mforms]: Resource file not found: wb_tile_plus_light@2x.png
18:38:22 [WRN][         mforms]: Resource file not found: wb_tile_user_light@2x.png
18:38:22 [WRN][         mforms]: Resource file not found: wb_tile_plus_light@2x.png
18:38:22 [WRN][         mforms]: Resource file not found: wb_doc_sql@2x.png
18:38:22 [WRN][         mforms]: Resource file not found: wb_tile_number_light@2x.png
18:38:22 [WRN][         mforms]: Resource file not found: wb_close@2x.png
18:38:22 [WRN][         mforms]: Resource file not found: wb_tile_open_light@2x.png
18:38:22 [WRN][         mforms]: Resource file not found: wb_tile_more_light@2x.png
18:38:27 [WRN][         mforms]: Resource file not found: snippet_mwb@2x.png
18:38:37 [ERR][            grt]: (216, 20) "GENERATED" is not valid at this position, expecting : ')'	
18:38:37 [ERR][            grt]: (338, 24) "GENERATED" is not valid at this position, expecting : ')'	
18:38:37 [ERR][            grt]: (445, 25) "GENERATED" is not valid at this position, expecting : ')'	
18:38:37 [ERR][            grt]: (645, 25) "GENERATED" is not valid at this position, expecting : ')'	
18:38:37 [ERR][            grt]: (657, 25) "GENERATED" is not valid at this position, expecting : ')'	
18:38:37 [ERR][            grt]: (770, 28) "GENERATED" is not valid at this position, expecting : ')'	
18:38:37 [ERR][            grt]: (843, 28) "GENERATED" is not valid at this position, expecting : ')'	
18:38:37 [ERR][            grt]: (871, 28) "GENERATED" is not valid at this position, expecting : ')'	
18:38:37 [ERR][            grt]: (1032, 20) "GENERATED" is not valid at this position, expecting : ')'	
18:38:37 [ERR][            grt]: (1079, 28) "GENERATED" is not valid at this position, expecting : ')'	
18:38:37 [INF][            grt]: The SQL script was parsed

How to repeat:
Create a new model, add err diagram, name table as you like, add two columns:
- uuid binary(16)
- uuid_text varchar generated expression: HEX(uuid)

Generate a sql file using File > Export > Forward engineer SQL Create Script.

Abandon the file

Create a new file/model, try to import the generated .sql file using File > Import > Reverse Engineer MySQL Create Script. Select the file you've generated and try to import.

You will get the error message.

Suggested fix:
IDK, fix import.
[7 Sep 2019 21:05] Renato Batista
ample model

Attachment: example.mwb (application/octet-stream, text), 5.62 KiB.

[7 Sep 2019 21:06] Renato Batista
Sample generated SQL Script unable to import

Attachment: example.sql (application/octet-stream, text), 1.18 KiB.

[8 Sep 2019 19:35] MySQL Verification Team
Thank you for the bug report. Duplicate of https://bugs.mysql.com/bug.php?id=92267.