Bug #27541 Mygration toolkit suppresses the warnings when number type is rounded.
Submitted: 30 Mar 2007 8:59 Modified: 20 Oct 2008 13:29
Reporter: mantani shigeki Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Migration Toolkit Severity:S2 (Serious)
Version:1.1.11 OS:Windows (Windows XP SP2)
Assigned to: Mike Lischke CPU Architecture:Any

[30 Mar 2007 8:59] mantani shigeki
Description:
I used the Migration Toolkit to migrate the database from Oracle to MySQL.

The range of Number type in Oracle is different from that of Decimal type in MySQL.

So Migration Toolkit rounds and converts the Number type.

Then Migration toolkit suppresses the warnings when number type is rounded.

How to repeat:
Create the table in Oracle as follow.
--------------------------------------------------------------------
create table bug001_number (
col0 number(1,0),
col1 number(38,30) default 99999999.999999999999999999999999999999,
col2 number(38,31) default 9999999.9999999999999999999999999999999
);

commit;
--------------------------------------------------------------------

Convert the table using Migration Toolkit.

MySQL creates the such table.

-------------------------------------------------------------------------
mysql> show create table bug001_number\G
*************************** 1. row ***************************
       Table: bug001_number
Create Table: CREATE TABLE `bug001_number` (
  `col0` int(1) default NULL,
  `col1` decimal(38,30) default '99999999.999999999999999999999999999999',
  `col2` decimal(38,30) default '10000000.000000000000000000000000000000'
) ENGINE=InnoDB DEFAULT CHARSET=cp932
1 row in set (0.00 sec)
-------------------------------------------------------------------------

The col2 is rounded.
And default values is rounded too.

But I can't find the error or warnings in the log.

--------------------------------------------------------------------------------
-- MySQL Migration Toolkit Report                                             --
--                                                                            --
-- Title:   Summary Of The Migration Process                                  --
-- Date:    2007-03-30 17:49                                                  --
--------------------------------------------------------------------------------

1. Schema Migration
-------------------

  Number of migrated schemata: 1

  Schema Name:            mi
  - Tables:               1
  - Views:                0
  - Routines:             0
  - Routine Groups:       0
  - Synonyms:             0
  - Structured Types:     0
  - Sequences:            0

  Details:

  - Tables
      `mi`.`bug001_number`
      --------------------
  - Views
  - Routines
  - Routine Groups
  - Synonyms
  - Structured Types
  - Sequences

2. Data Bulk Transfer
---------------------

      `mi`.`bug001_number`
      --------------------
          1 row(s) transfered.

End of report.
--------------------------------------------------------------------------------

Suggested fix:
Avoiding the data lost and unexpected data change, Migration Toolkit should warn the rounding.
[4 May 2007 8:43] Valeriy Kravchuk
Thank you for a bug report. Verified just as described while migrating table from Oracle XE to MySQL 5.0.37 on Windows, using latest MT 1.1.11. 

DEFAULT value is not rounded in CREATE TABLE generated, but as column is created as DECIMAL(38, 30) (not DECIMAL(38,31)), rounding occures.
[20 Oct 2008 13:29] Mike Lischke
This is not a bug. Please read: http://dev.mysql.com/doc/refman/6.0/en/precision-math-decimal-changes.html. Maximum precision allowed in MySQL is 30, which is enforced by the migration toolkit to avoid server errors during migration.

The default value is taken over as is but the server automatically rounds it if it does not fit into the given space (see http://dev.mysql.com/doc/refman/5.1/en/numeric-types.html).