← Back to team overview

maria-developers team mailing list archive

Deprecate INT(M) in SHOW?

 

Hello,

We have an optional length for integer data types:

TINYINT(N)
SMALLINT(N)
MEDIUMINT(N)
INT(N)
BIGINT(N)


The number given in the parentheses imposes no any limits on the
supported range. So for example BIGINT(1) is still a full-featured
data type that can store and retrieve any 64-bit number
(btw, I find this confusing).


If I declare a column without N, it's later displayed
in SHOW CREATE TABLE with the default length, so:

CREATE TABLE t1 (a INT)

becomes

CREATE TABLE t1 (a INT(11));


The length is really important only in two cases:

1. In combination with ZEROFILL.

2. When the explicitly specified length is larger than the default
length for the data type. For example, INT(40).
  In this case on cast to string, it's converted to
  VARCHAR(40) rather than to VARCHAR(11).


In all other cases the length does not matter and has no any visible
effects.


Does anybody see any problems if in 10.4 we fix all metadata statements,
such as:

- SHOW CREATE TABLE t1
- DESCRIBE t1
- SELECT * FROM INFORMATION_SCHEMA.COLUMNS
not to print the default length for non-ZEROFILL columns?



Follow ups