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
Views: Raw Message | Whole Thread | Download mbox | Resend email
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

Browse pgsql-general by date

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