What is the difference between C and Posix locales

2019-04-03 18:06发布

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?

2条回答
叼着烟拽天下
2楼-- · 2019-04-03 18:22

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).

查看更多
劫难
3楼-- · 2019-04-03 18:27

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.

查看更多
登录 后发表回答