Data types

Updated at:

PolarDB-X 1.0 supports four categories of data types: numeric, string, date and time, and JSON. Spatial data types are not supported.

For syntax, storage requirements, and value ranges for each type, see Data types in the MySQL 5.7 Reference Manual.

Supported categories

CategoryDescription
NumericInteger types (TINYINT, SMALLINT, MEDIUMINT, INT, BIGINT), fixed-point types (DECIMAL, NUMERIC), floating-point types (FLOAT, DOUBLE), and the BIT type
StringCHAR, VARCHAR, BINARY, VARBINARY, BLOB, TEXT, ENUM, and SET types
Date and timeDATE, TIME, DATETIME, TIMESTAMP, and YEAR types
JSONThe JSON type for storing JSON-formatted data

Type notation

MySQL type definitions follow the form T(M[, D]), where:

  • T is the data type (for example, INT or DECIMAL).

  • M is the maximum display width for integer types. For floating-point and fixed-point types, M is the total number of digits (precision). For string types, M is the maximum length.

  • D applies to floating-point and fixed-point types and specifies the number of digits after the decimal point (scale).

  • fsp applies to TIME, DATETIME, and TIMESTAMP types and represents fractional seconds precision. Valid values are 0 to 6.

  • Square brackets ([ and ]) indicate optional parts of a type definition.

MySQL compatibility

PolarDB-X 1.0 is compatible with MySQL 5.7 data types with the following exception:

  • Spatial data types are not supported. Types such as GEOMETRY, POINT, LINESTRING, and POLYGON are unavailable.

For all other data type behavior, PolarDB-X 1.0 follows MySQL 5.7 semantics. Consult the MySQL 5.7 Reference Manual for details on syntax, storage requirements, value ranges, and type-specific behavior.