phppgadmin : How does it kick users out of postgres, so it can db_drop?

Posted by egarcia on Stack Overflow See other posts from Stack Overflow or by egarcia
Published on 2010-03-12T12:09:50Z Indexed on 2010/03/12 12:27 UTC
Read the original article Hit count: 335

Filed under:
|
|

I've got one Posgresql database (I'm the owner) and I'd like to drop it and re-create it from a dump.

Problem is, there're a couple applications (two websites, rails and perl) that access the db regularly. So I get a "database is being accessed by other users" error.

I've read that one possibility is getting the pids of the processes involved and killing them individually. I'd like to do something cleaner, if possible.

Phppgadmin seems to do what I want: I am able to drop schemas using its web interface, even when the websites are on, without getting errors. So I'm investigating how its code works. However, I'm no PHP expert.

I'm trying to understand the phppgadmin code in order to see how it does it. I found out a line (257 in Schemas.php) where it says:

$data->dropSchema(...)

$data is a global variable and I could not find where it is defined.

Any pointers would be greatly appreciated.

© Stack Overflow or respective owner

Related posts about phppgadmin

Related posts about php