Bug #99385 Length of integer field will not by stored
Submitted: 28 Apr 2020 9:00 Modified: 29 Apr 2020 7:00
Reporter: Joerg Plenert Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: DDL Severity:S3 (Non-critical)
Version:8.0.19 OS:Windows (2019)
Assigned to: CPU Architecture:x86

[28 Apr 2020 9:00] Joerg Plenert
Description:
With MySQL Server 8.0.19 a field (InnoDB) with the type INTEGER does not store the length of the field. 
It will only store the length if it is zerofilled.

This is a breaking change (compared to MySQL 5.7.21).

Is this an error or an undocumented change?
(Or we just missed the documentation for that change..)

How to repeat:
MySQL 8.0.19;
=> CREATE TABLE `test` (`Col1` INT(5) NULL) COLLATE='utf8mb4_0900_ai_ci';
=> SHOW CREATE TABLE `test`.`test`;
==> CREATE TABLE "test" ("Col1" int DEFAULT NULL) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci

MySQL 5.7.21:
=> CREATE TABLE `test` ('Col1` INT(5) NULL) COLLATE='utf8_general_ci';
=> SHOW CREATE TABLE `test`.`test`;
==> CREATE TABLE "test" ("Col1" int(5) DEFAULT NULL) ENGINE=InnoDB DEFAULT CHARSET=utf8
[28 Apr 2020 12:32] MySQL Verification Team
Hi Mr. Plenert,

Thank you for your bug report.

However, this is not a bug. This change has been fully documented. If you read our Release Notes, you will find the following item:

"
Display width specification for integer data types was deprecated in MySQL 8.0.17, and now statements that include data type definitions in their output no longer show the display width for integer types, with these exceptions:

The type is TINYINT(1). MySQL Connectors make the assumption that TINYINT(1) columns originated as BOOLEAN columns; this exception enables them to continue to make that assumption.

The type includes the ZEROFILL attribute.

This change applies to tables, views, and stored routines, and affects the output from SHOW CREATE and DESCRIBE statements, and from INFORMATION_SCHEMA tables.

For DESCRIBE statements and INFORMATION_SCHEMA queries, output is unaffected for objects created in previous MySQL 8.0 versions because information already stored in the data dictionary remains unchanged. This exception does not apply for upgrades from MySQL 5.7 to 8.0, for which all data dictionary information is re-created such that data type definitions do not include display width. (Bug #30556657, Bug #97680)
"

Hence, this is not a bug.
[29 Apr 2020 7:00] Joerg Plenert
Thanks! I guess we searched for the wrong key words in the documentation.
[29 Apr 2020 12:11] MySQL Verification Team
Hi Mr. Plenert,

You are truly welcome.