Re: [ADMIN] how do i kill user sessions? - Mailing list pgsql-hackers

From Magnus Hagander
Subject Re: [ADMIN] how do i kill user sessions?
Date
Msg-id 6BCB9D8A16AC4241919521715F4D8BCE6C748C@algol.sollentuna.se
Whole thread Raw
List pgsql-hackers
> > I have a problem  with the users administration. When I
> want to erase
> > (drop) some databases there's an error: ** database
> "name_db" is being
> > accessed by other users.**  I want to kill the user
> sessions conected
> > but i don't know how to do it   (Kill the user sessions).
>
> First, use ps to find the pid of the offending users.  for instance:
>
> ps ax|grep postgres|grep test
> 18925 pts/1    S      0:00 postgres: postgres test [local] idle
>
> then, as the postgres superuser, kill the backend:
>
> kill 18925


Moved to hackers, since this is no longer an answer to the original
question.


First, I think this is a very FA:ed Q (how to kill off a session), so I
think this should go in the FAQ.

Second, most of the time people ask about this, they get the advice to
use 'kill'. Last I heard, this was not considered safe in any other
situations than total database shutdown. (using it to cancel a query is
safe, but that won't get rid of the backend) And that the only
recommended way to terminate a backend was to shutdown and restart the
postmaster along with all backends. Such a FAQ entry should clearly
outline this (and why it's not safe). Unless this is no longer true, but
I haven't seen any patches that have claimed to fix this.

Third, I beleive it's very important for us to fix this. My experience
from last time clearly tells me that I'm not capable of doing this
myself, so I'll just reiterate the point and hope that somebody who does
can make it happen :-) again, unless it's already fixed and I missed it.


//Magnus


pgsql-hackers by date:

Previous
From: Christopher Kings-Lynne
Date:
Subject: Re: SQL_ASCII vs. 7-bit ASCII encodings
Next
From: Andreas Pflug
Date:
Subject: Re: Server instrumentation for 8.1