Silent Column Specification Changes
In some cases, MariaDB silently changes column specifications from those given in a CREATE TABLE or ALTER TABLE statement. These might be changes to a data type, to attributes associated with a data type, or to an index specification.
All changes are subject to the internal row-size limit of 65,535 bytes, which may cause some attempts at data type changes to fail. See "Table Column-Count and Row-Size Limits".
- Columns that are part of a
PRIMARY KEYare madeNOT NULLeven if not declared that way. - Trailing spaces are automatically deleted from
ENUMandSETmember values when the table is created. - MySQL maps certain data types used by other SQL database vendors to MariaDB types. See , "Using Data Types from Other Database Engines".
- If you include a
USINGclause to specify an index type that is not legal for a given storage engine, but there is another index type available that the engine can use without affecting query results, the engine uses the available type. - If strict SQL mode is not enabled, a
VARCHARcolumn with a length specification greater than 65535 is converted toTEXT, and aVARBINARYcolumn with a length specification greater than 65535 is converted toBLOB. Otherwise, an error occurs in either of these cases. - Specifying the
CHARACTER SET binaryattribute for a character data type causes the column to be created as the corresponding binary data type:CHARbecomesBINARY,VARCHARbecomesVARBINARY, andTEXTbecomesBLOB. For theENUMandSETdata types, this does not occur; they are created as declared. Suppose that you specify a table using this definition:CREATE TABLE t ( c1 VARCHAR(10) CHARACTER SET binary, c2 TEXT CHARACTER SET binary, c3 ENUM('a','b','c') CHARACTER SET binary );The resulting table has this definition:
CREATE TABLE t ( c1 VARBINARY(10), c2 BLOB, c3 ENUM('a','b','c') CHARACTER SET binary );
To see whether MariaDB used a data type other than the one you specified, issue a DESCRIBE or SHOW CREATE TABLE statement after creating or altering the table.
Certain other data type changes can occur if you compress a table using myisampack. See , "Compressed Table Characteristics".