Re: how to make collation work

Поиск
Список
Период
Сортировка
От Havasvölgyi Ottó
Тема Re: how to make collation work
Дата
Msg-id 005c01c54f5a$281d58b0$ab00a8c0@OTTO
обсуждение исходный текст
Ответ на Re: how to make collation work  (Havasvölgyi Ottó <h.otto@freemail.hu>)
Список pgsql-novice
Tövis,

Just do this in psql:

\encoding LATIN2 --set client encoding

create table collation_test(c char(1));  --if default encoding is LATIN2

--fill the table
insert into collation_test values('á');
insert into collation_test values('é');
insert into collation_test values('í');
insert into collation_test values('ó');
insert into collation_test values('ö');
insert into collation_test values('ő');
insert into collation_test values('ú');
insert into collation_test values('ü');
insert into collation_test values('ű');
insert into collation_test values('Á');
insert into collation_test values('É');
insert into collation_test values('Í');
insert into collation_test values('Ó');
insert into collation_test values('Ö');
insert into collation_test values('Ő');
insert into collation_test values('Ú');
insert into collation_test values('Ü');
insert into collation_test values('Ű');
insert into collation_test values('A');
insert into collation_test values('g');
insert into collation_test values('k');
insert into collation_test values('S');

select * from collation_test order by c;

select upper('á'); --'á' for me

select lower('Á'); --'Á' for me I guess



I got all characters correctly in the table query, they were just in the
wrong order.

However, the upper() didn't work correctly for me. I did not try lower()
after that.

By the way what glibc version do you use? How did you manage to get
Hungarian collation work correctly?

Üdv / Best Regards,
Otto


----- Original Message -----
From: "tövis" <tovises@freemail.hu>
To: "pgsql novice" <pgsql-novice@postgresql.org>; "Havasvölgyi Ottó"
<h.otto@freemail.hu>
Sent: Monday, May 02, 2005 6:36 PM
Subject: Re: [NOVICE] how to make collation work


> Exciting!
> Unfortunatelly I do not know how to check this quickly on my server;-(
> Could you sent some simple sequence to check this out?
> Üdv
>    Tövis
> ----- Original Message -----
> From: "Havasvölgyi Ottó" <h.otto@freemail.hu>
> To: <pgsql-novice@postgresql.org>
> Sent: Monday, May 02, 2005 6:19 PM
> Subject: Re: [NOVICE] how to make collation work
>
>
>> Volkan,
>>
>> I passed the desired collation and ctype to initdb.
>> The version of gcc is 3.4. Should I upgrade to 4.0 perhaps?
>> As for filling the table, I did it with psql on the server, setting the
>> client encoding to LATIN2, the same as in the database. Initially it was
>> set
>> to WIN1250.
>> Then I tested the upper() function as well, but they worked only with
>> English characters. For example:
>>
>> select upper('á');
>>
>> I expected 'Á', but I got 'á'. So upper() didn't change this Hungarian
>> character.
>>
>> Best Regards,
>> Otto
>>
>>
>>
>>
>> ----- Original Message -----
>> From: "Volkan YAZICI" <volkan.yazici@gmail.com>
>> To: "tövis" <tovises@freemail.hu>
>> Cc: "PostgreSQL Novice" <pgsql-novice@postgresql.org>
>> Sent: Sunday, May 01, 2005 10:28 PM
>> Subject: Re: [NOVICE] how to make collation work
>>
>>
>> Hi,
>>
>> On 5/1/05, tövis <tovises@freemail.hu> wrote:
>>>   This was help me, on Debian Sarge.
>>>   PostgreSQL problems with collation sequence!
>>>   #dpkg-reconfigure locales        - generate - "hu_HU" and NLS hu_UTF8
>>>   #reboot
>>
>> I know it'll be a little bit offtopic (when considered to list
>> caption), but you don't have to (also you shouldn't) reboot your
>> machine after a locale generation. Just login again to take changes
>> effect. (You know, one of the best side of Linux as a server OS is
>> that you don't have to reboot system after every configuration. Please
>> give up your Micros~1 habbits. :)
>>
>>>   #/etc/init.d/postgresql stop
>>>   #su postgres -> postgres@srv02:
>>>
>>>   empty directory /var/lib/postgres/data
>>>
>>>   /usr/lib/postgresql/bin/initdb -U
>>> postgres --locale=hu_HU --lc-collate=hu_HU -E LATIN2 \
>>>  -D /var/lib/postgres/data -W --pwprompt
>>>   ... set same password for "postgres" root
>>
>> -W and --pwprompt is just the same. Just chose one of 'em.
>>
>> On 5/1/05, "Havasvölgyi Ottó" <h.otto@freemail.hu> wrote:
>> So far I have tried the first
>>> and the second with initdb, set the --locale, --lc-collate
>>> and --lc-ctype
>>> to that locale. But after filling a table with Hunagrian characters, and
>>> selecting it all with order by didn't give the result I expected. The
>>> encoding of the database and the client was both LATIN2. Neither worked
>>> the upper() and lower() functions correct with Hungarian characters.
>>
>> As Tövis used above, you can pass collating locale to the database. If
>> there're still problems in sorting, I advice you for checking your
>> compiler version. (Probably gcc.) For instance, there were same
>> problem for Turkish locale too and we found that it's related with the
>> compiler, not with PostgreSQL.
>>
>> And another question. How did you typed your entries to the database?
>> Using psql or any other client. Would you also try to import from a
>> file which has Hungarian characters?
>>
>> Regards.
>>
>> ---------------------------(end of broadcast)---------------------------
>> TIP 7: don't forget to increase your free space map settings
>>
>>
>>
>>
>> ---------------------------(end of broadcast)---------------------------
>> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
>>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 7: don't forget to increase your free space map settings
>
>



В списке pgsql-novice по дате отправления:

Предыдущее
От: DavidF@nhb.org
Дата:
Сообщение: Purpose of pgsql/data/global directory? - permissions error
Следующее
От: "Keith Worthington"
Дата:
Сообщение: OIDs