From: basti <mailinglist@unix-solution.de>
To: pgsql-general@lists.postgresql.org
Subject: Re: postgresql order lowercase before uppercase
Date: Fri, 19 Mar 2021 10:12:33 +0100
Message-ID: <dd09e24e-f89b-2a65-4246-e2c3babae49e@unix-solution.de> (raw)
In-Reply-To: <f09b68f48506df4e122e279642f76165778b77fd.camel@cybertec.at>
References: <5a174fad-c30d-6d65-38c8-a3d9af8377df@unix-solution.de>
<fa00b39eb7c7589cd604e386ff9ce59997906f5d.camel@cybertec.at>
<34c739c1-b930-d58a-521b-c4a7b236d9bd@unix-solution.de>
<f09b68f48506df4e122e279642f76165778b77fd.camel@cybertec.at>
On 19.03.21 08:33, Laurenz Albe wrote:
> On Thu, 2021-03-18 at 23:51 +0100, basti wrote:
>> 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
>>>> ....
>>>
>>> Create an ICU collation:
>>>
>>> CREATE COLLATION inv (PROVIDER = icu, LOCALE = "en-US@CaseFirst=LowerFirst");
>>
>> 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?
>
> Ah, I misunderstood what you want.
>
> SELECT a.name
> FROM foo as a
> ORDER BY a.name <> lower(a.name), a.name;
>
> That works because FALSE < TRUE.
>
> Yours,
> Laurenz Albe
>
This does not work for me. The same result as normal order.
Amm
andere Marken
Ani
Anti
Bra
Cali
Test data attached.
Attachments:
table.sql (application/sql, 969B) download
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: mailinglist@unix-solution.de
Subject: Re: postgresql order lowercase before uppercase
In-Reply-To: <dd09e24e-f89b-2a65-4246-e2c3babae49e@unix-solution.de>
References: <5a174fad-c30d-6d65-38c8-a3d9af8377df@unix-solution.de> <fa00b39eb7c7589cd604e386ff9ce59997906f5d.camel@cybertec.at> <34c739c1-b930-d58a-521b-c4a7b236d9bd@unix-solution.de> <f09b68f48506df4e122e279642f76165778b77fd.camel@cybertec.at> <dd09e24e-f89b-2a65-4246-e2c3babae49e@unix-solution.de>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox