Re: Determine if a user and database are available - Mailing list pgsql-general

From Tom Lane
Subject Re: Determine if a user and database are available
Date
Msg-id 1229132.1662157263@sss.pgh.pa.us
Whole thread Raw
In response to Determine if a user and database are available  (Jeffrey Walton <noloader@gmail.com>)
Responses Re: Determine if a user and database are available
List pgsql-general
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



pgsql-general by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: Determine if a user and database are available
Next
From: Ron
Date:
Subject: Re: Determine if a user and database are available