"Dan Armbrust" <daniel.armbrust.list@xxxxxxxxx> writes: > First, after validating some passwords, my installer will run this command: > psql -c "select datname from pg_stat_activity where datname='fred'" -U > username -d template1 > I then scan the output looking for 'fred'. My (perhaps incorrect) > assumption is that if I don't find the database name 'fred' in the > output, then I can assume that no process is using this database, and > I should be able to drop it. There are obvious race conditions in that assumption. Why don't you just try the drop and see if it succeeds? regards, tom lane -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general