Bug #81554 Data Migration Wizard: using [] quoted objects with Sybase fails on max 28 bytes
Submitted: 23 May 2016 21:22 Modified: 25 May 2016 11:33
Reporter: Kenny Gryp Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Workbench: Migration Severity:S3 (Non-critical)
Version:6.3.6 OS:Any
Assigned to: CPU Architecture:Any

[23 May 2016 21:22] Kenny Gryp
Description:
Sybase has a limitation that you cannot refer to an object that has more than 28 characters while quoting them (with []). 

Workbench migration is quoting tablenames for example, and it gives the following error:

17:47:02 [INF][      copytable]: Opening ODBC connection to [unknown] 'DSN=sybase_dev;DATABASE=schema;UID=sa;DelimitIdentifier=Yes;PWD=XXX'
ERROR:`schema`.`Long_Table_which_is_more_than_28_bytes`:SQLExecDirect(SELECT count(*) FROM [schema].[dbo].[Long_Table_which_is_more_than_28_bytes]): ZZZZZ:1103:[Sybase][ODBC Driver][Adaptive Server Enterprise]
The identifier that starts with '[Long_Table_which_is_more_th' is too long. Maximum length is 28.

How to repeat:
- In Sybase, create a table with a name more than 28 characters long.
- try to do Data Migration, you will get an error while trying to `--count-rows`

```
17:47:02 [INF][      copytable]: --table [schema]       [dbo].[Long_Table_which_is_more_than_28_bytes]  `schema`        `Long_Table_which_is_more_than_28_bytes`       [ID], [ID_CHAR], [Familie], [Source], [AExporter], [IdNosca]
17:47:02 [INF][      copytable]: Connecting to MySQL server at mysql:3306 with user root
17:47:02 [INF][      copytable]: Connection to MySQL opened
17:47:02 [INF][      copytable]: Opening ODBC connection to [unknown] 'DSN=sybase_dev;DATABASE=schema;UID=sa;DelimitIdentifier=Yes;PWD=XXX'
17:47:02 [INF][      copytable]: ODBC connection to 'DSN=sybase_dev;DATABASE=schema;UID=sa;DelimitIdentifier=Yes;PWD=' opened
17:47:02 [INF][      copytable]: Connecting to MySQL server at mysql:3306 wth user root
17:47:02 [INF][      copytable]: Connection to MySQL opened
17:47:02 [INF][      copytable]: Opening ODBC connection to [unknown] 'DSN=sybase_dev;DATABASE=schema;UID=sa;DelimitIdentifier=Yes;PWD=XXX'
ERROR:`schema`.`Long_Table_which_is_more_than_28_bytes`:SQLExecDirect(SELECT count(*) FROM [schema].[dbo].[Long_Table_which_is_more_than_28_bytes]): ZZZZZ:1103:[Sybase][ODBC Driver][Adaptive Server Enterprise]
The identifier that starts with '[Long_Table_which_is_more_th' is too long. Maximum length is 28.

AND:`schema`.`Long_Table_which_is_more_than_28_bytes`:Finished copying 0 rows in 0m00s
17:47:02 [INF][      copytable]: ODBC connection to 'DSN=sybase_dev;DATABASE=schema;UID=sa;DelimitIdentifier=Yes;PWD=' opened
17:47:02 [INF][      copytable]: Connecting to MySQL server at mysql:3306 with user root
17:47:02 [INF][      copytable]: Connection to MySQL opened
17:47:02 [INF][      copytable]: Re-enabling triggers for schema 'schema'
17:47:02 [INF][      copytable]: No triggers found for 'schema'
FINISHED
```

Suggested fix:

The batch file generated actually quotes the objects with []. If you remove those quotes from the batch file manually, the queries run fine.
I'm pretty sure they are quoted for a reason, but this limitation does break a lot of objects.
[25 May 2016 11:33] MySQL Verification Team
Hello Kenny Gryp,

Thank you for the report and feedback!

Thanks,
Umesh