4
Locales and their Categories
Locales
define the language, region, and character encoding,
for example, fr_FR.UTF8
installed in the operating system
Locale categories and their corresponding parameters
LC_COLLATE — string sort order
LC_CTYPE — character classification
LC_MESSAGES lc_messages language of messages
LC_MONETARY lc_monetary formatting of currency amounts
LC_NUMERIC lc_numeric formatting of numbers
LC_TIME lc_time formatting of dates and times
PostgreSQL relies on the localization capabilities provided by the operating
system. Therefore, the locales required for the DBMS should be pre-
configured in the OS.
Locales in the OS are typically specified in the “language_region.encoding”
format. For example, fr_CA.UTF8 represents the French language as
spoken in Canada (CA). Windows uses verbose locale names, such as
French_Canada.1252.
The language and region determine cultural preferences such as character
order, date formats, decimal separators, etc.
Sometimes it is necessary to combine the behavior of different locales. For
example, to use French date and time formats while keeping server
messages in English. PostgreSQL supports setting locale categories
separately via corresponding configuration parameters of the same name.
Starting with PostgreSQL 16, the unchangeable server parameters for the
LC_COLLATE and LC_CTYPE locale categories have been removed. To
obtain information about a database’s locale now, you should query the
pg_database system catalog table.