pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: noloader@gmail.com
Cc: pgsql-general@lists.postgresql.org
Subject: Re: Determine if a user and database are available
Date: Fri, 02 Sep 2022 18:21:03 -0400
Message-ID: <1229132.1662157263@sss.pgh.pa.us> (raw)
In-Reply-To: <CAH8yC8=fbU-DWSNso7qKDSNCj52hTop8ENKxF7_4a=hjY-nn6w@mail.gmail.com>
References: <CAH8yC8=fbU-DWSNso7qKDSNCj52hTop8ENKxF7_4a=hjY-nn6w@mail.gmail.com>

Jeffrey Walton <noloader@gmail.com> 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





view thread (8+ messages)  latest in thread

Message-ID: <1229132.1662157263@sss.pgh.pa.us>
Permalink:  ../1229132.1662157263@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/1229132.1662157263@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: tgl@sss.pgh.pa.us, noloader@gmail.com
  Subject: Re: Determine if a user and database are available
  In-Reply-To: <1229132.1662157263@sss.pgh.pa.us>
  References: <CAH8yC8=fbU-DWSNso7qKDSNCj52hTop8ENKxF7_4a=hjY-nn6w@mail.gmail.com> <1229132.1662157263@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox