pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Default locale in postgres
6+ messages / 3 participants
[nested] [flat]

* Default locale in postgres
@ 2018-07-13 18:18  Debraj Manna <subharaj.manna@gmail.com>
  0 siblings, 1 reply; 6+ messages in thread

From: Debraj Manna @ 2018-07-13 18:18 UTC (permalink / raw)
  To: pgsql-admin

Hi

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?

^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Default locale in postgres
@ 2018-07-13 18:26  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Debraj Manna <subharaj.manna@gmail.com>
  0 siblings, 1 reply; 6+ messages in thread

From: Tom Lane @ 2018-07-13 18:26 UTC (permalink / raw)
  To: Debraj Manna <subharaj.manna@gmail.com>; +Cc: pgsql-admin

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




^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Default locale in postgres
@ 2018-07-13 18:50  Debraj Manna <subharaj.manna@gmail.com>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 6+ messages in thread

From: Debraj Manna @ 2018-07-13 18:50 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: 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
>

^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Default locale in postgres
@ 2018-07-13 20:57  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Debraj Manna <subharaj.manna@gmail.com>
  0 siblings, 1 reply; 6+ messages in thread

From: Tom Lane @ 2018-07-13 20:57 UTC (permalink / raw)
  To: Debraj Manna <subharaj.manna@gmail.com>; +Cc: pgsql-admin

Debraj Manna <subharaj.manna@gmail.com> writes:
> Thanks Tom for replying.
> support@vrni-platform-release:~$ locale
> LANG=en_US.UTF-8

OK, so that's what you have in your interactive shell environment ...

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

Presumably, initdb is not seeing that same environment.  Might be a side
effect of running it under sudo or some wrapper script.

			regards, tom lane




^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Default locale in postgres
@ 2018-07-14 06:10  Debraj Manna <subharaj.manna@gmail.com>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 6+ messages in thread

From: Debraj Manna @ 2018-07-14 06:10 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-admin

Is it possible to specify the default locale in postgres.conf in postgres
10 so that it takes this locale if no locale is specified in initdb?

On Sat, Jul 14, 2018 at 2:27 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:

> Debraj Manna <subharaj.manna@gmail.com> writes:
> > Thanks Tom for replying.
> > support@vrni-platform-release:~$ locale
> > LANG=en_US.UTF-8
>
> OK, so that's what you have in your interactive shell environment ...
>
> > 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.
>
> Presumably, initdb is not seeing that same environment.  Might be a side
> effect of running it under sudo or some wrapper script.
>
>                         regards, tom lane
>

^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Default locale in postgres
@ 2018-07-14 07:30  David G. Johnston <david.g.johnston@gmail.com>
  parent: Debraj Manna <subharaj.manna@gmail.com>
  0 siblings, 0 replies; 6+ messages in thread

From: David G. Johnston @ 2018-07-14 07:30 UTC (permalink / raw)
  To: Debraj Manna <subharaj.manna@gmail.com>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; pgsql-admin

On Friday, July 13, 2018, Debraj Manna <subharaj.manna@gmail.com> wrote:

> Is it possible to specify the default locale in postgres.conf in postgres
> 10 so that it takes this locale if no locale is specified in initdb?
>

No, postgres.conf doesn't exist until initdb is run.

David J.

^ permalink  raw  reply  [nested|flat] 6+ messages in thread


end of thread, other threads:[~2018-07-14 07:30 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-07-13 18:18 Default locale in postgres Debraj Manna <subharaj.manna@gmail.com>
2018-07-13 18:26 ` Tom Lane <tgl@sss.pgh.pa.us>
2018-07-13 18:50   ` Debraj Manna <subharaj.manna@gmail.com>
2018-07-13 20:57     ` Tom Lane <tgl@sss.pgh.pa.us>
2018-07-14 06:10       ` Debraj Manna <subharaj.manna@gmail.com>
2018-07-14 07:30         ` David G. Johnston <david.g.johnston@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox