Search Postgresql Archives

Aw: Re: Set COLLATE on a session level

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> > 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






[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux