Re: psql shell return codes - checking if database exists - Mailing list pgsql-admin

From Milen A. Radev
Subject Re: psql shell return codes - checking if database exists
Date
Msg-id fu25vb$oii$1@ger.gmane.org
Whole thread Raw
In response to psql shell return codes - checking if database exists  (Mario Splivalo <mario.splivalo@megafon.hr>)
Responses Re: psql shell return codes - checking if database exists
List 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 by date:

Previous
From: "Dmitry Shubin"
Date:
Subject: postgres 8.1 usermanagement problem
Next
From: Julius Tuskenis
Date:
Subject: Re: postgres 8.1 usermanagement problem