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

From Christophe Pettus
Subject Re: Determine if a user and database are available
Date
Msg-id FB14ACCE-7F7D-4AE7-837A-1E1568FD55A4@thebuild.com
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

> On Sep 2, 2022, at 14:22, Jeffrey Walton <noloader@gmail.com> wrote:
> Given the NOTES in the man page, how do we determine if a user and
> database are present using the shell? Is there another utility we
> should be using?

pg_isready literally only checks that the server can be reached over the connection path (network or sockets), not that
anylogin credentials work.  You can use psql do that, though: 

    psql <connection info) -c "SELECT 1"

... will return an error if the connection information can't be used to successfully log in.


pgsql-general by date:

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