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

From Kyotaro Horiguchi
Subject Re: Make ON_ERROR_STOP stop on shell script failure
Date
Msg-id 20220916.173035.322733707258561235.horikyota.ntt@gmail.com
Whole thread Raw
In response to Make ON_ERROR_STOP stop on shell script failure  (bt22nakamorit <bt22nakamorit@oss.nttdata.com>)
Responses Re: Make ON_ERROR_STOP stop on shell script failure
List pgsql-hackers
At Fri, 16 Sep 2022 15:55:33 +0900, bt22nakamorit <bt22nakamorit@oss.nttdata.com> wrote in 
> Hi,
> 
> """\set ON_ERROR_STOP on""" stops any subsequent incoming query that
> comes after an error of an SQL, but does not stop after a shell script
> ran by """\! <some command>""" returning values other than 0, -1, or
> 127, which suggests a failure in the result of the shell script.
> 
> For example, suppose that below is an SQL file.
> \set ON_ERROR_STOP on
> SELECT 1;
> \! false
> SELECT 2;
> 
> The current design allows SELECT 2 even though the shell script
> returns a value indicating a failure.

Since the "false" command did not "error out"?

> I thought that this action is rather unexpected since, based on the
> word """ON_ERROR_STOP""", ones may expect that failures of shell
> scripts should halt the incoming instructions as well.
> One clear solution is to let failures of shell script stop incoming
> queries just like how errors of SQLs do currently. Thoughts?

I'm not sure we want to regard any exit status from a succssful run as
a failure.

On the other hand, the proposed behavior seems useful to me.

So +1 from me to the proposal, assuming the corresponding edit of the
documentation happens.

regards.

-- 
Kyotaro Horiguchi
NTT Open Source Software Center



pgsql-hackers by date:

Previous
From: Kyotaro Horiguchi
Date:
Subject: Re: ICU for global collation
Next
From: Kyotaro Horiguchi
Date:
Subject: Re: A question about wording in messages