Re: PSQL return coder - Mailing list pgsql-hackers

From Tom Lane
Subject Re: PSQL return coder
Date
Msg-id 2768.1381387972@sss.pgh.pa.us
Whole thread Raw
In response to PSQL return coder  (James Sewell <james.sewell@lisasoft.com>)
Responses Re: PSQL return coder  (Merlin Moncure <mmoncure@gmail.com>)
List pgsql-hackers
James Sewell <james.sewell@lisasoft.com> writes:
> My question is in a rollback scenario is it possible to get PSQL to return
> a non 0 exit status?

Maybe you could use -c instead of -f?

$ psql -c 'select 1; select 1/0' regression
ERROR:  division by zero
$ echo $?
1

You won't need explicit BEGIN/END because this is already a single
transaction.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Ronan Dunklau
Date:
Subject: Re: Triggers on foreign tables
Next
From: Andres Freund
Date:
Subject: Re: Support for REINDEX CONCURRENTLY