pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: basti <mailinglist@unix-solution.de>
To: pgsql-general@lists.postgresql.org
Subject: Re: postgresql order lowercase before uppercase
Date: Thu, 18 Mar 2021 23:51:49 +0100
Message-ID: <34c739c1-b930-d58a-521b-c4a7b236d9bd@unix-solution.de> (raw)
In-Reply-To: <fa00b39eb7c7589cd604e386ff9ce59997906f5d.camel@cybertec.at>
References: <5a174fad-c30d-6d65-38c8-a3d9af8377df@unix-solution.de>
	<fa00b39eb7c7589cd604e386ff9ce59997906f5d.camel@cybertec.at>



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@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.








view thread (12+ messages)  latest in thread

Message-ID: <34c739c1-b930-d58a-521b-c4a7b236d9bd@unix-solution.de>
Permalink:  ../34c739c1-b930-d58a-521b-c4a7b236d9bd@unix-solution.de/
Also on:    postgresql.org/message-id/34c739c1-b930-d58a-521b-c4a7b236d9bd@unix-solution.de

 · 

reply

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: <34c739c1-b930-d58a-521b-c4a7b236d9bd@unix-solution.de>
  References: <5a174fad-c30d-6d65-38c8-a3d9af8377df@unix-solution.de> <fa00b39eb7c7589cd604e386ff9ce59997906f5d.camel@cybertec.at> <34c739c1-b930-d58a-521b-c4a7b236d9bd@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