Re: Per-column collation - Mailing list pgsql-hackers

From Pavel Stehule
Subject Re: Per-column collation
Date
Msg-id AANLkTinErqqfi8nm+wHzbtoy2xtumdEy-u7ki16uUbjR@mail.gmail.com
Whole thread Raw
In response to Re: Per-column collation  (Peter Eisentraut <peter_e@gmx.net>)
Responses Re: Per-column collation
List pgsql-hackers
2010/11/16 Peter Eisentraut <peter_e@gmx.net>:
> On tis, 2010-11-16 at 20:59 +0100, Pavel Stehule wrote:
>> 2010/11/16 Peter Eisentraut <peter_e@gmx.net>:
>> > On tis, 2010-11-16 at 20:00 +0100, Pavel Stehule wrote:
>> >> yes - my first question is: Why we need to specify encoding, when only
>> >> one encoding is supported? I can't to use a cs_CZ.iso88592 when my db
>> >> use a UTF8 - btw there is wrong message:
>> >>
>> >> yyy=# select * from jmena order by jmeno collate "cs_CZ.iso88592";
>> >> ERROR:  collation "cs_CZ.iso88592" for current database encoding
>> >> "UTF8" does not exist
>> >> LINE 1: select * from jmena order by jmeno collate "cs_CZ.iso88592";
>> >>                                            ^
>> >
>> > Sorry, is there some mistake in that message?
>> >
>>
>> it is unclean - I expect some like "cannot to use collation
>> cs_CZ.iso88502, because your database use a utf8 encoding".
>
> No, the namespace for collations is per encoding.  (This is per SQL
> standard.)  So you *could* have a collation called "cs_CZ.iso88502" for
> the UTF8 encoding.
>
>> I have not a problem with size. Just I think, current behave isn't
>> practical. When database encoding is utf8, then I except, so "cs_CZ"
>> or "czech" will be for utf8. I understand, so template0 must have a
>> all locales, and I understand why current behave is, but it is very
>> user unfriendly. Actually, only old application in CR uses latin2,
>> almost all uses a utf, but now latin2 is preferred. This is bad and
>> should be solved.
>
> Again, we can only look at the locale names that the operating system
> gives us.  Mapping that to the names you expect is an AI problem.  If
> you have a solution, please share it.
>

ok, then we should to define this alias manually

some like - CREATE COLLATE "czech" FOR LOCALE "cs_CZ.UTF8"

or some similar. Without this, the application or stored procedures
can be non portable between UNIX and WIN.

Peter, now initdb check relation between encoding and locale - and
this check is portable. Can we use this code?

Pavel

>
>


pgsql-hackers by date:

Previous
From: Josh Berkus
Date:
Subject: Re: autovacuum maintenance_work_mem
Next
From: Tom Lane
Date:
Subject: Re: GiST insert algorithm rewrite