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 1rVyxX-002Xpl-PM for pgsql-hackers@arkaria.postgresql.org; Fri, 02 Feb 2024 19:12:20 +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 1rVyxV-00FNPy-VX for pgsql-hackers@arkaria.postgresql.org; Fri, 02 Feb 2024 19:12:17 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rVyxV-00FNPq-MB for pgsql-hackers@lists.postgresql.org; Fri, 02 Feb 2024 19:12:17 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rVyxT-0058Ea-3Z for pgsql-hackers@postgresql.org; Fri, 02 Feb 2024 19:12:17 +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 412JCDjh3229198; Fri, 2 Feb 2024 14:12:13 -0500 From: Tom Lane To: Alexander Kuzmenkov cc: pgsql-hackers@postgresql.org Subject: Re: Correct SQLSTATE for ENOMEM in file access In-reply-to: References: Comments: In-reply-to Alexander Kuzmenkov message dated "Fri, 02 Feb 2024 20:02:37 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3229196.1706901133.1@sss.pgh.pa.us> Date: Fri, 02 Feb 2024 14:12:13 -0500 Message-ID: <3229197.1706901133@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Alexander Kuzmenkov writes: > Looking through the logs of some server that were experiencing out of > memory errors, I noticed that errcode_for_file_access() reports > ERRCODE_INTERNAL_ERROR for ENOMEM, while the correct SQLSTATE for this > should probably be ERRCODE_OUT_OF_MEMORY. Attached is a small patch to > fix this. Hmm, do you think this is actually reachable? AFAIK we should only be calling errcode_for_file_access() after functions that are unlikely to report ENOMEM. regards, tom lane