Updated on 2025-06-30 GMT+08:00

String Data Types

Table 1 String data types

MySQL

GaussDB

Difference

CHAR(M)

Supported, with differences

Input format: If a binary or hexadecimal character string is input, GaussDB outputs a hexadecimal character string, and MySQL escapes the character string based on the ASCII code table. If the character string cannot be escaped, the output is empty.

VARCHAR(M)

Supported, with differences

Input formats:
  • The length of parameters and return values of GaussDB user-defined functions cannot be verified. The length of stored procedure parameters cannot be verified. However, MySQL supports these functions.
  • The length of temporary variables in GaussDB user-defined functions and stored procedures can be verified, and an error or truncation alarm is reported in strict or loose mode. However, MySQL does not support these functions.
  • After a binary or hexadecimal character string is entered, GaussDB outputs a hexadecimal character string, and MySQL escapes the character string based on the ASCII code table. If the character string cannot be escaped, the output is empty.

TINYTEXT

Supported, with differences

  • Input formats:
    • Default value: When creating a table column, you can set a default value in the syntax. MySQL does not allow you to set a default value.
    • After a binary or hexadecimal character string is entered, GaussDB outputs a hexadecimal character string, and MySQL escapes the character string based on the ASCII code table. If the character string cannot be escaped, the output is empty.
  • Primary key: In MySQL, the TINYTEXT type does not support primary keys, but GaussDB supports.
  • Index: In MySQL, the TINYTEXT type does not support other index methods except prefix indexes. GaussDB supports these index methods.
  • Foreign key: In MySQL, the TINYTEXT type cannot be used as the referencing column or referenced column of a foreign key, but GaussDB supports this operation.

TEXT

Supported, with differences

  • Input formats:
    • Default value: When creating a table column, you can set a default value in the syntax. MySQL does not allow you to set a default value.
    • After a binary or hexadecimal character string is entered, GaussDB outputs a hexadecimal character string, and MySQL escapes the character string based on the ASCII code table. If the character string cannot be escaped, the output is empty.
  • Primary key: In MySQL, the TEXT type does not support primary keys, but GaussDB supports.
  • Index: In MySQL, the TEXT type does not support other index methods except prefix indexes. GaussDB supports these index methods.
  • Foreign key: In MySQL, the TINYTEXT type cannot be used as the referencing column or referenced column of a foreign key, but GaussDB supports this operation.

MEDIUMTEXT

Supported, with differences

  • Input formats:
    • Default value: When creating a table column, you can set a default value in the syntax. MySQL does not allow you to set a default value.
    • After a binary or hexadecimal character string is entered, GaussDB outputs a hexadecimal character string, and MySQL escapes the character string based on the ASCII code table. If the character string cannot be escaped, the output is empty.
  • Primary key: In MySQL, the MEDIUMTEXT type does not support primary keys, but GaussDB supports.
  • Index: In MySQL, the MEDIUMTEXT type does not support other index methods except prefix indexes. GaussDB supports these index methods.
  • Foreign key: In MySQL, the TINYTEXT type cannot be used as the referencing column or referenced column of a foreign key, but GaussDB supports this operation.

LONGTEXT

Supported, with differences

  • Input format:
    • GaussDB supports a maximum of 1 GB, and MySQL supports a maximum of 4 GB minus 1 byte.
    • Default value: When creating a table column, you can set a default value in the syntax. MySQL does not allow you to set a default value.
    • After a binary or hexadecimal character string is entered, GaussDB outputs a hexadecimal character string, and MySQL escapes the character string based on the ASCII code table. If the character string cannot be escaped, the output is empty.
  • Primary key: In MySQL, the LONGTEXT type does not support primary keys, but GaussDB supports.
  • Index: In MySQL, the LONGTEXT type does not support other index methods except prefix indexes. GaussDB supports these index methods.
  • Foreign key: In MySQL, the TINYTEXT type cannot be used as the referencing column or referenced column of a foreign key, but GaussDB supports this operation.