Search Postgresql Archives

Re: Drop database / database in use question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux