From: | basti <mailinglist(at)unix-solution(dot)de> |
---|---|
To: | pgsql-general(at)lists(dot)postgresql(dot)org |
Subject: | Re: postgresql order lowercase before uppercase |
Date: | 2021-03-18 22:51:49 |
Message-ID: | 34c739c1-b930-d58a-521b-c4a7b236d9bd@unix-solution.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Am 18.03.21 um 17:19 schrieb Laurenz Albe:
> On Thu, 2021-03-18 at 15:39 +0100, basti wrote:
>> I need to as follow:
>>
>> ande
>> Amma
>> Anit
>> Anti
>> Brac
>> Cali
>> ....
>>
>> I have try ORDER by name COLLATE 'C';
>>
>> but this order as follow:
>>
>> Amma
>> Anit
>> Anti
>> Brac
>> Cali
>> ....
>> ande
>
> Create an ICU collation:
>
> CREATE COLLATION inv (PROVIDER = icu, LOCALE = "en-US(at)CaseFirst=LowerFirst");
>
> Then use
>
> ORDER BY name COLLATE inv
>
> Yours,
> Laurenz Albe
>
I have try the inv collate, that does not work on PG 9.6 and 10.
Order is the same as without collate.
SELECT a.name
FROM foo as a
LEFT JOIN (SELECT name from foo WHERE name = 'lowercase name') as b
on a.name = b.name
ORDER by b.name,a.name
does it.
perhaps there is a better way?
There is only one name in lowercase and this one must be the first one.
From | Date | Subject | |
---|---|---|---|
Next Message | Adrian Klaver | 2021-03-18 23:05:50 | Re: Drop Database |
Previous Message | Gustavo FERREYRA | 2021-03-18 22:39:53 | Drop Database |