Localization: Refers to cultural preferences related to characters, sorting, digit formats, currency symbols, etc.
PostgreSQL provides Localization support in two ways:
- 1. Obtain localization preferences through the OS used
- Initdb.exe or automatically obtains localization information from the operating system environment. If the retrieval fails, postgressql uses the default c setting.
- Of course, you can use -- local = loacl_set to specify localization rules;
- Initdb.exe allows you to specify the specific localization details parameter to be mentioned below for detailed settings.
- 2. Provides several localized settings for parameter customization in every detail
- Lc_collate: Sorting rule
- Lc_ctype: Character Set
- Lc_numeric: digit format
- Lc_time: Date and Time Format
- Lc_monetary: currency format
- Lc_messages: Message Language
Localization settings affect the following:
- Sort order by text data
- Like search
- Upper, lower, and initcap character Functions
- To_char series data conversion functions
- Note: localization is costly. It affects performance and slows down character data processing. Organizations like to use common indexes
Common, common, difficult, and selling point character set support problems
Any applicationProgramTo succeed globally, supporting different localized character sets is unavoidable. PostgreSQL supports a large number of character sets (encoding) in three layers: Server, conversion function, and client.
- The serverend sequence set is determined when initdb.exe is used for initialization. Note that euc_cn is a simplified Chinese character set. Gb18030 and GBK = windows936 are character sets that can be used only on the client.
- There are many pre-made conversion functions in PostgreSQL. You can use create conversion to add your own conversion functions. Note the availability of server and client (Character Set compatibility issues)
- Client settings
- Set client_encoding to character_set_name
- Set names character_set_name
- Psql.exe use \ encoding character_set_name
- Program that calls the libpq Library: Call the character set encoding setting function of the client.
- Use the configuration file option client_encoding
- Use the OS environment variable to specify: pgclentencoding