Re: \if, \elseif, \else, \endif (was Re: [HACKERS] PSQL commands:\quit_if, \quit_unless)

Поиск
Список
Период
Сортировка
От Fabien COELHO
Тема Re: \if, \elseif, \else, \endif (was Re: [HACKERS] PSQL commands:\quit_if, \quit_unless)
Дата
Msg-id alpine.DEB.2.20.1702061014150.10745@lancre
обсуждение исходный текст
Ответ на Re: \if, \elseif, \else, \endif (was Re: [HACKERS] PSQL commands:\quit_if, \quit_unless)  (Corey Huinker <corey.huinker@gmail.com>)
Ответы Re: \if, \elseif, \else, \endif (was Re: [HACKERS] PSQL commands:\quit_if, \quit_unless)  (Fabien COELHO <coelho@cri.ensmp.fr>)
Список pgsql-hackers
>>   # elif error
>>   "\\if false\n\\elif error\n\\endif\n"
>>
>>   # ignore commands on error (stdout must be empty)
>>   "\\if error\n\\echo NO\n\\else\n\\echo NO\n\\endif\n"
>
> Those are already in the regression (around line 2763 of
> expected/psql.out), are you saying we should have them in TAP as well?
> Should we only do TAP tests?

Ok. so, maybe just the first one. The idea would be to cover more cases of 
on error stop and check that it indeed stopped.

Find attached a small patch to improve tap tests, which also checks that 
psql really exited by checking that nothing is printed afterwards.

Also, for some reason there were \\n instead of \n in some place, it was 
working because the first command induced the error.

> Anyway, here's the Ctrl-C behavior:

Ok. Basically it moves up each time Ctrl-C is called. Fine.

The future improvement would be to do that if the current input line was 
empty, otherwise only the current input line would be cleaned up.

> Ctrl-C exits do the same before/after state checks that \endif does, the
> lone difference being that it "escaped" the \if rather than "exited" the
> \if. Thanks to Daniel for pointing out where it should be handled, because
> I wasn't going to figure that out on my own.
>
> v7's only major difference from v6 is the Ctrl-C branch escaping.

Ok. Bar from minor tests improvements, this looks pretty much ok to me.

-- 
Fabien.



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

Предыдущее
От: Rushabh Lathia
Дата:
Сообщение: Re: [HACKERS] Gather Merge
Следующее
От: Fabien COELHO
Дата:
Сообщение: Re: \if, \elseif, \else, \endif (was Re: [HACKERS] PSQL commands:\quit_if, \quit_unless)