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

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
Cc: Jelte Fennema-Nio <postgres(at)jeltef(dot)nl>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, Jacob Champion <jacob(dot)champion(at)enterprisedb(dot)com>
Subject: Re: Don't use the deprecated and insecure PQcancel in our frontend tools anymore
Date: 2026-07-07 06:14:29
Message-ID: akyZRUQovOCutJ9_@paquier.xyz
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Smith 2026-07-07 06:20:23 Re: Include sequences in publications created by pg_createsubscriber
Previous Message jian he 2026-07-07 06:12:17 Re: CAST(... ON DEFAULT) - WIP build on top of Error-Safe User Functions