On 10/12/07, Guy Rouillier <guyr-ml1@burntmail.com> wrote:
> I've had several occasions when a user-defined variable would have come
> in handy. What is the scope of user_vars as you've defined them above?
> Are they unique to a connection? A user_id? Or defined globally?
> Ideally, they would be connection-unique. One place they would come in
> really handy is with web-apps using connection pooling. I could stuff
> the userid of the person who connected to my secure website into a
> user_var, then the database could access that to track user actions.
> Right now, that is cumbersome to do, since the current_user is always
> the same: the userid for the connection pool.
The Veil project might be worth looking at: http://veil.projects.postgresql.org/
It's designed with providing row-level security through views in mind,
but it does that with global and session variable primitives.