Skip to content

Missing display width for integer types with deprecate-integer-display-length #46650

@dveeden

Description

@dveeden

Bug Report

In MySQL 8.0.19 and newer (including MySQL 8.1.0) integer display width is hidden by default.

Except when:

  • The type is tinyint and the display width is 1 as connectors use this to indicate booleans.
  • When ZEROFILL is used.

TiDB with deprecate-integer-display-length doesn't do this, which might cause issues with some connectors.

From https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-19.html

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.

1. Minimal reproduce step (Required)

CREATE TABLE t (
  id INT PRIMARY KEY,
  c1 BOOL,
  c2 INT(10) ZEROFILL
);
SHOW CREATE TABLE t\G

2. What did you expect to see? (Required)

MySQL 8.1.0

sql> SHOW CREATE TABLE t\G
*************************** 1. row ***************************
       Table: t
Create Table: CREATE TABLE `t` (
  `id` int NOT NULL,
  `c1` tinyint(1) DEFAULT NULL,
  `c2` int(10) unsigned zerofill DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
1 row in set (0.0037 sec)

3. What did you see instead (Required)

sql> SHOW CREATE TABLE t\G
*************************** 1. row ***************************
       Table: t
Create Table: CREATE TABLE `t` (
  `id` int NOT NULL,
  `c1` tinyint DEFAULT NULL,
  `c2` int unsigned zerofill DEFAULT NULL,
  PRIMARY KEY (`id`) /*T![clustered_index] CLUSTERED */
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin
1 row in set (0.0004 sec)

4. What is your TiDB version? (Required)

Mon 4 Sep build from master at 587eacf

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions