Updated on 2025-09-09 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 format:
  • GaussDB cannot verify the length of parameters and return values of user-defined functions or the length of stored procedure parameters. However, MySQL supports their verification.
  • GaussDB can verify the length of temporary variables in user-defined functions and stored procedures, 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 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.
  • Default value: The default value cannot be set in MySQL 5.7 but can be set in GaussDB and MySQL 8.0.
  • Primary key: When creating a primary key, you must specify the prefix length in MySQL, but you cannot specify the prefix length in GaussDB.
  • Index: In MySQL, the TINYTEXT type does not support other index methods except prefix indexes. GaussDB supports these index methods.

TEXT

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.
  • Default value: The default value cannot be set in MySQL 5.7 but can be set in GaussDB and MySQL 8.0.
  • Primary key: When creating a primary key, you must specify the prefix length in MySQL, but you cannot specify the prefix length in GaussDB.
  • Index: In MySQL, the TEXT type does not support other index methods except prefix indexes. GaussDB supports these index methods.

MEDIUMTEXT

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.
  • Default value: The default value cannot be set in MySQL 5.7 but can be set in GaussDB and MySQL 8.0.
  • Primary key: When creating a primary key, you must specify the prefix length in MySQL, but you cannot specify the prefix length in GaussDB.
  • Index: In MySQL, the MEDIUMTEXT type does not support other index methods except prefix indexes. GaussDB supports these index methods.

LONGTEXT

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.
  • Default value: The default value cannot be set in MySQL 5.7 but can be set in GaussDB and MySQL 8.0.
  • Primary key: When creating a primary key, you must specify the prefix length in MySQL, but you cannot specify the prefix length in GaussDB.
  • Index: In MySQL, the LONGTEXT type does not support other index methods except prefix indexes. GaussDB supports these index methods.