From: | Jeffrey Walton <noloader(at)gmail(dot)com> |
---|---|
To: | xof(at)thebuild(dot)com |
Cc: | pgsql-general(at)lists(dot)postgresql(dot)org |
Subject: | Re: Determine if a user and database are available |
Date: | 2022-09-06 14:13:29 |
Message-ID: | CAH8yC8kdiRB-sN+ZiYaTjf6XaG8gPhdwHWE0aKgeYaq8uQ-_WQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Fri, Sep 2, 2022 at 5:43 PM Christophe Pettus <xof(at)thebuild(dot)com> wrote:
>
> > 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.
Now available as a direct replacement for pg_isready :
https://github.com/noloader/pg_check_conn .
Jeff
From | Date | Subject | |
---|---|---|---|
Next Message | Dirschel, Steve | 2022-09-06 19:07:56 | log_min_messages = warning |
Previous Message | Christophe Pettus | 2022-09-06 13:38:35 | Re: Postgres SQL unable to handle Null values for Text datatype |