Re: [GENERAL] How to find correct locale name for CREATE DATABASE

2010-12-02 Thread Robert Gravsjö



On 2010-12-01 09.26, Andrus wrote:

Thom,


You can list available locales on your system with: locale -a


Thank you.

How to resolve this issue if only 5432 port is open in server ?


Maybe asking the sysadmin of that host to return the result of "locale -a"?

Btw, are you sure et_EE.UTF-8 is installed on the host?


Based on my limited knowledge, postgres does not have command to run
"locale -a"
How to get list of available locale names from Postgres ?
Why Postgres does not have command which returns available locale names ?
How to use same locale names in every platform?

Andrus.




--
Regards,
Robert "roppert" Gravsjö

--
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 find correct locale name for CREATE DATABASE

2010-12-01 Thread Craig Ringer

On 12/02/2010 02:49 AM, Alban Hertroys wrote:


Because, as opposed to the developers of the projects that you're apparently 
familiar with, the Postgres developers have common sense ;)

Seriously though, functionality like that has no place in a database server. 
That's the responsibility of the OS, or if it lacks in that respect, for 
third-party tools.


I can't say I entirely agree with that. PostgreSQL exposes locale names 
for input, and it'd be helpful for users to have a way to determine what 
the range of accepted input values is. If it was as simple as providing 
a proc to list supported locale names, I'd say it'd be worth a few port/ 
files. However:


Knowing which values are acceptable locale names still doesn't help you 
understand what they mean and what their consequences are. You'd also 
need a way to get charset names at minimum - and not all OS-supported 
charsets are supported by Pg. Pg's confusing "half-in-the-OS, 
half-in-the-database-server" charset/collation/encoding handling doesn't 
simplify things here.


An alternative would be to provide standard, portable names in Pg and 
translate them to OS-specific names. Nobody sane would want to go there 
given the choice, though, given that locales on different OSes are 
rarely perfectly equivalent. The WINxxx and CPxxx encodings vs LATIN-xx 
encodings are only one stumbling point; there are also issues with 
differing TZDATA and DST rules and all sorts of other horrors.


So: Listing locales, probably filtered by supported charset(s), would be 
nice, but given Pg's current partial dependence on the OS for handling 
charset and locale issues, might be as confusing as it is helpful. If Pg 
ever gets full locale and collation support internally it'd be a no-brainer.


(Of course, if Pg does its own collation and locale handling later 
there'll be issues with inconsistencies between OS and Pg handling. 
Argh! You cannot win.)


--
Craig Ringer

--
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 find correct locale name for CREATE DATABASE

2010-12-01 Thread Alban Hertroys
On 1 Dec 2010, at 21:46, Andrus wrote:

> Alban,
> 
>> Seriously though, functionality like that has no place in a database server. 
>> That's the responsibility of the OS, or if it lacks in that respect, for 
>> third-party tools.
> 
> Thank you.
> So only portable way is to probe Postgres 9 locales using CREATE DATABASE 
> command with expected locale names hoping that some call suceeds?


Well... if you really have to insist on using Postgres to determine system 
locales, I suppose you could do that - just like you can use a crane to park 
your car. It's not a very sensible thing to attempt before looking at 
alternative solutions though.

I imagine there must be tools for that purpose, or otherwise some programming 
language will probably have functions for this that you can use. Using the 
database server for this would be the last thing I'd try.
I can't say I'm too well-versed in locale usage though, I usually just stick 
with English.

Alban Hertroys

--
Screwing up is an excellent way to attach something to the ceiling.


!DSPAM:737,4cf6cd4e802658319426940!



-- 
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 find correct locale name for CREATE DATABASE

2010-12-01 Thread Andrus

Alban,

Seriously though, functionality like that has no place in a database 
server. That's the responsibility of the OS, or if it lacks in that 
respect, for third-party tools.


Thank you.
So only portable way is to probe Postgres 9 locales using CREATE DATABASE 
command with expected locale names hoping that some call suceeds?


Andrus. 



--
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 find correct locale name for CREATE DATABASE

2010-12-01 Thread Alban Hertroys

On 1 Dec 2010, at 15:15, Andrus wrote:

>> There is no portable operating system interface to get the names of all
>> locales.
> 
> Thank you.
> Why postgres does not use conditional directives like
> 
> #ifdef WINDOWS
> ...
> #endif
> 
> #ifdef LINUX
> ..
> #endif
> 
> to return list of available locales ?


Because, as opposed to the developers of the projects that you're apparently 
familiar with, the Postgres developers have common sense ;)

Seriously though, functionality like that has no place in a database server. 
That's the responsibility of the OS, or if it lacks in that respect, for 
third-party tools.

Alban Hertroys

--
Screwing up is an excellent way to attach something to the ceiling.


!DSPAM:737,4cf698ed802651815816680!



-- 
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 find correct locale name for CREATE DATABASE

2010-12-01 Thread Andrus

There is no portable operating system interface to get the names of all
locales.


Thank you.
Why postgres does not use conditional directives like

#ifdef WINDOWS

...

#endif

#ifdef LINUX
..
#endif

to return list of available locales ?

Andrus.

--
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 find correct locale name for CREATE DATABASE

2010-12-01 Thread Peter Eisentraut
On ons, 2010-12-01 at 10:26 +0200, Andrus wrote:
> How to get list of available locale names from Postgres ?
> Why Postgres does not have command which returns available locale
> names ?
> How to use same locale names in every platform? 

There is no portable operating system interface to get the names of all
locales.


-- 
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 find correct locale name for CREATE DATABASE

2010-12-01 Thread Raymond O'Donnell

On 01/12/2010 08:26, Andrus wrote:

Thom,


You can list available locales on your system with: locale -a


Thank you.

How to resolve this issue if only 5432 port is open in server ?
Based on my limited knowledge, postgres does not have command to run
"locale -a"
How to get list of available locale names from Postgres ?


This is a *nix command, not a PostgreSQL one, so just enter it at the 
Linux shell prompt.



Why Postgres does not have command which returns available locale names ?


"show server_encoding;" will tell you the encoding of the database to 
which you're currently connected. I'm not sure how you find out what's 
available, but the docs may help:


  http://www.postgresql.org/docs/9.0/static/charset.html


How to use same locale names in every platform?


See the docs above.

Ray.

--
Raymond O'Donnell :: Galway :: Ireland
r...@iol.ie

--
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 find correct locale name for CREATE DATABASE

2010-12-01 Thread Andrus

Thom,


You can list available locales on your system with: locale -a


Thank you.

How to resolve this issue if only 5432 port is open in server ?
Based on my limited knowledge, postgres does not have command to run 
"locale -a"

How to get list of available locale names from Postgres ?
Why Postgres does not have command which returns available locale names ?
How to use same locale names in every platform?

Andrus.


--
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 find correct locale name for CREATE DATABASE

2010-11-30 Thread Thom Brown
2010/11/30 Andrus :
> I tried in  Debian ("PostgreSQL 9.0.1 on x86_64-pc-linux-gnu, compiled by
> GCC gcc-4.4.real (Debian 4.4.5-8) 4.4.5, 64-bit") :
>
> 1. CREATE DATABASE "mydb" WITH TEMPLATE=template0
> LC_COLLATE='Estonian_Estonia.1257' LC_CTYPE='Estonian_Estonia.1257'
> OWNER="mydb_owner" ENCODING='UNICODE'
>
> 2. CREATE DATABASE "mydb" WITH TEMPLATE=template0  LC_COLLATE='et_EE.UTF-8'
> LC_CTYPE='et_EE.UTF-8' OWNER="mydb_owner" ENCODING='UNICODE'
>
> 3. 2. CREATE DATABASE "mydb" WITH TEMPLATE=template0 LC_COLLATE='et_EE.UTF8'
> LC_CTYPE='et_EE.UTF8' OWNER="mydb_owner" ENCODING='UNICODE'
>
> in all cases same error
>
> invalid locale name
>
> occurs.
>
> Questions:
>
> 1. How to find correct locale name for Estonian in Debian  Linux ?
> In Windows case (1) works.

You can list available locales on your system with: locale -a

-- 
Thom Brown
Twitter: @darkixion
IRC (freenode): dark_ixion
Registered Linux user: #516935

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


[GENERAL] How to find correct locale name for CREATE DATABASE

2010-11-30 Thread Andrus

I tried in  Debian ("PostgreSQL 9.0.1 on x86_64-pc-linux-gnu, compiled by
GCC gcc-4.4.real (Debian 4.4.5-8) 4.4.5, 64-bit") :

1. CREATE DATABASE "mydb" WITH TEMPLATE=template0
LC_COLLATE='Estonian_Estonia.1257' LC_CTYPE='Estonian_Estonia.1257'
OWNER="mydb_owner" ENCODING='UNICODE'

2. CREATE DATABASE "mydb" WITH TEMPLATE=template0  LC_COLLATE='et_EE.UTF-8'
LC_CTYPE='et_EE.UTF-8' OWNER="mydb_owner" ENCODING='UNICODE'

3. 2. CREATE DATABASE "mydb" WITH TEMPLATE=template0 
LC_COLLATE='et_EE.UTF8'

LC_CTYPE='et_EE.UTF8' OWNER="mydb_owner" ENCODING='UNICODE'

in all cases same error

invalid locale name

occurs.

Questions:

1. How to find correct locale name for Estonian in Debian  Linux ?
In Windows case (1) works.

2. How to create portable CREATE DATABASE command for estonian locale which 
works in all operating systems?


3. Or how to detect OS from PostgreSql server and select correct Estonian 
locale ?


Andrus. 



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