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

From Greg Stark
Subject Re: Make ON_ERROR_STOP stop on shell script failure
Date
Msg-id CAM-w4HOW3cc8V6HUegWiB-9t1oHZ74rQUZ0J5zuUJsjOyZLg+w@mail.gmail.com
Whole thread Raw
In response to Re: Make ON_ERROR_STOP stop on shell script failure  (Andreas 'ads' Scherbaum <ads@pgug.de>)
Responses Re: Make ON_ERROR_STOP stop on shell script failure  ("Gregory Stark (as CFM)" <stark.cfm@gmail.com>)
Re: Make ON_ERROR_STOP stop on shell script failure  (Peter Eisentraut <peter.eisentraut@enterprisedb.com>)
List pgsql-hackers
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...

But if you remove that failing hunk the resulting patch does apply. I
don't see any tests so ... I don't know if the behaviour is still
sensible. A quick read gives me the impression that now it's actually
inconsistent in the other direction where it stops sometimes more
often than the user might expect.

I also don't understand the difference between ON_ERROR_STOP_ON and
ON_ERROR_STOP_ALL. Nor why we would want ON_ERROR_STOP_SHELL which
stops only on shell errors, rather than, say, ON_ERROR_STOP_SQL to do
the converse which would at least match the historical behaviour?

Attachment

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Save a few bytes in pg_attribute
Next
From: "Gregory Stark (as CFM)"
Date:
Subject: Re: Make ON_ERROR_STOP stop on shell script failure