What is the difference between C and Posix locales on Postgres?

不羁的心 提交于 2020-01-01 07:39: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?


回答1:


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




回答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.



来源:https://stackoverflow.com/questions/2355051/what-is-the-difference-between-c-and-posix-locales-on-postgres

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!