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 1jNztz-0006Rw-70 for pgsql-bugs@arkaria.postgresql.org; Mon, 13 Apr 2020 14:17:31 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jNztx-00085J-Q3 for pgsql-bugs@arkaria.postgresql.org; Mon, 13 Apr 2020 14:17:29 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jNztx-00085B-Jw for pgsql-bugs@lists.postgresql.org; Mon, 13 Apr 2020 14:17:29 +0000 Received: from courriel-2.mines-paristech.fr ([77.158.173.19] helo=antispam-1.ensmp.fr) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jNztu-0005B9-Rx for pgsql-bugs@postgresql.org; Mon, 13 Apr 2020 14:17:28 +0000 Received: from smtp-4.mines-paristech.fr (smtp-4.ensmp.fr [77.158.173.143]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by antispam-1.ensmp.fr (antispam.mines-paristech.fr) with ESMTPS id 83ED355E45; Mon, 13 Apr 2020 16:17:22 +0200 (CEST) Received: from pseudo (108.237.219.88.rev.sfr.net [88.219.237.108]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp-4.mines-paristech.fr (Postfix) with ESMTPSA id 3CF5D2C028B; Mon, 13 Apr 2020 16:17:22 +0200 (CEST) Date: Mon, 13 Apr 2020 16:17:21 +0200 (CEST) From: Fabien COELHO X-X-Sender: fabien@pseudo To: "Hunosau, Aliaksei" cc: "pgsql-bugs@postgresql.org" Subject: Re: pg_isready bug In-Reply-To: <1586782412339.75897@scnsoft.com> Message-ID: References: <1586782412339.75897@scnsoft.com> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="2056645051-1124355277-1586787442=:27777" X-CLAMAV-SCAN: ok X-VRSPAM-SCORE: -100 X-VRSPAM-STATE: legit X-VRSPAM-CAUSE: gggruggvucftvghtrhhoucdtuddrgeduhedrvdelgdejjecutefuodetggdotefrucfrrhhofhhilhgvmecuggftfghnshhusghstghrihgsvgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhepfffhvffujgfkfhgfgggtsehmtderredtreejnecuhfhrohhmpefhrggsihgvnhcuvefqgffnjffquceotghovghlhhhosegtrhhirdgvnhhsmhhprdhfrheqnecukfhppeekkedrvdduledrvdefjedruddtkeenucfrrghrrghmpehmohguvgepshhmthhpohhuth X-VRSPAM-EXTCAUSE: mhhouggvpehsmhhtphhouhht List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --2056645051-1124355277-1586787442=:27777 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8BIT Hello, > root@29243fe45836:/# pg_isready -d 123456 -h localhost -p 5432 -U postgres # the DB 123456 doesn't exist > localhost:5432 - accepting connections # but it shows all is good > root@29243fe45836:/# echo $? > 0 I can confirm, but I'm afraid it is a feature. The server *is* indeed accepting connections… it does not say that the connection with the parameters you supplied worked. The feature relies on "PQpingParams" function which states the following somehow strange sentence: "It is not necessary to supply correct user name, password, or database name values to obtain the server status; however, if incorrect values are provided, the server will log a failed connection attempt." The same occurs with a non existing user (-U). Basically a connection is merely attempted, but it does not report success of said connection. The sentence of "pg_isready --help" is somehow ambiguous: "pg_isready issues a connection check to a PostgreSQL database.", but no one specified whaa a "connection check" is. I can understand that you would expect to be an actual connection:-) ISTM that the doc should be clarified about what is a "connection check", and that it is not working a connection. If you want to check that your parameters are ok, probably you want to issue an actual psql run, eg: psql -c "SELECT 'ok'" -- Fabien. --2056645051-1124355277-1586787442=:27777--