Обсуждение: BUG #3381: Bad sort order for UTF-8 texts on sk_SK.UTF-8 locale on 8.2.4

Поиск
Список
Период
Сортировка

BUG #3381: Bad sort order for UTF-8 texts on sk_SK.UTF-8 locale on 8.2.4

От
"Ujo Jozef"
Дата:
The following bug has been logged online:

Bug reference:      3381
Logged by:          Ujo Jozef
Email address:      ujojozef@gmail.com
PostgreSQL version: 8.2.4
Operating system:   free bsd 6.2
Description:        Bad sort order for UTF-8 texts on sk_SK.UTF-8 locale on
8.2.4
Details:

-- SAMPLE DB, TABLE:
create database test with encoding 'UNICODE';
\c test
create table test (name varchar(8));

-- ENVIROMENT:
test=# SELECT version();
                                             version
----------------------------------------------------------------------------
---------------------
 PostgreSQL 8.2.4 on amd64-portbld-freebsd6.2, compiled by GCC cc (GCC)
3.4.6 [FreeBSD] 20060305
(1 row)

-- LOCALE SETTINGS:
test=# SHOW LC_COLLATE;
 lc_collate
-------------
 sk_SK.UTF-8
(1 row)

test=# SHOW LC_CTYPE;
  lc_ctype
-------------
 sk_SK.UTF-8
(1 row)

-- SAMPLE DATA:
insert into test values ('a');
insert into test values ('á'); -- lower-case "a" with acute accent
insert into test values ('z');

-- BAD SELECT RESULT:
test=# select name from test order by name;
 name
------
 a
 z
 á
(3 rows)

Correct order should be: a, á, z. I get correct results on 8.0.8 with
exactly same data as above. Thank you.

Re: BUG #3381: Bad sort order for UTF-8 texts on sk_SK.UTF-8 locale on 8.2.4

От
Tom Lane
Дата:
"Ujo Jozef" <ujojozef@gmail.com> writes:
> Description:        Bad sort order for UTF-8 texts on sk_SK.UTF-8 locale on
> 8.2.4

Your test case works as expected for me.  Maybe there's something hosed
about the locale files on your machine?  Does plain old sort(1) sort the
way you're expecting?  Does "locale -a" agree that you've spelled the
locale name correctly?

Postgres just sorts the way strcoll() tells it to, so unless you've
messed up the database-encoding-vs-locale dependency (which you seem to
have gotten right), wrong sort order really boils down to being a locale
definition issue.

            regards, tom lane