pgloader icon indicating copy to clipboard operation
pgloader copied to clipboard

`precision` in pgloader is `display width` in MySQL syntax. Is it a design in pgloader?

Open junfx opened this issue 4 years ago • 1 comments

I read the code and found the term precision is display width in MySQL syntax. Is it a design in pgloader? In the case of converting int(M) auto_increment to pg serial, I dont think should consider display width as precision, e.g (when (< precision 10)).

For integer data types, M indicates the maximum display width. -- MySQL :: MySQL 5.7 Reference Manual :: 11.1.1 Numeric Data Type Syntax

For integer data types, M indicates the maximum display width. -- MySQL :: MySQL 8.0 Reference Manual :: 11.1.1 Numeric Data Type Syntax

junfx avatar Aug 24 '21 12:08 junfx

I agree with this issue.

The precision/display width on an integer should not be considered when moving from mysql to postgres, as it could notably affect the size of the column in storage.

Also, it may be deprecated completely in MySQL as well --

For floating-point and fixed-point data types, M is the total number of digits that can be stored.

As of MySQL 8.0.17, the display width attribute is deprecated for integer data types; you should expect support for it to be removed in a future version of MySQL. https://dev.mysql.com/doc/refman/8.0/en/numeric-type-syntax.html

sdyarnell avatar Jul 31 '23 21:07 sdyarnell