LC_COLLATE

classic Classic list List threaded Threaded
17 messages Options
Reply | Threaded
Open this post in threaded view
|

LC_COLLATE

bluesun08
Hi,

for my postgresql-server i need:
LC_COLLATE="de_DE.UTF-8"

But the following command in the .profile don't work:
export LC_COLLATE="de_DE.UTF-8"

Why not? How can i do this?

Regards

Alex
Reply | Threaded
Open this post in threaded view
|

Re: LC_COLLATE

Philip Guenther-2
On Sat, Nov 7, 2015 at 9:58 AM, bluesun08 <[hidden email]> wrote:
> for my postgresql-server i need:
> LC_COLLATE="de_DE.UTF-8"
>
> But the following command in the .profile don't work:
> export LC_COLLATE="de_DE.UTF-8"
>
> Why not? How can i do this?

.profile is only read by login shells.

If you want to set environment variables for a daemon the 'setenv'
option in its /etc/login.conf entry (if it has its own) should work.



> View this message in context: http://openbsd-archive.7691.n7.nabble.com/LC-COLLATE-tp282248.html
> Sent from the openbsd user - misc mailing list archive at Nabble.com.

Nabble: because what email needs is *banner ads*!


Philip Guenther

Reply | Threaded
Open this post in threaded view
|

Re: LC_COLLATE

bluesun08
Thank you. I try in /etc/login.conf:

postgres:\
        :lang=de_DE.UTF-8:\
        :setenv=LC_COLLATE=de_DE.UTF-8:\
        :tc=default:

After the command "initdb  --lc-collate=de_DE.UTF-8 -D /var/postgresql/data" i get the following error message:
                                                         
The files belonging to this database system will be owned by user "_postgresql".
This user must also own the server process.

initdb: invalid locale name "de_DE.UTF-8"
initdb: invalid locale name ""
initdb: invalid locale name ""
initdb: invalid locale name ""
The database cluster will be initialized with locales
  COLLATE:  C
  CTYPE:    de_DE.UTF-8
  MESSAGES: de_DE.UTF-8
  MONETARY: C
  NUMERIC:  C
  TIME:     C
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "german".

But i need the COLLATE "de_DE.UTF-8" and get "invalid locale name "de_DE.UTF-8" "

What is the problem here and how can i fix this?

Regards

Alex
Reply | Threaded
Open this post in threaded view
|

Re: LC_COLLATE

Philip Guenther-2
On Sat, Nov 7, 2015 at 1:15 PM, bluesun08 <[hidden email]> wrote:

> Thank you. I try in /etc/login.conf:
>
> postgres:\
>         :lang=de_DE.UTF-8:\
>         :setenv=LC_COLLATE=de_DE.UTF-8:\
>         :tc=default:
>
> After the command "initdb  --lc-collate=de_DE.UTF-8 -D /var/postgresql/data"
> i get the following error message:
>
> The files belonging to this database system will be owned by user
> "_postgresql".
> This user must also own the server process.
>
> initdb: invalid locale name "de_DE.UTF-8"
> initdb: invalid locale name ""
> initdb: invalid locale name ""
> initdb: invalid locale name ""
...
> But i need the COLLATE "de_DE.UTF-8" and get "invalid locale name
> "de_DE.UTF-8" "
>
> What is the problem here and how can i fix this?

I'm confused: you said you need that setting but you hadn't actually
verified that it solves your real problem?  I think you skipped a step
in there: what is the *real* problem you're trying to solve?


Philip Guenther

Reply | Threaded
Open this post in threaded view
|

Re: LC_COLLATE

bluesun08
ok. sorry.

the real problem:
i have a windows application which needs a postgresql-database with "de_DE.UTF-8" collation.

When i try to create such a database in openbsd i get the error:
initdb: invalid locale name "de_DE.UTF-8"

When i try to create the collation in postgres, i get the following error:
postgres=# CREATE COLLATION german (LOCALE = 'de_DE.utf8');
ERROR:  nondefault collations are not supported on this platform

Maybe my problem is similar to this posting, but i don't understand how to solve it:

http://openbsd-archive.7691.n7.nabble.com/LC-COLLATE-and-PostgreSQL-td43687.html


Reply | Threaded
Open this post in threaded view
|

Re: LC_COLLATE

Stefan Sperling-5
On Sat, Nov 07, 2015 at 04:48:28PM -0700, bluesun08 wrote:

> ok. sorry.
>
> the real problem:
> i have a windows application which needs a postgresql-database with
> "de_DE.UTF-8" collation.
>
> When i try to create such a database in openbsd i get the error:
> initdb: invalid locale name "de_DE.UTF-8"
>
> When i try to create the collation in postgres, i get the following error:
> postgres=# CREATE COLLATION german (LOCALE = 'de_DE.utf8');
> ERROR:  nondefault collations are not supported on this platform

OpenBSD doesn't provide LC_COLLATE locales.

Is there another way to use collation in postgres which is independent
of locales? Libraries like ICU (http://site.icu-project.org/) can
support collation regardless of locale settings.

Perhaps you should also ask your question in prostgres support forums.

Reply | Threaded
Open this post in threaded view
|

Re: LC_COLLATE

bluesun08
But when i type "locale -a" i get:
...
de_AT.ISO8859-1
de_AT.ISO8859-15
de_AT.UTF-8
de_CH.ISO8859-1
de_CH.ISO8859-15
de_CH.UTF-8
de_DE.ISO8859-1
de_DE.ISO8859-15
de_DE.UTF-8
el_GR.ISO8859-7
el_GR.UTF-8
...

So the locale "de_DE.UTF-8" exist. What goes wrong?
Reply | Threaded
Open this post in threaded view
|

Re: LC_COLLATE

Stefan Sperling-5
On Sun, Nov 08, 2015 at 04:03:05AM -0700, bluesun08 wrote:

> But when i type "locale -a" i get:
> ...
> de_AT.ISO8859-1
> de_AT.ISO8859-15
> de_AT.UTF-8
> de_CH.ISO8859-1
> de_CH.ISO8859-15
> de_CH.UTF-8
> de_DE.ISO8859-1
> de_DE.ISO8859-15
> de_DE.UTF-8
> el_GR.ISO8859-7
> el_GR.UTF-8
> ...
>
> So the locale "de_DE.UTF-8" exist. What goes wrong?

These only apply to LC_CTYPE (character set) at present.
(See the locale(1) man page for a list of locale categories.)

The other LC_ categories are no-ops on OpenBSD (apart from
LC_MESSAGES which is handled by GNU gettext, and only for
ports and not the base system).

In the documentation this fact is hidden in the setlocale(3) man page:

BUGS
     The current implementation supports only the "C" and "POSIX" locales for
     all but the LC_CTYPE locale.

Reply | Threaded
Open this post in threaded view
|

Re: LC_COLLATE

Stuart Henderson
In reply to this post by bluesun08
On 2015-11-08, bluesun08 <[hidden email]> wrote:

> But when i type "locale -a" i get:
> ...
> de_AT.ISO8859-1
> de_AT.ISO8859-15
> de_AT.UTF-8
> de_CH.ISO8859-1
> de_CH.ISO8859-15
> de_CH.UTF-8
> de_DE.ISO8859-1
> de_DE.ISO8859-15
> de_DE.UTF-8
> el_GR.ISO8859-7
> el_GR.UTF-8
> ...
>
> So the locale "de_DE.UTF-8" exist. What goes wrong?

These are LC_CTYPE.

OpenBSD doesn't provide LC_COLLATE locales.

There is an optional patch in FreeBSD ports that provides partial support
which may be possible to adapt, see https://wiki.postgresql.org/wiki/Todo:ICU
and links. This is probably something that would need to be applied locally,
I don't think it would be a good fit for us in ports.

Reply | Threaded
Open this post in threaded view
|

Re: LC_COLLATE

bluesun08
"OpenBSD doesn't provide LC_COLLATE locales. " ?????

We are in 2015 and i thought OpenBSD is a up-to-date server operating system.
So OpenBSD is not recommended for practical use or a postgresql database server.
No wonder that most professional users switch to linux.

No harm meant!
Reply | Threaded
Open this post in threaded view
|

Re: LC_COLLATE

Jiri B-2
> So OpenBSD is not recommended for practical use or a postgresql database
> server.
> No wonder that most professional users switch to linux.
>
> No harm meant!

You are retard, go away and don't return then.

j.

Reply | Threaded
Open this post in threaded view
|

Re: LC_COLLATE

Stefan Sperling-5
In reply to this post by bluesun08
On Sun, Nov 08, 2015 at 06:29:22AM -0700, bluesun08 wrote:
> "OpenBSD doesn't provide LC_COLLATE locales. " ?????
>
> We are in 2015 and i thought OpenBSD is a up-to-date server operating
> system.
> So OpenBSD is not recommended for practical use or a postgresql database
> server.
> No wonder that most professional users switch to linux.
>
> No harm meant!

https://wiki.postgresql.org/wiki/Todo:ICU

Reply | Threaded
Open this post in threaded view
|

Re: LC_COLLATE

Stuart Henderson
In reply to this post by bluesun08
On 2015-11-08, bluesun08 <[hidden email]> wrote:
> "OpenBSD doesn't provide LC_COLLATE locales. " ?????
>
> We are in 2015 and i thought OpenBSD is a up-to-date server operating
> system.
> So OpenBSD is not recommended for practical use or a postgresql database
> server.

I don't know how you go from "doesn't support alternative LC_COLLATE" to
"not recommended for practical use or a postgresql database server".
It just doesn't support something that some (but by no means all) people
want.

> No wonder that most professional users switch to linux.

If you follow the list threads from the link I gave you you'll see that
it's not perfect there either, e.g.

http://www.postgresql.org/message-id/CA+TgmoZv=gWjwH9vJKQahdV4Mgb7P=69Ruy6a+koEVGb-ZeViA@...

Reply | Threaded
Open this post in threaded view
|

Re: LC_COLLATE

Peter Hessler
In reply to this post by Jiri B-2
Don't insult other people on the mailing list.

--
SCCS, the source motel!  Programs check in and never check out!
                -- Ken Thompson

Reply | Threaded
Open this post in threaded view
|

Re: LC_COLLATE

bluesun08
I beg your pardon - i was cynical!

Back to the problem: I think OpenBSD need a patch for PostgreSQL that uses ICU, like this one for FreeBSD (because i don't know how to do it manually):

http://people.freebsd.org/~girgen/postgresql-icu/README.html

Reply | Threaded
Open this post in threaded view
|

Re: LC_COLLATE

Mike Burns
On 2015-11-08 13.28.32 -0700, bluesun08 wrote:
> Back to the problem: I think OpenBSD need a patch for PostgreSQL

To get it into ports, send your patch to [hidden email] and CC the
database/postgresql maintainer (Pierre-Emmanuel Andre <[hidden email]>).

Please upstream your patch, too. There's an extensive FAQ on how to get
started in Postgres hacking on their wiki:
https://wiki.postgresql.org/wiki/Developer_FAQ . You'll want to join the
pgsql-hackers mailing list, as described in the FAQ.

Reply | Threaded
Open this post in threaded view
|

Re: LC_COLLATE

bluesun08
In the meantime i managed it to compile Postgresql with icu-support.
Though Postgresql is still not able to *create* a database with "de_DE.UTF"-collation.
So the icu-workaround is useless for database-creation with other lc_collations.
So much ado about nothing ...