Re: Collation problem?

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Bjørn T Johansen <btj(at)havleik(dot)no>
Cc: PostgreSQL mailing lists <pgsql-general(at)postgresql(dot)org>
Subject: Re: Collation problem?
Date: 2015-04-26 08:30:01
Message-ID: CAB7nPqSEWtw1m8WEVOWOjF_BQmF_vCn9M3JJk3BcSyBorMr0qQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 the Norwegian 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Gunnar "Nick" Bluth 2015-04-26 08:31:37 Re: Collation problem?
Previous Message Bjørn T Johansen 2015-04-26 08:02:33 Collation problem?