Switch role after connecting to database

Posted by Chris Gow on Stack Overflow See other posts from Stack Overflow or by Chris Gow
Published on 2010-06-08T15:08:14Z Indexed on 2010/06/08 15:22 UTC
Read the original article Hit count: 155

Filed under:

Is it possible to change the postgresql role a user is using when interacting with postgres after the initial connection?

The database(s) will be used in a web application and I'd like to employ database level rules on tables and schemas with connection pooling. From reading the postgresql documentation it appears I can switch roles if I originally connect as a user with the superuser role, but I would prefer to initially connect as a user with minimal permissions and switch as necessary. Having to specify the user's password when switching would be fine (in fact I'd prefer it).

What am I missing?

© Stack Overflow or respective owner

Related posts about postgresql