Обсуждение: [GENERAL] How to add new Collation language

Поиск
Список
Период
Сортировка

[GENERAL] How to add new Collation language

От
Rob Northcott
Дата:

How can I add a collation language to a Postgres server?

Specifically, I want to create a new database with collation of English_United Kingdom.1252 but the only options are C, Posix and United States.

Even if I select United Kingdom as the locale when installing Postgres I still only have United States.

 

Am I missing something or is there a way to add the United Kingdom collation?

 

This is Postgres 9.6 on Windows server 2012.  The server is Swedish, and my user login is set to UK.

Re: [GENERAL] How to add new Collation language

От
rob stone
Дата:

On Thu, 2017-09-14 at 11:30 +0000, Rob Northcott wrote:
> How can I add a collation language to a Postgres server?
> Specifically, I want to create a new database with collation of
> English_United Kingdom.1252 but the only options are C, Posix and
> United States.
> Even if I select United Kingdom as the locale when installing
> Postgres I still only have United States.
>  
> Am I missing something or is there a way to add the United Kingdom
> collation?
>  
> This is Postgres 9.6 on Windows server 2012.  The server is Swedish,
> and my user login is set to UK.


Hello,

initdb --locale=en_GB.UTF-8 . . . plus other init options as required.


HTH,
Rob



-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Re: [GENERAL] How to add new Collation language

От
Rob Northcott
Дата:
    

-----Original Message-----
From: rob stone [mailto:floriparob@gmail.com] 
Sent: 14 September 2017 13:38
To: Rob Northcott <Rob.Northcott@compilator.com>; pgsql-general@postgresql.org
Subject: Re: [GENERAL] How to add new Collation language



On Thu, 2017-09-14 at 11:30 +0000, Rob Northcott wrote:
> How can I add a collation language to a Postgres server?
> Specifically, I want to create a new database with collation of 
> English_United Kingdom.1252 but the only options are C, Posix and 
> United States.
> Even if I select United Kingdom as the locale when installing Postgres 
> I still only have United States.
>  
> Am I missing something or is there a way to add the United Kingdom 
> collation?
>  
> This is Postgres 9.6 on Windows server 2012.  The server is Swedish, 
> and my user login is set to UK.


>>Hello,

>>initdb --locale=en_GB.UTF-8 . . . plus other init options as required.


Thanks for the reply.  When I try that I get the message "invalid locale name"

Rob

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Re: [GENERAL] How to add new Collation language

От
Tom Lane
Дата:
Rob Northcott <Rob.Northcott@compilator.com> writes:
> From: rob stone [mailto:floriparob@gmail.com]
>> On Thu, 2017-09-14 at 11:30 +0000, Rob Northcott wrote:
>>> How can I add a collation language to a Postgres server?
>>> Specifically, I want to create a new database with collation of
>>> English_United Kingdom.1252 but the only options are C, Posix and
>>> United States.
>>> This is Postgres 9.6 on Windows server 2012.  The server is Swedish,
>>> and my user login is set to UK.

>> initdb --locale=en_GB.UTF-8 . . . plus other init options as required.

> Thanks for the reply.  When I try that I get the message "invalid locale name"

en_GB.UTF-8 is a Unix-style locale name, it won't help you on Windows.
You need something like "English_United Kingdom.1252" on Windows.

I'm not sure what you mean by "the only options are" ... are you using
some GUI that only offers those options?  If so, this is a shortcoming
in that GUI.  Postgres itself should take whatever ctype/collation
settings the underlying system accepts.  You could try manually invoking
initdb as above, but with a Windows-style locale name.  Or if you want
to make a new database within an existing installation, use CREATE
DATABASE directly, setting the LC_COLLATE and LC_CTYPE options
(and selecting a matching ENCODING).
        regards, tom lane


--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Re: [GENERAL] How to add new Collation language

От
Rob Northcott
Дата:

-----Original Message-----
From: Tom Lane [mailto:tgl@sss.pgh.pa.us]
Sent: 14 September 2017 14:53
To: Rob Northcott <Rob.Northcott@compilator.com>
Cc: pgsql-general@postgresql.org
Subject: Re: [GENERAL] How to add new Collation language

Rob Northcott <Rob.Northcott@compilator.com> writes:
> From: rob stone [mailto:floriparob@gmail.com]
>> On Thu, 2017-09-14 at 11:30 +0000, Rob Northcott wrote:
>>> How can I add a collation language to a Postgres server?
>>> Specifically, I want to create a new database with collation of
>>> English_United Kingdom.1252 but the only options are C, Posix and
>>> United States.
>>> This is Postgres 9.6 on Windows server 2012.  The server is Swedish,
>>> and my user login is set to UK.

>> initdb --locale=en_GB.UTF-8 . . . plus other init options as required.

> Thanks for the reply.  When I try that I get the message "invalid locale name"

>>en_GB.UTF-8 is a Unix-style locale name, it won't help you on Windows.
>>You need something like "English_United Kingdom.1252" on Windows.

>>I'm not sure what you mean by "the only options are" ... are you using some GUI that >>only offers those options?  If
so,this is a shortcoming in that GUI.  Postgres itself >>should take whatever ctype/collation settings the underlying
systemaccepts.  You >>could try manually invoking initdb as above, but with a Windows-style locale name.  >>Or if you
wantto make a new database within an existing installation, use CREATE >>DATABASE directly, setting the LC_COLLATE and
LC_CTYPEoptions (and selecting a >>matching ENCODING). 

>>            regards, tom lane

Thanks Tom, using initdb to create a new data directory (cluster?) worked, using "English_United..." rather than en_GB
asyou suggested. 

I've never had to do that before - always just used the default Postgres installation and selected "English United
Kingdom"during the install.  That didn't seem to work on this server - it insisted on being United States.  Anyway,
learninghow to use the command line is no bad thing. 

Thanks for your help.

Rob


--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general