Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fBAtU-0000fe-NW for pgsql-bugs@arkaria.postgresql.org; Wed, 25 Apr 2018 03:14:56 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fBAtT-0007O4-Go for pgsql-bugs@arkaria.postgresql.org; Wed, 25 Apr 2018 03:14:55 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fB8bf-0001gl-HS for pgsql-bugs@lists.postgresql.org; Wed, 25 Apr 2018 00:48:23 +0000 Received: from sender-pp-092.zoho.com ([135.84.80.237]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fB8bc-0003Zc-14 for pgsql-bugs@lists.postgresql.org; Wed, 25 Apr 2018 00:48:21 +0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=zapps768; d=zoho.com; h=date:from:to:cc:message-id:in-reply-to:references:subject:mime-version:content-type:user-agent; b=KyjtunxDCgln3+usieSLRkqkZskDVZ16N5MYz+DEJgkQHCGqtw8Oa6tWurzroeBan5G6rSqdOfN3 QIMyCF8Y2xI/i8B6DThxZMdmh7tGLQAXKp7ZchnzQqs9ZY0KDj5P Received: from mail.zoho.com by mx.zohomail.com with SMTP id 1524617294326795.8061040141163; Tue, 24 Apr 2018 17:48:14 -0700 (PDT) Received: from [50.38.82.1] by mail.zoho.com with HTTP;Tue, 24 Apr 2018 17:48:14 -0700 (PDT) Date: Tue, 24 Apr 2018 17:48:14 -0700 From: jake To: "David G. Johnston" Cc: "pgsql-bugs@lists.postgresql.org" Message-Id: <162fa45b1f0.e784e91e8344.4158165001514423492@zoho.com> In-Reply-To: <162f93f6c75.cdd696776295.5991878161692757736@zoho.com> References: <152454331410.19803.86605614092680300@wrigleys.postgresql.org> <162f93f6c75.cdd696776295.5991878161692757736@zoho.com> Subject: Re: BUG #15168: "pg_isready -d" effectively ignores given database name MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_21295_1029894952.1524617294320" X-Priority: Medium User-Agent: Zoho Mail X-Mailer: Zoho Mail List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk ------=_Part_21295_1029894952.1524617294320 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit After discussing this with the Lead Developer of Snowdrift.coop, I'd like to humbly suggest that the specification be slightly adjusted to remove the surprising aspect. Usually, an exit status of zero means that all went well. The aforementioned behavior is, by Postgres' own admittance, not only an error, but a fatal error, indicated in the log: FATAL: database "jibberish" does not exist And yet, pg_isready exits with a zero, contradicting the usual meaning. Again, it is following spec perfectly; I only suggest a change to the spec. Specifically, I suggest two small adjustments. One, an exit status of 4 would mean that a connection to the server was made, but the specified database does not exist. In the future, this may be generalized to mean that a connection was made, but some parameter value did not make sense with the cluster's current state. Though right now, the only possible such friction I see is that the specified database does not exist. And for the second adjustment: an exit status of 0 would mean "complete success": a connection was made and the parameters made sense. Note the exit statuses of 1, 2 and 3 would keep their old meanings. In order to get an exit status of 4, the arguments must be syntactically valid. Otherwise, 3 is returned. Jake T. ---- On Tue, 24 Apr 2018 13:01:46 -0700 jake <jakelist@zoho.com> wrote ---- Ah-ha. Thank you for pointing that out. I did not notice. In case you're interested, I used a StackOverflow solution to programmatically determine whether a database exists, after first ensuring that the cluster has been initialized and that the server is running. Thank you for your rapid response, Jake ---- On Mon, 23 Apr 2018 21:29:11 -0700 David G. Johnston <david.g.johnston@gmail.com> wrote ---- On Monday, April 23, 2018, PG Bug reporting form <noreply@postgresql.org> wrote: # Not expected, database "jibberish" does not exist: $ pg_isready -d jibberish /run/media/jthomas/BackupOne/development/snowdrift/.postgres-work:5432 - accepting connections The notes section of the docs for the command cover this behavior. It is not a bug, the utility answers whether the server will accept connections generally, not that a specific connection string and credentials are valid. David J. ------=_Part_21295_1029894952.1524617294320 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable =
After discussing this with the Lead Developer of Snowdri= ft.coop, I'd like to humbly suggest that the specification be slightly adju= sted to remove the surprising aspect.

Usually,= an exit status of zero means that all went well. The aforementioned behavi= or is, by Postgres' own admittance, not only an error, but a fatal error, i= ndicated in the log:
FATAL:  database "jibberish" does n= ot exist

And yet, pg_isready exits with a zero= , contradicting the usual meaning. Again, it is following spec perfectly; I= only suggest a change to the spec.

Specifical= ly, I suggest two small adjustments. One, an exit status of 4 would mean th= at a connection to the server was made, but the specified database does not= exist. In the future, this may be generalized to mean that a connection wa= s made, but some parameter value did not make sense with the cluster's curr= ent state. Though right now, the only possible such friction I see is that = the specified database does not exist. And for the second adjustment: an ex= it status of 0 would mean "complete success": a connection was made and the= parameters made sense.

Note the exit statuses= of 1, 2 and 3 would keep their old meanings. In order to get an exit statu= s of 4, the arguments must be syntactically valid. Otherwise, 3 is returned= .

Jake T.

---- On Tue, 24 Apr 2018 13:01:46 -070= 0 jake <jakelist@zoho.com> wrote ----

Ah-ha. Thank you for pointing that out. I di= d not notice.

= In case you're interested, I used a StackOverflow solution to programmaticall= y determine whether a database exists, after first ensuring that the cluste= r has been initialized and that the server is running.

Thank you for your rapid response,
Jake
---- On Mon, 23 Apr 2018 21:29:11 -0700 David G. Johnston <david.g.johnst= on@gmail.com> wrote ----

On Monday, April 23, 2018, PG Bug reporting for= m <noreply@p= ostgresql.org> wrote:
# N= ot expected, database "jibberish" does not exist:
$ pg_isread= y -d jibberish
/run/media/jthomas/BackupOne/development/snowd= rift/.postgres-work:5432 -
accepting connections

The notes section of the docs for the command= cover this behavior.  It is not a bug, the utility answers whether th= e server will accept connections generally, not that a specific connection = string and credentials are valid.

David J.
=



------=_Part_21295_1029894952.1524617294320--