Re: Drop database / database in use question

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Drop database / database in use question
Дата
Msg-id 4170.1224203817@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Drop database / database in use question  ("Dan Armbrust" <daniel.armbrust.list@gmail.com>)
Ответы Re: Drop database / database in use question  ("Dan Armbrust" <daniel.armbrust.list@gmail.com>)
Список pgsql-general
"Dan Armbrust" <daniel.armbrust.list@gmail.com> 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

В списке pgsql-general по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: postgresql on 64-bit windows
Следующее
От: "Tim Uckun"
Дата:
Сообщение: Question about NOT NULL and default values.