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.94.2) (envelope-from ) id 1qNzbJ-006Whi-2c for pgsql-hackers@arkaria.postgresql.org; Mon, 24 Jul 2023 17:44:04 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1qNzbH-00CPHc-KL for pgsql-hackers@arkaria.postgresql.org; Mon, 24 Jul 2023 17:44:03 +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.94.2) (envelope-from ) id 1qNzbH-00CPHU-Aw for pgsql-hackers@lists.postgresql.org; Mon, 24 Jul 2023 17:44:03 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qNzbC-001Lnh-Rc for pgsql-hackers@postgresql.org; Mon, 24 Jul 2023 17:44:02 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 36OHhuIx1588059; Mon, 24 Jul 2023 13:43:56 -0400 From: Tom Lane To: "Tristan Partin" cc: pgsql-hackers@postgresql.org Subject: Re: psql not responding to SIGINT upon db reconnection In-reply-to: References: Comments: In-reply-to "Tristan Partin" message dated "Mon, 24 Jul 2023 12:11:27 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1588057.1690220636.1@sss.pgh.pa.us> Date: Mon, 24 Jul 2023 13:43:56 -0400 Message-ID: <1588058.1690220636@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk "Tristan Partin" writes: > v3 is attached which fixes up some code comments I added which I hadn't > attached to the commit already, sigh. I don't care for this patch at all. You're bypassing the pqsignal abstraction layer that the rest of psql goes through, and the behavior you're implementing isn't very nice. People do not expect ^C to kill psql - it should just stop the \c attempt and leave you as you were. Admittedly, getting PQconnectdbParams to return control on SIGINT isn't too practical. But you could probably replace that with a loop around PQconnectPoll and test for CancelRequested in the loop. regards, tom lane