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

String Functions

Table 1 String functions

MySQL

GaussDB

Difference

ASCII()

Supported.

-

BIT_LENGTH()

Supported.

-

CHAR_LENGTH()

Supported, with differences.

In GaussDB, if the character set is SQL_ASCII, CHAR_LENGTH() returns the number of bytes instead of characters.

CHARACTER_LENGTH()

Supported, with differences.

In GaussDB, if the character set is SQL_ASCII, CHARACTER_LENGTH() returns the number of bytes instead of characters.

CONCAT()

Supported, with differences.

For binary return values, MySQL offers various options (including BINARY, VARBINARY, and BLOB), while GaussDB offers only one—LONGBLOB. For non-binary return values, MySQL offers various options (including CHAR, VARCHAR, and TEXT), while GaussDB only offers TEXT.

CONCAT_WS()

Supported, with differences.

For binary return values, MySQL offers various options (including BINARY, VARBINARY, and BLOB), while GaussDB offers only one—LONGBLOB. For non-binary return values, MySQL offers various options (including CHAR, VARCHAR, and TEXT), while GaussDB only offers TEXT.

HEX()

Supported.

-

LENGTH()

Supported.

-

LPAD()

Supported, with differences.

  • The default maximum padding length in MySQL is 1398101, and that in GaussDB is 1048576. The maximum padding length varies depending on the character set. For example, if the character set is GBK, the default maximum padding length in GaussDB is 2097152.
  • When GaussDB uses the SQL_ASCII, the server interprets byte values 0 to 127 according to the ASCII standard, and byte values 128 to 255 are regarded as characters that cannot be parsed. If the input and output of the function contain any non-ASCII data, the database cannot convert or verify non-ASCII characters. As a result, the behavior of the function is greatly different from that of MySQL.
  • For binary return values, MySQL offers various options (including BINARY, VARBINARY, and BLOB), while GaussDB offers only one—LONGBLOB. For non-binary return values, MySQL offers various options (including CHAR, VARCHAR, and TEXT), while GaussDB only offers TEXT.

REPEAT()

Supported, with differences.

For binary return values, MySQL offers various options (including BINARY, VARBINARY, and BLOB), while GaussDB offers only one—LONGBLOB. For non-binary return values, MySQL offers various options (including CHAR, VARCHAR, and TEXT), while GaussDB only offers TEXT.

REPLACE()

Supported, with differences.

For binary return values, MySQL offers various options (including BINARY, VARBINARY, and BLOB), while GaussDB offers only one—LONGBLOB. For non-binary return values, MySQL offers various options (including CHAR, VARCHAR, and TEXT), while GaussDB only offers TEXT.

RPAD()

Supported, with differences.

  • The default maximum padding length in MySQL is 1398101, and that in GaussDB is 1048576. The maximum padding length varies depending on the character set. For example, if the character set is GBK, the default maximum padding length in GaussDB is 2097152.
  • When GaussDB uses the SQL_ASCII, the server interprets byte values 0 to 127 according to the ASCII standard, and byte values 128 to 255 are regarded as characters that cannot be parsed. If the input and output of the function contain any non-ASCII data, the database cannot convert or verify non-ASCII characters. As a result, the behavior of the function is greatly different from that of MySQL.
  • For binary return values, MySQL offers various options (including BINARY, VARBINARY, and BLOB), while GaussDB offers only one—LONGBLOB. For non-binary return values, MySQL offers various options (including CHAR, VARCHAR, and TEXT), while GaussDB only offers TEXT.

SPACE()

Supported.

-

STRCMP()

Supported, with differences.

When GaussDB uses the SQL_ASCII, the server interprets byte values 0 to 127 according to the ASCII standard, and byte values 128 to 255 are regarded as characters that cannot be parsed. If the input and output of the function contain any non-ASCII data, the database cannot convert or verify non-ASCII characters. As a result, the behavior of the function is greatly different from that of MySQL.

FIND_IN_SET()

Supported, with differences.

When GaussDB uses the SQL_ASCII, the server interprets byte values 0 to 127 according to the ASCII standard, and byte values 128 to 255 are regarded as characters that cannot be parsed. If the input and output of the function contain any non-ASCII data, the database cannot convert or verify non-ASCII characters. As a result, the behavior of the function is greatly different from that of MySQL.

For binary return values, MySQL offers various options (including BINARY, VARBINARY, and BLOB), while GaussDB offers only one—LONGBLOB. For non-binary return values, MySQL offers various options (including CHAR, VARCHAR, and TEXT), while GaussDB only offers TEXT.

LCASE()

LEFT()

LOWER()

LTRIM()

REVERSE()

RIGHT()

RTRIM()

SUBSTR()

SUBSTRING()

SUBSTRING_INDEX()

TRIM()

UCASE()

UPPER()

UNHEX()

Supported, with differences.

The return value type in MySQL is BINARY, VARBINARY, BLOB, MEDIUMBLOB, or LONGBLOB, while the return value type in GaussDB is fixed to LONGBLOB.

FIELD()

Supported.

-

FORMAT()

Supported.

-