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 1oUF2E-0006Ob-05 for pgsql-general@arkaria.postgresql.org; Fri, 02 Sep 2022 22:21:10 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oUF2C-00055O-FW for pgsql-general@arkaria.postgresql.org; Fri, 02 Sep 2022 22:21:08 +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 1oUF2C-00054o-54 for pgsql-general@lists.postgresql.org; Fri, 02 Sep 2022 22:21:08 +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 1oUF2A-0007eh-5I for pgsql-general@lists.postgresql.org; Fri, 02 Sep 2022 22:21:07 +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 282ML3421229133; Fri, 2 Sep 2022 18:21:03 -0400 From: Tom Lane To: noloader@gmail.com cc: pgsql-general@lists.postgresql.org Subject: Re: Determine if a user and database are available In-reply-to: References: Comments: In-reply-to Jeffrey Walton message dated "Fri, 02 Sep 2022 17:22:12 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1229131.1662157263.1@sss.pgh.pa.us> Date: Fri, 02 Sep 2022 18:21:03 -0400 Message-ID: <1229132.1662157263@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Jeffrey Walton writes: > I have another beginner question. I am trying to use pg_isready to > determine if a database and user are present. The program seems to > always succeed, even when I delete the user or the database. That's a feature actually. The intended use of pg_isready is to find out if the server is alive, not whether any particular user or database name is correct. So it treats responses like "no such database" as sufficient proof that the server is alive. As David says, you could try to log in with any other client software, or connect using known-good parameters and check the system catalogs. regards, tom lane