Re: Collation problem? - Mailing list pgsql-general

From Michael Paquier
Subject Re: Collation problem?
Date
Msg-id CAB7nPqSEWtw1m8WEVOWOjF_BQmF_vCn9M3JJk3BcSyBorMr0qQ@mail.gmail.com
Whole thread Raw
In response to Collation problem?  (Bjørn T Johansen <btj@havleik.no>)
List pgsql-general
On Sun, Apr 26, 2015 at 5:02 PM, Bjørn T Johansen wrote:
> And my problem is that I am using Norwegian in some tables and when using order by the sort order is not correct for
theNorwegian letters.. 
> So my guestion is if it is possible to get the correct sort order without recreating all my databases or initialize
PGSQL?

You can enforce the collate used in an ORDER BY clause:
SELECT a, b, c FROM tbl WHERE ... ORDER BY a COLLATE "C";
http://www.postgresql.org/docs/devel/static/sql-expressions.html#SQL-SYNTAX-COLLATE-EXPRS
Regards,
--
Michael


pgsql-general by date:

Previous
From: Bjørn T Johansen
Date:
Subject: Collation problem?
Next
From: "Gunnar \"Nick\" Bluth"
Date:
Subject: Re: Collation problem?