Re: psql shell return codes - checking if database exists

Поиск
Список
Период
Сортировка
От Milen A. Radev
Тема Re: psql shell return codes - checking if database exists
Дата
Msg-id fu25vb$oii$1@ger.gmane.org
обсуждение исходный текст
Ответ на psql shell return codes - checking if database exists  (Mario Splivalo <mario.splivalo@megafon.hr>)
Ответы Re: psql shell return codes - checking if database exists  (sundaram <sundaram.bioreliance@gmail.com>)
Список pgsql-admin
Mario Splivalo написа:
> I need to check, from a bash script, if certain database exists in a
> postgres cluster. When I issue:
>
> psql -U someuser somedatabase
>
> psql returns error code 2 regardless of 'no user' or 'no database'
> condition. How could I distinguish from the two?

A workaround: add "--list" option to the command line and grep for the
database you need.


--
Milen A. Radev

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

Предыдущее
От: "Dmitry Shubin"
Дата:
Сообщение: postgres 8.1 usermanagement problem
Следующее
От: Julius Tuskenis
Дата:
Сообщение: Re: postgres 8.1 usermanagement problem