Re: Set COLLATE on a session level - Mailing list pgsql-general

From Karsten Hilbert
Subject Re: Set COLLATE on a session level
Date
Msg-id 20201120144717.GD5091@hermes.hilbert.loc
Whole thread Raw
In response to Re: Set COLLATE on a session level  (Pavel Stehule <pavel.stehule@gmail.com>)
Responses Re: Set COLLATE on a session level  (Dirk Mika <Dirk.Mika@mikatiming.de>)
List pgsql-general
On Fri, Nov 20, 2020 at 03:32:48PM +0100, Pavel Stehule wrote:

> pá 20. 11. 2020 v 15:28 odesílatel Dirk Mika <Dirk.Mika@mikatiming.de>
> napsal:
>
> > Let's assume there is an app that accesses the same database from
> > different countries. And in this app data should be displayed ordered. And
> > the sort order is not identical in all countries.
> >
> > Does the app have to send different SQL commands depending on the country?
> > Not nice.
> > Do the data have to be sorted in the app? Not nice either.
> >
>
> the query is the same - you just use a different COLLATE clause. For
> Postgres there is not any other way.

One might use a function producing a SELECT taking the locale as a parameter.

Or views in schemas per locale. Selecting the search path
per locale pulls in the right view.

Karsten
--
GPG  40BE 5B0E C98E 1713 AFA6  5BC0 3BEA AC80 7D4F C89B



pgsql-general by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: Set COLLATE on a session level
Next
From: Adrian Klaver
Date:
Subject: Re: AW: Linux package upgrade without dependency conflicts