Skip site navigation (1) Skip section navigation (2)

dropdb: database removal failed: active sessions

From: JD Wong <jdmswong(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: dropdb: database removal failed: active sessions
Date: 2011-08-29 19:22:43
Message-ID: CAGuHHn-KJru-hi-6ZHdVdJgYBEJdre9fwn0CWCXKwmwy9Zt3Jw@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-general
Hi,

I cannot dropdb.  Postgres throws me:
dropdb: database removal failed: ERROR:  database "database1" is being
accessed by other users
DETAIL:  There are 1 other session(s) using the database.

the "select datname,current_query,query_start from pg_stat_activity ;" query
gives me:

         datname         |
   current_query                                                       |
     query_start
-------------------------+--------------------------------------------------------------------------------------------------------------------------+-------------------------------
 database2             | CREATE INDEX location_object_bioseg ON location
USING gist (locatedonid, bioseg_create(intermine_start, intermine_end)); |
2011-08-29 14:43:40.856594-04
 database3             | <IDLE>
                                                                      |
2011-08-29 15:08:17.469927-04
 database4             | <IDLE>
                                                                      |
2011-08-29 15:07:09.484543-04
 database3             | <IDLE>
                                                                      |
2011-08-29 15:07:09.901601-04
 database2             | select datname,current_query,query_start from
pg_stat_activity ;                                                         |
2011-08-29 15:12:39.811168-04
 database3             | <IDLE>
                                                                      |
2011-08-29 15:08:17.476254-04
 database3             | <IDLE>
                                                                      |
2011-08-29 15:07:10.422579-04
 database4             | <IDLE>
                                                                      |
2011-08-29 15:07:10.515946-04
 database1             | <IDLE>
                                                                      |
2011-08-29 15:07:31.423596-04

Is the drop being prevented by the active query from database2?  If not how
can I kill the <IDLE> query that must be preventing deletion.

Thanks!

Responses

pgsql-general by date

Next:From: Martín MarquésDate: 2011-08-29 19:42:17
Subject: Re: passing cursors from one PL function to another
Previous:From: Pavel StehuleDate: 2011-08-29 19:12:35
Subject: Re: passing cursors from one PL function to another

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group