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 X8TP169g6vgQrlm2@hermes.hilbert.loc
Whole thread Raw
In response to Re: Set COLLATE on a session level  (Dirk Mika <Dirk.Mika@mikatiming.de>)
Responses Re: Set COLLATE on a session level  (Dirk Mika <Dirk.Mika@mikatiming.de>)
List 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@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



pgsql-general by date:

Previous
From: Dirk Mika
Date:
Subject: Re: Set COLLATE on a session level
Next
From: Laura Smith
Date:
Subject: Storage and querying of filesystem paths