Re: Switching user within connection. - Mailing list pgsql-jdbc

From Oliver Jowett
Subject Re: Switching user within connection.
Date
Msg-id 43844B2F.1010309@opencloud.com
Whole thread Raw
In response to Switching user within connection.  (Rob Kirkbride <rob@rkcomputing.co.uk>)
Responses Re: Switching user within connection.  (Rob Kirkbride <rob@rkcomputing.co.uk>)
List pgsql-jdbc
Rob Kirkbride wrote:

> Is there a standard way (or indeed a special way in Postgres) to switch
> user/password without creating a new connection?
> You can obviously do it within psql with \c but I wondered whether there
> was a way in JDBC?

There is no standard JDBC way I know of, short of reconnecting.

AFAIK there's no way at the protocol level to reauthenticate as a
different user on an existing connection. I believe psql's \c command
actually establishes a new connection.

If you originally connected as the database superuser you could use SET
SESSION AUTHORIZATION to get a similar effect; see
http://www.postgresql.org/docs/8.1/static/sql-set-session-authorization.html.

-O

pgsql-jdbc by date:

Previous
From: Tjioe Ai Xin
Date:
Subject: Re: Can PostgreSQL do data type automated casting in
Next
From: Oliver Jowett
Date:
Subject: Re: Can PostgreSQL do data type automated casting in