PostgreSQL: Local Support

Source: Internet
Author: User

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
  1. Set client_encoding to character_set_name
  2. Set names character_set_name
  3. Psql.exe use \ encoding character_set_name
  4. Program that calls the libpq Library: Call the character set encoding setting function of the client.
  5. Use the configuration file option client_encoding
  6. Use the OS environment variable to specify: pgclentencoding

 

 

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.