I was avoiding ON_ERROR_STOP because I was using ON_ERROR_ROLLBACK, but
have just realised that if I encase my SQL in a transaction then rollback
will still happen.
Perfect!
James Sewell,
PostgreSQL Team Lead / Solutions Architect
__
Level 2, 50 Queen St,
James Sewell james.sew...@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
On Thu, Oct 10, 2013 at 1:52 AM, Tom Lane t...@sss.pgh.pa.us wrote:
James Sewell james.sew...@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'
Hello
2013/10/10 James Sewell james.sew...@lisasoft.com
Hello,
I am using PSQL to run SQL from a file with the -f flag as follows:
BEGIN
SQL
SQL
...
END
This gives me rollback on error and a nicer output than -1. This works
fine.
My question is in a rollback scenario is it