Re: \if, \elseif, \else, \endif (was Re: [HACKERS] PSQL commands: \quit_if, \quit_unless)
От | Daniel Verite |
---|---|
Тема | Re: \if, \elseif, \else, \endif (was Re: [HACKERS] PSQL commands: \quit_if, \quit_unless) |
Дата | |
Msg-id | ac097a44-f9f4-4e80-ba6b-996f0e42c8d8@manitou-mail.org обсуждение исходный текст |
Ответ на | 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)
|
Список | pgsql-hackers |
Corey Huinker wrote: [about Ctrl-C] > That does seem to be the consensus desired behavior. I'm just not sure > where to handle that. The var "cancel_pressed" shows up in a lot of places. > Advice? Probably you don't need to care about cancel_pressed, and the /if stack could be unwound at the point the SIGINT handler longjumps to, in mainloop.c: /* got here with longjmp */ /* reset parsing state */psql_scan_finish(scan_state);psql_scan_reset(scan_state);resetPQExpBuffer(query_buf);resetPQExpBuffer(history_buf);count_eof =0;slashCmdStatus = PSQL_CMD_UNKNOWN;prompt_status = PROMPT_READY;pset.stmt_lineno = 1;cancel_pressed = false; The check I was suggesting on whether Ctrl+C has been pressed on an empty line seems harder to implement, because get_interactive() just calls readline() or fgets(), which block to return when a whole line is ready. AFAICS psql can't know what was the edit-in-progress when these functions are interrupted by a signal instead of returning normally. But I don't think this check is essential, it could be left to another patch. Best regards, -- Daniel Vérité PostgreSQL-powered mailer: http://www.manitou-mail.org Twitter: @DanielVerite
В списке pgsql-hackers по дате отправления: