Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ksUyt-0007D5-3G for pgsql-hackers@arkaria.postgresql.org; Thu, 24 Dec 2020 18:04:55 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1ksUyr-0005FX-Po for pgsql-hackers@arkaria.postgresql.org; Thu, 24 Dec 2020 18:04:53 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ksUyr-0005FQ-JR for pgsql-hackers@lists.postgresql.org; Thu, 24 Dec 2020 18:04:53 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ksUym-00087Y-3J for pgsql-hackers@lists.postgresql.org; Thu, 24 Dec 2020 18:04:52 +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 0BOI4i0s847984; Thu, 24 Dec 2020 13:04:44 -0500 From: Tom Lane To: Bharath Rupireddy cc: Magnus Hagander , PostgreSQL Hackers Subject: Re: Better client reporting for "immediate stop" shutdowns In-reply-to: References: <559291.1608587013@sss.pgh.pa.us> <615956.1608658320@sss.pgh.pa.us> Comments: In-reply-to Bharath Rupireddy message dated "Wed, 23 Dec 2020 12:07:25 +0530" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <847982.1608833084.1@sss.pgh.pa.us> Date: Thu, 24 Dec 2020 13:04:44 -0500 Message-ID: <847983.1608833084@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Bharath Rupireddy writes: > On Tue, Dec 22, 2020 at 11:02 PM Tom Lane wrote: >> There might be an argument for emitting the "unexpected SIGQUIT" >> text if we find garbage in sigquit_reason. Any thoughts about that? > Although I can't think of any case now, IMHO we can still have a > default case(we may or may not hit it) in the switch with a message > something like "terminating connection due to unexpected SIGQUIT". I don't really want to add a default case just on speculation. We generally prefer to avoid writing a default in a switch that's supposed to cover all values of an enum type, because without the default most C compilers will warn you if you omit a value, whereas with the default they won't. Admittedly, it's unlikely someone would add a new QuitSignalReason and forget to update this code, but still it's not really project style to do it like that. I don't think there's enough risk here to go against the style. Hence, pushed it like that. regards, tom lane