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 1u5UQo-001Dfr-4F for pgsql-interfaces@arkaria.postgresql.org; Thu, 17 Apr 2025 18:57:50 +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 1u5UQl-00FROM-RI for pgsql-interfaces@arkaria.postgresql.org; Thu, 17 Apr 2025 18:57:48 +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 1u5UQl-00FROD-JC for pgsql-interfaces@lists.postgresql.org; Thu, 17 Apr 2025 18:57:48 +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.96) (envelope-from ) id 1u5UQj-000cDo-0H for pgsql-interfaces@postgresql.org; Thu, 17 Apr 2025 18:57:48 +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 53HIvhn72359908; Thu, 17 Apr 2025 14:57:43 -0400 From: Tom Lane To: David CARLIER cc: pgsql-interfaces@postgresql.org Subject: Re: libpq, connection error - question In-reply-to: References: Comments: In-reply-to David CARLIER message dated "Thu, 17 Apr 2025 19:05:51 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2359906.1744916263.1@sss.pgh.pa.us> Date: Thu, 17 Apr 2025 14:57:43 -0400 Message-ID: <2359907.1744916263@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk David CARLIER writes: > in case of PQconnectdb call failure, is it possible to get SQLstate code > such as 28P01 and if yes in which circumstance(s) ? I can t seem to get it > from PQerrorMessage. No, libpq generally doesn't assign SQLSTATE codes to errors generated within libpq. (Adding that has been on the TODO list for a long time, but apparently few people care.) regards, tom lane