I know that database locales on Postgres are responsible for proper order of national characters, proper lower/upper-casing etc.
But why there are two language-neutral locales: posix
and c
? Is there any difference between them or is it just one neutral locale with two different names?
UPDATE As Magnus Hagander states in his answer, POSIX and C locales are the same locale with different names (no matter if Postgres is installed on POSIX or Windows System). I don't know how to confirm this information - where to look for proper section of documentation?
Magnus's explanation seems sensible, but it is strange at the same time that there are two names for the same locale to choose from. What is the purpose of this - only to make confusion?
Locale support refers to an application respecting cultural preferences regarding alphabets, sorting, number formatting, etc. PostgreSQL uses the standard ISO C and POSIX locale facilities provided by the server operating system. For additional information refer to the documentation of your system.
This locale refers to the ANSI C or POSIX-defined standard for the locale inherited by all processes at startup time. The C or POSIX locale assumes the 7-bit ASCII character set and defines information for the six previous categories.
You cannot to change these values for already created databases. In this moment, when there are not other databases, the most easy solution is a) stop database, b) delete data directory, c) run manually initdb with options --encoding and --locale (run this command under postgres user).
Note that PostgreSQL just uses the operating system locale, and doesn't have it's own definition of locales. If your system is POSIX compliant, C and POSIX will be the exact same locale: http://www.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap07.html (see the first sentence under 7.2).
According to The Single UNIX ® Specification POSIX and C locales are aliases:
The strings "C" and "POSIX" are reserved as identifiers for the POSIX locale
So they are guaranteed to be the same on POSIX systems. I don't know how far Windows Vista or 7 are POSIX compliant, but probably similar definition can be found in Microsoft documentation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With