String Functions
No. |
MySQL |
GaussDB |
Difference |
---|---|---|---|
1 |
ASCII() |
Supported. |
- |
2 |
BIT_LENGTH() |
Supported. |
- |
3 |
CHAR_LENGTH() |
Supported, with differences. |
In GaussDB, if the character set is SQL_ASCII, CHAR_LENGTH() returns the number of bytes instead of characters. |
4 |
CHARACTER_LENGTH() |
Supported, with differences. |
In GaussDB, if the character set is SQL_ASCII, CHARACTER_LENGTH() returns the number of bytes instead of characters. |
5 |
CONCAT() |
Supported. |
If the return value type in MySQL is binary string (such as BINARY, VARBINARY, or BLOB), the return value type in GaussDB is BLOB. If the return value type in MySQL is non-binary string (such as CHAR, VARCHAR, or TEXT), the return value type in GaussDB is TEXT. |
6 |
CONCAT_WS() |
Supported. |
If the return value type in MySQL is binary string (such as BINARY, VARBINARY, or BLOB), the return value type in GaussDB is BLOB. If the return value type in MySQL is non-binary string (such as CHAR, VARCHAR, or TEXT), the return value type in GaussDB is TEXT. |
7 |
HEX() |
Supported. |
- |
8 |
LENGTH() |
Supported. |
- |
9 |
LPAD() |
Supported, with differences. |
|
10 |
MD5() |
Supported, with differences. |
When the length of the inserted string of the BINARY type is less than the target length, the padding characters in GaussDB are different from those in MySQL. Therefore, when the input parameter is of the BINARY type, the function result in GaussDB is different from that in MySQL. |
11 |
RANDOM_BYTES() |
Supported. |
Both GaussDB and MySQL use OpenSSL to generate random character strings. GaussDB uses OpenSSL 3.x.x to generate random character strings. Compared with MySQL using OpenSSL 1.x.x, the performance in GaussDB may deteriorate. |
12 |
REPEAT() |
Supported. |
If the return value type in MySQL is binary string (such as BINARY, VARBINARY, or BLOB), the return value type in GaussDB is BLOB. If the return value type in MySQL is non-binary string (such as CHAR, VARCHAR, or TEXT), the return value type in GaussDB is TEXT. |
13 |
REPLACE() |
Supported. |
|
14 |
RPAD() |
Supported, with differences. |
|
15 |
SHA()/SHA1() |
Supported. |
- |
16 |
SHA2() |
Supported. |
- |
17 |
SPACE() |
Supported. |
- |
18 |
STRCMP() |
Supported, with differences. |
If the database character set is SQL_ASCII, unexpected results may occur. |
19 |
FIND_IN_SET() |
Supported, with differences. |
When characters are specified to be encoded in SQL_ASCII for the database, the server parses byte values 0 to 127 according to the ASCII standard, and byte values 128 to 255 cannot be parsed. If the input and output of the function contain any non-ASCII characters, the database cannot help you convert or verify them. If the return value type in MySQL is binary string (such as BINARY, VARBINARY, or BLOB), the return value type in GaussDB is BLOB. If the return value type in MySQL is non-binary string (such as CHAR, VARCHAR, or TEXT), the return value type in GaussDB is TEXT. The SUBSTRING function is different from that in MySQL when the first input parameter is nested.
The differences in SUBSTRING_INDEX function are as follows:
|
20 |
LCASE() |
||
21 |
LEFT() |
||
22 |
LOWER() |
||
23 |
LTRIM() |
||
24 |
REVERSE() |
||
25 |
RIGHT() |
||
26 |
RTRIM() |
||
27 |
SUBSTR() |
||
28 |
SUBSTRING() |
||
29 |
SUBSTRING_INDEX() |
||
30 |
TRIM() |
||
31 |
UCASE() |
||
32 |
UPPER() |
||
33 |
UNHEX() |
Supported. |
The return value type in MySQL is BINARY, VARBINARY, BLOB, MEDIUMBLOB, or LONGBLOB, while the return value type in GaussDB is fixed to LONGBLOB. |
34 |
FIELD() |
Supported. |
- |
35 |
COMPRESS() |
Supported, with differences. |
In MySQL, the return value type is VARBINARY, BLOB, or LONGBLOB. In GaussDB, the return value type is LONGBLOB. |
36 |
UNCOMPRESS() |
Supported. |
- |
37 |
UNCOMPRESS_LENGTH() |
Supported. |
- |
38 |
EXPORT_SET() |
Supported. |
- |
39 |
POSITION() |
Supported. |
- |
40 |
LOCATE() |
Supported. |
- |
41 |
CHAR() |
Supported, with differences. |
|
42 |
ELT() |
Supported, with differences. |
In MySQL, the number of input parameters of the ELT function is not limited. In GaussDB, the number of input parameters of the function cannot exceed 8192. |
43 |
FORMAT() |
Supported. |
- |
44 |
BIN() |
Supported. |
- |
45 |
MAKE_SET() |
Supported. |
In MySQL 5.7, if the first parameter selected by the MAKE_SET function is of the integer, floating-point, or fixed-point type and the returned result contains non-ASCII characters, garbled characters may be displayed. In GaussDB, the displayed result is normal, which is the same as that in MySQL 8.0. |
46 |
TO_BASE64() |
Supported. |
- |
47 |
FROM_BASE64() |
Supported. |
- |
48 |
ORD() |
Supported. |
- |
49 |
MID() |
Supported. |
- |
50 |
QUOTE() |
Supported, with differences. |
|
51 |
INSERT() |
Supported. |
- |
52 |
INSTR() |
Supported. |
- |
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot