Re: Per-column collation

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Per-column collation
Date: 2010-11-16 20:40:15
Message-ID: AANLkTinErqqfi8nm+wHzbtoy2xtumdEy-u7ki16uUbjR@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2010/11/16 Peter Eisentraut <peter_e(at)gmx(dot)net>:
> On tis, 2010-11-16 at 20:59 +0100, Pavel Stehule wrote:
>> 2010/11/16 Peter Eisentraut <peter_e(at)gmx(dot)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

>
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2010-11-16 20:46:15 Re: GiST insert algorithm rewrite
Previous Message Josh Berkus 2010-11-16 20:34:23 Re: autovacuum maintenance_work_mem