On 20.03.23 19:31, Greg Stark wrote:
So I took a look at this patch. The conflict is with 2fe3bdbd691
committed by Peter Eisentraut which added error checks for pipes.
Afaics the behaviour is now for pipe commands returning non-zero to
cause an error*always*  regardless of the setting of ON_ERROR_STOP.

I'm not entirely sure that's sensible actually. If you write to a pipe
that ends in grep and it happens to produce no matching rows you may
actually be quite surprised when that causes your script to fail...

The only thing that that patch changed in psql was the \w command, and AFAICT, ON_ERROR_STOP is still respected:

$ cat test.sql
\w |foo

$ psql -f test.sql
sh: foo: command not found
psql:test.sql:1: error: |foo: command not found
$ echo $?
0

$ psql -f test.sql -v ON_ERROR_STOP=1
sh: foo: command not found
psql:test.sql:1: error: |foo: command not found
$ echo $?
3



Reply via email to