Re: psql exit status with multiple -c or -f

2019-01-30 Thread Justin Pryzby
At Tue, 18 Dec 2018 10:24:39 -0600, Justin Pryzby wrote: > I think ON_ERROR_STOP would control whether the script stops, but it should > fail the exit status should reflect any error in the last command. The > shell does that even without set -e. Let me correct my own language: | I think ON_ERR

Re: psql exit status with multiple -c or -f

2019-01-30 Thread David G. Johnston
On Wed, Jan 30, 2019 at 6:38 PM Kyotaro HORIGUCHI wrote: > I guess the reason is that psql is widely used with just a single > -c command and acutually the fix breaks the cases. So it doesn't > seem back-pachable but it is apparently contradicting to > documentation, which seems perfectly reasonab

Re: psql exit status with multiple -c or -f

2019-01-30 Thread Kyotaro HORIGUCHI
At Thu, 31 Jan 2019 10:37:28 +0900 (Tokyo Standard Time), Kyotaro HORIGUCHI wrote in <20190131.103728.153290385.horiguchi.kyot...@lab.ntt.co.jp> > > I think ON_ERROR_STOP would control whether the script stops, but it should > > fail the exit status should reflect any error in the last command.

Re: psql exit status with multiple -c or -f

2019-01-30 Thread Kyotaro HORIGUCHI
Hello. At Tue, 18 Dec 2018 10:24:39 -0600, Justin Pryzby wrote in <20181218162439.gb8...@telsasoft.com> > On Tue, Dec 18, 2018 at 05:13:40PM +0900, Kyotaro HORIGUCHI wrote: > > $ psql postgres -v ON_ERROR_STOP=0 -f ~/work/y.txt ; echo $? > > $ psql postgres -v ON_ERROR_STOP=0 < ~/work/y.txt ;

Re: psql exit status with multiple -c or -f

2018-12-18 Thread Justin Pryzby
On Tue, Dec 18, 2018 at 05:13:40PM +0900, Kyotaro HORIGUCHI wrote: > $ psql postgres -v ON_ERROR_STOP=0 -f ~/work/y.txt ; echo $? > $ psql postgres -v ON_ERROR_STOP=0 < ~/work/y.txt ; echo $? > c) psql postgres -v ON_ERROR_STOP=0 -c foo -c 'select 1'; echo $? > d) psql postgres -v ON_ERROR_STOP=

Re: psql exit status with multiple -c or -f

2018-12-18 Thread Pavel Stehule
Ășt 18. 12. 2018 v 9:14 odesĂ­latel Kyotaro HORIGUCHI < horiguchi.kyot...@lab.ntt.co.jp> napsal: > Hello. > > At Mon, 17 Dec 2018 11:58:41 -0600, Justin Pryzby > wrote in <20181217175841.gs13...@telsasoft.com> > > Our deployment script failed to notice dozens of commands failed in a > > transaction

Re: psql exit status with multiple -c or -f

2018-12-18 Thread Kyotaro HORIGUCHI
Hello. At Mon, 17 Dec 2018 11:58:41 -0600, Justin Pryzby wrote in <20181217175841.gs13...@telsasoft.com> > Our deployment script failed to notice dozens of commands failed in a > transaction block and I only noticed due to keeping full logs and monitoring > for error_severity>'LOG'. I would hav