Updated on 2024-03-28 GMT+08:00

MySQL->GaussDB(DWS)

Table 1 Data type mapping

Data Type (MySQL)

Data Type (GaussDB(DWS))

Whether to Support Mapping

BIT[(M)]

BIT

Yes

TINYINT[(M)]

SMALLINT

Yes

TINYINT[(M)] [UNSIGNED]

SMALLINT

Yes

SMALLINT[(M)]

SMALLINT

Yes

SMALLINT[(M)] [UNSIGNED]

INTEGER

Yes

MEDIUMINT[(M)]

INTEGER

Yes

MEDIUMINT[(M)][UNSIGNED]

INTEGER

Yes

INT[(M)]

INTEGER

Yes

INT[(M)] [UNSIGNED]

BIGINT

Yes

BIGINT[(M)]

BIGINT

Yes

BIGINT[(M)] [UNSIGNED]

NUMERIC

Yes

DECIMAL[(M[,D])]

SMALLINT| INTEGER| BIGINT | NUMERIC

Yes. Use a data type that meets the precision and scale requirements.

FLOAT(p)

FLOAT4

Yes

DOUBLE[(M,D)]

FLOAT8

Yes

DATE

DATE

Yes. In earlier versions, the data type is TIMESTAMP(0) WITHOUT TIME ZONE.

DATETIME[(fsp)]

TIMESTAMP

Yes

TIMESTAMP[(fsp)]

TIMESTAMP WITH TIME ZONE

Yes

TIME[(fsp)]

TIME

Yes

YEAR[(4)]

SMALLINT

Yes

CHAR[(M)]

CHAR

Yes

VARCHAR(M)

CHARACTER VARYING()

Yes. The length of a varchar column is increased multiple times in the destination database based on the column character set in the source database.

BINARY[(M)]

BYTEA

Yes

VARBINARY(M)

BYTEA

Yes

TINYBLOB

BLOB

Yes

TINYTEXT

TEXT

Yes

BLOB

BLOB

Yes

TEXT

TEXT

Yes

MEDIUMBLOB

BLOB

Yes

MEDIUMTEXT

TEXT

Yes

LONGBLOB

BLOB

Yes

LONGTEXT

TEXT

Yes

ENUM

VARCHAR

Yes

SET

VARCHAR

Yes

JSON

JSONB

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(DWS), 0000-00-00 is an invalid date and the DRS synchronization task will fail. 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(DWS), 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, the DRS synchronization task will fail.
  • YEAR value ranges supported by MySQL are 1901 to 2155 and 0000. For details, see official MySQL documentation. GaussDB(DWS) does not have the YEAR type, so DRS will convert the YEAR type of MySQL to the SMALLINT type.
  • For '0000' of the DATE type in MySQL, the DRS synchronization task will fail.
  • 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.