Re: psql exit status with multiple -c or -f

Поиск
Список
Период
Сортировка
От Justin Pryzby
Тема Re: psql exit status with multiple -c or -f
Дата
Msg-id 20190131034523.GH13248@telsasoft.com
обсуждение исходный текст
Ответ на Re: psql exit status with multiple -c or -f  (Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp>)
Список pgsql-hackers
At Tue, 18 Dec 2018 10:24:39 -0600, Justin Pryzby <pryzby@telsasoft.com> wrote:
> I think ON_ERROR_STOP would control whether the script stops, but it should
> fail the exit status should reflect any error in the last command.  The
> shell does that even without set -e.

Let me correct my own language:

| I think ON_ERROR_STOP would control whether the script stops, but 
| the exit status should reflect any error in the last command.  The
| shell does that even without set -e.

What I mean is that "the exit status of the shell reflects the status of the
last command".  That's why you'll see at the bottom of shscripts an "exit 0"
which might seem to be implied.  Actually falling off the end of the script is
same as "exit" which is same as "exit $?" which may be nonzero if the preceding
command was a conditional/test, like:

for ...
 if ...
 fi
done
# without this, script will variously "fail" due to conditional evaluating to
# false:
exit 0

So I'm pointing out serious concern if psql would return 0 if last command
failed, a case where it's currently exiting with status 1.

Justin


В списке pgsql-hackers по дате отправления:

Предыдущее
От: "David G. Johnston"
Дата:
Сообщение: Re: psql exit status with multiple -c or -f
Следующее
От: Michael Paquier
Дата:
Сообщение: Re: A few new options for vacuumdb