Re: default to to ON_ERROR_STOP=on (Re: psql: exit status with multiple -c and -f)

2022-01-16 Thread Julien Rouhaud
Hi, On Mon, Dec 27, 2021 at 12:31:07PM -0500, Tom Lane wrote: > Justin Pryzby writes: > > I think the current behavior of the regression test SQL scripts is exactly > > the > > opposite of what's desirable for almost all other scripts. The attached > > makes > > ON_ERROR_STOP the default, and

Re: default to to ON_ERROR_STOP=on (Re: psql: exit status with multiple -c and -f)

2021-12-27 Thread Tom Lane
Justin Pryzby writes: > I think the current behavior of the regression test SQL scripts is exactly the > opposite of what's desirable for almost all other scripts. The attached makes > ON_ERROR_STOP the default, and runs the regression tests with ON_ERROR_STOP=0. > Is it viable to consider

Re: default to to ON_ERROR_STOP=on (Re: psql: exit status with multiple -c and -f)

2021-12-27 Thread Pavel Stehule
po 27. 12. 2021 v 17:10 odesílatel Justin Pryzby napsal: > On Mon, Dec 06, 2021 at 09:08:56AM -0600, Justin Pryzby wrote: > > I raised this issue a few years ago. > > > https://www.postgresql.org/message-id/20181217175841.GS13019%40telsasoft.com > > > > |[pryzbyj@database ~]$ psql -v

default to to ON_ERROR_STOP=on (Re: psql: exit status with multiple -c and -f)

2021-12-27 Thread Justin Pryzby
On Mon, Dec 06, 2021 at 09:08:56AM -0600, Justin Pryzby wrote: > I raised this issue a few years ago. > https://www.postgresql.org/message-id/20181217175841.GS13019%40telsasoft.com > > |[pryzbyj@database ~]$ psql -v VERBOSITY=terse ts -xtc 'ONE' -c "SELECT > 'TWO'"; echo "exit status $?" >

psql: exit status with multiple -c and -f

2021-12-06 Thread Justin Pryzby
I raised this issue a few years ago. https://www.postgresql.org/message-id/20181217175841.GS13019%40telsasoft.com |[pryzbyj@database ~]$ psql -v VERBOSITY=terse ts -xtc 'ONE' -c "SELECT 'TWO'"; echo "exit status $?" |ERROR: syntax error at or near "ONE" at character 1 |?column? | TWO | |exit

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

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

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

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 > >

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

psql exit status with multiple -c or -f

2018-12-17 Thread Justin Pryzby
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 have thought that exit status would be nonzero had an error occured in an earlier script. The docs since PG9.6 say: