On Mon, Aug 29, 2011 at 2:39 PM, John R Pierce <pierce(at)hogranch(dot)com> wrote:
> any connection to the database, even idle, will prevent a drop database.
>
> try...
>
> select pg_terminate_backend(procpid) from pg_stat_activity where datname
> = 'database1';
>
> that will snuff those processes. then you can drop the database, assuming
> the clients don't immediately reconnect.
If you lose your connection at this point you'll know who was
connected to that database as well.
Yes, I have done that before.