Re: Make ON_ERROR_STOP stop on shell script failure - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: Make ON_ERROR_STOP stop on shell script failure
Date
Msg-id 8e940fb8-0e16-0e6f-c4be-e5920b49fd23@enterprisedb.com
Whole thread Raw
In response to Re: Make ON_ERROR_STOP stop on shell script failure  (Greg Stark <stark@mit.edu>)
Responses Re: Make ON_ERROR_STOP stop on shell script failure  (Corey Huinker <corey.huinker@gmail.com>)
List pgsql-hackers
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




pgsql-hackers by date:

Previous
From: "Kumar, Sachin"
Date:
Subject: RE: Initial Schema Sync for Logical Replication
Next
From: Daniel Gustafsson
Date:
Subject: Re: User functions for building SCRAM secrets