Re: DROP ROLE: how to detect active sessions? - Mailing list pgsql-admin

From Tom Lane
Subject Re: DROP ROLE: how to detect active sessions?
Date
Msg-id 27773.1287685132@sss.pgh.pa.us
Whole thread Raw
In response to DROP ROLE: how to detect active sessions?  (Ken Lalonde <kenl@gap.ca>)
Responses Re: DROP ROLE: how to detect active sessions?
List pgsql-admin
Ken Lalonde <kenl@gap.ca> writes:
> Is there any way to determine if a given role has any active sessions?

Not if you're using SET ROLE.  pg_stat_activity will show you the
login role names for active sessions.  Do you really need SET ROLE
rather than logging in with the appropriate username?

There are going to be race conditions in any case, of course.
Probably the best solution is to just not try to drop roles
except when the system is idle.

            regards, tom lane

pgsql-admin by date:

Previous
From: Ken Lalonde
Date:
Subject: DROP ROLE: how to detect active sessions?
Next
From: Ken Lalonde
Date:
Subject: Re: DROP ROLE: how to detect active sessions?