On 04/07/2026 01:28, Jelte Fennema-Nio wrote:
psql has a global variable, 'cancel_pressed', which is set in the signal
handler callback. Is it redundant with 'CancelRequested' that's also set
in the signal handler?
I did some spelunking, and yes it is redundant. Fixed in 0001
Cool!
5d43c3c54 mentions the --single-step flag as something that required
further analysis. I tried --single-step with and without this commit,
and Ctrl+C behaves the same in both. I also cannot think of a reason why
it would behave any differently.
Hmm, me neither. Michael, it was a long time ago, but would you happen
to remember what your concern on that was?
That said, the behavior with --single-step and Ctrl-C isn't great, with
or without this patch. Ctrl-C doesn't work while you're stopped on the
confirmation prompt:
postgres=# \set SINGLESTEP 1
postgres=# select 1; select 2;
/**(Single step mode: verify
command)******************************************/
select 1;
/**(press return to proceed or enter x and return to
cancel)*******************/
^C^C^C^C^C
Hitting Ctrl-C doesn't get you out of that prompt. It does cause the
query to not execute, but you still need to hit enter. I find that
surprising and I bet most users would agree.
I started to dig into that, but it's a rabbit hole. I'll start a
separate thread to not derail this patch. Patch 0001 looks good to me,
unless Michael remembers something we're missing.
- Heikki