Updated on 2024-05-14 GMT+08:00

String Data Types

Table 1 String data types

No.

MySQL

GaussDB

Difference

1

CHAR[(M)]

Supported

  • 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
    • GaussDB can convert a character string to a floating-point value and perform the modulo operation on the character string and integer value. The return value is an integer. 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.

2

VARCHAR(M)

Supported

  • 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
    • GaussDB can convert a character string to a floating-point value and perform the modulo operation on the character string and integer value. The return value is an integer. 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.

3

TINYTEXT

Supported

  • Input format
    • The length limit in GaussDB is 1 GB, not 255 bytes. If the length exceeds the limit, no error or truncation alarm is reported in strict or loose mode. However, MySQL supports these functions.
    • GaussDB does not support escape characters or double quotation marks (""). MySQL supports these inputs.
  • Operator
    • GaussDB can convert a character string to a floating-point value and perform the modulo operation on the character string and integer value. The return value is an integer. 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.

4

TEXT

Supported

  • Input format
    • The length limit in GaussDB is 1 GB, not 65535 bytes. If the length exceeds the limit, no error or truncation alarm is reported in strict or loose mode. However, MySQL supports these functions.
    • GaussDB does not support escape characters or double quotation marks (""). MySQL supports these inputs.
  • Operator
    • GaussDB can convert a character string to a floating-point value and perform the modulo operation on the character string and integer value. The return value is an integer. 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.

5

MEDIUMTEXT

Supported

  • Input format
    • The length limit in GaussDB is 1 GB, not 16777215 bytes. If the length exceeds the limit, no error or truncation alarm is reported in strict or loose mode. However, MySQL supports these functions.
    • GaussDB does not support escape characters or double quotation marks (""). MySQL supports these inputs.
  • Operator
    • GaussDB can convert a character string to a floating-point value and perform the modulo operation on the character string and integer value. The return value is an integer. 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.

6

LONGTEXT

Supported

  • 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
    • GaussDB can convert a character string to a floating-point value and perform the modulo operation on the character string and integer value. The return value is an integer. 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.

7

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

Not supported

-

8

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

Supported

-