Re: Default locale in postgres - Mailing list pgsql-admin

From Debraj Manna
Subject Re: Default locale in postgres
Date
Msg-id CAF6DVKNho8jr=poGgEnvOcgfV_Ma0kYrKBgEsQWRYKMt3cSu0Q@mail.gmail.com
Whole thread Raw
In response to Re: Default locale in postgres  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Default locale in postgres  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-admin
Thanks Tom for replying.


support@vrni-platform-release:~$ locale
LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=

My locale settings are like above. But I am seeing is C picked by postgres. Any idea why it is picking C instead of en_US.UTF-8. I am on Ubuntu 14 and postgres 9.5.4. In initdb I am just passing encoding as UTF-8 and data checksum as enabled.

support@vrni-platform-release:~$ psql -l -U postgres -h localhost
                             List of databases
   Name    |  Owner   | Encoding | Collate | Ctype |   Access privileges
-----------+----------+----------+---------+-------+-----------------------
 postgres  | postgres | UTF8     | C       | C     |
 template0 | postgres | UTF8     | C       | C     | =c/postgres          +
           |          |          |         |       | postgres=CTc/postgres
 template1 | postgres | UTF8     | C       | C     | =c/postgres          +
           |          |          |         |       | postgres=CTc/postgres
 vnera     | postgres | UTF8     | C       | C     |
(4 rows)

On Fri, Jul 13, 2018 at 11:56 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
Debraj Manna <subharaj.manna@gmail.com> writes:
> Can someone let me know if I am not passing any locale while doing initdb
> what locale (Collate & Ctype) will postgres 9.5.4 pick?

Whatever is the prevailing default in initdb's environment ---
see LANG and LC_XXX environment variables.

If none of those are set, I imagine it'll fall back to C locale,
though this choice is possibly dependent on your local libc.
"man locale" might be informative.

                        regards, tom lane

pgsql-admin by date:

Previous
From: Tom Lane
Date:
Subject: Re: Default locale in postgres
Next
From: Tom Lane
Date:
Subject: Re: Default locale in postgres