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

String Data Types

Table 1 String data types

No.

MySQL

GaussDB

Difference

1

CHAR(M)

Supported, with differences

  • Input formats:
    • 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.
    • GaussDB does not support escape characters, but MySQL supports.

2

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.
    • GaussDB does not support escape characters, but MySQL supports.
    • 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.

3

TINYTEXT

Supported, with differences

  • Input formats:
    • GaussDB does not support escape characters, but MySQL supports.
    • 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.

4

TEXT

Supported, with differences

  • Input formats:
    • GaussDB does not support escape characters, but MySQL supports.
    • 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.

5

MEDIUMTEXT

Supported, with differences

  • Input formats:
    • GaussDB does not support escape characters, but MySQL supports.
    • 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.

6

LONGTEXT

Supported, with differences

  • Input formats:
    • GaussDB supports a maximum of 1 GB, and MySQL supports a maximum of 4 GB minus 1 byte.
    • GaussDB does not support escape characters, but MySQL supports.
    • 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.