Updated on 2023-07-03 GMT+08:00

MySQL->GaussDB

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/BLOB

Yes

MEDIUMBLOB

BYTEA

Yes

LONGBLOB

BYTEA

Yes

TINYTEXT

TEXT

Yes

TEXT

TEXT

Yes

MEDIUMTEXT

TEXT

Yes

LONGTEXT

TEXT

Yes

ENUM

VARCHAR

Yes

SET

VARCHAR

Yes

TINYINT

SMALLINT

Yes

SMALLINT

SMALLINT

Yes

MEDIUMINT

INT

Supported

INT

INT

Yes

BIGINT

BIGINT

Yes

FLOAT

FLOAT4

Yes

DOUBLE

FLOAT8

Yes

DATE

DATE

Yes

DATETIME

TIMESTAMP WITHOUT TIME ZONE

Yes

TIMESTAMP

TIMESTAMP WITH TIME ZONE

Yes

TIME

TIME

Yes

BIT

BIT

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.

    For GaussDB, 0000-00-00 is an invalid date and will be converted to 1970-01-01 by DRS. For example, '0000-00-00' of the DATE type in MySQL is converted to '1970-01-01' by DRS, and '1000-00-31 23:59:59' of the DATETIME or TIMESTAMP type in MySQL is converted to '1970-01-01 00:00:00' by DRS.

  • TIME values supported by MySQL range from '-838:59:59' to '838:59:59'. For details, see the official MySQL documentation. For GaussDB, the minimum value of the TIME type is 00:00:00 and the maximum value is 24:00:00. In MySQL, if a value of the TIME type is less than 00:00:00 or greater than 24:00:00, DRS will convert it to 00:00:00.
  • 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.