Re: Set COLLATE on a session level

From: Karsten Hilbert <Karsten(dot)Hilbert(at)gmx(dot)net>
To: "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Set COLLATE on a session level
Date: 2020-11-30 10:56:23
Message-ID: X8TP169g6vgQrlm2@hermes.hilbert.loc
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Am Mon, Nov 30, 2020 at 10:11:38AM +0000 schrieb Dirk Mika:

> > Or views in schemas per locale. Selecting the search path
> > per locale pulls in the right view.
>
> And one view per locale would mean that I would have to
> create a whole schema including all views for each locale I
> want to support. I would have to roll out a new version of
> the data model, just for an additional locale.

Or a "smart" view. Set a session variable before running the
query and have the (one) view return the locale'd data based
on the session variable ...

set session "mika.current_locale" = 'locale(at)2_use';

and use

select current_setting('mika.current_locale')

as needed inside the view definition

> This all seems unnecessarily complicated to me.

No one said it is going to be particularly convenient... You
asked for possible, I guess. :-)

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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Laura Smith 2020-11-30 12:05:22 Storage and querying of filesystem paths
Previous Message Dirk Mika 2020-11-30 10:11:38 Re: Set COLLATE on a session level