Re: Is it bad sorting in UTF ??

From: Lincoln Yeoh <lyeoh(at)pop(dot)jaring(dot)my>
To: Richard Huxton <dev(at)archonet(dot)com>, wstrzalka <wstrzalka(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Is it bad sorting in UTF ??
Date: 2009-04-14 12:57:16
Message-ID: 200904141257.n3ECvJlS002521@vsmtp3.jaring.my
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

At 07:57 PM 4/14/2009, Richard Huxton wrote:
>wstrzalka wrote:
>>Why PG sort's my data in case insensitive manner?
>
>>masterdb=# select name, setting from pg_settings WHERE name ilike 'lc
>>%';
>> name | setting
>>-------------+-------------
>> lc_collate | en_US.UTF-8
>
>Because that's what en_US.UTF-8 does. If you want "computer-style"
>sorting choose the "C" locale. You'll need to dump all your
>databases an re-initdb to do that I'm afraid. I believe 8.4 is going
>to allow different locales for each database though.

Is it possible to have something like:

select name from sometable order by collate(name,'en_US.UTF-8');
select name from sometable order by collate(name,'C');

Link.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Alvaro Herrera 2009-04-14 14:01:35 Re: how to disable autovaccum
Previous Message sandiphw 2009-04-14 12:28:29 Re: pgSql authentication problem with openLdap