From: Oliver Jowett <oliver@opencloud.com>
To: Rob Kirkbride <rob@rkcomputing.co.uk>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Switching user within connection.
Date: Wed, 23 Nov 2005 23:57:51 +1300
Message-ID: <43844B2F.1010309@opencloud.com> (raw)
In-Reply-To: <43843F94.6070900@rkcomputing.co.uk>
References: <43843F94.6070900@rkcomputing.co.uk>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: oliver@opencloud.com, rob@rkcomputing.co.uk
Subject: Re: Switching user within connection.
In-Reply-To: <43844B2F.1010309@opencloud.com>
References: <43843F94.6070900@rkcomputing.co.uk> <43844B2F.1010309@opencloud.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox