Re: PSQL return coder

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: James Sewell <james(dot)sewell(at)lisasoft(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: PSQL return coder
Date: 2013-10-10 06:52:52
Message-ID: 2768.1381387972@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

James Sewell <james(dot)sewell(at)lisasoft(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Chris Travers 2013-10-10 07:27:25 Re: [HACKERS] Urgent Help Required
Previous Message Ronan Dunklau 2013-10-10 06:48:23 Re: Triggers on foreign tables