Re: Make ON_ERROR_STOP stop on shell script failure

From: Greg Stark <stark(at)mit(dot)edu>
To: "Andreas 'ads' Scherbaum" <ads(at)pgug(dot)de>
Cc: Matheus Alcantara <mths(dot)dev(at)pm(dot)me>, bt22nakamorit <bt22nakamorit(at)oss(dot)nttdata(dot)com>, Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com>, Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org, Peter Eisentraut <peter(at)eisentraut(dot)org>
Subject: Re: Make ON_ERROR_STOP stop on shell script failure
Date: 2023-03-20 18:31:51
Message-ID: CAM-w4HOW3cc8V6HUegWiB-9t1oHZ74rQUZ0J5zuUJsjOyZLg+w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 Content-Type Size
v5-0001-on-error-stop-for-shell.patch text/x-patch 9.3 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Gregory Stark (as CFM) 2023-03-20 18:34:39 Re: Make ON_ERROR_STOP stop on shell script failure
Previous Message Jacob Champion 2023-03-20 18:23:54 Re: pg_dump needs SELECT privileges on irrelevant extension table