Help Center/ GaussDB/ Centralized_8.x/ SQL Reference/ Character Sets and Collations/ Character Sets and Collations of the Client Connection
Updated on 2024-06-03 GMT+08:00

Character Sets and Collations of the Client Connection

When data containing character set attributes is transmitted between the server and client, encoding conversion is automatically performed. After receiving an SQL statement from a client, the server converts the character set of the SQL statement from the client character set client_encoding to the database character set server_encoding. Before the query result data is sent to the client, the data is encoded and converted to the character_set_results character set of the client.

System parameters:

  • server_encoding

    Character set specified during database creation. For details, see CREATE DATABASE.

  • client_encoding

    Character set of the client, which can be modified using the SET NAMES statement. For details, see SET. For details about the parameter, see client_encoding in "Configuring Running Parameters > GUC Parameters > Default Settings of Client Connection > Locale and Formatting" in Administrator Guide.

  • character_set_connection

    Default character set of string constants for which no character sets are specified in SQL statements. For details about the parameter, see character_set_connection in "Configuring Running Parameters > GUC Parameters > Version and Platform Compatibility > Platform and Client Compatibility" in Administrator Guide.

  • collation_connection

    Default collation of string constants for which no collations are specified in SQL statements. For details about the parameter, see collation_connection in "Configuring Running Parameters > GUC Parameters > Version and Platform Compatibility > Platform and Client Compatibility" in Administrator Guide.

  • character_set_results

    Character set of the returned result. For details about the parameters, see character_set_results in "Configuring Running Parameters > GUC Parameters > Version and Platform Compatibility > Platform and Client Compatibility" in Administrator Guide.

    • For an expression that converts a non-character type object to a character type, the result character set and collation are character_set_connection and collation_connection, respectively.

    • By default, the character set and collation number of a binding parameter of the character type are the values of character_set_connection and collation_connection, respectively. Any value entered for a binding parameter is considered belonging to the preceding character set.

    • During character data conversion, the character encoding is verified. If the character encoding does not meet the requirements, an exception is thrown.