Re: Make ON_ERROR_STOP stop on shell script failure

From: bt22nakamorit <bt22nakamorit(at)oss(dot)nttdata(dot)com>
To: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Make ON_ERROR_STOP stop on shell script failure
Date: 2022-09-20 06:15:39
Message-ID: 8a022f2c8de93ea79116f0b7eb42248a@oss.nttdata.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2022-09-17 09:44 に bt22nakamorit さんは書きました:
> 2022-09-16 17:30 に Kyotaro Horiguchi さんは書きました:
>> At Fri, 16 Sep 2022 15:55:33 +0900, bt22nakamorit
>> <bt22nakamorit(at)oss(dot)nttdata(dot)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.
>
>> Since the "false" command did not "error out"?
> "false" command returns 1 which is an exit status code that indicates
> failure, but not error.
> I think it does not "error out" if that is what you mean.
>
>> So +1 from me to the proposal, assuming the corresponding edit of the
>> documentation happens.
> I will work on editing the document and share further updates.
>
> Thank you!
> Tatsu

I edited the documentation for ON_ERROR_STOP.
Any other suggestions?

Tatsu

Attachment Content-Type Size
stop_error.patch text/x-diff 1.2 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message wangw.fnst@fujitsu.com 2022-09-20 06:17:48 RE: Data is copied twice when specifying both child and parent table in publication
Previous Message David Rowley 2022-09-20 06:10:12 Re: Reducing the chunk header sizes on all memory context types