Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wg5mb-005v3o-2T for pgsql-hackers@arkaria.postgresql.org; Sat, 04 Jul 2026 19:12:11 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wg5mZ-00Asml-1W for pgsql-hackers@arkaria.postgresql.org; Sat, 04 Jul 2026 19:12:07 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wg5mZ-00Asmc-0G for pgsql-hackers@lists.postgresql.org; Sat, 04 Jul 2026 19:12:07 +0000 Received: from lahtoruutu.iki.fi ([2a0b:5c81:1c1::37]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wg5mW-00000001VY3-2sXU for pgsql-hackers@lists.postgresql.org; Sat, 04 Jul 2026 19:12:06 +0000 Received: from [10.0.2.15] (unknown [130.41.208.2]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange x25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: hlinnaka) by lahtoruutu.iki.fi (Postfix) with ESMTPSA id 4gt0bv4Z7Yz49PwS; Sat, 04 Jul 2026 22:11:55 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=lahtoruutu; t=1783192316; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jqwU70qySrwTkqXDQqvdmlKJwbmPfH9KPUjqPYQ4jN0=; b=O94On+z8SlCo0bbZIGAQsV8WoxrKfhf81EggyWpGPO3sU/fXTA6hkCYJ0Et9eHJNhj6FAL R+9xL+9UFv2LGfXFnWAs6JsSt1ctSBQm9krH/yQArRqa4GFO0gM4/D0+rCgaIe3ibrVY8l U7rqvc3/g/F3ey3E0PYmULjErGrp30Z3fnVnkriTh6OcJzRLIypzZ7GWhwLd4NfUMPMSON uxrwwAGHmIsEO3FLQQGHJCb/+YmXMvQapaeY9PwNUSL6fvaBh1b9ywJ+dX9m7Ges6SD3iw p2xjJd/Z7pl96prDRgNm9yUC7pa1KvAY9CWM51ogJnlSs/hpb17XX7Lv18F17g== ARC-Seal: i=1; a=rsa-sha256; d=iki.fi; s=lahtoruutu; cv=none; t=1783192316; b=vR7G0HQH9J3zh3Nrp1fkYuJS4Cc6YnL+v2ju/5O3SdcWNGe3/sfIE3v21NCENf4lbDhZRr L81pI5Z+k+nr+Vp6trVYsepg9Wq/Vxj00Z3GAMDqsij3iCbTOicrNTBoo5MYqIgA4N6mnF 5TfSVfReqxV3wyL1Q9S5zosq0fRiqfXC2ndwRkocdT9ed4BDLVJ5n2LL8bbyOJfWBJiKFH AE/AOgwTZyz/c6JzWDIJuZP6uuI17fLT/xCEdtUszCual4gIE7XEcxyZ7NZp+MHe5TMGWY o2zqIN4HH1ls3yqg+VrLYmlxHZqSo+zV76ekl2IN8USts/Ej03jVMBuY3ULSkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=lahtoruutu; t=1783192316; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jqwU70qySrwTkqXDQqvdmlKJwbmPfH9KPUjqPYQ4jN0=; b=CP+zg6cWW8ypZtVAM04MCqi/dYW3/0LloSKtufEzAcyx3vGhtrTQU8meDnezhPkU247Qmu 7fjJHIcw2udmzdjHlXgpqH3fK2zXPJl9T0oBaA4eye9mvWhpHYFYP5T5vLe6NkooADouZy q3F7TNxBqUUGz9gP0PHSqPdDG6CgOIm2vCzI6HcAFdD2Sm6rgVwxa3x5QCDsFcolhdme0N 0GGEtrMlaC8qHIUaRD67GyxlTCDQhcRmxprUfFCBI1FuvttSeoDmO+4hoC6wqwvyou4btU dB0jo+R/L7o/MJEjUufnwkTb9tXnOWYB7HCkyf00N9wbxgNw+V8P4tla8BWqJg== ARC-Authentication-Results: i=1; ORIGINATING; auth=pass smtp.auth=hlinnaka smtp.mailfrom=hlinnaka@iki.fi Message-ID: Date: Sat, 4 Jul 2026 22:11:54 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Don't use the deprecated and insecure PQcancel in our frontend tools anymore To: Jelte Fennema-Nio , Michael Paquier Cc: PostgreSQL Hackers , Alvaro Herrera , Jacob Champion References: <88dfe280-ba29-4943-95b8-63abc9f3f771@iki.fi> <9d7ba3ac-d660-483e-8f68-9096a2464e90@iki.fi> Content-Language: en-US From: Heikki Linnakangas In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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