Description:
When you convert a Sybase table with default values using regular ODBC, then the DEFAULT values are not copied along.
However if you use FreeTDS to connect, the defaults are copied along.
How to repeat:
Have a sybase table:
1> sp_help TAB_CMD_CLI_INTERNET
2> go
Name Owner Object_type
------------------------------ ------------------------------ --------------------------------
TAB_CMD_CLI_INTERNET dbo user table
(1 row affected)
Data_located_on_segment When_created
------------------------------ --------------------------
default Nov 5 2013 9:46AM
Column_name Type Length Prec Scale Nulls Default_name Rule_name Access_Rule_name Identity
-------------- ------------ ----------- ---- ----- ----- ------------------------------ ---------- ------------------ --------
...
DT_MOD T_DT_SYS 8 NULL NULL 1 TAB_CMD_CL_DT_MOD_1790626391 NULL NULL 0
USR_MOD T_USR_CHAR 15 NULL NULL 1 TAB_CMD_CL_USR_MO_1806626448 NULL NULL 0
...
(return status = 0)
1> select text from syscomments where id=1790626391
2> go
text
--------------------
DEFAULT GETDATE()
FreeTDS will create it like (the default is not good, see http://bugs.mysql.com/bug.php?id=81589):
CREATE TABLE IF NOT EXISTS `schema`.`TAB_CMD_CLI_INTERNET` (
...
`DT_MOD` DATETIME NULL DEFAULT GETDATE(),
`USR_MOD` VARCHAR(15) NULL DEFAULT HOST_NAME());
However, ODBC will create it like::
CREATE TABLE `TAB_CMD_CLI_INTERNET` (
...
`DT_MOD` varchar(255) DEFAULT NULL,
`USR_MOD` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
So the defaults are lost.
No warning is given by workbench migration script.
Suggested fix:
Copy the defaults along or give a warning that they are lost.