Aw: Re: Set COLLATE on a session level

Поиск
Список
Период
Сортировка
От Karsten Hilbert
Тема Aw: Re: Set COLLATE on a session level
Дата
Msg-id trinity-6d5962ef-1ffc-469d-91d2-c530c02e113d-1607177909245@3c-app-gmx-bap68
обсуждение исходный текст
Ответ на Re: Set COLLATE on a session level  (Karsten Hilbert <Karsten.Hilbert@gmx.net>)
Список pgsql-general
> > 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
>
> But the argument that follows COLLATE is an identifier, not a parameter,

ah, true enough

> so it must be hardcoded in the view, just like column names or table names.
> I don't see how you could use the setting to control the COLLATE clause
> through a view.

The view might produce its rows by calling a function which
in turn reads the setting and dynamically constructs and exexcutes
the query needed to produce the locale-dependant rows, no ?  =8-)

Convoluted ?  I guess so ...

Karsten



В списке pgsql-general по дате отправления:

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: Re: Set COLLATE on a session level
Следующее
От: "Daniel Verite"
Дата:
Сообщение: Re: Set COLLATE on a session level