Updated on 2024-11-30 GMT+08:00

MySQL->GaussDB

MySQL -> GaussDB B-, MySQL-, and PostgreSQL-Compatible Mode

Table 1 Data type mapping

Data Type (MySQL)

Data Type (GaussDB)

Whether to Support Mapping

CHAR

CHARACTER

Yes. If a column of this type in the source database contains characters that occupy more than one byte, increase the length of the column in the destination database.

VARCHAR

CHARACTER VARYING()

Yes. If a column of this type in the source database contains characters that occupy more than one byte, increase the length of the column in the destination database.

BINARY

BYTEA

Yes

VARBINARY

BYTEA

Yes

TINYBLOB

BYTEA

Yes

BLOB

BYTEA

Yes

MEDIUMBLOB

BYTEA

Yes

LONGBLOB

BYTEA

Yes

TINYTEXT

TEXT

Yes

TEXT

TEXT

Yes

MEDIUMTEXT

TEXT

Yes

LONGTEXT

CLOB

Yes

ENUM

VARCHAR

Yes

SET

VARCHAR

Yes

TINYINT

SMALLINT

Yes

SMALLINT

SMALLINT

Yes

MEDIUMINT

INT

Yes

INT

INT

Yes

BIGINT

BIGINT

Yes

FLOAT

REAL/DOUBLE PRECISION

Yes

DOUBLE

DOUBLE PRECISION

Yes

DATE

DATE

Yes

DATETIME

TIMESTAMP WITHOUT TIME ZONE

Yes

TIMESTAMP

TIMESTAMP WITH TIME ZONE

Yes

TIME

TIME WITHOUT TIME ZONE

Yes

BIT

BIT

Yes

JSON

JSON

Yes, but JSON containing BIT data is not supported.

DECIMAL

NUMERIC

Yes

NUMERIC

NUMERIC

Yes

YEAR

SMALLINT

Yes

BOOLEAN

SMALLINT

Yes

  • DATE values supported by MySQL range from '1000-01-01' to '9999-12-31'.

    DATETIME values supported by MySQL range from '1000-01-01 00:00:00' to '9999-12-31 23:59:59'.

    TIMESTAMP values supported by MySQL range from '1970-01-01 00:00:01' UTC to '2038-01-19 03:14:07' UTC.

    For details, see official MySQL documentation.

  • YEAR value ranges supported by MySQL are 1901 to 2155 and 0000. For details, see official MySQL documentation. GaussDB does not have the YEAR type, so DRS will convert the YEAR type of MySQL to the SMALLINT type.
  • For MySQL databases, '0000' of the DATE type will be converted to 0 by DRS.
  • If the data type of a column is INT and the column contains the AUTO_INCREMENT attribute, DRS converts the data type of the column to SERIAL during synchronization.
  • Auto-increment columns cannot be migrated in PostgreSQL compatibility mode.

MySQL -> GaussDB M-Compatible Mode

Table 2 Data type mapping

Data Type (MySQL)

Data Type (GaussDB)

Whether to Support Mapping

BOOL

BOOL

Yes

BOOLEAN

BOOLEAN

Yes

TINYINT

TINYINT

Yes

SMALLINT

SMALLINT

Yes

MEDIUMINT

MEDIUMINT

Yes

INT

INT

Yes

INTEGER

INTEGER

Yes

BIGINT

BIGINT

Yes

DECIMAL

DECIMAL

Yes

NUMERIC

DECIMAL

Yes

DEC

DEC

Yes

FIXED

DECIMAL

Yes

FLOAT

FLOAT

Yes

DOUBLE

DOUBLE

Yes

DOUBLE PRECISION

DOUBLE

Yes

REAL

DOUBLE

Yes

DATE

DATE

Yes

DATETIME

DATETIME

Yes

TIMESTAMP

TIMESTAMP

Yes

TIME

TIME

Yes

YEAR

YEAR

Yes

CHAR

CHAR

Yes

VARCHAR

VARCHAR

Yes

TINYTEXT

TINYTEXT

Yes

TEXT

TEXT

Yes

MEDIUMTEXT

MEDIUMTEXT

Yes

LONGTEXT

LONGTEXT

Yes

ENUM('value1','value2',...)

VARCHAR

Yes

SET('value1','value2',...)

VARCHAR+CHECK

Yes

BINARY

BINARY

Yes

VARBINARY

VARBINARY

Yes

TINYBLOB

TINYBLOB

Yes

BLOB

BLOB

Yes

MEDIUMBLOB

MEDIUMBLOB

Yes

LONGBLOB

LONGBLOB

Yes

BIT

BIT

Yes

JSON

TEXT

Yes