Bug #76055 need more integer types
Submitted: 25 Feb 2015 19:06
Reporter: Trey Raymond Email Updates:
Status: Open Impact on me:
Category:MySQL Server: Data Types Severity:S4 (Feature request)
Version: OS:Any
Assigned to: CPU Architecture:Any
Tags: data types

[25 Feb 2015 19:06] Trey Raymond
8B is a sensible max for integer types (64 bit math and all), but the lack of support for 5,6,7 byte ints is a long-standing annoyance.  it's especially odd that there's no 6, as mysql internally uses 6 bytes for so many things.  current workarounds (like having a one row table with an 8 byte int, casting it to binary(6)) add unnecessary extra work to busy systems with additional writes and casting operations, and cause unnecessary locking.

How to repeat:
create table test (id biggishint unsigned not null auto_increment, primary key (id));
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'biggishint unsigned not null auto_increment, primary key (id))' at line 1

Suggested fix:
add more int types!  in a perfect world, support for definitions like int(bits/bytes) would be great, as the 'display width' concept is archaic, but the lack of backwards compatibility with such a change probably puts it off the table for the time being (though it should be addressed someday...).  just add additional data types with the current naming structure, maybe name them something fun, even.