Hi,

I have a problem with proper collation of UTF-8 strings using PostgreSQL
version 9.2.4 under Debian Linux 6.0 with de_DE.utf8 (but en_US behaves
the same) locale:

CREATE TABLE test_collation ( q text );
INSERT INTO test_collation (q) VALUES ('aa'), ('ac'), ('a&b');
SELECT * FROM test_collation ORDER BY q COLLATE "de_DE";
    q
-----
   aa
   a&b
   ac

I need the "&" character to be sorted at the beginning or at the end of
the alphabet, but it seems like it is simply ignored. The space
character (" ") is treated the same way (just swap the ampersand in
previous example with a space).

I made a test on ICU pages (http://site.icu-project.org/) and there I
get proper collation: 1. a&b, 2. aa, 3. ac. Screenshot:
http://software.eq.cz/icu_collation_de_DE.png

Is there a way to achieve this collation (note also the order of the
characters with umlaut on the screenshot) with PostgreSQL? Or is it a
glibc bug?

Thanks,

r.

Search Discussions

  • Jasen Betts at Apr 7, 2013 at 12:05 am

    On 2013-04-06, rudolf wrote:
    Hi,

    I have a problem with proper collation of UTF-8 strings using PostgreSQL
    version 9.2.4 under Debian Linux 6.0 with de_DE.utf8 (but en_US behaves
    the same) locale:

    CREATE TABLE test_collation ( q text );
    INSERT INTO test_collation (q) VALUES ('aa'), ('ac'), ('a&b');
    SELECT * FROM test_collation ORDER BY q COLLATE "de_DE";
    q
    -----
    aa
    a&b
    ac
    postgres uses the collation provided by libc (wccasecmp() I think)
    Is there a way to achieve this collation (note also the order of the
    characters with umlaut on the screenshot) with PostgreSQL? Or is it a
    glibc bug?
    yeah, it's a feature of glibc.



    --
    ⚂⚃ 100% natural

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppgsql-general @
categoriespostgresql
postedApr 6, '13 at 10:57a
activeApr 7, '13 at 12:05a
posts2
users2
websitepostgresql.org
irc#postgresql

2 users in discussion

Jasen Betts: 1 post Rudolf: 1 post

People

Translate

site design / logo © 2021 Grokbase