pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Mario Splivalo <mario.splivalo@megafon.hr>
To: pgsql-admin@postgresql.org
Subject: psql shell return codes - checking if database exists
Date: Tue, 15 Apr 2008 13:15:10 +0200
Message-ID: <48048E3E.2090807@megafon.hr> (raw)

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?

    Mario



view thread (3+ messages)  latest in thread

Message-ID: <48048E3E.2090807@megafon.hr>
Permalink:  ../48048E3E.2090807@megafon.hr/
Also on:    postgresql.org/message-id/48048E3E.2090807@megafon.hr

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: mario.splivalo@megafon.hr
  Subject: Re: psql shell return codes - checking if database exists
  In-Reply-To: <48048E3E.2090807@megafon.hr>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox