dropdb and dropuser: IF EXISTS

Поиск
Список
Период
Сортировка
От Josh Kupershmidt
Тема dropdb and dropuser: IF EXISTS
Дата
Msg-id CAK3UJRFxbzy+n-d6_MhJ-XB4UNZUFO0VFxem1F4TTMf6E49TNg@mail.gmail.com
обсуждение исходный текст
Ответы Re: dropdb and dropuser: IF EXISTS  (Robert Haas <robertmhaas@gmail.com>)
Список pgsql-hackers
I noticed a few places where it would be handy if dropdb took a flag
like "--if-exists" which would basically just add in the 'IF EXISTS'
clause to the DROP DATABASE statement. For example, scripts like
find_static or mbregress.sh use dropdb && createdb, but they generate
noisy errors from dropdb when run for the first time since there's no
--if-exists flag. (They could just pipe 'DROP DATABASE IF EXISTS ...'
to psql, but what's the point of having dropdb if it's not used?)

Attached is a very quick patch implementing the "--if-exists" or "-X"
option for dropdb and dropuser. I didn't bother adding in a check to
make sure the server version was 8.2+ since we're not even supporting
8.1 nowadays, though that'd be easy enough to add in.

Josh

Вложения

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: tsvector concatenation - backend crash
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: [GENERAL] pg_upgrade problem