This topic was translated by AI and is currently in queue for revision by our editors. Alibaba Cloud does not guarantee the accuracy of AI-translated content. Request expedited revision

Data type mapping relationships involved in initial schema synchronization

Updated at: 2025-03-20 10:05

Different databases, known as heterogeneous databases, support various data types. DTS handles data type mapping during the initial schema synchronization phase, converting data types from the source database to those compatible with the destination database. This topic provides a detailed list of data type mapping relationships to help you assess the impact of data synchronization on your business.

Overview

Review the data type mapping relationships between heterogeneous databases based on the following synchronization schemes:

Data synchronization with MySQL as the source

When using MySQL as the source database (including RDS MySQL, self-managed MySQL, PolarDB MySQL) and the destination instance is a heterogeneous database (such as AnalyticDB for MySQLAnalyticDB for MySQL and 2.0, AnalyticDB for PostgreSQL), the data type mapping relationships are as follows:

Note

If the data range to be synchronized from the source instance exceeds what DTS supports, the precision of the data in the destination instance will be reduced.

The destination instance is AnalyticDB for MySQL or AnalyticDB for PostgreSQL.

Type

Source instance data type

Value range

AnalyticDB for MySQL data type

AnalyticDB for PostgreSQL data type

Integer types

BIT[(M)]

1 ~ 64

VARCHAR

BIT[(M)]

TINYINT[(M)]

-128 ~ 127

TINYINT

SMALLINT

TINYINT[(M)] [UNSIGNED]

0 ~ 255

SMALLINT

SMALLINT

SMALLINT[(M)]

-32768 ~ 32767

SMALLINT

SMALLINT

SMALLINT[(M)] [UNSIGNED]

0 ~ 65535

INT

INTEGER

MEDIUMINT[(M)]

-8388608 ~ 8388607

INT

INTEGER

MEDIUMINT[(M)] [UNSIGNED]

0 ~ 16777215

INT

INTEGER

INT[(M)]

-2147483648 ~ 2147483647

INT

INTEGER

INT[(M)] [UNSIGNED]

0 ~ 4294967295

BIGINT

BIGINT

BIGINT[(M)]

-9223372036854775808 ~ 9223372036854775807

BIGINT

BIGINT

BIGINT[(M)] [UNSIGNED]

0 ~ 18446744073709551615

DECIMAL(20,0)

NUMERIC(20)

Decimal types

DECIMAL[(M[,D])]

M: 0~65.

D: 0~30

DECIMAL[(M[,D])]

DECIMAL[(M[,D])]

FLOAT(p)

1.175494351E-38 ~ 3.402823466E+38

FLOAT

REAL

DOUBLE[(M,D)]

2.2250738585072014E-308 ~ 1.7976931348623157E+308

DOUBLE

DOUBLE PRECISION

Time types

DATE

1000-01-01~9999-12-31

Note

Format is YYYY-MM-DD.

DATE

DATE

DATETIME[(fsp)]

1000-01-01 00:00:00.000000 ~ 9999-12-31 23:59:59.999999

Note

Format is YYYY-MM-DD hh:mm:ss[.fraction] (UTC).

DATETIME

TIMESTAMP

TIMESTAMP[(fsp)]

1970-01-01 00:00:01.000000 ~ 2038-01-19 03:14:07.999999

Note

Format is YYYY-MM-DD hh:mm:ss[.fraction] (UTC).

TIMESTAMP

TIMESTAMP WITH TIME ZONE

TIME[(fsp)]

-838:59:59.000000 ~ 838:59:59.000000

Note

Format is hh:mm:ss[.fraction] (UTC).

TIME

TIMESTAMP WITH TIME ZONE

YEAR[(4)]

1901 ~ 2155, or 0000.

INT

INTEGER

String types

CHAR[(M)]

0 ~ 255 characters

VARCHAR

CHAR

VARCHAR(M)

0 ~ 65,535 characters

VARCHAR

VARCHAR

BINARY[(M)]

0 ~ 255 bytes

VARBINARY

BYTEA

VARBINARY(M)

0 ~ 65,535 bytes

VARBINARY

BYTEA

TINYBLOB

255 (2^8 - 1) bytes

VARBINARY

BYTEA

TINYTEXT

255 (2^8 - 1) characters

VARCHAR

TEXT

BLOB

65,535 (2^16 - 1) bytes

VARBINARY

BYTEA

TEXT

65,535 (2^16 - 1) characters

VARCHAR

TEXT

MEDIUMBLOB

16,777,215 (2^24 - 1) bytes

VARBINARY

BYTEA

MEDIUMTEXT

16,777,215 (2^24 - 1) characters

VARCHAR

TEXT

LONGBLOB

4,294,967,295 or 4GB (2^32 - 1) bytes

VARBINARY

BYTEA

LONGTEXT

4,294,967,295 or 4GB (2^32 - 1) characters

VARCHAR

TEXT

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

Up to 65,535 enumeration values

VARCHAR

VARCHAR(128)

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

Up to 64 elements

VARCHAR

VARCHAR(128)

Spatial types

GEOMETRY

Value of any geometric type

VARBINARY

POLYGON

POINT

None

VARBINARY

POINT

LINESTRING

None

VARBINARY

PATH

POLYGON

None

VARBINARY

POLYGON

MULTIPOINT

None

VARBINARY

POLYGON

MULTILINESTRING

None

VARBINARY

PATH

MULTIPOLYGON

None

VARBINARY

POLYGON

GEOMETRYCOLLECTION

Collection of values of any geometric type

VARBINARY

POLYGON

JSON type

JSON

None

JSON

JSON

The destination instance is DataHub, Kafka (Alibaba Cloud Message Queue Kafka, self-managed Kafka)

Type

Source instance data type

Value range

DataHub data type

Alibaba Cloud Message Queue Kafka, self-managed Kafka data type

Integer types

BIT[(M)]

1 ~ 64

BOOLEAN | STRING

Consistent with MySQL, PolarDB MySQL data types

TINYINT[(M)]

-128 ~ 127

BIGINT

TINYINT[(M)] [UNSIGNED]

0 ~ 255

BIGINT

SMALLINT[(M)]

-32768 ~ 32767

BIGINT

SMALLINT[(M)] [UNSIGNED]

0 ~ 65535

BIGINT

MEDIUMINT[(M)]

-8388608 ~ 8388607

BIGINT

MEDIUMINT[(M)] [UNSIGNED]

0 ~ 16777215

BIGINT

INT[(M)]

-2147483648 ~ 2147483647

BIGINT

INT[(M)] [UNSIGNED]

0 ~ 4294967295

BIGINT

BIGINT[(M)]

-9223372036854775808 ~ 9223372036854775807

BIGINT

BIGINT[(M)] [UNSIGNED]

0 ~ 18446744073709551615

BIGINT

Decimal types

DECIMAL[(M[,D])]

M: 0~65.

D: 0~30

DECIMAL

FLOAT(p)

1.175494351E-38 ~ 3.402823466E+38

DOUBLE

DOUBLE[(M,D)]

2.2250738585072014E-308 ~ 1.7976931348623157E+308

DOUBLE

Time types

DATE

1000-01-01~9999-12-31

Note

Format is YYYY-MM-DD.

TIMESTAMP

DATETIME[(fsp)]

1000-01-01 00:00:00.000000 ~ 9999-12-31 23:59:59.999999

Note

Format is YYYY-MM-DD hh:mm:ss[.fraction] (UTC).

TIMESTAMP

TIMESTAMP[(fsp)]

1970-01-01 00:00:01.000000 ~ 2038-01-19 03:14:07.999999

Note

Format is YYYY-MM-DD hh:mm:ss[.fraction] (UTC).

TIMESTAMP

TIME[(fsp)]

-838:59:59.000000 ~ 838:59:59.000000

Note

Format is hh:mm:ss[.fraction] (UTC).

STRING

YEAR[(4)]

1901 ~ 2155, or 0000.

STRING

String types

CHAR[(M)]

0 ~ 255 characters

STRING

VARCHAR(M)

0 ~ 65,535 characters

STRING

BINARY[(M)]

0 ~ 255 bytes

STRING

VARBINARY(M)

0 ~ 65,535 bytes

STRING

TINYBLOB

255 (2^8 - 1) bytes

STRING

TINYTEXT

255 (2^8 - 1) characters

STRING

BLOB

65,535 (2^16 - 1) bytes

STRING

TEXT

65,535 (2^16 - 1) characters

STRING

MEDIUMBLOB

16,777,215 (2^24 - 1) bytes

STRING

MEDIUMTEXT

16,777,215 (2^24 - 1) characters

STRING

LONGBLOB

4,294,967,295 or 4GB (2^32 - 1) bytes

STRING

LONGTEXT

4,294,967,295 or 4GB (2^32 - 1) characters

STRING

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

Up to 65,535 elements

STRING

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

Up to 64 elements

STRING

Spatial types

GEOMETRY

Value of any geometric type

STRING

POINT

None

STRING

LINESTRING

None

STRING

POLYGON

None

STRING

MULTIPOINT

None

STRING

MULTILINESTRING

None

STRING

MULTIPOLYGON

None

STRING

GEOMETRYCOLLECTION

Collection of values of any geometric type

STRING

JSON type

JSON

None

STRING

The destination instance is MaxCompute, Elasticsearch, ClickHouse

Type

Source instance data type

Value range

MaxCompute

Elasticsearch

ClickHouse

Integer types

BIT[(M)]

1 ~ 64

BOOLEAN | STRING

BOOLEAN | LONG

Note

If only one byte, it is recommended to use BOOLEAN in Elasticsearch.

UInt8

TINYINT[(M)]

-128 ~ 127

BIGINT

SHORT

Int8

TINYINT[(M)] [UNSIGNED]

0 ~ 255

BIGINT

INTEGER

UInt8

SMALLINT[(M)]

-32768 ~ 32767

BIGINT

SHORT

Int16

SMALLINT[(M)] [UNSIGNED]

0 ~ 65535

BIGINT

INTEGER

UInt16

MEDIUMINT[(M)]

-8388608 ~ 8388607

BIGINT

INTEGER

Int32

MEDIUMINT[(M)] [UNSIGNED]

0 ~ 16777215

BIGINT

INTEGER

Int32

INT[(M)]

-2147483648 ~ 2147483647

BIGINT

INTEGER

Int32

INT[(M)] [UNSIGNED]

0 ~ 4294967295

BIGINT

LONG

UInt32

BIGINT[(M)]

-9223372036854775808 ~ 9223372036854775807

BIGINT

LONG

Int64

BIGINT[(M)] [UNSIGNED]

0 ~ 18446744073709551615

BIGINT

LONG

UInt64

Decimal types

DECIMAL[(M[,D])]

M: 0~65.

D: 0~30

DOUBLE

DOUBLE

Note

If the DECIMAL value has a decimal point, to ensure data consistency, it is recommended to use TEXT in Elasticsearch.

DECIMAL

FLOAT(p)

1.175494351E-38 ~ 3.402823466E+38

DOUBLE

FLOAT

Float32

DOUBLE[(M,D)]

2.2250738585072014E-308 ~ 1.7976931348623157E+308

DOUBLE

DOUBLE

Float64

Time types

DATE

1000-01-01~9999-12-31

Note

Format is YYYY-MM-DD.

DATETIME

DATE

Note

Format is YYYY-MM-DD. For more information, see the date format mapping definition.

DATE32

DATETIME[(fsp)]

1000-01-01 00:00:00.000000 ~ 9999-12-31 23:59:59.999999

Note

Format is YYYY-MM-DD hh:mm:ss[.fraction] (UTC).

DATETIME

DATE

Note

DATE format is yyyy-MM-dd'T'HH:mm:ss (UTC). If the precision is microseconds, the format is yyyy-MM-dd'T'HH:mm:ss.S. For more information, see the date format mapping definition.

DATETIME64

TIMESTAMP[(fsp)]

1970-01-01 00:00:01.000000 ~ 2038-01-19 03:14:07.999999

Note

Format is YYYY-MM-DD hh:mm:ss[.fraction] (UTC).

DATETIME

DATE

Note

DATE format is yyyy-MM-dd'T'HH:mm:ss (UTC). If the precision is microseconds, the format is yyyy-MM-dd'T'HH:mm:ss.S. For more information, see the date format mapping definition.

DATETIME

Note

Does not include time zone information.

TIME[(fsp)]

-838:59:59.000000 ~ 838:59:59.000000

Note

Format is hh:mm:ss[.fraction] (UTC).

STRING

DATE

Note

Format is YYYY-MM-DD. For more information, see the date format mapping definition.

STRING

YEAR[(4)]

1901 ~ 2155, or 0000.

STRING

DATE

Note

DATE format is yyyy. For more information, see the date format mapping definition.

Int16

String types

CHAR[(M)]

0 ~ 255 characters

STRING

TEXT

STRING

VARCHAR(M)

0 ~ 65,535 characters

STRING

TEXT

STRING

BINARY[(M)]

0 ~ 255 bytes

STRING

BINARY

STRING

VARBINARY(M)

0 ~ 65,535 bytes

STRING

BINARY

STRING

TINYBLOB

255 (2^8 - 1) bytes

STRING

BINARY

STRING

TINYTEXT

255 (2^8 - 1) characters

STRING

TEXT

STRING

BLOB

65,535 (2^16 - 1) bytes

STRING

BINARY

STRING

TEXT

65,535 (2^16 - 1) characters

STRING

TEXT

STRING

MEDIUMBLOB

16,777,215 (2^24 - 1) bytes

STRING

BINARY

STRING

MEDIUMTEXT

16,777,215 (2^24 - 1) characters

STRING

TEXT

STRING

LONGBLOB

4,294,967,295 or 4GB (2^32 - 1) bytes

STRING

BINARY

STRING

LONGTEXT

4,294,967,295 or 4GB (2^32 - 1) characters

STRING

TEXT

STRING

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

Up to 65,535 enumeration values

STRING

KEYWORD

ENUM

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

Up to 64 elements

STRING

KEYWORD

STRING

Spatial types

GEOMETRY

Value of any geometric type

STRING

GEO_SHAPE

STRING

POINT

None

STRING

GEO_POINT

STRING

LINESTRING

None

STRING

GEO_SHAPE

STRING

POLYGON

None

STRING

GEO_SHAPE

STRING

MULTIPOINT

None

STRING

GEO_SHAPE

Note

If only one byte, it is recommended to use BOOLEAN in Elasticsearch.

STRING

MULTILINESTRING

None

STRING

GEO_SHAPE

STRING

MULTIPOLYGON

None

STRING

GEO_SHAPE

STRING

GEOMETRYCOLLECTION

Collection of values of any geometric type

STRING

GEO_SHAPE

STRING

JSON type

JSON

None

STRING

OBJECT

Note

If only one byte, it is recommended to use BOOLEAN in Elasticsearch.

STRING

The destination instance is Tablestore

Source instance data type

Tablestore corresponding data type

INTEGER

INTEGER

INT

INTEGER

SMALLINT

INTEGER

TINYINT

INTEGER

MEDIUMINT

INTEGER

BIGINT

INTEGER

DECIMAL

DOUBLE

NUMERIC

DOUBLE

FLOAT

DOUBLE

DOUBLE

DOUBLE

BIT

BOOLEAN

DATE

STRING or INTEGER

Note

Default is STRING.

TIMESTAMP

DATETIME

TIME

YEAR

CHAR

STRING

VARCHAR

STRING

BINARY

BINARY

VARBINARY

BINARY

TINYBLOB/BLOB/MEDIUMBLOB/LONGBLOB

BINARY

TINYTEXT/TEXT/MEDIUMTEXT/LONGTEXT

STRING

ENUM

STRING

SET

STRING

GEOMETRY

STRING

POINT

STRING

LINESTRING

STRING

POLYGON

STRING

MULTIPOINT

STRING

MULTILINESTRING

STRING

MULTIPOLYGON

STRING

GEOMETRYCOLLECTION

STRING

JSON

STRING

The destination instance is Lindorm

Source instance data type

Lindorm corresponding data type

BOOLEAN

BOOLEAN

BIT

BOOLEAN

TINYINT

TINYINT

SMALLINT

SMALLINT

INTEGER

INTEGER

BIGINT

BIGINT

FLOAT

FLOAT

DOUBLE

DOUBLE

DECIMAL

DECIMAL

CHAR/VARCHAR/TEXT/TINYTEXT/MEDIUMTEXT/LONGTEXT

CHAR/VARCHAR

BINARY

BINARY

BLOB

VARBINARY

VARBINAY

VARBINARY

TIMESTAMP

TIMESTAMP

YEAR

INTEGER

DATE

VARCHAR

DATETIME

VARCHAR

Important
  • It is recommended to map it to VARCHAR type on the destination side.

  • If you need to map it to TIMESTAMP type, it may cause data inconsistency due to time zone issues. It is recommended to use the ETL feature during task configuration to ensure data consistency.

TIME

VARCHAR

JSON

JSON

Data synchronization with Oracle as the source

When using a self-managed Oracle as the source instance and the destination instance is a heterogeneous database (such as AnalyticDB for PostgreSQL), the data type mapping relationships are as follows:

Note

If the data range to be synchronized from the source instance exceeds what DTS supports, the precision of the data in the destination instance will be reduced.

Type

Oracle data type

Value range

MySQL, PolarDB MySQL, PolarDB-X data type

AnalyticDB for PostgreSQL data type

Numeric types

NUMBER(p,s)

1 to 22 bytes.

p represents the precision digit, and the value range is 1 to 38.

s represents the decimal place, and the value range is -84 to 127.

DECIMAL[(p[,s])]

Note

If neither precision nor decimal place exists, it is mapped to DECIMAL(65,30).

DECIMAL | TINYINT | SMALLINT | INTEGER | BIGINT

FLOAT(p)

1 to 22 bytes.

p represents a pointer variable, and the value range is 1 to 126 bits.

FLOAT

DOUBLE PRECISION

BINARY_FLOAT

32-bit floating-point number, which is 4 bytes.

FLOAT

DOUBLE PRECISION

BINARY_DOUBLE

64-bit floating-point number, which is 8 bytes.

DOUBLE

DOUBLE PRECISION

Date

DATE

None

DATETIME

TIMESTAMP(0)

TIMESTAMP [(fractional_seconds_precision)]

None

DATETIME[(fractional_seconds_precision)]

TIMESTAMP

TIMESTAMP [(fractional_seconds_precision)] WITH TIME ZONE

None

DATETIME[(fractional_seconds_precision)]

TIMESTAMP WITH TIME ZONE

TIMESTAMP [(fractional_seconds_precision)] WITH LOCAL TIME ZONE

None

DATETIME[(fractional_seconds_precision)]

TIMESTAMP WITH TIME ZONE

INTERVAL YEAR [(year_precision)] TO MONTH

None

Not supported

VARCHAR(32)

INTERVAL DAY [(day_precision)] TO SECOND [(fractional_seconds_precision)]

None

Not supported

VARCHAR(32)

String types

CHAR [(size [BYTE | CHAR])]

2000 bytes.

CHAR[(n)]

Note

If the length is not specified, it is mapped to CHAR(1).

CHAR

NCHAR[(size)]

2000 bytes.

NATIONAL CHAR[(n)]

Note

If the length is not specified, it maps to NATIONAL CHAR(1).

VARCHAR

VARCHAR(size [BYTE | CHAR])

When MAX_STRING_SIZE = EXTENDED, the maximum length is 32767 bytes.

When MAX_STRING_SIZE = STANDARD, the maximum length is 4000 bytes.

VARCHAR(n)

VARCHAR(n)

VARCHAR2(size [BYTE | CHAR])

When MAX_STRING_SIZE = EXTENDED, the maximum length is 32767 bytes.

When MAX_STRING_SIZE = STANDARD, the maximum length is 4000 bytes.

VARCHAR(n)

VARCHAR

NVARCHAR2(size)

When MAX_STRING_SIZE = EXTENDED, the maximum length is 32767 bytes.

When MAX_STRING_SIZE = STANDARD, the maximum length is 4000 bytes.

NATIONALVARCHAR[(n)]

VARCHAR

LONG

Maximum length 2G (2^31-1).

LONGTEXT

TEXT

RAW(size)

Maximum length of 32767 bytes or 2000 bytes.

BINARY(2×size)

BYTEA

LONG RAW

Maximum length 2 GB.

LONGBLOB

BYTEA

CLOB

Maximum length (4 GB -1) × DB_BLOCK_SIZE.

LONGTEXT

TEXT

NCLOB

Maximum length (4 GB - 1) × DB_BLOCK_SIZE.

LONGTEXT

TEXT

BLOB

Maximum length (4 GB - 1) × DB_BLOCK_SIZE.

LONGBLOB

BYTEA

BFILE

4G.

Not supported

Not supported

JSON type

JSON

Maximum length is 32 MB.

Not supported

JSON

ROWID type

ROWID

64 characters.

Not supported

OID

UROWID

64 characters.

Not supported

Not supported

Space type

Requires customization

Not supported

Note

For the cloud-native data warehouse AnalyticDB PostgreSQL edition, DTS will convert unsupported field types to BYTEA. If the conversion fails, the data content will be set to NULL.

Data synchronization with PostgreSQL as the source

When the source instance is PostgreSQL (including self-managed PostgreSQL and RDS PostgreSQL) and the destination instance is a heterogeneous database (such as the cloud-native data warehouse AnalyticDB PostgreSQL edition), the data type mapping is as follows:

Note

If the timestamp range of the data to be synchronized from the source instance exceeds what DTS supports, the precision of the data in the destination instance will be reduced.

Type

PostgreSQL data type

Value range

Cloud-native data warehouse AnalyticDB PostgreSQL edition data type

Integer types

SMALLINT

-32768 to +32767

SMALLINT

INTEGER

-2147483648 to +2147483647

INTEGER

BIGINT

-9223372036854775808 to +9223372036854775807

BIGINT

Decimal types

DECIMAL

Up to 131072 digits before the decimal point and 16383 digits after the decimal point

DECIMAL

NUMERIC

Up to 131072 digits before the decimal point and 16383 digits after the decimal point

NUMERIC

REAL

6 decimal digits precision

REAL

DOUBLE PRECISION

15 decimal digits precision

DOUBLE PRECISION

Currency types

MONEY

-92233720368547758.08 to +92233720368547758.07

MONEY

String types

CHARACTER VARYING(n)

None

CHARACTER VARYING(n)

CHARACTER(n)

None

CHARACTER(n)

TEXT

None

TEXT

CHAR

Default is 1 byte

CHAR

NAME

Maximum length is 64 bytes

NAME

Text search types

TSQUERY

Represents a text query

TEXT

TSVECTOR

Represents a document in a form optimized for text search

TEXT

Binary data types

BYTEA

1 or 4 bytes plus the actual binary string

BYTEA

Date types

TIMESTAMP [ (p) ] [ WITHOUT TIME ZONE ]

Represents date and time (without time zone), occupies 8 bytes

TIMESTAMP [ (p) ] [ WITHOUT TIME ZONE ]

TIMESTAMP [ (p) ] WITH TIME ZONE

Represents date and time (with time zone), occupies 8 bytes

TIMESTAMP [ (p) ] WITH TIME ZONE

DATE

Represents date, occupies 4 bytes

DATE

TIME [ (p) ] [ WITHOUT TIME ZONE ]

Represents time (without time zone), occupies 8 bytes

TIME [ (p) ] [ WITHOUT TIME ZONE ]

TIME [ (p) ] WITH TIME ZONE

Represents time (with time zone), occupies 12 bytes

TIME [ (p) ] WITH TIME ZONE

interval [ fields ] [ (p) ]

Represents time interval, occupies 16 bytes

interval [ fields ] [ (p) ]

The Boolean data type

BOOLEAN

1 byte

BOOLEAN

Enumeration types

Custom enumeration

None

VARCHAR(128)

Spatial types

POINT

Point on a plane, maximum length is 16 bytes

POINT

LINE

Infinite line, maximum length is 32 bytes

LINE

LSEG

Finite line segment, maximum length is 32 bytes

LSEG

BOX

Rectangle, maximum length is 32 bytes

BOX

PATH

Path, maximum length is 16+16n bytes

PATH

POLYGON

Polygon (similar to a closed path), maximum length is 40+16n bytes

POLYGON

CIRCLE

Circle, maximum length is 24 bytes

CIRCLE

Network address types

CIDR

IPv4 and IPv6 networks, maximum length is 7 or 19 bytes

CIDR

INET

IPv4 and IPv6 hosts and networks, maximum length is 7 or 19 bytes

INET

MACADDR

MAC address, maximum length is 6 bytes

MACADDR

MACADDR8

MAC address (EUI-64 format), maximum length is 8 bytes

MACADDR8

Bit string types

Bit (n)

None

Bit (n)

BIT VARYING (n)

None

BIT VARYING (n)

UUID types

UUID

None

VARCHAR(64)

XML types

XML

None

XML

JSON types

JSON

None

JSON

JSONB

None

JSONB

Data synchronization with SQL Server as the source

When the source instance is SQL Server (including self-managed SQL Server and RDS SQL Server) and the destination instance is a heterogeneous database (such as AnalyticDB for MySQLAnalyticDB for MySQL, AnalyticDB for PostgreSQL, PostgreSQL, MySQL, PolarDB for MySQL cluster), the data type mapping is as follows:

Note

If the timestamp range of the data to be synchronized from the source instance exceeds what DTS supports, the precision of the data in the destination instance will be reduced.

Type

SQL Server data type

Value range

AnalyticDB for MySQL data type

PostgreSQL, AnalyticDB for PostgreSQL data type

MySQL, PolarDB for MySQL data type

Integer types

BIT

INTEGER data type that can take values of 1, 0, or NULL

BOOLEAN

BIT(1)

BIT(1)

TINYINT

0 to 255

TINYINT

SMALLINT

TINYINT UNSIGNED

SMALLINT

-2^15 (-32768) to 2^15-1 (32767)

SMALLINT

SMALLINT

SMALLINT

INT

-2^31 (-2147483648) to 2^31-1 (2147483647)

INTEGER

INTEGER

INT

BIGINT

-2^63 (-9223372036854775808) to 2^63-1 (9223372036854775807)

BIGINT

BIGINT

BIGINT

Decimal types

NUMERIC[ (p[ ,s] )]

-10^38+1 to 10^38-1; 1<=p<=38

DECIMAL

DECIMAL

DECIMAL[ (p[ ,s] )]

DECIMAL[ (p[ ,s] )]

-10^38+1 to 10^38-1; 1<= p<=38

DECIMAL

DECIMAL

DECIMAL[ (p[ ,s] )]

FLOAT

-1.79E+308 to -2.23E -308, 0 and 2.23E-308 to 1.79E+308

DOUBLE

DOUBLE PRECISION

DOUBLE

REAL

-3.40E+38 to -1.18E- 38, 0 and 1.18E-38 to 3.40E +38

FLOAT

REAL

DOUBLE

Currency types

MONEY

-922,337,203,685,477.5808 to 922,337,203,685,477.5807

DECIMAL(19, 4)

DECIMAL(19, 4)

DECIMAL(19, 4)

SMALLMONEY

-214,748.3648 to 214,748.3647

DECIMAL(10, 4)

DECIMAL(10, 4)

DECIMAL(10, 4)

Date types

DATE

0001-01-01 to 9999-12-31

DATE

DATE

DATE

DATETIME

Date range from January 1, 1753 to December 31, 9999.

Time range from 00:00:00 to 23:59:59.997

DATETIME

TIMESTAMP(3) WITHOUT TIME ZONE

DATETIME(3)

DATETIME2[ (fractional seconds precision) ]

Date range from January 1, 1 AD to December 31, 9999 AD.

Time range from 00:00:00 to 23:59:59.9999999

DATETIME

TIMESTAMP(7) WITHOUT TIME ZONE

DATETIME(p)

Note

The default precision is 6.

DATETIMEOFFSET [ (fractional seconds precision) ]

Date range from January 1, 1 AD to December 31, 9999 AD.

Time range from 00:00:00 to 23:59:59.9999999.

Time zone offset range from -14:00 to +14:00

TIMESTAMP

TIMESTAMP(7) WITH TIME ZONE

DATETIME(p)

Note

The default precision is 6.

SMALLDATETIME

Seconds are always zero (:00) and do not have fractional seconds

DATETIME

TIMESTAMP WITHOUT TIME ZONE

DATETIME

TIME [ (fractional second scale) ]

00:00:00.0000000 to 23:59:59.9999999

TIME

TIME(7) WITH TIME ZONE

TIME(p)

String types

BINARY [ ( n ) ]

The value range of n is 1~8,000

VARBINARY

BYTEA

  • When length > 255: BLOB

  • Others: BINARY(n)

VARBINARY [ ( n | max) ]

The value range of n is 1~8,000; max represents the maximum storage size of 2^31-1 bytes

VARBINARY

BYTEA

  • When length = max: LONGBLOB

  • Others: VARBINARY(n)

CHAR [ ( n ) ]

The value range of n is 1~8,000, storage size is n bytes

VARCHAR

CHARACTER

  • When length > 255: VARCHAR

  • Others: CHAR

VARCHAR [ ( n | max ) ]

The value range of n is 1~8,000; max represents the maximum storage size of 2^31-1 bytes (2GB)

VARCHAR

CHARACTER

  • When length = max: LONGTEXT

  • Others: VARCHAR(n)

NCHAR [ ( n ) ]

Measured in dword, the value range of n is 1 to 4,000, storage size is twice n bytes

VARCHAR

CHARACTER VARYING

VARCHAR(200)

NVARCHAR [ ( n | max ) ]

Measured in dword, the value range of n is 1 to 4,000, max represents the maximum storage size of 2^30-1 words (2 GB)

VARCHAR

CHARACTER VARYING

  • When length = max: LONGTEXT

  • Others: VARCHAR(n)

NTEXT

Variable-length Unicode data, maximum string length is 2^30-1 (1073741823) bytes

VARCHAR

TEXT

LONGTEXT

TEXT

Maximum string length is 2^31-1 (2147483647) bytes

VARCHAR

TEXT

LONGTEXT

IMAGE

Variable-length binary data, from 0 to 2^31-1 (2147483647) bytes.

VARBINARY

BYTEA

LONGBLOB

Spatial and geometric types

GEOGRAPHY

None

VARCHAR

Not supported

BLOB

GEOMETRY

None

VARCHAR

Not supported

BLOB

XML types

XML ( [ CONTENT | DOCUMENT ] xml_schema_collection )

None

VARCHAR

XML

LONGTEXT

Other types

UNIQUEIDENTIFIER

None

VARCHAR

CHARACTER(36)

CHAR(36)

SQL_VARIANT

None

Not supported

Not supported

VARCHAR(200)

HIERARCHYID

None

Not supported

Not supported

VARCHAR(200)

SYSNAME

None

VARCHAR

CHARACTER VARYING(128)

VARCHAR(200)

Data synchronization with Db2 for LUW as the source

When the source instance is Db2 for LUW and the destination instance is a heterogeneous database (such as MySQL), the data type mapping is as follows:

Note

If the timestamp range of the data to be synchronized from the source instance exceeds what DTS supports, the precision of the data in the destination instance will be reduced.

Type

Db2 for LUW data type

Value range

MySQL data type

Integer types

SMALLINT

-32,768~+32,767

SMALLINT

INTEGER

-2,147,483,648~+2,147,483,647

INT

BIGINT

-9,223,372,036,854,775,808~ +9,223,372,036,854,775,807

BIGINT

Decimal types

DECIMAL(precision-integer, scale-integer)

p<=38

DECIMAL

FLOAT(integer)

The value range is 1~53. A value between 1~24 represents single-precision, and a value between 25~53 represents double-precision

FLOAT

DECFLOAT(precision-integer)

None

DECIMAL(65,10)

Date types

DATE

0001-01-01~9999-12-31

DATE

TIME

00:00:00~24:00:00

TIME

TIMESTAMP(integer)

0001-01-01-00.00.00.000000000000~9999-12-31-24.00.00.000000000000;0<=p<= 12

DATETIME

String types

CHARACTER(integer)

254

CHAR | VARCHAR

VARCHAR(integer)

32,672

VARCHAR

CHARACTER(integer) FOR BIT DATA

254

BLOB

CLOB

2,147,483,647

LONGTEXT

GRAPHIC(integer)

127

CHAR(length×4)

VARGRAPHIC(integer)

16,336

CHAR(length×4)

DBCLOB(integer)

1,073,741,823

VARCHAR | LONGTEXT

BLOB

2,147,483,647

LONGBLOB

Other types

XML

2,147,483,647

VARCHAR | LONGTEXT

Data synchronization with Db2 for i as the source

When the source instance is Db2 for i and the destination instance is a heterogeneous database (such as MySQL), the data type mapping is as follows:

Note

If the timestamp range of the data to be synchronized from the source instance exceeds what DTS supports, the precision of the data in the destination instance will be reduced.

Type

Db2 for i data type

Value range

Data type in MySQL

Integer types

SMALLINT

-32,768~+32,767

SMALLINT

INTEGER

-2,147,483,648~+2,147,483,647

INT

BIGINT

-9,223,372,036,854,775,808~ +9,223,372,036,854,775,807

BIGINT

Decimal types

DECIMAL(precision-integer, scale-integer)

p<=63

DECIMAL

NUMERIC

None

DECIMAL

FLOAT(integer)

None

FLOAT

DECFLOAT(precision-integer)

None

DECIMAL(65,10)

Date types

DATE

0001-01-0~9999-12-31

DATE

TIME

00:00:00~24:00:00

TIME

TIMESTAMP(integer)

0001-01-01-00.00.00.000000000000~9999-12-31-24.00.00.000000000000; 0 <=p <=12

DATETIME

String types

CHAR(integer)

32,765

CHAR | VARCHAR

VARCHAR(integer)

32,739

VARCHAR

CHAR(integer) FOR BIT DATA

None

BLOB

CLOB

2,147,483,647

LONGTEXT

GRAPHIC(integer)

16,382

CHAR

VARGRAPHIC(integer)

16,369

VARCHAR

DBCLOB(integer)

1,073,741,823

LONGTEXT

BINARY

32,765

BINARY

VARBIN

32,739

VARBINARY

BLOB

2,147,483,647

LONGBLOB

Other types

DATALINK

None

VARCHAR | LONGTEXT

ROWID

40

VARCHAR | LONGTEXT

XML

2,147,483,647

VARCHAR | LONGTEXT

Data synchronization with TiDB as the source

When the source instance is a self-built TiDB and the destination instance is a heterogeneous database like AnalyticDB MySQL 3.0, the data type mapping is as follows:

Data type in TiDB

Data type in MySQL

BIGINT

BIGINT

BIGINT UNSIGNED

DECIMAL(20,0)

BINARY

BINARY

BIT

BIT

BOOL\ BOOLEAN

TINYINT

CHAR

CHAR

DATE

DATE

DATETIME

DATETIME

DECIMAL

DECIMAL

DOUBLE

DOUBLE

ENUM

ENUM

FLOAT

FLOAT

INT

INT

INT UNSIGNED

BIGINT

INTEGER

INTEGER

JSON

JSON

MEDIUMBLOB/LONGBLOB

TINYBLOB/BLOB/

MEDIUMBLOB/LONGBLOB

TINYBLOB/BLOB/

MEDIUMINT

MEDIUMINT

SET

SET

SMALLINT

SMALLINT

SMALLINT UNSIGNED

INT

TEXT/LONGTEXT

TEXT/LONGTEXT

TIME

TIME

TIMESTAMP

TIMESTAMP

TINYINT

TINYINT

TINYINT UNSIGNED

SMALLINT

VARBINARY

VARBINARY

VARCHAR

VARCHAR

YEAR

YEAR

  • On this page (1)
  • Overview
  • Data synchronization with MySQL as the source
  • Data synchronization with Oracle as the source
  • Data synchronization with PostgreSQL as the source
  • Data synchronization with SQL Server as the source
  • Data synchronization with Db2 for LUW as the source
  • Data synchronization with Db2 for i as the source
  • Data synchronization with TiDB as the source
Feedback