Re: Overriding local encoding defaults

Lists: pgsql-novice
From: Bob McConnell <rmcconne(at)lightlink(dot)com>
To: "pgsql-novice(at)postgresql(dot)org" <pgsql-novice(at)postgresql(dot)org>
Subject: Overriding local encoding defaults
Date: 2010-10-17 13:03:52
Message-ID: 4CBAF438.1050605@lightlink.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-novice

I am trying to create a Pg 8.4 cluster with UTF8 encoding for JDBC
access. But initdb insists that because my local console is en_US, it
cannot do that. We're talking about setting up a server here. Why should
it even care what the local console settings are? initdb and pg_ctl are
the only commands that will ever be run through that console.

Is there any way to force initdb to ignore the local environment and use
UTF8?

If not, how do I modify the local console to match the UTF8 requirement?
This is on Slackware/64 13.1.0.

Thank you,

Bob McConnell


From: Leif Biberg Kristensen <leif(at)solumslekt(dot)org>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: Overriding local encoding defaults
Date: 2010-10-17 13:50:03
Message-ID: 201010171550.03440.leif@solumslekt.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-novice

On Sunday 17. October 2010 15.03.52 Bob McConnell wrote:
> I am trying to create a Pg 8.4 cluster with UTF8 encoding for JDBC
> access. But initdb insists that because my local console is en_US, it
> cannot do that. We're talking about setting up a server here. Why should
> it even care what the local console settings are? initdb and pg_ctl are
> the only commands that will ever be run through that console.
>
> Is there any way to force initdb to ignore the local environment and use
> UTF8?
>
> If not, how do I modify the local console to match the UTF8 requirement?
> This is on Slackware/64 13.1.0.

Don't know Slackware, but in Gentoo I've got a file /etc/env.d/02locale which
just says:

LC_ALL="nb_NO.UTF-8"

You should probably also set up your locales in the /etc/locale.gen and then
run the command locale-gen from root. At least that's how it's done in Gentoo.

Regards,
Leif Biberg Kristensen


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bob McConnell <rmcconne(at)lightlink(dot)com>
Cc: "pgsql-novice(at)postgresql(dot)org" <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Overriding local encoding defaults
Date: 2010-10-17 14:25:14
Message-ID: 8329.1287325514@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-novice

Bob McConnell <rmcconne(at)lightlink(dot)com> writes:
> I am trying to create a Pg 8.4 cluster with UTF8 encoding for JDBC
> access. But initdb insists that because my local console is en_US, it
> cannot do that. We're talking about setting up a server here. Why should
> it even care what the local console settings are?

You need a locale setting that's compatible with UTF8, and apparently
your platform's version of "en_US" isn't. Try specifying locale
en_US.utf8. (There are various ways of spelling that --- "locale -a"
should give you a clue which one applies for you.)

regards, tom lane


From: Bob McConnell <rmcconne(at)lightlink(dot)com>
To: "pgsql-novice(at)postgresql(dot)org" <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Overriding local encoding defaults
Date: 2010-10-17 16:48:29
Message-ID: 4CBB28DD.3060009@lightlink.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-novice

Tom Lane wrote:
> Bob McConnell <rmcconne(at)lightlink(dot)com> writes:
>> I am trying to create a Pg 8.4 cluster with UTF8 encoding for JDBC
>> access. But initdb insists that because my local console is en_US, it
>> cannot do that. We're talking about setting up a server here. Why should
>> it even care what the local console settings are?
>
> You need a locale setting that's compatible with UTF8, and apparently
> your platform's version of "en_US" isn't. Try specifying locale
> en_US.utf8. (There are various ways of spelling that --- "locale -a"
> should give you a clue which one applies for you.)

OK, this seems to work, so far. While logged in as the postgres user, I
typed in:

export LANG=en_US.UTF-8

Then:

initdb -D /home/pgsql/data -E UTF8

built a cluster with UTF8 encoding. Just for safety, I also created
~/.profile with the same export line. So if I accidentally use pgsql via
SSH, I should be safe.

The 'export' syntax came from the CHANGES_AND_HINTS.TXT file for
Slackware 13.1 under SCIM input methods.

I still don't understand why a server process should care about the
local console. Are there any plans to fix that?

Thank you,

Bob McConnell
N2SPP


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bob McConnell <rmcconne(at)lightlink(dot)com>
Cc: "pgsql-novice(at)postgresql(dot)org" <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Overriding local encoding defaults
Date: 2010-10-17 20:19:42
Message-ID: 14052.1287346782@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-novice

Bob McConnell <rmcconne(at)lightlink(dot)com> writes:
> I still don't understand why a server process should care about the
> local console. Are there any plans to fix that?

No, because it's not broken. Where else should initdb get the default
locale setting, if not from the environment it's invoked in?

regards, tom lane


From: Bob McConnell <rmcconne(at)lightlink(dot)com>
To: "pgsql-novice(at)postgresql(dot)org" <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Overriding local encoding defaults
Date: 2010-10-17 22:01:36
Message-ID: 4CBB7240.7050109@lightlink.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-novice

Tom Lane wrote:
> Bob McConnell <rmcconne(at)lightlink(dot)com> writes:
>> I still don't understand why a server process should care about the
>> local console. Are there any plans to fix that?
>
> No, because it's not broken. Where else should initdb get the default
> locale setting, if not from the environment it's invoked in?

Something that critical should never be left to a default. It should be
explicitly required in the command line and ignore all of the local
settings. In this case, the local settings are irrelevant anyway. The
console will never be used to access the DB on a headless server.

But what I think is broken is that the command line argument is blocked
by the local settings. When the command line says to use UTF-8, it
should override any and all local settings. They become superfluous.

Bob McConnell
N2SPP


From: Lukasz Brodziak <lukasz(dot)brodziak(at)gmail(dot)com>
To: Bob McConnell <rmcconne(at)lightlink(dot)com>
Cc: "pgsql-novice(at)postgresql(dot)org" <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Overriding local encoding defaults
Date: 2010-10-18 05:12:03
Message-ID: AANLkTimApfuPXFjcinu9n4oPt=Xri4LASvA37R6vXnC1@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-novice

I have a similar problem. When I try to put up a cluster with encoding
set to CP1250 I get an info that this is not a proper server encoding
type. The initdb and pg_createcluster force me to use utf8 with pl_PL
locale. Is there a way to override this as I know that CP1250 is
supported by PG. The system is Ubuntu 10.04.

2010/10/18 Bob McConnell <rmcconne(at)lightlink(dot)com>:
> Tom Lane wrote:
>>
>> Bob McConnell <rmcconne(at)lightlink(dot)com> writes:
>>>
>>> I still don't understand why a server process should care about the local
>>> console. Are there any plans to fix that?
>>
>> No, because it's not broken.  Where else should initdb get the default
>> locale setting, if not from the environment it's invoked in?
>
> Something that critical should never be left to a default. It should be
> explicitly required in the command line and ignore all of the local
> settings. In this case, the local settings are irrelevant anyway. The
> console will never be used to access the DB on a headless server.
>
> But what I think is broken is that the command line argument is blocked by
> the local settings. When the command line says to use UTF-8, it should
> override any and all local settings. They become superfluous.
>
> Bob McConnell
> N2SPP
>
>
> --
> Sent via pgsql-novice mailing list (pgsql-novice(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-novice
>

--
Łukasz Brodziak
II MU Bioinformatyka


From: jr <jorg(dot)raskowski(at)tailorware(dot)org(dot)uk>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: Overriding local encoding defaults
Date: 2010-10-18 23:54:17
Message-ID: i9imni$308e$1@news.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-novice

hi Bob,

> If not, how do I modify the local console to match the UTF8 requirement?
> This is on Slackware/64 13.1.0.

modify the '/etc/profile.d/lang.*' files.

--

regards, jr. (jr(at)tailorware(dot)org(dot)uk)


From: Bob McConnell <rmcconne(at)lightlink(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: Overriding local encoding defaults
Date: 2010-10-19 12:42:19
Message-ID: 4CBD922B.7020509@lightlink.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-novice

jr wrote:
> hi Bob,
>
>> If not, how do I modify the local console to match the UTF8
>> requirement? This is on Slackware/64 13.1.0.
>
> modify the '/etc/profile.d/lang.*' files.
>

Got it.

Thanks,

Bob McConnell
N2SPP