Skip site navigation (1) Skip section navigation (2)

Re: how to detect psql's errors?

From: "Peter Gibbs" <peter(at)emkel(dot)co(dot)za>
To: "Drew Wilson" <amw(at)speakeasy(dot)net>,"Postgresql General" <pgsql-general(at)postgresql(dot)org>
Subject: Re: how to detect psql's errors?
Date: 2003-02-25 10:15:03
Message-ID: 015d01c2dcb6$c3648aa0$0b01010a@emkel.co.za (view raw or flat)
Thread:
Lists: pgsql-general
Drew Wilson wrote:

> Is there anyway to test for errors returned by psql?
>
> For example:
>   echo "select foo from pg_database" | psql -U admin myDB || echo
> "failed" && echo "success"
>
> This doesn't work. Neither "failed" nor "success" are echoed.
> Only 'ERROR:  Attribute "foo" not found' is displayed on console.

Try:
  psql -c "select foo from pg_database" -U admin myDB && echo "success" ||
echo "failed"

--
Peter Gibbs
EmKel Systems


In response to

pgsql-general by date

Next:From: Richard SandDate: 2003-02-25 11:18:20
Subject: error compiling 7.3.2 on solaris 8- library conflict
Previous:From: Erwin MollerDate: 2003-02-25 10:04:10
Subject: Re: Help, Postgres7.3 --> Postgres7.2.1 database recreation fails

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group