Skip to content
This repository was archived by the owner on May 10, 2023. It is now read-only.
This repository was archived by the owner on May 10, 2023. It is now read-only.

Unsigned bigint conversion issue #44

@cjgu

Description

@cjgu

Hi!

Have to start with that I really like your script! I have however stumbled upon one issue.

Unsigned bigint gets converted to numeric, which is fine. However it is using the precision from the bigint as the precision for the numeric. That causes some problems because precision is usually 11 for mysql bigint, however that is not affecting any operation at all in mysql for bigint.

 M indicates the maximum display width for integer types. The maximum 
 display width is 255. Display width is unrelated to the range of values a 
 type can contain, as described in Section 11.2, “Numeric Types”. For 
 floating-point and fixed-point types, M is the total number of digits that 
  can be stored. 

(From http://dev.mysql.com/doc/refman/5.6/en/numeric-type-overview.html)

So this script converts bigint(11) to numeric(11), then inserts of values that have more than 11 digits (as allowed by mysql) will fail.

The solution would be to always convert unsigned bigint to numberic(20) as maximum value for unsigned bigint is 18446744073709551615, i.e 20 digits.

I could provide a patch for this if you think this would be a good solution.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions