Re: Don't use the deprecated and insecure PQcancel in our frontend tools anymore

Michael Paquier <michael@paquier.xyz>

From: Michael Paquier <michael@paquier.xyz>
To: Heikki Linnakangas <hlinnaka@iki.fi>
Cc: Jelte Fennema-Nio <postgres@jeltef.nl>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>, Alvaro Herrera <alvherre@alvh.no-ip.org>, Jacob Champion <jacob.champion@enterprisedb.com>
Date: 2026-07-07T06:14:29Z
Lists: pgsql-hackers
On Sat, Jul 04, 2026 at 10:11:54PM +0300, Heikki Linnakangas wrote:
> On 04/07/2026 01:28, Jelte Fennema-Nio wrote:
>> 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?

I unfortunately do not have anymore my notes from 2019 lying around,
but looking at the other thread and the code, it seems to me that the
problem I saw back then is that cancel request was not working at all
under --single-step because we would not set the flag when PQcancel()
failed.  Back around 5d43c3c54 the CancelRequest flag was only set
after we've successfully sent a request.  92f33bb7afd3 has changed
that globally, by setting the flag even if a cancel request could not
be sent.  So back then I am pretty sure that my line of thoughts
turned around the case where PQcancel() failed.
--
Michael