Re: BUG #8118: Wrong sorting text

From: Daniele Varrazzo <daniele(dot)varrazzo(at)gmail(dot)com>
To: Jov <amutu(at)amutu(dot)com>
Cc: whiplash(at)bss(dot)org(dot)ua, pgsql-bugs <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #8118: Wrong sorting text
Date: 2013-04-28 21:05:42
Message-ID: CA+mi_8Y-0DwHtFNxQZ9BZVjpHDXxNZNipq9-RF_M42trk=0R=w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

>> Bug reference: 8118
>> Logged by: whiplash
>> Email address: whiplash(at)bss(dot)org(dot)ua
>> PostgreSQL version: 9.2.2
>> Operating system: Linux (Fedora 11, Fedora 16 and Ubuntu 12.04)
>> Description:
>>
>> I execute query (1):
>>
>> SELECT t.name
>> FROM
>> (
>> SELECT 'AAA AAA' AS name
>> UNION ALL
>> SELECT 'AAA_AAA'
>> UNION ALL
>> SELECT 'BBB_AAA'
>> UNION ALL
>> SELECT 'BBB AAB'
>> ) t
>> ORDER BY t.name
>>
>> and I getting a result:
>>
>> AAA AAA
>> AAA_AAA
>> BBB_AAA
>> BBB AAB

It's a matter of collate. If you want ascii ordering specify collate "C".

...
ORDER BY t.name collate "C";
name
---------
AAA AAA
AAA_AAA
BBB AAB
BBB_AAA
(4 rows)

-- Daniele

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message pradip29 2013-04-29 07:02:41 BUG #8125: server connecting error
Previous Message eleasar22 2013-04-28 09:58:12 BUG #8124: How to uninstall and reinstall postgreSQL 9.2