Re: Determine if a user and database are available

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: "noloader(at)gmail(dot)com" <noloader(at)gmail(dot)com>
Cc: "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Determine if a user and database are available
Date: 2022-09-02 22:00:04
Message-ID: CAKFQuwYLrrnXqQNvVow58HKwjmoapLyNfzo+099zwAYQHQ28mQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Friday, September 2, 2022, 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?
>

Literally every other shell program that requires logging into the database
will fail if invalid credentials are provided.

Or, you can use good credentials and psql to connect to a known database
and then query the system to learn, without an error, if other roles or
databases exist in the same cluster.

David J.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2022-09-02 22:21:03 Re: Determine if a user and database are available
Previous Message Christophe Pettus 2022-09-02 21:42:34 Re: Determine if a user and database are available