Re: Determine if a user and database are available

From: Christophe Pettus <xof(at)thebuild(dot)com>
To: noloader(at)gmail(dot)com
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Determine if a user and database are available
Date: 2022-09-02 21:42:34
Message-ID: FB14ACCE-7F7D-4AE7-837A-1E1568FD55A4@thebuild.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> On Sep 2, 2022, at 14:22, Jeffrey Walton <noloader(at)gmail(dot)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 any login 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.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David G. Johnston 2022-09-02 22:00:04 Re: Determine if a user and database are available
Previous Message Jeffrey Walton 2022-09-02 21:22:12 Determine if a user and database are available