Re: \if, \elseif, \else, \endif (was Re: [HACKERS] PSQL commands:\quit_if, \quit_unless)
От | Corey Huinker |
---|---|
Тема | Re: \if, \elseif, \else, \endif (was Re: [HACKERS] PSQL commands:\quit_if, \quit_unless) |
Дата | |
Msg-id | CADkLM=futLcQrjJ_-=NnMah56snegE3VXvFEvne=KQQ-6Ye8NQ@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: \if, \elseif, \else, \endif (was Re: [HACKERS] PSQL commands:\quit_if, \quit_unless) (Fabien COELHO <coelho@cri.ensmp.fr>) |
Ответы |
Re: \if, \elseif, \else, \endif (was Re: [HACKERS] PSQL commands:\quit_if, \quit_unless)
|
Список | pgsql-hackers |
It seems that ON_ERROR_STOP is mostly ignored by design when in interactive mode, probably because it is nicer not to disconnect the user who is actually typing things on a terminal.
"""
ON_ERROR_STOP
By default, command processing continues after an error. When this variable is set to on, processing will instead stop immediately. In interactive mode, psql will return to the command prompt; otherwise, psql will exit, returning error code 3 to distinguish this case from fatal error conditions, which are reported using error code 1.
"""
This was my previous understanding of ON_ERROR_STOP. Somewhere in the course of developing this patch I lost that. Glad to have it back.
The only changes I made were to invalid booleans on if/elif, and the final branch balancing check won't set status to EXIT_USER unless it's non-interactive and ON_ERROR_STOP = on.
> \if truenew \if is true, executing commands> \endifexited \if, executing commands> \if falsenew \if is false, ignoring commands until next \elif, \else, or \endif> \endifexited \if, executing commands> \if errorunrecognized value "error" for "\if <expr>": boolean expectednew \if is invalid, ignoring commands until next \endif> \echo fooinside inactive branch, command ignored.> ^Cescaped \if, executing commands> \echo foofoo> \endifencountered un-matched \endif>
Вложения
В списке pgsql-hackers по дате отправления: