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
    • The length of parameters and return values of GaussDB user-defined functions cannot be verified. The length of stored procedure parameters cannot be verified. In addition, correct spaces cannot be supplemented when PAD_CHAR_TO_FULL_LENGTH is enabled. However, MySQL supports these functions.
    • GaussDB does not support escape characters or double quotation marks (""). MySQL supports these inputs.
  • Syntax

    The CAST(expr as char) syntax of GaussDB cannot convert the input string to the corresponding type based on the string length. It can only be converted to the varchar type. CAST( '' as char) and CAST( '' as char(0)) cannot convert an empty string to the char(0) type. MySQL supports conversion to the corresponding type by length.

  • Operator
    • After performing addition, subtraction, multiplication, division, or modulo operations on a string (that can be converted to a floating-point value) and an integer value, GaussDB returns an integer, while MySQL returns a floating-point value.
    • If a value is divided by 0, GaussDB reports an error, and MySQL returns null.
    • "~": returns a negative number in GaussDB and an 8-byte unsigned integer in MySQL.
    • "^": indicates a power in GaussDB and a bitwise XOR in MySQL.

VARCHAR(M)

Supported, with differences

  • Input format
    • 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.
    • GaussDB does not support escape characters or double quotation marks (""). MySQL supports these inputs.
  • Operator
    • After performing addition, subtraction, multiplication, division, or modulo operations on a string (that can be converted to a floating-point value) and an integer value, GaussDB returns an integer, while MySQL returns a floating-point value.
    • If a value is divided by 0, GaussDB reports an error, and MySQL returns null.
    • "~": returns a negative number in GaussDB and an 8-byte unsigned integer in MySQL.
    • "^": indicates a power in GaussDB and a bitwise XOR in MySQL.

TINYTEXT

Supported, with differences

  • Input format
    • In GaussDB, the length of this type cannot exceed 1 GB. If the length exceeds 1 GB, an error is reported. In MySQL, the length of this type cannot exceed 255 bytes. Otherwise, an error is reported in strict mode, and data is truncated and an alarm is generated in loose mode.
    • GaussDB does not support escape characters or double quotation marks (""). MySQL supports these inputs.
  • Operator
    • After performing addition, subtraction, multiplication, division, or modulo operations on a string (that can be converted to a floating-point value) and an integer value, GaussDB returns an integer, while MySQL returns a floating-point value.
    • If a value is divided by 0, GaussDB reports an error, and MySQL returns null.
    • "~": returns a negative number in GaussDB and an 8-byte unsigned integer in MySQL.
    • "^": indicates a power in GaussDB and a bitwise XOR in MySQL.

TEXT

Supported, with differences

  • Input format
    • In GaussDB, the length of this type cannot exceed 1 GB. If the length exceeds 1 GB, an error is reported. In MySQL, the length of this type cannot exceed 65535 bytes. Otherwise, an error is reported in strict mode, and data is truncated and an alarm is generated in loose mode.
    • GaussDB does not support escape characters or double quotation marks (""). MySQL supports these inputs.
  • Operator
    • After performing addition, subtraction, multiplication, division, or modulo operations on a string (that can be converted to a floating-point value) and an integer value, GaussDB returns an integer, while MySQL returns a floating-point value.
    • If a value is divided by 0, GaussDB reports an error, and MySQL returns null.
    • "~": returns a negative number in GaussDB and an 8-byte unsigned integer in MySQL.
    • "^": indicates a power in GaussDB and a bitwise XOR in MySQL.

MEDIUMTEXT

Supported, with differences

  • Input format
    • In GaussDB, the length of this type cannot exceed 1 GB. If the length exceeds 1 GB, an error is reported. In MySQL, the length of this type cannot exceed 16777215 bytes. Otherwise, an error is reported in strict mode, and data is truncated and an alarm is generated in loose mode.
    • GaussDB does not support escape characters or double quotation marks (""). MySQL supports these inputs.
  • Operator
    • After performing addition, subtraction, multiplication, division, or modulo operations on a string (that can be converted to a floating-point value) and an integer value, GaussDB returns an integer, while MySQL returns a floating-point value.
    • If a value is divided by 0, GaussDB reports an error, and MySQL returns null.
    • "~": returns a negative number in GaussDB and an 8-byte unsigned integer in MySQL.
    • "^": indicates a power in GaussDB and a bitwise XOR in MySQL.

LONGTEXT

Supported, with differences

  • Input format
    • GaussDB supports a maximum of 1 GB, and MySQL supports a maximum of 4 GB minus 1 byte.
    • GaussDB does not support escape characters or double quotation marks (""). MySQL supports these inputs.
  • Operator
    • After performing addition, subtraction, multiplication, division, or modulo operations on a string (that can be converted to a floating-point value) and an integer value, GaussDB returns an integer, while MySQL returns a floating-point value.
    • If a value is divided by 0, GaussDB reports an error, and MySQL returns null.
    • "~": returns a negative number in GaussDB and an 8-byte unsigned integer in MySQL.
    • "^": indicates a power in GaussDB and a bitwise XOR in MySQL.

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

Not supported

-

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

Not supported

-