Character Sets and Collations of Expressions of the String Type
Each expression of the string type contains character sets and collation attributes.
In B-compatible mode (sql_compatibility is set to 'B'), if b_format_version is set to '5.7' and b_format_dev_version is set to 's2', the default character sets and collations of string constants are determined by the system parameters character_set_connection and collation_connection. Otherwise, the default character set is the same as server_encoding of the database, and the default collation is default.
Character set syntax:
Currently, the character set syntax for specifying string constants is not supported in GaussDB.
1
|
[_charset_name]'string' |
Collation syntax:
You can also specify the collation for expressions of other character string types.
1
|
expression [COLLATE collation_name] |
Syntax description:
COLLATE collation_name
Collation name, which is the collation attribute of the string.
The data type of the expression must be a data type that supports collations.
The specified collation must be supported by the character set of the expression.
Example:
1 2 |
-- Use the COLLATE statement to specify the collation. gaussdb=# SELECT 'a' COLLATE utf8mb4_general_ci = 'A'; |
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.